From 7f57360a41c4515a1d025f3476fd54b64fbc333a Mon Sep 17 00:00:00 2001 From: Jon Skeet Date: Mon, 15 Jun 2026 08:07:19 +0000 Subject: [PATCH 1/2] chore: fix google-cloud-monitoring OwlBot config --- packages/google-cloud-monitoring/.OwlBot.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google-cloud-monitoring/.OwlBot.yaml b/packages/google-cloud-monitoring/.OwlBot.yaml index 327fc50ab3aa..d9a5ff60dac2 100644 --- a/packages/google-cloud-monitoring/.OwlBot.yaml +++ b/packages/google-cloud-monitoring/.OwlBot.yaml @@ -15,7 +15,7 @@ deep-remove-regex: - /owl-bot-staging deep-copy-regex: - - source: /google/monitoring/google-cloud-monitoring-nodejs + - source: /google/monitoring/google-monitoring-nodejs dest: /owl-bot-staging/google-cloud-monitoring begin-after-commit-hash: ed3195d0a29ae8c2608dc5a2aa2590554a3f9d14 api-name: monitoring From 7265178a0463533abaf1e04afa8205e4ef1cd7d0 Mon Sep 17 00:00:00 2001 From: Jon Skeet Date: Mon, 15 Jun 2026 08:21:07 +0000 Subject: [PATCH 2/2] feat: regenerate google-cloud-monitoring --- packages/google-cloud-monitoring/.OwlBot.yaml | 14 +- packages/google-cloud-monitoring/.jsdoc.js | 2 +- packages/google-cloud-monitoring/.nycrc | 2 +- packages/google-cloud-monitoring/README.md | 237 +- .../google-cloud-monitoring/protos/protos.js | 7101 ++++++++++++----- .../protos/protos.json | 9 +- .../src/v3/alert_policy_service_client.ts | 2010 +++-- .../src/v3/group_service_client.ts | 2353 +++--- .../google-cloud-monitoring/src/v3/index.ts | 16 +- .../src/v3/metric_service_client.ts | 3576 +++++---- .../v3/notification_channel_service_client.ts | 3324 +++++--- .../src/v3/query_service_client.ts | 1134 ++- .../v3/service_monitoring_service_client.ts | 3095 ++++--- .../src/v3/snooze_service_client.ts | 1739 ++-- .../src/v3/uptime_check_service_client.ts | 2243 ++++-- .../system-test/fixtures/sample/src/index.ts | 22 +- .../system-test/install.ts | 24 +- .../test/gapic_alert_policy_service_v3.ts | 4561 ++++++----- .../test/gapic_group_service_v3.ts | 5096 +++++++----- .../test/gapic_metric_service_v3.ts | 6863 +++++++++------- .../gapic_notification_channel_service_v3.ts | 6455 +++++++++------ .../test/gapic_query_service_v3.ts | 3591 +++++---- .../gapic_service_monitoring_service_v3.ts | 6351 +++++++++------ .../test/gapic_snooze_service_v3.ts | 4322 ++++++---- .../test/gapic_uptime_check_service_v3.ts | 5014 +++++++----- .../google-cloud-monitoring/webpack.config.js | 2 +- 26 files changed, 42259 insertions(+), 26897 deletions(-) diff --git a/packages/google-cloud-monitoring/.OwlBot.yaml b/packages/google-cloud-monitoring/.OwlBot.yaml index d9a5ff60dac2..8c6c51102fdc 100644 --- a/packages/google-cloud-monitoring/.OwlBot.yaml +++ b/packages/google-cloud-monitoring/.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,10 +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/monitoring/google-monitoring-nodejs - dest: /owl-bot-staging/google-cloud-monitoring -begin-after-commit-hash: ed3195d0a29ae8c2608dc5a2aa2590554a3f9d14 -api-name: monitoring + - source: /google/monitoring/google-monitoring-nodejs + dest: /owl-bot-staging/google-monitoring + +api-name: monitoring \ No newline at end of file diff --git a/packages/google-cloud-monitoring/.jsdoc.js b/packages/google-cloud-monitoring/.jsdoc.js index 679273f5610e..2cfb8206169e 100644 --- a/packages/google-cloud-monitoring/.jsdoc.js +++ b/packages/google-cloud-monitoring/.jsdoc.js @@ -40,7 +40,7 @@ module.exports = { includePattern: '\\.js$' }, templates: { - copyright: 'Copyright 2025 Google LLC', + copyright: 'Copyright 2026 Google LLC', includeDate: false, sourceFiles: false, systemName: '@google-cloud/monitoring', diff --git a/packages/google-cloud-monitoring/.nycrc b/packages/google-cloud-monitoring/.nycrc index b18d5472b62b..81a95fc94b00 100644 --- a/packages/google-cloud-monitoring/.nycrc +++ b/packages/google-cloud-monitoring/.nycrc @@ -21,4 +21,4 @@ ], "exclude-after-remap": false, "all": true -} +} \ No newline at end of file diff --git a/packages/google-cloud-monitoring/README.md b/packages/google-cloud-monitoring/README.md index cc347670f617..da2edab5d04e 100644 --- a/packages/google-cloud-monitoring/README.md +++ b/packages/google-cloud-monitoring/README.md @@ -1,27 +1,26 @@ -[Stackdriver Monitoring](https://cloud.google.com/monitoring/docs) collects metrics, events, and metadata from -Google Cloud Platform, Amazon Web Services (AWS), hosted uptime probes, application instrumentation, -and a variety of common application components including Cassandra, Nginx, Apache Web Server, Elasticsearch and many others. [//]: # "This README.md file is auto-generated, all changes to this file will be lost." -[//]: # "To regenerate it, use `python -m synthtool`." +[//]: # "The comments you see below are used to generate those parts of the template in later states." Google Cloud Platform logo -# [Stackdriver Monitoring: Node.js Client](https://github.com/googleapis/google-cloud-node/tree/main/packages/google-cloud-monitoring) - -[![release level](https://img.shields.io/badge/release%20level-stable-brightgreen.svg?style=flat)](https://cloud.google.com/terms/launch-stages) -[![npm version](https://img.shields.io/npm/v/@google-cloud/monitoring.svg)](https://www.npmjs.org/package/@google-cloud/monitoring) - +# [Cloud Monitoring API: Nodejs Client][homepage] +This library is considered to be in **preview**. This means it is still a +work-in-progress and under active development. Any release is subject to +backwards-incompatible changes at any time. +[![npm version](https://img.shields.io/npm/v/@google-cloud/monitoring.svg)](https://www.npmjs.org/package/@google-cloud/monitoring) -Stackdriver Monitoring API client for Node.js +Cloud Monitoring API client for Node.js +[Stackdriver Monitoring](https://cloud.google.com/monitoring/docs) collects metrics, events, and metadata from +Google Cloud Platform, Amazon Web Services (AWS), hosted uptime probes, application instrumentation, +and a variety of common application components including Cassandra, Nginx, Apache Web Server, Elasticsearch and many others. A comprehensive list of changes in each version may be found in -[the CHANGELOG](https://github.com/googleapis/google-cloud-node/tree/main/packages/google-cloud-monitoring/CHANGELOG.md). +[the CHANGELOG][homepage_changelog]. + +* [Cloud Monitoring API Nodejs Client API Reference](https://cloud.google.com/nodejs/docs/reference/monitoring/latest) -* [Stackdriver Monitoring Node.js Client API Reference][client-docs] -* [Stackdriver Monitoring Documentation][product-docs] -* [github.com/googleapis/google-cloud-node/packages/google-cloud-monitoring](https://github.com/googleapis/google-cloud-node/tree/main/packages/google-cloud-monitoring) Read more about the client libraries for Cloud APIs, including the older Google APIs Client Libraries, in [Client Libraries Explained][explained]. @@ -30,155 +29,88 @@ Google APIs Client Libraries, in [Client Libraries Explained][explained]. **Table of contents:** - * [Quickstart](#quickstart) * [Before you begin](#before-you-begin) * [Installing the client library](#installing-the-client-library) - * [Using the client library](#using-the-client-library) -* [Samples](#samples) + * [Versioning](#versioning) * [Contributing](#contributing) * [License](#license) ## Quickstart - ### Before you begin 1. [Select or create a Cloud Platform project][projects]. 1. [Enable billing for your project][billing]. -1. [Enable the Stackdriver Monitoring API][enable_api]. +1. [Enable the Cloud Monitoring API API][enable_api]. 1. [Set up authentication][auth] so you can access the API from your local workstation. - ### Installing the client library ```bash npm install @google-cloud/monitoring ``` - -### Using the client library - -```javascript -// Imports the Google Cloud client library -const monitoring = require('@google-cloud/monitoring'); - -async function quickstart() { - // Creates a client - const client = new monitoring.MetricServiceClient(); - - // TODO(developer): Uncomment and set the following variables - // const projectId = "PROJECT_ID" - - // Prepares an individual data point - const dataPoint = { - interval: { - endTime: { - seconds: Date.now() / 1000, - }, - }, - value: { - // The amount of sales - doubleValue: 123.45, - }, - }; - - // Prepares the time series request - const request = { - name: client.projectPath(projectId), - timeSeries: [ - { - // Ties the data point to a custom metric - metric: { - type: 'custom.googleapis.com/stores/daily_sales', - labels: { - store_id: 'Pittsburgh', - }, - }, - resource: { - type: 'global', - labels: { - project_id: projectId, - }, - }, - points: [dataPoint], - }, - ], - }; - - // Writes time series data - const [result] = await client.createTimeSeries(request); - console.log('Done writing time series data.', result); -} -quickstart(); - -``` - - +[//]: # "partials.body" ## Samples -Samples are in the [`samples/`](https://github.com/googleapis/google-cloud-node/tree/main/packages/google-cloud-monitoring/samples) directory. Each sample's `README.md` has instructions for running its sample. - -| Sample | Source Code | Try it | -| --------------------------- | --------------------------------- | ------ | -| Alert_policy_service.create_alert_policy | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-monitoring/samples/generated/v3/alert_policy_service.create_alert_policy.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-monitoring/samples/generated/v3/alert_policy_service.create_alert_policy.js,packages/google-cloud-monitoring/samples/README.md) | -| Alert_policy_service.delete_alert_policy | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-monitoring/samples/generated/v3/alert_policy_service.delete_alert_policy.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-monitoring/samples/generated/v3/alert_policy_service.delete_alert_policy.js,packages/google-cloud-monitoring/samples/README.md) | -| Alert_policy_service.get_alert_policy | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-monitoring/samples/generated/v3/alert_policy_service.get_alert_policy.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-monitoring/samples/generated/v3/alert_policy_service.get_alert_policy.js,packages/google-cloud-monitoring/samples/README.md) | -| Alert_policy_service.list_alert_policies | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-monitoring/samples/generated/v3/alert_policy_service.list_alert_policies.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-monitoring/samples/generated/v3/alert_policy_service.list_alert_policies.js,packages/google-cloud-monitoring/samples/README.md) | -| Alert_policy_service.update_alert_policy | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-monitoring/samples/generated/v3/alert_policy_service.update_alert_policy.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-monitoring/samples/generated/v3/alert_policy_service.update_alert_policy.js,packages/google-cloud-monitoring/samples/README.md) | -| Group_service.create_group | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-monitoring/samples/generated/v3/group_service.create_group.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-monitoring/samples/generated/v3/group_service.create_group.js,packages/google-cloud-monitoring/samples/README.md) | -| Group_service.delete_group | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-monitoring/samples/generated/v3/group_service.delete_group.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-monitoring/samples/generated/v3/group_service.delete_group.js,packages/google-cloud-monitoring/samples/README.md) | -| Group_service.get_group | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-monitoring/samples/generated/v3/group_service.get_group.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-monitoring/samples/generated/v3/group_service.get_group.js,packages/google-cloud-monitoring/samples/README.md) | -| Group_service.list_group_members | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-monitoring/samples/generated/v3/group_service.list_group_members.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-monitoring/samples/generated/v3/group_service.list_group_members.js,packages/google-cloud-monitoring/samples/README.md) | -| Group_service.list_groups | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-monitoring/samples/generated/v3/group_service.list_groups.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-monitoring/samples/generated/v3/group_service.list_groups.js,packages/google-cloud-monitoring/samples/README.md) | -| Group_service.update_group | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-monitoring/samples/generated/v3/group_service.update_group.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-monitoring/samples/generated/v3/group_service.update_group.js,packages/google-cloud-monitoring/samples/README.md) | -| Metric_service.create_metric_descriptor | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-monitoring/samples/generated/v3/metric_service.create_metric_descriptor.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-monitoring/samples/generated/v3/metric_service.create_metric_descriptor.js,packages/google-cloud-monitoring/samples/README.md) | -| Metric_service.create_service_time_series | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-monitoring/samples/generated/v3/metric_service.create_service_time_series.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-monitoring/samples/generated/v3/metric_service.create_service_time_series.js,packages/google-cloud-monitoring/samples/README.md) | -| Metric_service.create_time_series | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-monitoring/samples/generated/v3/metric_service.create_time_series.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-monitoring/samples/generated/v3/metric_service.create_time_series.js,packages/google-cloud-monitoring/samples/README.md) | -| Metric_service.delete_metric_descriptor | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-monitoring/samples/generated/v3/metric_service.delete_metric_descriptor.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-monitoring/samples/generated/v3/metric_service.delete_metric_descriptor.js,packages/google-cloud-monitoring/samples/README.md) | -| Metric_service.get_metric_descriptor | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-monitoring/samples/generated/v3/metric_service.get_metric_descriptor.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-monitoring/samples/generated/v3/metric_service.get_metric_descriptor.js,packages/google-cloud-monitoring/samples/README.md) | -| Metric_service.get_monitored_resource_descriptor | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-monitoring/samples/generated/v3/metric_service.get_monitored_resource_descriptor.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-monitoring/samples/generated/v3/metric_service.get_monitored_resource_descriptor.js,packages/google-cloud-monitoring/samples/README.md) | -| Metric_service.list_metric_descriptors | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-monitoring/samples/generated/v3/metric_service.list_metric_descriptors.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-monitoring/samples/generated/v3/metric_service.list_metric_descriptors.js,packages/google-cloud-monitoring/samples/README.md) | -| Metric_service.list_monitored_resource_descriptors | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-monitoring/samples/generated/v3/metric_service.list_monitored_resource_descriptors.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-monitoring/samples/generated/v3/metric_service.list_monitored_resource_descriptors.js,packages/google-cloud-monitoring/samples/README.md) | -| Metric_service.list_time_series | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-monitoring/samples/generated/v3/metric_service.list_time_series.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-monitoring/samples/generated/v3/metric_service.list_time_series.js,packages/google-cloud-monitoring/samples/README.md) | -| Notification_channel_service.create_notification_channel | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-monitoring/samples/generated/v3/notification_channel_service.create_notification_channel.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-monitoring/samples/generated/v3/notification_channel_service.create_notification_channel.js,packages/google-cloud-monitoring/samples/README.md) | -| Notification_channel_service.delete_notification_channel | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-monitoring/samples/generated/v3/notification_channel_service.delete_notification_channel.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-monitoring/samples/generated/v3/notification_channel_service.delete_notification_channel.js,packages/google-cloud-monitoring/samples/README.md) | -| Notification_channel_service.get_notification_channel | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-monitoring/samples/generated/v3/notification_channel_service.get_notification_channel.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-monitoring/samples/generated/v3/notification_channel_service.get_notification_channel.js,packages/google-cloud-monitoring/samples/README.md) | -| Notification_channel_service.get_notification_channel_descriptor | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-monitoring/samples/generated/v3/notification_channel_service.get_notification_channel_descriptor.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-monitoring/samples/generated/v3/notification_channel_service.get_notification_channel_descriptor.js,packages/google-cloud-monitoring/samples/README.md) | -| Notification_channel_service.get_notification_channel_verification_code | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-monitoring/samples/generated/v3/notification_channel_service.get_notification_channel_verification_code.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-monitoring/samples/generated/v3/notification_channel_service.get_notification_channel_verification_code.js,packages/google-cloud-monitoring/samples/README.md) | -| Notification_channel_service.list_notification_channel_descriptors | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-monitoring/samples/generated/v3/notification_channel_service.list_notification_channel_descriptors.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-monitoring/samples/generated/v3/notification_channel_service.list_notification_channel_descriptors.js,packages/google-cloud-monitoring/samples/README.md) | -| Notification_channel_service.list_notification_channels | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-monitoring/samples/generated/v3/notification_channel_service.list_notification_channels.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-monitoring/samples/generated/v3/notification_channel_service.list_notification_channels.js,packages/google-cloud-monitoring/samples/README.md) | -| Notification_channel_service.send_notification_channel_verification_code | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-monitoring/samples/generated/v3/notification_channel_service.send_notification_channel_verification_code.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-monitoring/samples/generated/v3/notification_channel_service.send_notification_channel_verification_code.js,packages/google-cloud-monitoring/samples/README.md) | -| Notification_channel_service.update_notification_channel | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-monitoring/samples/generated/v3/notification_channel_service.update_notification_channel.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-monitoring/samples/generated/v3/notification_channel_service.update_notification_channel.js,packages/google-cloud-monitoring/samples/README.md) | -| Notification_channel_service.verify_notification_channel | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-monitoring/samples/generated/v3/notification_channel_service.verify_notification_channel.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-monitoring/samples/generated/v3/notification_channel_service.verify_notification_channel.js,packages/google-cloud-monitoring/samples/README.md) | -| Query_service.query_time_series | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-monitoring/samples/generated/v3/query_service.query_time_series.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-monitoring/samples/generated/v3/query_service.query_time_series.js,packages/google-cloud-monitoring/samples/README.md) | -| Service_monitoring_service.create_service | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-monitoring/samples/generated/v3/service_monitoring_service.create_service.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-monitoring/samples/generated/v3/service_monitoring_service.create_service.js,packages/google-cloud-monitoring/samples/README.md) | -| Service_monitoring_service.create_service_level_objective | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-monitoring/samples/generated/v3/service_monitoring_service.create_service_level_objective.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-monitoring/samples/generated/v3/service_monitoring_service.create_service_level_objective.js,packages/google-cloud-monitoring/samples/README.md) | -| Service_monitoring_service.delete_service | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-monitoring/samples/generated/v3/service_monitoring_service.delete_service.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-monitoring/samples/generated/v3/service_monitoring_service.delete_service.js,packages/google-cloud-monitoring/samples/README.md) | -| Service_monitoring_service.delete_service_level_objective | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-monitoring/samples/generated/v3/service_monitoring_service.delete_service_level_objective.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-monitoring/samples/generated/v3/service_monitoring_service.delete_service_level_objective.js,packages/google-cloud-monitoring/samples/README.md) | -| Service_monitoring_service.get_service | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-monitoring/samples/generated/v3/service_monitoring_service.get_service.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-monitoring/samples/generated/v3/service_monitoring_service.get_service.js,packages/google-cloud-monitoring/samples/README.md) | -| Service_monitoring_service.get_service_level_objective | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-monitoring/samples/generated/v3/service_monitoring_service.get_service_level_objective.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-monitoring/samples/generated/v3/service_monitoring_service.get_service_level_objective.js,packages/google-cloud-monitoring/samples/README.md) | -| Service_monitoring_service.list_service_level_objectives | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-monitoring/samples/generated/v3/service_monitoring_service.list_service_level_objectives.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-monitoring/samples/generated/v3/service_monitoring_service.list_service_level_objectives.js,packages/google-cloud-monitoring/samples/README.md) | -| Service_monitoring_service.list_services | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-monitoring/samples/generated/v3/service_monitoring_service.list_services.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-monitoring/samples/generated/v3/service_monitoring_service.list_services.js,packages/google-cloud-monitoring/samples/README.md) | -| Service_monitoring_service.update_service | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-monitoring/samples/generated/v3/service_monitoring_service.update_service.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-monitoring/samples/generated/v3/service_monitoring_service.update_service.js,packages/google-cloud-monitoring/samples/README.md) | -| Service_monitoring_service.update_service_level_objective | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-monitoring/samples/generated/v3/service_monitoring_service.update_service_level_objective.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-monitoring/samples/generated/v3/service_monitoring_service.update_service_level_objective.js,packages/google-cloud-monitoring/samples/README.md) | -| Snooze_service.create_snooze | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-monitoring/samples/generated/v3/snooze_service.create_snooze.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-monitoring/samples/generated/v3/snooze_service.create_snooze.js,packages/google-cloud-monitoring/samples/README.md) | -| Snooze_service.get_snooze | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-monitoring/samples/generated/v3/snooze_service.get_snooze.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-monitoring/samples/generated/v3/snooze_service.get_snooze.js,packages/google-cloud-monitoring/samples/README.md) | -| Snooze_service.list_snoozes | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-monitoring/samples/generated/v3/snooze_service.list_snoozes.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-monitoring/samples/generated/v3/snooze_service.list_snoozes.js,packages/google-cloud-monitoring/samples/README.md) | -| Snooze_service.update_snooze | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-monitoring/samples/generated/v3/snooze_service.update_snooze.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-monitoring/samples/generated/v3/snooze_service.update_snooze.js,packages/google-cloud-monitoring/samples/README.md) | -| Uptime_check_service.create_uptime_check_config | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-monitoring/samples/generated/v3/uptime_check_service.create_uptime_check_config.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-monitoring/samples/generated/v3/uptime_check_service.create_uptime_check_config.js,packages/google-cloud-monitoring/samples/README.md) | -| Uptime_check_service.delete_uptime_check_config | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-monitoring/samples/generated/v3/uptime_check_service.delete_uptime_check_config.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-monitoring/samples/generated/v3/uptime_check_service.delete_uptime_check_config.js,packages/google-cloud-monitoring/samples/README.md) | -| Uptime_check_service.get_uptime_check_config | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-monitoring/samples/generated/v3/uptime_check_service.get_uptime_check_config.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-monitoring/samples/generated/v3/uptime_check_service.get_uptime_check_config.js,packages/google-cloud-monitoring/samples/README.md) | -| Uptime_check_service.list_uptime_check_configs | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-monitoring/samples/generated/v3/uptime_check_service.list_uptime_check_configs.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-monitoring/samples/generated/v3/uptime_check_service.list_uptime_check_configs.js,packages/google-cloud-monitoring/samples/README.md) | -| Uptime_check_service.list_uptime_check_ips | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-monitoring/samples/generated/v3/uptime_check_service.list_uptime_check_ips.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-monitoring/samples/generated/v3/uptime_check_service.list_uptime_check_ips.js,packages/google-cloud-monitoring/samples/README.md) | -| Uptime_check_service.update_uptime_check_config | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-monitoring/samples/generated/v3/uptime_check_service.update_uptime_check_config.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-monitoring/samples/generated/v3/uptime_check_service.update_uptime_check_config.js,packages/google-cloud-monitoring/samples/README.md) | -| Quickstart | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-monitoring/samples/quickstart.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-monitoring/samples/quickstart.js,packages/google-cloud-monitoring/samples/README.md) | - - - -The [Stackdriver Monitoring Node.js Client API Reference][client-docs] documentation -also contains samples. +Samples are in the [`samples/`][homepage_samples] directory. Each sample's `README.md` has instructions for running its sample. + +| Sample | Source Code | +| --------------------------- | --------------------------------- | +| create alert policy | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-monitoring/samples/generated/v3/alert_policy_service.create_alert_policy.js) | +| delete alert policy | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-monitoring/samples/generated/v3/alert_policy_service.delete_alert_policy.js) | +| get alert policy | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-monitoring/samples/generated/v3/alert_policy_service.get_alert_policy.js) | +| list alert policies | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-monitoring/samples/generated/v3/alert_policy_service.list_alert_policies.js) | +| update alert policy | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-monitoring/samples/generated/v3/alert_policy_service.update_alert_policy.js) | +| create group | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-monitoring/samples/generated/v3/group_service.create_group.js) | +| delete group | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-monitoring/samples/generated/v3/group_service.delete_group.js) | +| get group | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-monitoring/samples/generated/v3/group_service.get_group.js) | +| list group members | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-monitoring/samples/generated/v3/group_service.list_group_members.js) | +| list groups | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-monitoring/samples/generated/v3/group_service.list_groups.js) | +| update group | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-monitoring/samples/generated/v3/group_service.update_group.js) | +| create metric descriptor | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-monitoring/samples/generated/v3/metric_service.create_metric_descriptor.js) | +| create service time series | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-monitoring/samples/generated/v3/metric_service.create_service_time_series.js) | +| create time series | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-monitoring/samples/generated/v3/metric_service.create_time_series.js) | +| delete metric descriptor | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-monitoring/samples/generated/v3/metric_service.delete_metric_descriptor.js) | +| get metric descriptor | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-monitoring/samples/generated/v3/metric_service.get_metric_descriptor.js) | +| get monitored resource descriptor | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-monitoring/samples/generated/v3/metric_service.get_monitored_resource_descriptor.js) | +| list metric descriptors | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-monitoring/samples/generated/v3/metric_service.list_metric_descriptors.js) | +| list monitored resource descriptors | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-monitoring/samples/generated/v3/metric_service.list_monitored_resource_descriptors.js) | +| list time series | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-monitoring/samples/generated/v3/metric_service.list_time_series.js) | +| create notification channel | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-monitoring/samples/generated/v3/notification_channel_service.create_notification_channel.js) | +| delete notification channel | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-monitoring/samples/generated/v3/notification_channel_service.delete_notification_channel.js) | +| get notification channel | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-monitoring/samples/generated/v3/notification_channel_service.get_notification_channel.js) | +| get notification channel descriptor | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-monitoring/samples/generated/v3/notification_channel_service.get_notification_channel_descriptor.js) | +| get notification channel verification code | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-monitoring/samples/generated/v3/notification_channel_service.get_notification_channel_verification_code.js) | +| list notification channel descriptors | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-monitoring/samples/generated/v3/notification_channel_service.list_notification_channel_descriptors.js) | +| list notification channels | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-monitoring/samples/generated/v3/notification_channel_service.list_notification_channels.js) | +| send notification channel verification code | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-monitoring/samples/generated/v3/notification_channel_service.send_notification_channel_verification_code.js) | +| update notification channel | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-monitoring/samples/generated/v3/notification_channel_service.update_notification_channel.js) | +| verify notification channel | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-monitoring/samples/generated/v3/notification_channel_service.verify_notification_channel.js) | +| query time series | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-monitoring/samples/generated/v3/query_service.query_time_series.js) | +| create service | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-monitoring/samples/generated/v3/service_monitoring_service.create_service.js) | +| create service level objective | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-monitoring/samples/generated/v3/service_monitoring_service.create_service_level_objective.js) | +| delete service | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-monitoring/samples/generated/v3/service_monitoring_service.delete_service.js) | +| delete service level objective | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-monitoring/samples/generated/v3/service_monitoring_service.delete_service_level_objective.js) | +| get service | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-monitoring/samples/generated/v3/service_monitoring_service.get_service.js) | +| get service level objective | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-monitoring/samples/generated/v3/service_monitoring_service.get_service_level_objective.js) | +| list service level objectives | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-monitoring/samples/generated/v3/service_monitoring_service.list_service_level_objectives.js) | +| list services | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-monitoring/samples/generated/v3/service_monitoring_service.list_services.js) | +| update service | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-monitoring/samples/generated/v3/service_monitoring_service.update_service.js) | +| update service level objective | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-monitoring/samples/generated/v3/service_monitoring_service.update_service_level_objective.js) | +| create snooze | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-monitoring/samples/generated/v3/snooze_service.create_snooze.js) | +| get snooze | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-monitoring/samples/generated/v3/snooze_service.get_snooze.js) | +| list snoozes | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-monitoring/samples/generated/v3/snooze_service.list_snoozes.js) | +| update snooze | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-monitoring/samples/generated/v3/snooze_service.update_snooze.js) | +| create uptime check config | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-monitoring/samples/generated/v3/uptime_check_service.create_uptime_check_config.js) | +| delete uptime check config | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-monitoring/samples/generated/v3/uptime_check_service.delete_uptime_check_config.js) | +| get uptime check config | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-monitoring/samples/generated/v3/uptime_check_service.get_uptime_check_config.js) | +| list uptime check configs | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-monitoring/samples/generated/v3/uptime_check_service.list_uptime_check_configs.js) | +| list uptime check ips | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-monitoring/samples/generated/v3/uptime_check_service.list_uptime_check_ips.js) | +| update uptime check config | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-monitoring/samples/generated/v3/uptime_check_service.update_uptime_check_config.js) | + ## Supported Node.js Versions @@ -205,18 +137,6 @@ for versions compatible with Node.js 8. This library follows [Semantic Versioning](http://semver.org/). - - -This library is considered to be **stable**. The code surface will not change in backwards-incompatible ways -unless absolutely necessary (e.g. because of critical security issues) or with -an extensive deprecation period. Issues and requests against **stable** libraries -are addressed with the highest priority. - - - - - - More Information: [Google Cloud Platform Launch Stages][launch_stages] [launch_stages]: https://cloud.google.com/terms/launch-stages @@ -225,11 +145,9 @@ More Information: [Google Cloud Platform Launch Stages][launch_stages] Contributions welcome! See the [Contributing Guide](https://github.com/googleapis/google-cloud-node/blob/main/CONTRIBUTING.md). -Please note that this `README.md`, the `samples/README.md`, +Please note that this `README.md` and a variety of configuration files in this repository (including `.nycrc` and `tsconfig.json`) -are generated from a central template. To edit one of these files, make an edit -to its templates in -[directory](https://github.com/googleapis/synthtool). +are generated from a central template. ## License @@ -237,10 +155,11 @@ Apache Version 2.0 See [LICENSE](https://github.com/googleapis/google-cloud-node/blob/main/LICENSE) -[client-docs]: https://cloud.google.com/nodejs/docs/reference/monitoring/latest -[product-docs]: https://cloud.google.com/monitoring/docs [shell_img]: https://gstatic.com/cloudssh/images/open-btn.png [projects]: https://console.cloud.google.com/project [billing]: https://support.google.com/cloud/answer/6293499#enable-billing [enable_api]: https://console.cloud.google.com/flows/enableapi?apiid=monitoring.googleapis.com -[auth]: https://cloud.google.com/docs/authentication/external/set-up-adc-local \ No newline at end of file +[auth]: https://cloud.google.com/docs/authentication/external/set-up-adc-local +[homepage_samples]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-monitoring/samples +[homepage_changelog]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-monitoring/CHANGELOG.md +[homepage]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-monitoring diff --git a/packages/google-cloud-monitoring/protos/protos.js b/packages/google-cloud-monitoring/protos/protos.js index 5492ec57f1b5..87f1d4472b5d 100644 --- a/packages/google-cloud-monitoring/protos/protos.js +++ b/packages/google-cloud-monitoring/protos/protos.js @@ -92,7 +92,7 @@ this.notificationChannels = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -280,9 +280,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - AlertPolicy.decode = function decode(reader, length, error) { + AlertPolicy.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.AlertPolicy(), key, value; while (reader.pos < end) { var tag = reader.uint32(); @@ -298,7 +302,7 @@ break; } case 13: { - message.documentation = $root.google.monitoring.v3.AlertPolicy.Documentation.decode(reader, reader.uint32()); + message.documentation = $root.google.monitoring.v3.AlertPolicy.Documentation.decode(reader, reader.uint32(), undefined, long + 1); break; } case 16: { @@ -317,17 +321,19 @@ value = reader.string(); break; default: - reader.skipType(tag2 & 7); + reader.skipType(tag2 & 7, long); break; } } + if (key === "__proto__") + $util.makeProp(message.userLabels, key); message.userLabels[key] = value; break; } case 12: { if (!(message.conditions && message.conditions.length)) message.conditions = []; - message.conditions.push($root.google.monitoring.v3.AlertPolicy.Condition.decode(reader, reader.uint32())); + message.conditions.push($root.google.monitoring.v3.AlertPolicy.Condition.decode(reader, reader.uint32(), undefined, long + 1)); break; } case 6: { @@ -335,11 +341,11 @@ break; } case 17: { - message.enabled = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); + message.enabled = $root.google.protobuf.BoolValue.decode(reader, reader.uint32(), undefined, long + 1); break; } case 18: { - message.validity = $root.google.rpc.Status.decode(reader, reader.uint32()); + message.validity = $root.google.rpc.Status.decode(reader, reader.uint32(), undefined, long + 1); break; } case 14: { @@ -349,15 +355,15 @@ break; } case 10: { - message.creationRecord = $root.google.monitoring.v3.MutationRecord.decode(reader, reader.uint32()); + message.creationRecord = $root.google.monitoring.v3.MutationRecord.decode(reader, reader.uint32(), undefined, long + 1); break; } case 11: { - message.mutationRecord = $root.google.monitoring.v3.MutationRecord.decode(reader, reader.uint32()); + message.mutationRecord = $root.google.monitoring.v3.MutationRecord.decode(reader, reader.uint32(), undefined, long + 1); break; } case 21: { - message.alertStrategy = $root.google.monitoring.v3.AlertPolicy.AlertStrategy.decode(reader, reader.uint32()); + message.alertStrategy = $root.google.monitoring.v3.AlertPolicy.AlertStrategy.decode(reader, reader.uint32(), undefined, long + 1); break; } case 22: { @@ -365,7 +371,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -396,9 +402,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - AlertPolicy.verify = function verify(message) { + AlertPolicy.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.name != null && message.hasOwnProperty("name")) if (!$util.isString(message.name)) return "name: string expected"; @@ -406,7 +416,7 @@ if (!$util.isString(message.displayName)) return "displayName: string expected"; if (message.documentation != null && message.hasOwnProperty("documentation")) { - var error = $root.google.monitoring.v3.AlertPolicy.Documentation.verify(message.documentation); + var error = $root.google.monitoring.v3.AlertPolicy.Documentation.verify(message.documentation, long + 1); if (error) return "documentation." + error; } @@ -422,7 +432,7 @@ if (!Array.isArray(message.conditions)) return "conditions: array expected"; for (var i = 0; i < message.conditions.length; ++i) { - var error = $root.google.monitoring.v3.AlertPolicy.Condition.verify(message.conditions[i]); + var error = $root.google.monitoring.v3.AlertPolicy.Condition.verify(message.conditions[i], long + 1); if (error) return "conditions." + error; } @@ -438,12 +448,12 @@ break; } if (message.enabled != null && message.hasOwnProperty("enabled")) { - var error = $root.google.protobuf.BoolValue.verify(message.enabled); + var error = $root.google.protobuf.BoolValue.verify(message.enabled, long + 1); if (error) return "enabled." + error; } if (message.validity != null && message.hasOwnProperty("validity")) { - var error = $root.google.rpc.Status.verify(message.validity); + var error = $root.google.rpc.Status.verify(message.validity, long + 1); if (error) return "validity." + error; } @@ -455,17 +465,17 @@ return "notificationChannels: string[] expected"; } if (message.creationRecord != null && message.hasOwnProperty("creationRecord")) { - var error = $root.google.monitoring.v3.MutationRecord.verify(message.creationRecord); + var error = $root.google.monitoring.v3.MutationRecord.verify(message.creationRecord, long + 1); if (error) return "creationRecord." + error; } if (message.mutationRecord != null && message.hasOwnProperty("mutationRecord")) { - var error = $root.google.monitoring.v3.MutationRecord.verify(message.mutationRecord); + var error = $root.google.monitoring.v3.MutationRecord.verify(message.mutationRecord, long + 1); if (error) return "mutationRecord." + error; } if (message.alertStrategy != null && message.hasOwnProperty("alertStrategy")) { - var error = $root.google.monitoring.v3.AlertPolicy.AlertStrategy.verify(message.alertStrategy); + var error = $root.google.monitoring.v3.AlertPolicy.AlertStrategy.verify(message.alertStrategy, long + 1); if (error) return "alertStrategy." + error; } @@ -490,9 +500,13 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.AlertPolicy} AlertPolicy */ - AlertPolicy.fromObject = function fromObject(object) { + AlertPolicy.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.AlertPolicy) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.AlertPolicy(); if (object.name != null) message.name = String(object.name); @@ -501,14 +515,17 @@ if (object.documentation != null) { if (typeof object.documentation !== "object") throw TypeError(".google.monitoring.v3.AlertPolicy.documentation: object expected"); - message.documentation = $root.google.monitoring.v3.AlertPolicy.Documentation.fromObject(object.documentation); + message.documentation = $root.google.monitoring.v3.AlertPolicy.Documentation.fromObject(object.documentation, long + 1); } if (object.userLabels) { if (typeof object.userLabels !== "object") throw TypeError(".google.monitoring.v3.AlertPolicy.userLabels: object expected"); message.userLabels = {}; - for (var keys = Object.keys(object.userLabels), i = 0; i < keys.length; ++i) + for (var keys = Object.keys(object.userLabels), i = 0; i < keys.length; ++i) { + if (keys[i] === "__proto__") + $util.makeProp(message.userLabels, keys[i]); message.userLabels[keys[i]] = String(object.userLabels[keys[i]]); + } } if (object.conditions) { if (!Array.isArray(object.conditions)) @@ -517,7 +534,7 @@ for (var i = 0; i < object.conditions.length; ++i) { if (typeof object.conditions[i] !== "object") throw TypeError(".google.monitoring.v3.AlertPolicy.conditions: object expected"); - message.conditions[i] = $root.google.monitoring.v3.AlertPolicy.Condition.fromObject(object.conditions[i]); + message.conditions[i] = $root.google.monitoring.v3.AlertPolicy.Condition.fromObject(object.conditions[i], long + 1); } } switch (object.combiner) { @@ -547,12 +564,12 @@ if (object.enabled != null) { if (typeof object.enabled !== "object") throw TypeError(".google.monitoring.v3.AlertPolicy.enabled: object expected"); - message.enabled = $root.google.protobuf.BoolValue.fromObject(object.enabled); + message.enabled = $root.google.protobuf.BoolValue.fromObject(object.enabled, long + 1); } if (object.validity != null) { if (typeof object.validity !== "object") throw TypeError(".google.monitoring.v3.AlertPolicy.validity: object expected"); - message.validity = $root.google.rpc.Status.fromObject(object.validity); + message.validity = $root.google.rpc.Status.fromObject(object.validity, long + 1); } if (object.notificationChannels) { if (!Array.isArray(object.notificationChannels)) @@ -564,17 +581,17 @@ if (object.creationRecord != null) { if (typeof object.creationRecord !== "object") throw TypeError(".google.monitoring.v3.AlertPolicy.creationRecord: object expected"); - message.creationRecord = $root.google.monitoring.v3.MutationRecord.fromObject(object.creationRecord); + message.creationRecord = $root.google.monitoring.v3.MutationRecord.fromObject(object.creationRecord, long + 1); } if (object.mutationRecord != null) { if (typeof object.mutationRecord !== "object") throw TypeError(".google.monitoring.v3.AlertPolicy.mutationRecord: object expected"); - message.mutationRecord = $root.google.monitoring.v3.MutationRecord.fromObject(object.mutationRecord); + message.mutationRecord = $root.google.monitoring.v3.MutationRecord.fromObject(object.mutationRecord, long + 1); } if (object.alertStrategy != null) { if (typeof object.alertStrategy !== "object") throw TypeError(".google.monitoring.v3.AlertPolicy.alertStrategy: object expected"); - message.alertStrategy = $root.google.monitoring.v3.AlertPolicy.AlertStrategy.fromObject(object.alertStrategy); + message.alertStrategy = $root.google.monitoring.v3.AlertPolicy.AlertStrategy.fromObject(object.alertStrategy, long + 1); } switch (object.severity) { default: @@ -659,8 +676,11 @@ var keys2; if (message.userLabels && (keys2 = Object.keys(message.userLabels)).length) { object.userLabels = {}; - for (var j = 0; j < keys2.length; ++j) + for (var j = 0; j < keys2.length; ++j) { + if (keys2[j] === "__proto__") + $util.makeProp(object.userLabels, keys2[j]); object.userLabels[keys2[j]] = message.userLabels[keys2[j]]; + } } if (message.enabled != null && message.hasOwnProperty("enabled")) object.enabled = $root.google.protobuf.BoolValue.toObject(message.enabled, options); @@ -723,7 +743,7 @@ this.links = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -819,9 +839,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Documentation.decode = function decode(reader, length, error) { + Documentation.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.AlertPolicy.Documentation(); while (reader.pos < end) { var tag = reader.uint32(); @@ -843,11 +867,11 @@ case 4: { if (!(message.links && message.links.length)) message.links = []; - message.links.push($root.google.monitoring.v3.AlertPolicy.Documentation.Link.decode(reader, reader.uint32())); + message.links.push($root.google.monitoring.v3.AlertPolicy.Documentation.Link.decode(reader, reader.uint32(), undefined, long + 1)); break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -878,9 +902,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Documentation.verify = function verify(message) { + Documentation.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.content != null && message.hasOwnProperty("content")) if (!$util.isString(message.content)) return "content: string expected"; @@ -894,7 +922,7 @@ if (!Array.isArray(message.links)) return "links: array expected"; for (var i = 0; i < message.links.length; ++i) { - var error = $root.google.monitoring.v3.AlertPolicy.Documentation.Link.verify(message.links[i]); + var error = $root.google.monitoring.v3.AlertPolicy.Documentation.Link.verify(message.links[i], long + 1); if (error) return "links." + error; } @@ -910,9 +938,13 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.AlertPolicy.Documentation} Documentation */ - Documentation.fromObject = function fromObject(object) { + Documentation.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.AlertPolicy.Documentation) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.AlertPolicy.Documentation(); if (object.content != null) message.content = String(object.content); @@ -927,7 +959,7 @@ for (var i = 0; i < object.links.length; ++i) { if (typeof object.links[i] !== "object") throw TypeError(".google.monitoring.v3.AlertPolicy.Documentation.links: object expected"); - message.links[i] = $root.google.monitoring.v3.AlertPolicy.Documentation.Link.fromObject(object.links[i]); + message.links[i] = $root.google.monitoring.v3.AlertPolicy.Documentation.Link.fromObject(object.links[i], long + 1); } } return message; @@ -1014,7 +1046,7 @@ function Link(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -1089,9 +1121,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Link.decode = function decode(reader, length, error) { + Link.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.AlertPolicy.Documentation.Link(); while (reader.pos < end) { var tag = reader.uint32(); @@ -1107,7 +1143,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -1138,9 +1174,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Link.verify = function verify(message) { + Link.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.displayName != null && message.hasOwnProperty("displayName")) if (!$util.isString(message.displayName)) return "displayName: string expected"; @@ -1158,9 +1198,13 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.AlertPolicy.Documentation.Link} Link */ - Link.fromObject = function fromObject(object) { + Link.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.AlertPolicy.Documentation.Link) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.AlertPolicy.Documentation.Link(); if (object.displayName != null) message.displayName = String(object.displayName); @@ -1252,7 +1296,7 @@ function Condition(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -1401,9 +1445,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Condition.decode = function decode(reader, length, error) { + Condition.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.AlertPolicy.Condition(); while (reader.pos < end) { var tag = reader.uint32(); @@ -1419,31 +1467,31 @@ break; } case 1: { - message.conditionThreshold = $root.google.monitoring.v3.AlertPolicy.Condition.MetricThreshold.decode(reader, reader.uint32()); + message.conditionThreshold = $root.google.monitoring.v3.AlertPolicy.Condition.MetricThreshold.decode(reader, reader.uint32(), undefined, long + 1); break; } case 2: { - message.conditionAbsent = $root.google.monitoring.v3.AlertPolicy.Condition.MetricAbsence.decode(reader, reader.uint32()); + message.conditionAbsent = $root.google.monitoring.v3.AlertPolicy.Condition.MetricAbsence.decode(reader, reader.uint32(), undefined, long + 1); break; } case 20: { - message.conditionMatchedLog = $root.google.monitoring.v3.AlertPolicy.Condition.LogMatch.decode(reader, reader.uint32()); + message.conditionMatchedLog = $root.google.monitoring.v3.AlertPolicy.Condition.LogMatch.decode(reader, reader.uint32(), undefined, long + 1); break; } case 19: { - message.conditionMonitoringQueryLanguage = $root.google.monitoring.v3.AlertPolicy.Condition.MonitoringQueryLanguageCondition.decode(reader, reader.uint32()); + message.conditionMonitoringQueryLanguage = $root.google.monitoring.v3.AlertPolicy.Condition.MonitoringQueryLanguageCondition.decode(reader, reader.uint32(), undefined, long + 1); break; } case 21: { - message.conditionPrometheusQueryLanguage = $root.google.monitoring.v3.AlertPolicy.Condition.PrometheusQueryLanguageCondition.decode(reader, reader.uint32()); + message.conditionPrometheusQueryLanguage = $root.google.monitoring.v3.AlertPolicy.Condition.PrometheusQueryLanguageCondition.decode(reader, reader.uint32(), undefined, long + 1); break; } case 22: { - message.conditionSql = $root.google.monitoring.v3.AlertPolicy.Condition.SqlCondition.decode(reader, reader.uint32()); + message.conditionSql = $root.google.monitoring.v3.AlertPolicy.Condition.SqlCondition.decode(reader, reader.uint32(), undefined, long + 1); break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -1474,9 +1522,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Condition.verify = function verify(message) { + Condition.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; var properties = {}; if (message.name != null && message.hasOwnProperty("name")) if (!$util.isString(message.name)) @@ -1487,7 +1539,7 @@ if (message.conditionThreshold != null && message.hasOwnProperty("conditionThreshold")) { properties.condition = 1; { - var error = $root.google.monitoring.v3.AlertPolicy.Condition.MetricThreshold.verify(message.conditionThreshold); + var error = $root.google.monitoring.v3.AlertPolicy.Condition.MetricThreshold.verify(message.conditionThreshold, long + 1); if (error) return "conditionThreshold." + error; } @@ -1497,7 +1549,7 @@ return "condition: multiple values"; properties.condition = 1; { - var error = $root.google.monitoring.v3.AlertPolicy.Condition.MetricAbsence.verify(message.conditionAbsent); + var error = $root.google.monitoring.v3.AlertPolicy.Condition.MetricAbsence.verify(message.conditionAbsent, long + 1); if (error) return "conditionAbsent." + error; } @@ -1507,7 +1559,7 @@ return "condition: multiple values"; properties.condition = 1; { - var error = $root.google.monitoring.v3.AlertPolicy.Condition.LogMatch.verify(message.conditionMatchedLog); + var error = $root.google.monitoring.v3.AlertPolicy.Condition.LogMatch.verify(message.conditionMatchedLog, long + 1); if (error) return "conditionMatchedLog." + error; } @@ -1517,7 +1569,7 @@ return "condition: multiple values"; properties.condition = 1; { - var error = $root.google.monitoring.v3.AlertPolicy.Condition.MonitoringQueryLanguageCondition.verify(message.conditionMonitoringQueryLanguage); + var error = $root.google.monitoring.v3.AlertPolicy.Condition.MonitoringQueryLanguageCondition.verify(message.conditionMonitoringQueryLanguage, long + 1); if (error) return "conditionMonitoringQueryLanguage." + error; } @@ -1527,7 +1579,7 @@ return "condition: multiple values"; properties.condition = 1; { - var error = $root.google.monitoring.v3.AlertPolicy.Condition.PrometheusQueryLanguageCondition.verify(message.conditionPrometheusQueryLanguage); + var error = $root.google.monitoring.v3.AlertPolicy.Condition.PrometheusQueryLanguageCondition.verify(message.conditionPrometheusQueryLanguage, long + 1); if (error) return "conditionPrometheusQueryLanguage." + error; } @@ -1537,7 +1589,7 @@ return "condition: multiple values"; properties.condition = 1; { - var error = $root.google.monitoring.v3.AlertPolicy.Condition.SqlCondition.verify(message.conditionSql); + var error = $root.google.monitoring.v3.AlertPolicy.Condition.SqlCondition.verify(message.conditionSql, long + 1); if (error) return "conditionSql." + error; } @@ -1553,9 +1605,13 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.AlertPolicy.Condition} Condition */ - Condition.fromObject = function fromObject(object) { + Condition.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.AlertPolicy.Condition) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.AlertPolicy.Condition(); if (object.name != null) message.name = String(object.name); @@ -1564,32 +1620,32 @@ if (object.conditionThreshold != null) { if (typeof object.conditionThreshold !== "object") throw TypeError(".google.monitoring.v3.AlertPolicy.Condition.conditionThreshold: object expected"); - message.conditionThreshold = $root.google.monitoring.v3.AlertPolicy.Condition.MetricThreshold.fromObject(object.conditionThreshold); + message.conditionThreshold = $root.google.monitoring.v3.AlertPolicy.Condition.MetricThreshold.fromObject(object.conditionThreshold, long + 1); } if (object.conditionAbsent != null) { if (typeof object.conditionAbsent !== "object") throw TypeError(".google.monitoring.v3.AlertPolicy.Condition.conditionAbsent: object expected"); - message.conditionAbsent = $root.google.monitoring.v3.AlertPolicy.Condition.MetricAbsence.fromObject(object.conditionAbsent); + message.conditionAbsent = $root.google.monitoring.v3.AlertPolicy.Condition.MetricAbsence.fromObject(object.conditionAbsent, long + 1); } if (object.conditionMatchedLog != null) { if (typeof object.conditionMatchedLog !== "object") throw TypeError(".google.monitoring.v3.AlertPolicy.Condition.conditionMatchedLog: object expected"); - message.conditionMatchedLog = $root.google.monitoring.v3.AlertPolicy.Condition.LogMatch.fromObject(object.conditionMatchedLog); + message.conditionMatchedLog = $root.google.monitoring.v3.AlertPolicy.Condition.LogMatch.fromObject(object.conditionMatchedLog, long + 1); } if (object.conditionMonitoringQueryLanguage != null) { if (typeof object.conditionMonitoringQueryLanguage !== "object") throw TypeError(".google.monitoring.v3.AlertPolicy.Condition.conditionMonitoringQueryLanguage: object expected"); - message.conditionMonitoringQueryLanguage = $root.google.monitoring.v3.AlertPolicy.Condition.MonitoringQueryLanguageCondition.fromObject(object.conditionMonitoringQueryLanguage); + message.conditionMonitoringQueryLanguage = $root.google.monitoring.v3.AlertPolicy.Condition.MonitoringQueryLanguageCondition.fromObject(object.conditionMonitoringQueryLanguage, long + 1); } if (object.conditionPrometheusQueryLanguage != null) { if (typeof object.conditionPrometheusQueryLanguage !== "object") throw TypeError(".google.monitoring.v3.AlertPolicy.Condition.conditionPrometheusQueryLanguage: object expected"); - message.conditionPrometheusQueryLanguage = $root.google.monitoring.v3.AlertPolicy.Condition.PrometheusQueryLanguageCondition.fromObject(object.conditionPrometheusQueryLanguage); + message.conditionPrometheusQueryLanguage = $root.google.monitoring.v3.AlertPolicy.Condition.PrometheusQueryLanguageCondition.fromObject(object.conditionPrometheusQueryLanguage, long + 1); } if (object.conditionSql != null) { if (typeof object.conditionSql !== "object") throw TypeError(".google.monitoring.v3.AlertPolicy.Condition.conditionSql: object expected"); - message.conditionSql = $root.google.monitoring.v3.AlertPolicy.Condition.SqlCondition.fromObject(object.conditionSql); + message.conditionSql = $root.google.monitoring.v3.AlertPolicy.Condition.SqlCondition.fromObject(object.conditionSql, long + 1); } return message; }; @@ -1695,7 +1751,7 @@ function Trigger(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -1784,9 +1840,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Trigger.decode = function decode(reader, length, error) { + Trigger.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.AlertPolicy.Condition.Trigger(); while (reader.pos < end) { var tag = reader.uint32(); @@ -1802,7 +1862,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -1833,9 +1893,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Trigger.verify = function verify(message) { + Trigger.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; var properties = {}; if (message.count != null && message.hasOwnProperty("count")) { properties.type = 1; @@ -1860,9 +1924,13 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.AlertPolicy.Condition.Trigger} Trigger */ - Trigger.fromObject = function fromObject(object) { + Trigger.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.AlertPolicy.Condition.Trigger) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.AlertPolicy.Condition.Trigger(); if (object.count != null) message.count = object.count | 0; @@ -1975,7 +2043,7 @@ this.denominatorAggregations = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -2132,9 +2200,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - MetricThreshold.decode = function decode(reader, length, error) { + MetricThreshold.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.AlertPolicy.Condition.MetricThreshold(); while (reader.pos < end) { var tag = reader.uint32(); @@ -2148,7 +2220,7 @@ case 8: { if (!(message.aggregations && message.aggregations.length)) message.aggregations = []; - message.aggregations.push($root.google.monitoring.v3.Aggregation.decode(reader, reader.uint32())); + message.aggregations.push($root.google.monitoring.v3.Aggregation.decode(reader, reader.uint32(), undefined, long + 1)); break; } case 9: { @@ -2158,11 +2230,11 @@ case 10: { if (!(message.denominatorAggregations && message.denominatorAggregations.length)) message.denominatorAggregations = []; - message.denominatorAggregations.push($root.google.monitoring.v3.Aggregation.decode(reader, reader.uint32())); + message.denominatorAggregations.push($root.google.monitoring.v3.Aggregation.decode(reader, reader.uint32(), undefined, long + 1)); break; } case 12: { - message.forecastOptions = $root.google.monitoring.v3.AlertPolicy.Condition.MetricThreshold.ForecastOptions.decode(reader, reader.uint32()); + message.forecastOptions = $root.google.monitoring.v3.AlertPolicy.Condition.MetricThreshold.ForecastOptions.decode(reader, reader.uint32(), undefined, long + 1); break; } case 4: { @@ -2174,11 +2246,11 @@ break; } case 6: { - message.duration = $root.google.protobuf.Duration.decode(reader, reader.uint32()); + message.duration = $root.google.protobuf.Duration.decode(reader, reader.uint32(), undefined, long + 1); break; } case 7: { - message.trigger = $root.google.monitoring.v3.AlertPolicy.Condition.Trigger.decode(reader, reader.uint32()); + message.trigger = $root.google.monitoring.v3.AlertPolicy.Condition.Trigger.decode(reader, reader.uint32(), undefined, long + 1); break; } case 11: { @@ -2186,7 +2258,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -2217,9 +2289,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - MetricThreshold.verify = function verify(message) { + MetricThreshold.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.filter != null && message.hasOwnProperty("filter")) if (!$util.isString(message.filter)) return "filter: string expected"; @@ -2227,7 +2303,7 @@ if (!Array.isArray(message.aggregations)) return "aggregations: array expected"; for (var i = 0; i < message.aggregations.length; ++i) { - var error = $root.google.monitoring.v3.Aggregation.verify(message.aggregations[i]); + var error = $root.google.monitoring.v3.Aggregation.verify(message.aggregations[i], long + 1); if (error) return "aggregations." + error; } @@ -2239,13 +2315,13 @@ if (!Array.isArray(message.denominatorAggregations)) return "denominatorAggregations: array expected"; for (var i = 0; i < message.denominatorAggregations.length; ++i) { - var error = $root.google.monitoring.v3.Aggregation.verify(message.denominatorAggregations[i]); + var error = $root.google.monitoring.v3.Aggregation.verify(message.denominatorAggregations[i], long + 1); if (error) return "denominatorAggregations." + error; } } if (message.forecastOptions != null && message.hasOwnProperty("forecastOptions")) { - var error = $root.google.monitoring.v3.AlertPolicy.Condition.MetricThreshold.ForecastOptions.verify(message.forecastOptions); + var error = $root.google.monitoring.v3.AlertPolicy.Condition.MetricThreshold.ForecastOptions.verify(message.forecastOptions, long + 1); if (error) return "forecastOptions." + error; } @@ -2266,12 +2342,12 @@ if (typeof message.thresholdValue !== "number") return "thresholdValue: number expected"; if (message.duration != null && message.hasOwnProperty("duration")) { - var error = $root.google.protobuf.Duration.verify(message.duration); + var error = $root.google.protobuf.Duration.verify(message.duration, long + 1); if (error) return "duration." + error; } if (message.trigger != null && message.hasOwnProperty("trigger")) { - var error = $root.google.monitoring.v3.AlertPolicy.Condition.Trigger.verify(message.trigger); + var error = $root.google.monitoring.v3.AlertPolicy.Condition.Trigger.verify(message.trigger, long + 1); if (error) return "trigger." + error; } @@ -2296,9 +2372,13 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.AlertPolicy.Condition.MetricThreshold} MetricThreshold */ - MetricThreshold.fromObject = function fromObject(object) { + MetricThreshold.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.AlertPolicy.Condition.MetricThreshold) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.AlertPolicy.Condition.MetricThreshold(); if (object.filter != null) message.filter = String(object.filter); @@ -2309,7 +2389,7 @@ for (var i = 0; i < object.aggregations.length; ++i) { if (typeof object.aggregations[i] !== "object") throw TypeError(".google.monitoring.v3.AlertPolicy.Condition.MetricThreshold.aggregations: object expected"); - message.aggregations[i] = $root.google.monitoring.v3.Aggregation.fromObject(object.aggregations[i]); + message.aggregations[i] = $root.google.monitoring.v3.Aggregation.fromObject(object.aggregations[i], long + 1); } } if (object.denominatorFilter != null) @@ -2321,13 +2401,13 @@ for (var i = 0; i < object.denominatorAggregations.length; ++i) { if (typeof object.denominatorAggregations[i] !== "object") throw TypeError(".google.monitoring.v3.AlertPolicy.Condition.MetricThreshold.denominatorAggregations: object expected"); - message.denominatorAggregations[i] = $root.google.monitoring.v3.Aggregation.fromObject(object.denominatorAggregations[i]); + message.denominatorAggregations[i] = $root.google.monitoring.v3.Aggregation.fromObject(object.denominatorAggregations[i], long + 1); } } if (object.forecastOptions != null) { if (typeof object.forecastOptions !== "object") throw TypeError(".google.monitoring.v3.AlertPolicy.Condition.MetricThreshold.forecastOptions: object expected"); - message.forecastOptions = $root.google.monitoring.v3.AlertPolicy.Condition.MetricThreshold.ForecastOptions.fromObject(object.forecastOptions); + message.forecastOptions = $root.google.monitoring.v3.AlertPolicy.Condition.MetricThreshold.ForecastOptions.fromObject(object.forecastOptions, long + 1); } switch (object.comparison) { default: @@ -2370,12 +2450,12 @@ if (object.duration != null) { if (typeof object.duration !== "object") throw TypeError(".google.monitoring.v3.AlertPolicy.Condition.MetricThreshold.duration: object expected"); - message.duration = $root.google.protobuf.Duration.fromObject(object.duration); + message.duration = $root.google.protobuf.Duration.fromObject(object.duration, long + 1); } if (object.trigger != null) { if (typeof object.trigger !== "object") throw TypeError(".google.monitoring.v3.AlertPolicy.Condition.MetricThreshold.trigger: object expected"); - message.trigger = $root.google.monitoring.v3.AlertPolicy.Condition.Trigger.fromObject(object.trigger); + message.trigger = $root.google.monitoring.v3.AlertPolicy.Condition.Trigger.fromObject(object.trigger, long + 1); } switch (object.evaluationMissingData) { default: @@ -2506,7 +2586,7 @@ function ForecastOptions(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -2571,9 +2651,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ForecastOptions.decode = function decode(reader, length, error) { + ForecastOptions.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.AlertPolicy.Condition.MetricThreshold.ForecastOptions(); while (reader.pos < end) { var tag = reader.uint32(); @@ -2581,11 +2665,11 @@ break; switch (tag >>> 3) { case 1: { - message.forecastHorizon = $root.google.protobuf.Duration.decode(reader, reader.uint32()); + message.forecastHorizon = $root.google.protobuf.Duration.decode(reader, reader.uint32(), undefined, long + 1); break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -2616,11 +2700,15 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ForecastOptions.verify = function verify(message) { + ForecastOptions.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.forecastHorizon != null && message.hasOwnProperty("forecastHorizon")) { - var error = $root.google.protobuf.Duration.verify(message.forecastHorizon); + var error = $root.google.protobuf.Duration.verify(message.forecastHorizon, long + 1); if (error) return "forecastHorizon." + error; } @@ -2635,14 +2723,18 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.AlertPolicy.Condition.MetricThreshold.ForecastOptions} ForecastOptions */ - ForecastOptions.fromObject = function fromObject(object) { + ForecastOptions.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.AlertPolicy.Condition.MetricThreshold.ForecastOptions) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.AlertPolicy.Condition.MetricThreshold.ForecastOptions(); if (object.forecastHorizon != null) { if (typeof object.forecastHorizon !== "object") throw TypeError(".google.monitoring.v3.AlertPolicy.Condition.MetricThreshold.ForecastOptions.forecastHorizon: object expected"); - message.forecastHorizon = $root.google.protobuf.Duration.fromObject(object.forecastHorizon); + message.forecastHorizon = $root.google.protobuf.Duration.fromObject(object.forecastHorizon, long + 1); } return message; }; @@ -2723,7 +2815,7 @@ this.aggregations = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -2819,9 +2911,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - MetricAbsence.decode = function decode(reader, length, error) { + MetricAbsence.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.AlertPolicy.Condition.MetricAbsence(); while (reader.pos < end) { var tag = reader.uint32(); @@ -2835,19 +2931,19 @@ case 5: { if (!(message.aggregations && message.aggregations.length)) message.aggregations = []; - message.aggregations.push($root.google.monitoring.v3.Aggregation.decode(reader, reader.uint32())); + message.aggregations.push($root.google.monitoring.v3.Aggregation.decode(reader, reader.uint32(), undefined, long + 1)); break; } case 2: { - message.duration = $root.google.protobuf.Duration.decode(reader, reader.uint32()); + message.duration = $root.google.protobuf.Duration.decode(reader, reader.uint32(), undefined, long + 1); break; } case 3: { - message.trigger = $root.google.monitoring.v3.AlertPolicy.Condition.Trigger.decode(reader, reader.uint32()); + message.trigger = $root.google.monitoring.v3.AlertPolicy.Condition.Trigger.decode(reader, reader.uint32(), undefined, long + 1); break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -2878,9 +2974,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - MetricAbsence.verify = function verify(message) { + MetricAbsence.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.filter != null && message.hasOwnProperty("filter")) if (!$util.isString(message.filter)) return "filter: string expected"; @@ -2888,18 +2988,18 @@ if (!Array.isArray(message.aggregations)) return "aggregations: array expected"; for (var i = 0; i < message.aggregations.length; ++i) { - var error = $root.google.monitoring.v3.Aggregation.verify(message.aggregations[i]); + var error = $root.google.monitoring.v3.Aggregation.verify(message.aggregations[i], long + 1); if (error) return "aggregations." + error; } } if (message.duration != null && message.hasOwnProperty("duration")) { - var error = $root.google.protobuf.Duration.verify(message.duration); + var error = $root.google.protobuf.Duration.verify(message.duration, long + 1); if (error) return "duration." + error; } if (message.trigger != null && message.hasOwnProperty("trigger")) { - var error = $root.google.monitoring.v3.AlertPolicy.Condition.Trigger.verify(message.trigger); + var error = $root.google.monitoring.v3.AlertPolicy.Condition.Trigger.verify(message.trigger, long + 1); if (error) return "trigger." + error; } @@ -2914,9 +3014,13 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.AlertPolicy.Condition.MetricAbsence} MetricAbsence */ - MetricAbsence.fromObject = function fromObject(object) { + MetricAbsence.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.AlertPolicy.Condition.MetricAbsence) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.AlertPolicy.Condition.MetricAbsence(); if (object.filter != null) message.filter = String(object.filter); @@ -2927,18 +3031,18 @@ for (var i = 0; i < object.aggregations.length; ++i) { if (typeof object.aggregations[i] !== "object") throw TypeError(".google.monitoring.v3.AlertPolicy.Condition.MetricAbsence.aggregations: object expected"); - message.aggregations[i] = $root.google.monitoring.v3.Aggregation.fromObject(object.aggregations[i]); + message.aggregations[i] = $root.google.monitoring.v3.Aggregation.fromObject(object.aggregations[i], long + 1); } } if (object.duration != null) { if (typeof object.duration !== "object") throw TypeError(".google.monitoring.v3.AlertPolicy.Condition.MetricAbsence.duration: object expected"); - message.duration = $root.google.protobuf.Duration.fromObject(object.duration); + message.duration = $root.google.protobuf.Duration.fromObject(object.duration, long + 1); } if (object.trigger != null) { if (typeof object.trigger !== "object") throw TypeError(".google.monitoring.v3.AlertPolicy.Condition.MetricAbsence.trigger: object expected"); - message.trigger = $root.google.monitoring.v3.AlertPolicy.Condition.Trigger.fromObject(object.trigger); + message.trigger = $root.google.monitoring.v3.AlertPolicy.Condition.Trigger.fromObject(object.trigger, long + 1); } return message; }; @@ -3028,7 +3132,7 @@ this.labelExtractors = {}; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -3104,9 +3208,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - LogMatch.decode = function decode(reader, length, error) { + LogMatch.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.AlertPolicy.Condition.LogMatch(), key, value; while (reader.pos < end) { var tag = reader.uint32(); @@ -3133,15 +3241,17 @@ value = reader.string(); break; default: - reader.skipType(tag2 & 7); + reader.skipType(tag2 & 7, long); break; } } + if (key === "__proto__") + $util.makeProp(message.labelExtractors, key); message.labelExtractors[key] = value; break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -3172,9 +3282,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - LogMatch.verify = function verify(message) { + LogMatch.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.filter != null && message.hasOwnProperty("filter")) if (!$util.isString(message.filter)) return "filter: string expected"; @@ -3197,9 +3311,13 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.AlertPolicy.Condition.LogMatch} LogMatch */ - LogMatch.fromObject = function fromObject(object) { + LogMatch.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.AlertPolicy.Condition.LogMatch) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.AlertPolicy.Condition.LogMatch(); if (object.filter != null) message.filter = String(object.filter); @@ -3207,8 +3325,11 @@ if (typeof object.labelExtractors !== "object") throw TypeError(".google.monitoring.v3.AlertPolicy.Condition.LogMatch.labelExtractors: object expected"); message.labelExtractors = {}; - for (var keys = Object.keys(object.labelExtractors), i = 0; i < keys.length; ++i) + for (var keys = Object.keys(object.labelExtractors), i = 0; i < keys.length; ++i) { + if (keys[i] === "__proto__") + $util.makeProp(message.labelExtractors, keys[i]); message.labelExtractors[keys[i]] = String(object.labelExtractors[keys[i]]); + } } return message; }; @@ -3235,8 +3356,11 @@ var keys2; if (message.labelExtractors && (keys2 = Object.keys(message.labelExtractors)).length) { object.labelExtractors = {}; - for (var j = 0; j < keys2.length; ++j) + for (var j = 0; j < keys2.length; ++j) { + if (keys2[j] === "__proto__") + $util.makeProp(object.labelExtractors, keys2[j]); object.labelExtractors[keys2[j]] = message.labelExtractors[keys2[j]]; + } } return object; }; @@ -3293,7 +3417,7 @@ function MonitoringQueryLanguageCondition(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -3388,9 +3512,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - MonitoringQueryLanguageCondition.decode = function decode(reader, length, error) { + MonitoringQueryLanguageCondition.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.AlertPolicy.Condition.MonitoringQueryLanguageCondition(); while (reader.pos < end) { var tag = reader.uint32(); @@ -3402,11 +3530,11 @@ break; } case 2: { - message.duration = $root.google.protobuf.Duration.decode(reader, reader.uint32()); + message.duration = $root.google.protobuf.Duration.decode(reader, reader.uint32(), undefined, long + 1); break; } case 3: { - message.trigger = $root.google.monitoring.v3.AlertPolicy.Condition.Trigger.decode(reader, reader.uint32()); + message.trigger = $root.google.monitoring.v3.AlertPolicy.Condition.Trigger.decode(reader, reader.uint32(), undefined, long + 1); break; } case 4: { @@ -3414,7 +3542,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -3445,19 +3573,23 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - MonitoringQueryLanguageCondition.verify = function verify(message) { + MonitoringQueryLanguageCondition.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.query != null && message.hasOwnProperty("query")) if (!$util.isString(message.query)) return "query: string expected"; if (message.duration != null && message.hasOwnProperty("duration")) { - var error = $root.google.protobuf.Duration.verify(message.duration); + var error = $root.google.protobuf.Duration.verify(message.duration, long + 1); if (error) return "duration." + error; } if (message.trigger != null && message.hasOwnProperty("trigger")) { - var error = $root.google.monitoring.v3.AlertPolicy.Condition.Trigger.verify(message.trigger); + var error = $root.google.monitoring.v3.AlertPolicy.Condition.Trigger.verify(message.trigger, long + 1); if (error) return "trigger." + error; } @@ -3482,21 +3614,25 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.AlertPolicy.Condition.MonitoringQueryLanguageCondition} MonitoringQueryLanguageCondition */ - MonitoringQueryLanguageCondition.fromObject = function fromObject(object) { + MonitoringQueryLanguageCondition.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.AlertPolicy.Condition.MonitoringQueryLanguageCondition) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.AlertPolicy.Condition.MonitoringQueryLanguageCondition(); if (object.query != null) message.query = String(object.query); if (object.duration != null) { if (typeof object.duration !== "object") throw TypeError(".google.monitoring.v3.AlertPolicy.Condition.MonitoringQueryLanguageCondition.duration: object expected"); - message.duration = $root.google.protobuf.Duration.fromObject(object.duration); + message.duration = $root.google.protobuf.Duration.fromObject(object.duration, long + 1); } if (object.trigger != null) { if (typeof object.trigger !== "object") throw TypeError(".google.monitoring.v3.AlertPolicy.Condition.MonitoringQueryLanguageCondition.trigger: object expected"); - message.trigger = $root.google.monitoring.v3.AlertPolicy.Condition.Trigger.fromObject(object.trigger); + message.trigger = $root.google.monitoring.v3.AlertPolicy.Condition.Trigger.fromObject(object.trigger, long + 1); } switch (object.evaluationMissingData) { default: @@ -3611,7 +3747,7 @@ this.labels = {}; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -3737,9 +3873,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - PrometheusQueryLanguageCondition.decode = function decode(reader, length, error) { + PrometheusQueryLanguageCondition.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.AlertPolicy.Condition.PrometheusQueryLanguageCondition(), key, value; while (reader.pos < end) { var tag = reader.uint32(); @@ -3751,11 +3891,11 @@ break; } case 2: { - message.duration = $root.google.protobuf.Duration.decode(reader, reader.uint32()); + message.duration = $root.google.protobuf.Duration.decode(reader, reader.uint32(), undefined, long + 1); break; } case 3: { - message.evaluationInterval = $root.google.protobuf.Duration.decode(reader, reader.uint32()); + message.evaluationInterval = $root.google.protobuf.Duration.decode(reader, reader.uint32(), undefined, long + 1); break; } case 4: { @@ -3774,10 +3914,12 @@ value = reader.string(); break; default: - reader.skipType(tag2 & 7); + reader.skipType(tag2 & 7, long); break; } } + if (key === "__proto__") + $util.makeProp(message.labels, key); message.labels[key] = value; break; } @@ -3794,7 +3936,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -3825,19 +3967,23 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - PrometheusQueryLanguageCondition.verify = function verify(message) { + PrometheusQueryLanguageCondition.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.query != null && message.hasOwnProperty("query")) if (!$util.isString(message.query)) return "query: string expected"; if (message.duration != null && message.hasOwnProperty("duration")) { - var error = $root.google.protobuf.Duration.verify(message.duration); + var error = $root.google.protobuf.Duration.verify(message.duration, long + 1); if (error) return "duration." + error; } if (message.evaluationInterval != null && message.hasOwnProperty("evaluationInterval")) { - var error = $root.google.protobuf.Duration.verify(message.evaluationInterval); + var error = $root.google.protobuf.Duration.verify(message.evaluationInterval, long + 1); if (error) return "evaluationInterval." + error; } @@ -3869,28 +4015,35 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.AlertPolicy.Condition.PrometheusQueryLanguageCondition} PrometheusQueryLanguageCondition */ - PrometheusQueryLanguageCondition.fromObject = function fromObject(object) { + PrometheusQueryLanguageCondition.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.AlertPolicy.Condition.PrometheusQueryLanguageCondition) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.AlertPolicy.Condition.PrometheusQueryLanguageCondition(); if (object.query != null) message.query = String(object.query); if (object.duration != null) { if (typeof object.duration !== "object") throw TypeError(".google.monitoring.v3.AlertPolicy.Condition.PrometheusQueryLanguageCondition.duration: object expected"); - message.duration = $root.google.protobuf.Duration.fromObject(object.duration); + message.duration = $root.google.protobuf.Duration.fromObject(object.duration, long + 1); } if (object.evaluationInterval != null) { if (typeof object.evaluationInterval !== "object") throw TypeError(".google.monitoring.v3.AlertPolicy.Condition.PrometheusQueryLanguageCondition.evaluationInterval: object expected"); - message.evaluationInterval = $root.google.protobuf.Duration.fromObject(object.evaluationInterval); + message.evaluationInterval = $root.google.protobuf.Duration.fromObject(object.evaluationInterval, long + 1); } if (object.labels) { if (typeof object.labels !== "object") throw TypeError(".google.monitoring.v3.AlertPolicy.Condition.PrometheusQueryLanguageCondition.labels: object expected"); message.labels = {}; - for (var keys = Object.keys(object.labels), i = 0; i < keys.length; ++i) + for (var keys = Object.keys(object.labels), i = 0; i < keys.length; ++i) { + if (keys[i] === "__proto__") + $util.makeProp(message.labels, keys[i]); message.labels[keys[i]] = String(object.labels[keys[i]]); + } } if (object.ruleGroup != null) message.ruleGroup = String(object.ruleGroup); @@ -3933,8 +4086,11 @@ var keys2; if (message.labels && (keys2 = Object.keys(message.labels)).length) { object.labels = {}; - for (var j = 0; j < keys2.length; ++j) + for (var j = 0; j < keys2.length; ++j) { + if (keys2[j] === "__proto__") + $util.makeProp(object.labels, keys2[j]); object.labels[keys2[j]] = message.labels[keys2[j]]; + } } if (message.ruleGroup != null && message.hasOwnProperty("ruleGroup")) object.ruleGroup = message.ruleGroup; @@ -3999,7 +4155,7 @@ function SqlCondition(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -4139,9 +4295,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - SqlCondition.decode = function decode(reader, length, error) { + SqlCondition.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.AlertPolicy.Condition.SqlCondition(); while (reader.pos < end) { var tag = reader.uint32(); @@ -4153,27 +4313,27 @@ break; } case 2: { - message.minutes = $root.google.monitoring.v3.AlertPolicy.Condition.SqlCondition.Minutes.decode(reader, reader.uint32()); + message.minutes = $root.google.monitoring.v3.AlertPolicy.Condition.SqlCondition.Minutes.decode(reader, reader.uint32(), undefined, long + 1); break; } case 3: { - message.hourly = $root.google.monitoring.v3.AlertPolicy.Condition.SqlCondition.Hourly.decode(reader, reader.uint32()); + message.hourly = $root.google.monitoring.v3.AlertPolicy.Condition.SqlCondition.Hourly.decode(reader, reader.uint32(), undefined, long + 1); break; } case 4: { - message.daily = $root.google.monitoring.v3.AlertPolicy.Condition.SqlCondition.Daily.decode(reader, reader.uint32()); + message.daily = $root.google.monitoring.v3.AlertPolicy.Condition.SqlCondition.Daily.decode(reader, reader.uint32(), undefined, long + 1); break; } case 5: { - message.rowCountTest = $root.google.monitoring.v3.AlertPolicy.Condition.SqlCondition.RowCountTest.decode(reader, reader.uint32()); + message.rowCountTest = $root.google.monitoring.v3.AlertPolicy.Condition.SqlCondition.RowCountTest.decode(reader, reader.uint32(), undefined, long + 1); break; } case 6: { - message.booleanTest = $root.google.monitoring.v3.AlertPolicy.Condition.SqlCondition.BooleanTest.decode(reader, reader.uint32()); + message.booleanTest = $root.google.monitoring.v3.AlertPolicy.Condition.SqlCondition.BooleanTest.decode(reader, reader.uint32(), undefined, long + 1); break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -4204,9 +4364,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - SqlCondition.verify = function verify(message) { + SqlCondition.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; var properties = {}; if (message.query != null && message.hasOwnProperty("query")) if (!$util.isString(message.query)) @@ -4214,7 +4378,7 @@ if (message.minutes != null && message.hasOwnProperty("minutes")) { properties.schedule = 1; { - var error = $root.google.monitoring.v3.AlertPolicy.Condition.SqlCondition.Minutes.verify(message.minutes); + var error = $root.google.monitoring.v3.AlertPolicy.Condition.SqlCondition.Minutes.verify(message.minutes, long + 1); if (error) return "minutes." + error; } @@ -4224,7 +4388,7 @@ return "schedule: multiple values"; properties.schedule = 1; { - var error = $root.google.monitoring.v3.AlertPolicy.Condition.SqlCondition.Hourly.verify(message.hourly); + var error = $root.google.monitoring.v3.AlertPolicy.Condition.SqlCondition.Hourly.verify(message.hourly, long + 1); if (error) return "hourly." + error; } @@ -4234,7 +4398,7 @@ return "schedule: multiple values"; properties.schedule = 1; { - var error = $root.google.monitoring.v3.AlertPolicy.Condition.SqlCondition.Daily.verify(message.daily); + var error = $root.google.monitoring.v3.AlertPolicy.Condition.SqlCondition.Daily.verify(message.daily, long + 1); if (error) return "daily." + error; } @@ -4242,7 +4406,7 @@ if (message.rowCountTest != null && message.hasOwnProperty("rowCountTest")) { properties.evaluate = 1; { - var error = $root.google.monitoring.v3.AlertPolicy.Condition.SqlCondition.RowCountTest.verify(message.rowCountTest); + var error = $root.google.monitoring.v3.AlertPolicy.Condition.SqlCondition.RowCountTest.verify(message.rowCountTest, long + 1); if (error) return "rowCountTest." + error; } @@ -4252,7 +4416,7 @@ return "evaluate: multiple values"; properties.evaluate = 1; { - var error = $root.google.monitoring.v3.AlertPolicy.Condition.SqlCondition.BooleanTest.verify(message.booleanTest); + var error = $root.google.monitoring.v3.AlertPolicy.Condition.SqlCondition.BooleanTest.verify(message.booleanTest, long + 1); if (error) return "booleanTest." + error; } @@ -4268,36 +4432,40 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.AlertPolicy.Condition.SqlCondition} SqlCondition */ - SqlCondition.fromObject = function fromObject(object) { + SqlCondition.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.AlertPolicy.Condition.SqlCondition) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.AlertPolicy.Condition.SqlCondition(); if (object.query != null) message.query = String(object.query); if (object.minutes != null) { if (typeof object.minutes !== "object") throw TypeError(".google.monitoring.v3.AlertPolicy.Condition.SqlCondition.minutes: object expected"); - message.minutes = $root.google.monitoring.v3.AlertPolicy.Condition.SqlCondition.Minutes.fromObject(object.minutes); + message.minutes = $root.google.monitoring.v3.AlertPolicy.Condition.SqlCondition.Minutes.fromObject(object.minutes, long + 1); } if (object.hourly != null) { if (typeof object.hourly !== "object") throw TypeError(".google.monitoring.v3.AlertPolicy.Condition.SqlCondition.hourly: object expected"); - message.hourly = $root.google.monitoring.v3.AlertPolicy.Condition.SqlCondition.Hourly.fromObject(object.hourly); + message.hourly = $root.google.monitoring.v3.AlertPolicy.Condition.SqlCondition.Hourly.fromObject(object.hourly, long + 1); } if (object.daily != null) { if (typeof object.daily !== "object") throw TypeError(".google.monitoring.v3.AlertPolicy.Condition.SqlCondition.daily: object expected"); - message.daily = $root.google.monitoring.v3.AlertPolicy.Condition.SqlCondition.Daily.fromObject(object.daily); + message.daily = $root.google.monitoring.v3.AlertPolicy.Condition.SqlCondition.Daily.fromObject(object.daily, long + 1); } if (object.rowCountTest != null) { if (typeof object.rowCountTest !== "object") throw TypeError(".google.monitoring.v3.AlertPolicy.Condition.SqlCondition.rowCountTest: object expected"); - message.rowCountTest = $root.google.monitoring.v3.AlertPolicy.Condition.SqlCondition.RowCountTest.fromObject(object.rowCountTest); + message.rowCountTest = $root.google.monitoring.v3.AlertPolicy.Condition.SqlCondition.RowCountTest.fromObject(object.rowCountTest, long + 1); } if (object.booleanTest != null) { if (typeof object.booleanTest !== "object") throw TypeError(".google.monitoring.v3.AlertPolicy.Condition.SqlCondition.booleanTest: object expected"); - message.booleanTest = $root.google.monitoring.v3.AlertPolicy.Condition.SqlCondition.BooleanTest.fromObject(object.booleanTest); + message.booleanTest = $root.google.monitoring.v3.AlertPolicy.Condition.SqlCondition.BooleanTest.fromObject(object.booleanTest, long + 1); } return message; }; @@ -4393,7 +4561,7 @@ function Minutes(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -4458,9 +4626,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Minutes.decode = function decode(reader, length, error) { + Minutes.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.AlertPolicy.Condition.SqlCondition.Minutes(); while (reader.pos < end) { var tag = reader.uint32(); @@ -4472,7 +4644,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -4503,9 +4675,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Minutes.verify = function verify(message) { + Minutes.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.periodicity != null && message.hasOwnProperty("periodicity")) if (!$util.isInteger(message.periodicity)) return "periodicity: integer expected"; @@ -4520,9 +4696,13 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.AlertPolicy.Condition.SqlCondition.Minutes} Minutes */ - Minutes.fromObject = function fromObject(object) { + Minutes.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.AlertPolicy.Condition.SqlCondition.Minutes) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.AlertPolicy.Condition.SqlCondition.Minutes(); if (object.periodicity != null) message.periodicity = object.periodicity | 0; @@ -4599,7 +4779,7 @@ function Hourly(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -4683,9 +4863,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Hourly.decode = function decode(reader, length, error) { + Hourly.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.AlertPolicy.Condition.SqlCondition.Hourly(); while (reader.pos < end) { var tag = reader.uint32(); @@ -4701,7 +4885,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -4732,9 +4916,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Hourly.verify = function verify(message) { + Hourly.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; var properties = {}; if (message.periodicity != null && message.hasOwnProperty("periodicity")) if (!$util.isInteger(message.periodicity)) @@ -4755,9 +4943,13 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.AlertPolicy.Condition.SqlCondition.Hourly} Hourly */ - Hourly.fromObject = function fromObject(object) { + Hourly.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.AlertPolicy.Condition.SqlCondition.Hourly) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.AlertPolicy.Condition.SqlCondition.Hourly(); if (object.periodicity != null) message.periodicity = object.periodicity | 0; @@ -4841,7 +5033,7 @@ function Daily(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -4916,9 +5108,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Daily.decode = function decode(reader, length, error) { + Daily.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.AlertPolicy.Condition.SqlCondition.Daily(); while (reader.pos < end) { var tag = reader.uint32(); @@ -4930,11 +5126,11 @@ break; } case 2: { - message.executionTime = $root.google.type.TimeOfDay.decode(reader, reader.uint32()); + message.executionTime = $root.google.type.TimeOfDay.decode(reader, reader.uint32(), undefined, long + 1); break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -4965,14 +5161,18 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Daily.verify = function verify(message) { + Daily.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.periodicity != null && message.hasOwnProperty("periodicity")) if (!$util.isInteger(message.periodicity)) return "periodicity: integer expected"; if (message.executionTime != null && message.hasOwnProperty("executionTime")) { - var error = $root.google.type.TimeOfDay.verify(message.executionTime); + var error = $root.google.type.TimeOfDay.verify(message.executionTime, long + 1); if (error) return "executionTime." + error; } @@ -4987,16 +5187,20 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.AlertPolicy.Condition.SqlCondition.Daily} Daily */ - Daily.fromObject = function fromObject(object) { + Daily.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.AlertPolicy.Condition.SqlCondition.Daily) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.AlertPolicy.Condition.SqlCondition.Daily(); if (object.periodicity != null) message.periodicity = object.periodicity | 0; if (object.executionTime != null) { if (typeof object.executionTime !== "object") throw TypeError(".google.monitoring.v3.AlertPolicy.Condition.SqlCondition.Daily.executionTime: object expected"); - message.executionTime = $root.google.type.TimeOfDay.fromObject(object.executionTime); + message.executionTime = $root.google.type.TimeOfDay.fromObject(object.executionTime, long + 1); } return message; }; @@ -5075,7 +5279,7 @@ function RowCountTest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -5150,9 +5354,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - RowCountTest.decode = function decode(reader, length, error) { + RowCountTest.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.AlertPolicy.Condition.SqlCondition.RowCountTest(); while (reader.pos < end) { var tag = reader.uint32(); @@ -5168,7 +5376,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -5199,9 +5407,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - RowCountTest.verify = function verify(message) { + RowCountTest.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.comparison != null && message.hasOwnProperty("comparison")) switch (message.comparison) { default: @@ -5229,9 +5441,13 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.AlertPolicy.Condition.SqlCondition.RowCountTest} RowCountTest */ - RowCountTest.fromObject = function fromObject(object) { + RowCountTest.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.AlertPolicy.Condition.SqlCondition.RowCountTest) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.AlertPolicy.Condition.SqlCondition.RowCountTest(); switch (object.comparison) { default: @@ -5361,7 +5577,7 @@ function BooleanTest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -5426,9 +5642,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - BooleanTest.decode = function decode(reader, length, error) { + BooleanTest.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.AlertPolicy.Condition.SqlCondition.BooleanTest(); while (reader.pos < end) { var tag = reader.uint32(); @@ -5440,7 +5660,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -5471,9 +5691,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - BooleanTest.verify = function verify(message) { + BooleanTest.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.column != null && message.hasOwnProperty("column")) if (!$util.isString(message.column)) return "column: string expected"; @@ -5488,9 +5712,13 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.AlertPolicy.Condition.SqlCondition.BooleanTest} BooleanTest */ - BooleanTest.fromObject = function fromObject(object) { + BooleanTest.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.AlertPolicy.Condition.SqlCondition.BooleanTest) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.AlertPolicy.Condition.SqlCondition.BooleanTest(); if (object.column != null) message.column = String(object.column); @@ -5595,7 +5823,7 @@ this.notificationChannelStrategy = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -5695,9 +5923,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - AlertStrategy.decode = function decode(reader, length, error) { + AlertStrategy.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.AlertPolicy.AlertStrategy(); while (reader.pos < end) { var tag = reader.uint32(); @@ -5705,7 +5937,7 @@ break; switch (tag >>> 3) { case 1: { - message.notificationRateLimit = $root.google.monitoring.v3.AlertPolicy.AlertStrategy.NotificationRateLimit.decode(reader, reader.uint32()); + message.notificationRateLimit = $root.google.monitoring.v3.AlertPolicy.AlertStrategy.NotificationRateLimit.decode(reader, reader.uint32(), undefined, long + 1); break; } case 2: { @@ -5720,17 +5952,17 @@ break; } case 3: { - message.autoClose = $root.google.protobuf.Duration.decode(reader, reader.uint32()); + message.autoClose = $root.google.protobuf.Duration.decode(reader, reader.uint32(), undefined, long + 1); break; } case 4: { if (!(message.notificationChannelStrategy && message.notificationChannelStrategy.length)) message.notificationChannelStrategy = []; - message.notificationChannelStrategy.push($root.google.monitoring.v3.AlertPolicy.AlertStrategy.NotificationChannelStrategy.decode(reader, reader.uint32())); + message.notificationChannelStrategy.push($root.google.monitoring.v3.AlertPolicy.AlertStrategy.NotificationChannelStrategy.decode(reader, reader.uint32(), undefined, long + 1)); break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -5761,11 +5993,15 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - AlertStrategy.verify = function verify(message) { + AlertStrategy.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.notificationRateLimit != null && message.hasOwnProperty("notificationRateLimit")) { - var error = $root.google.monitoring.v3.AlertPolicy.AlertStrategy.NotificationRateLimit.verify(message.notificationRateLimit); + var error = $root.google.monitoring.v3.AlertPolicy.AlertStrategy.NotificationRateLimit.verify(message.notificationRateLimit, long + 1); if (error) return "notificationRateLimit." + error; } @@ -5783,7 +6019,7 @@ } } if (message.autoClose != null && message.hasOwnProperty("autoClose")) { - var error = $root.google.protobuf.Duration.verify(message.autoClose); + var error = $root.google.protobuf.Duration.verify(message.autoClose, long + 1); if (error) return "autoClose." + error; } @@ -5791,7 +6027,7 @@ if (!Array.isArray(message.notificationChannelStrategy)) return "notificationChannelStrategy: array expected"; for (var i = 0; i < message.notificationChannelStrategy.length; ++i) { - var error = $root.google.monitoring.v3.AlertPolicy.AlertStrategy.NotificationChannelStrategy.verify(message.notificationChannelStrategy[i]); + var error = $root.google.monitoring.v3.AlertPolicy.AlertStrategy.NotificationChannelStrategy.verify(message.notificationChannelStrategy[i], long + 1); if (error) return "notificationChannelStrategy." + error; } @@ -5807,14 +6043,18 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.AlertPolicy.AlertStrategy} AlertStrategy */ - AlertStrategy.fromObject = function fromObject(object) { + AlertStrategy.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.AlertPolicy.AlertStrategy) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.AlertPolicy.AlertStrategy(); if (object.notificationRateLimit != null) { if (typeof object.notificationRateLimit !== "object") throw TypeError(".google.monitoring.v3.AlertPolicy.AlertStrategy.notificationRateLimit: object expected"); - message.notificationRateLimit = $root.google.monitoring.v3.AlertPolicy.AlertStrategy.NotificationRateLimit.fromObject(object.notificationRateLimit); + message.notificationRateLimit = $root.google.monitoring.v3.AlertPolicy.AlertStrategy.NotificationRateLimit.fromObject(object.notificationRateLimit, long + 1); } if (object.notificationPrompts) { if (!Array.isArray(object.notificationPrompts)) @@ -5844,7 +6084,7 @@ if (object.autoClose != null) { if (typeof object.autoClose !== "object") throw TypeError(".google.monitoring.v3.AlertPolicy.AlertStrategy.autoClose: object expected"); - message.autoClose = $root.google.protobuf.Duration.fromObject(object.autoClose); + message.autoClose = $root.google.protobuf.Duration.fromObject(object.autoClose, long + 1); } if (object.notificationChannelStrategy) { if (!Array.isArray(object.notificationChannelStrategy)) @@ -5853,7 +6093,7 @@ for (var i = 0; i < object.notificationChannelStrategy.length; ++i) { if (typeof object.notificationChannelStrategy[i] !== "object") throw TypeError(".google.monitoring.v3.AlertPolicy.AlertStrategy.notificationChannelStrategy: object expected"); - message.notificationChannelStrategy[i] = $root.google.monitoring.v3.AlertPolicy.AlertStrategy.NotificationChannelStrategy.fromObject(object.notificationChannelStrategy[i]); + message.notificationChannelStrategy[i] = $root.google.monitoring.v3.AlertPolicy.AlertStrategy.NotificationChannelStrategy.fromObject(object.notificationChannelStrategy[i], long + 1); } } return message; @@ -5943,7 +6183,7 @@ function NotificationRateLimit(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -6008,9 +6248,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - NotificationRateLimit.decode = function decode(reader, length, error) { + NotificationRateLimit.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.AlertPolicy.AlertStrategy.NotificationRateLimit(); while (reader.pos < end) { var tag = reader.uint32(); @@ -6018,11 +6262,11 @@ break; switch (tag >>> 3) { case 1: { - message.period = $root.google.protobuf.Duration.decode(reader, reader.uint32()); + message.period = $root.google.protobuf.Duration.decode(reader, reader.uint32(), undefined, long + 1); break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -6053,11 +6297,15 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - NotificationRateLimit.verify = function verify(message) { + NotificationRateLimit.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.period != null && message.hasOwnProperty("period")) { - var error = $root.google.protobuf.Duration.verify(message.period); + var error = $root.google.protobuf.Duration.verify(message.period, long + 1); if (error) return "period." + error; } @@ -6072,14 +6320,18 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.AlertPolicy.AlertStrategy.NotificationRateLimit} NotificationRateLimit */ - NotificationRateLimit.fromObject = function fromObject(object) { + NotificationRateLimit.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.AlertPolicy.AlertStrategy.NotificationRateLimit) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.AlertPolicy.AlertStrategy.NotificationRateLimit(); if (object.period != null) { if (typeof object.period !== "object") throw TypeError(".google.monitoring.v3.AlertPolicy.AlertStrategy.NotificationRateLimit.period: object expected"); - message.period = $root.google.protobuf.Duration.fromObject(object.period); + message.period = $root.google.protobuf.Duration.fromObject(object.period, long + 1); } return message; }; @@ -6171,7 +6423,7 @@ this.notificationChannelNames = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -6247,9 +6499,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - NotificationChannelStrategy.decode = function decode(reader, length, error) { + NotificationChannelStrategy.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.AlertPolicy.AlertStrategy.NotificationChannelStrategy(); while (reader.pos < end) { var tag = reader.uint32(); @@ -6263,11 +6519,11 @@ break; } case 2: { - message.renotifyInterval = $root.google.protobuf.Duration.decode(reader, reader.uint32()); + message.renotifyInterval = $root.google.protobuf.Duration.decode(reader, reader.uint32(), undefined, long + 1); break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -6298,9 +6554,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - NotificationChannelStrategy.verify = function verify(message) { + NotificationChannelStrategy.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.notificationChannelNames != null && message.hasOwnProperty("notificationChannelNames")) { if (!Array.isArray(message.notificationChannelNames)) return "notificationChannelNames: array expected"; @@ -6309,7 +6569,7 @@ return "notificationChannelNames: string[] expected"; } if (message.renotifyInterval != null && message.hasOwnProperty("renotifyInterval")) { - var error = $root.google.protobuf.Duration.verify(message.renotifyInterval); + var error = $root.google.protobuf.Duration.verify(message.renotifyInterval, long + 1); if (error) return "renotifyInterval." + error; } @@ -6324,9 +6584,13 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.AlertPolicy.AlertStrategy.NotificationChannelStrategy} NotificationChannelStrategy */ - NotificationChannelStrategy.fromObject = function fromObject(object) { + NotificationChannelStrategy.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.AlertPolicy.AlertStrategy.NotificationChannelStrategy) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.AlertPolicy.AlertStrategy.NotificationChannelStrategy(); if (object.notificationChannelNames) { if (!Array.isArray(object.notificationChannelNames)) @@ -6338,7 +6602,7 @@ if (object.renotifyInterval != null) { if (typeof object.renotifyInterval !== "object") throw TypeError(".google.monitoring.v3.AlertPolicy.AlertStrategy.NotificationChannelStrategy.renotifyInterval: object expected"); - message.renotifyInterval = $root.google.protobuf.Duration.fromObject(object.renotifyInterval); + message.renotifyInterval = $root.google.protobuf.Duration.fromObject(object.renotifyInterval, long + 1); } return message; }; @@ -6447,7 +6711,7 @@ function TypedValue(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -6566,9 +6830,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - TypedValue.decode = function decode(reader, length, error) { + TypedValue.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.TypedValue(); while (reader.pos < end) { var tag = reader.uint32(); @@ -6592,11 +6860,11 @@ break; } case 5: { - message.distributionValue = $root.google.api.Distribution.decode(reader, reader.uint32()); + message.distributionValue = $root.google.api.Distribution.decode(reader, reader.uint32(), undefined, long + 1); break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -6627,9 +6895,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - TypedValue.verify = function verify(message) { + TypedValue.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; var properties = {}; if (message.boolValue != null && message.hasOwnProperty("boolValue")) { properties.value = 1; @@ -6662,7 +6934,7 @@ return "value: multiple values"; properties.value = 1; { - var error = $root.google.api.Distribution.verify(message.distributionValue); + var error = $root.google.api.Distribution.verify(message.distributionValue, long + 1); if (error) return "distributionValue." + error; } @@ -6678,9 +6950,13 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.TypedValue} TypedValue */ - TypedValue.fromObject = function fromObject(object) { + TypedValue.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.TypedValue) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.TypedValue(); if (object.boolValue != null) message.boolValue = Boolean(object.boolValue); @@ -6700,7 +6976,7 @@ if (object.distributionValue != null) { if (typeof object.distributionValue !== "object") throw TypeError(".google.monitoring.v3.TypedValue.distributionValue: object expected"); - message.distributionValue = $root.google.api.Distribution.fromObject(object.distributionValue); + message.distributionValue = $root.google.api.Distribution.fromObject(object.distributionValue, long + 1); } return message; }; @@ -6799,7 +7075,7 @@ function TimeInterval(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -6874,9 +7150,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - TimeInterval.decode = function decode(reader, length, error) { + TimeInterval.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.TimeInterval(); while (reader.pos < end) { var tag = reader.uint32(); @@ -6884,15 +7164,15 @@ break; switch (tag >>> 3) { case 2: { - message.endTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + message.endTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32(), undefined, long + 1); break; } case 1: { - message.startTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + message.startTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32(), undefined, long + 1); break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -6923,16 +7203,20 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - TimeInterval.verify = function verify(message) { + TimeInterval.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.endTime != null && message.hasOwnProperty("endTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.endTime); + var error = $root.google.protobuf.Timestamp.verify(message.endTime, long + 1); if (error) return "endTime." + error; } if (message.startTime != null && message.hasOwnProperty("startTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.startTime); + var error = $root.google.protobuf.Timestamp.verify(message.startTime, long + 1); if (error) return "startTime." + error; } @@ -6947,19 +7231,23 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.TimeInterval} TimeInterval */ - TimeInterval.fromObject = function fromObject(object) { + TimeInterval.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.TimeInterval) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.TimeInterval(); if (object.endTime != null) { if (typeof object.endTime !== "object") throw TypeError(".google.monitoring.v3.TimeInterval.endTime: object expected"); - message.endTime = $root.google.protobuf.Timestamp.fromObject(object.endTime); + message.endTime = $root.google.protobuf.Timestamp.fromObject(object.endTime, long + 1); } if (object.startTime != null) { if (typeof object.startTime !== "object") throw TypeError(".google.monitoring.v3.TimeInterval.startTime: object expected"); - message.startTime = $root.google.protobuf.Timestamp.fromObject(object.startTime); + message.startTime = $root.google.protobuf.Timestamp.fromObject(object.startTime, long + 1); } return message; }; @@ -7041,7 +7329,7 @@ this.groupByFields = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -7137,9 +7425,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Aggregation.decode = function decode(reader, length, error) { + Aggregation.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.Aggregation(); while (reader.pos < end) { var tag = reader.uint32(); @@ -7147,7 +7439,7 @@ break; switch (tag >>> 3) { case 1: { - message.alignmentPeriod = $root.google.protobuf.Duration.decode(reader, reader.uint32()); + message.alignmentPeriod = $root.google.protobuf.Duration.decode(reader, reader.uint32(), undefined, long + 1); break; } case 2: { @@ -7165,7 +7457,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -7196,11 +7488,15 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Aggregation.verify = function verify(message) { + Aggregation.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.alignmentPeriod != null && message.hasOwnProperty("alignmentPeriod")) { - var error = $root.google.protobuf.Duration.verify(message.alignmentPeriod); + var error = $root.google.protobuf.Duration.verify(message.alignmentPeriod, long + 1); if (error) return "alignmentPeriod." + error; } @@ -7267,14 +7563,18 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.Aggregation} Aggregation */ - Aggregation.fromObject = function fromObject(object) { + Aggregation.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.Aggregation) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.Aggregation(); if (object.alignmentPeriod != null) { if (typeof object.alignmentPeriod !== "object") throw TypeError(".google.monitoring.v3.Aggregation.alignmentPeriod: object expected"); - message.alignmentPeriod = $root.google.protobuf.Duration.fromObject(object.alignmentPeriod); + message.alignmentPeriod = $root.google.protobuf.Duration.fromObject(object.alignmentPeriod, long + 1); } switch (object.perSeriesAligner) { default: @@ -7644,7 +7944,7 @@ function MutationRecord(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -7719,9 +8019,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - MutationRecord.decode = function decode(reader, length, error) { + MutationRecord.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.MutationRecord(); while (reader.pos < end) { var tag = reader.uint32(); @@ -7729,7 +8033,7 @@ break; switch (tag >>> 3) { case 1: { - message.mutateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + message.mutateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32(), undefined, long + 1); break; } case 2: { @@ -7737,7 +8041,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -7768,11 +8072,15 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - MutationRecord.verify = function verify(message) { + MutationRecord.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.mutateTime != null && message.hasOwnProperty("mutateTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.mutateTime); + var error = $root.google.protobuf.Timestamp.verify(message.mutateTime, long + 1); if (error) return "mutateTime." + error; } @@ -7790,14 +8098,18 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.MutationRecord} MutationRecord */ - MutationRecord.fromObject = function fromObject(object) { + MutationRecord.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.MutationRecord) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.MutationRecord(); if (object.mutateTime != null) { if (typeof object.mutateTime !== "object") throw TypeError(".google.monitoring.v3.MutationRecord.mutateTime: object expected"); - message.mutateTime = $root.google.protobuf.Timestamp.fromObject(object.mutateTime); + message.mutateTime = $root.google.protobuf.Timestamp.fromObject(object.mutateTime, long + 1); } if (object.mutatedBy != null) message.mutatedBy = String(object.mutatedBy); @@ -8078,7 +8390,7 @@ function CreateAlertPolicyRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -8153,9 +8465,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - CreateAlertPolicyRequest.decode = function decode(reader, length, error) { + CreateAlertPolicyRequest.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.CreateAlertPolicyRequest(); while (reader.pos < end) { var tag = reader.uint32(); @@ -8167,11 +8483,11 @@ break; } case 2: { - message.alertPolicy = $root.google.monitoring.v3.AlertPolicy.decode(reader, reader.uint32()); + message.alertPolicy = $root.google.monitoring.v3.AlertPolicy.decode(reader, reader.uint32(), undefined, long + 1); break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -8202,14 +8518,18 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - CreateAlertPolicyRequest.verify = function verify(message) { + CreateAlertPolicyRequest.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.name != null && message.hasOwnProperty("name")) if (!$util.isString(message.name)) return "name: string expected"; if (message.alertPolicy != null && message.hasOwnProperty("alertPolicy")) { - var error = $root.google.monitoring.v3.AlertPolicy.verify(message.alertPolicy); + var error = $root.google.monitoring.v3.AlertPolicy.verify(message.alertPolicy, long + 1); if (error) return "alertPolicy." + error; } @@ -8224,16 +8544,20 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.CreateAlertPolicyRequest} CreateAlertPolicyRequest */ - CreateAlertPolicyRequest.fromObject = function fromObject(object) { + CreateAlertPolicyRequest.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.CreateAlertPolicyRequest) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.CreateAlertPolicyRequest(); if (object.name != null) message.name = String(object.name); if (object.alertPolicy != null) { if (typeof object.alertPolicy !== "object") throw TypeError(".google.monitoring.v3.CreateAlertPolicyRequest.alertPolicy: object expected"); - message.alertPolicy = $root.google.monitoring.v3.AlertPolicy.fromObject(object.alertPolicy); + message.alertPolicy = $root.google.monitoring.v3.AlertPolicy.fromObject(object.alertPolicy, long + 1); } return message; }; @@ -8311,7 +8635,7 @@ function GetAlertPolicyRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -8376,9 +8700,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetAlertPolicyRequest.decode = function decode(reader, length, error) { + GetAlertPolicyRequest.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.GetAlertPolicyRequest(); while (reader.pos < end) { var tag = reader.uint32(); @@ -8390,7 +8718,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -8421,9 +8749,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GetAlertPolicyRequest.verify = function verify(message) { + GetAlertPolicyRequest.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.name != null && message.hasOwnProperty("name")) if (!$util.isString(message.name)) return "name: string expected"; @@ -8438,9 +8770,13 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.GetAlertPolicyRequest} GetAlertPolicyRequest */ - GetAlertPolicyRequest.fromObject = function fromObject(object) { + GetAlertPolicyRequest.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.GetAlertPolicyRequest) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.GetAlertPolicyRequest(); if (object.name != null) message.name = String(object.name); @@ -8520,7 +8856,7 @@ function ListAlertPoliciesRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -8625,9 +8961,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ListAlertPoliciesRequest.decode = function decode(reader, length, error) { + ListAlertPoliciesRequest.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.ListAlertPoliciesRequest(); while (reader.pos < end) { var tag = reader.uint32(); @@ -8655,7 +8995,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -8686,9 +9026,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ListAlertPoliciesRequest.verify = function verify(message) { + ListAlertPoliciesRequest.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.name != null && message.hasOwnProperty("name")) if (!$util.isString(message.name)) return "name: string expected"; @@ -8715,9 +9059,13 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.ListAlertPoliciesRequest} ListAlertPoliciesRequest */ - ListAlertPoliciesRequest.fromObject = function fromObject(object) { + ListAlertPoliciesRequest.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.ListAlertPoliciesRequest) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.ListAlertPoliciesRequest(); if (object.name != null) message.name = String(object.name); @@ -8817,7 +9165,7 @@ this.alertPolicies = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -8903,9 +9251,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ListAlertPoliciesResponse.decode = function decode(reader, length, error) { + ListAlertPoliciesResponse.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.ListAlertPoliciesResponse(); while (reader.pos < end) { var tag = reader.uint32(); @@ -8915,7 +9267,7 @@ case 3: { if (!(message.alertPolicies && message.alertPolicies.length)) message.alertPolicies = []; - message.alertPolicies.push($root.google.monitoring.v3.AlertPolicy.decode(reader, reader.uint32())); + message.alertPolicies.push($root.google.monitoring.v3.AlertPolicy.decode(reader, reader.uint32(), undefined, long + 1)); break; } case 2: { @@ -8927,7 +9279,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -8958,14 +9310,18 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ListAlertPoliciesResponse.verify = function verify(message) { + ListAlertPoliciesResponse.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.alertPolicies != null && message.hasOwnProperty("alertPolicies")) { if (!Array.isArray(message.alertPolicies)) return "alertPolicies: array expected"; for (var i = 0; i < message.alertPolicies.length; ++i) { - var error = $root.google.monitoring.v3.AlertPolicy.verify(message.alertPolicies[i]); + var error = $root.google.monitoring.v3.AlertPolicy.verify(message.alertPolicies[i], long + 1); if (error) return "alertPolicies." + error; } @@ -8987,9 +9343,13 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.ListAlertPoliciesResponse} ListAlertPoliciesResponse */ - ListAlertPoliciesResponse.fromObject = function fromObject(object) { + ListAlertPoliciesResponse.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.ListAlertPoliciesResponse) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.ListAlertPoliciesResponse(); if (object.alertPolicies) { if (!Array.isArray(object.alertPolicies)) @@ -8998,7 +9358,7 @@ for (var i = 0; i < object.alertPolicies.length; ++i) { if (typeof object.alertPolicies[i] !== "object") throw TypeError(".google.monitoring.v3.ListAlertPoliciesResponse.alertPolicies: object expected"); - message.alertPolicies[i] = $root.google.monitoring.v3.AlertPolicy.fromObject(object.alertPolicies[i]); + message.alertPolicies[i] = $root.google.monitoring.v3.AlertPolicy.fromObject(object.alertPolicies[i], long + 1); } } if (object.nextPageToken != null) @@ -9089,7 +9449,7 @@ function UpdateAlertPolicyRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -9164,9 +9524,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - UpdateAlertPolicyRequest.decode = function decode(reader, length, error) { + UpdateAlertPolicyRequest.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.UpdateAlertPolicyRequest(); while (reader.pos < end) { var tag = reader.uint32(); @@ -9174,15 +9538,15 @@ break; switch (tag >>> 3) { case 2: { - message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32(), undefined, long + 1); break; } case 3: { - message.alertPolicy = $root.google.monitoring.v3.AlertPolicy.decode(reader, reader.uint32()); + message.alertPolicy = $root.google.monitoring.v3.AlertPolicy.decode(reader, reader.uint32(), undefined, long + 1); break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -9213,16 +9577,20 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - UpdateAlertPolicyRequest.verify = function verify(message) { + UpdateAlertPolicyRequest.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.updateMask != null && message.hasOwnProperty("updateMask")) { - var error = $root.google.protobuf.FieldMask.verify(message.updateMask); + var error = $root.google.protobuf.FieldMask.verify(message.updateMask, long + 1); if (error) return "updateMask." + error; } if (message.alertPolicy != null && message.hasOwnProperty("alertPolicy")) { - var error = $root.google.monitoring.v3.AlertPolicy.verify(message.alertPolicy); + var error = $root.google.monitoring.v3.AlertPolicy.verify(message.alertPolicy, long + 1); if (error) return "alertPolicy." + error; } @@ -9237,19 +9605,23 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.UpdateAlertPolicyRequest} UpdateAlertPolicyRequest */ - UpdateAlertPolicyRequest.fromObject = function fromObject(object) { + UpdateAlertPolicyRequest.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.UpdateAlertPolicyRequest) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.UpdateAlertPolicyRequest(); if (object.updateMask != null) { if (typeof object.updateMask !== "object") throw TypeError(".google.monitoring.v3.UpdateAlertPolicyRequest.updateMask: object expected"); - message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); + message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask, long + 1); } if (object.alertPolicy != null) { if (typeof object.alertPolicy !== "object") throw TypeError(".google.monitoring.v3.UpdateAlertPolicyRequest.alertPolicy: object expected"); - message.alertPolicy = $root.google.monitoring.v3.AlertPolicy.fromObject(object.alertPolicy); + message.alertPolicy = $root.google.monitoring.v3.AlertPolicy.fromObject(object.alertPolicy, long + 1); } return message; }; @@ -9327,7 +9699,7 @@ function DeleteAlertPolicyRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -9392,9 +9764,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - DeleteAlertPolicyRequest.decode = function decode(reader, length, error) { + DeleteAlertPolicyRequest.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.DeleteAlertPolicyRequest(); while (reader.pos < end) { var tag = reader.uint32(); @@ -9406,7 +9782,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -9437,9 +9813,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - DeleteAlertPolicyRequest.verify = function verify(message) { + DeleteAlertPolicyRequest.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.name != null && message.hasOwnProperty("name")) if (!$util.isString(message.name)) return "name: string expected"; @@ -9454,9 +9834,13 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.DeleteAlertPolicyRequest} DeleteAlertPolicyRequest */ - DeleteAlertPolicyRequest.fromObject = function fromObject(object) { + DeleteAlertPolicyRequest.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.DeleteAlertPolicyRequest) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.DeleteAlertPolicyRequest(); if (object.name != null) message.name = String(object.name); @@ -9533,7 +9917,7 @@ this.label = {}; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -9599,9 +9983,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - DroppedLabels.decode = function decode(reader, length, error) { + DroppedLabels.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.DroppedLabels(), key, value; while (reader.pos < end) { var tag = reader.uint32(); @@ -9624,15 +10012,17 @@ value = reader.string(); break; default: - reader.skipType(tag2 & 7); + reader.skipType(tag2 & 7, long); break; } } + if (key === "__proto__") + $util.makeProp(message.label, key); message.label[key] = value; break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -9663,9 +10053,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - DroppedLabels.verify = function verify(message) { + DroppedLabels.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.label != null && message.hasOwnProperty("label")) { if (!$util.isObject(message.label)) return "label: object expected"; @@ -9685,16 +10079,23 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.DroppedLabels} DroppedLabels */ - DroppedLabels.fromObject = function fromObject(object) { + DroppedLabels.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.DroppedLabels) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.DroppedLabels(); if (object.label) { if (typeof object.label !== "object") throw TypeError(".google.monitoring.v3.DroppedLabels.label: object expected"); message.label = {}; - for (var keys = Object.keys(object.label), i = 0; i < keys.length; ++i) + for (var keys = Object.keys(object.label), i = 0; i < keys.length; ++i) { + if (keys[i] === "__proto__") + $util.makeProp(message.label, keys[i]); message.label[keys[i]] = String(object.label[keys[i]]); + } } return message; }; @@ -9717,8 +10118,11 @@ var keys2; if (message.label && (keys2 = Object.keys(message.label)).length) { object.label = {}; - for (var j = 0; j < keys2.length; ++j) + for (var j = 0; j < keys2.length; ++j) { + if (keys2[j] === "__proto__") + $util.makeProp(object.label, keys2[j]); object.label[keys2[j]] = message.label[keys2[j]]; + } } return object; }; @@ -9776,7 +10180,7 @@ function Group(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -9881,9 +10285,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Group.decode = function decode(reader, length, error) { + Group.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.Group(); while (reader.pos < end) { var tag = reader.uint32(); @@ -9911,7 +10319,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -9942,9 +10350,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Group.verify = function verify(message) { + Group.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.name != null && message.hasOwnProperty("name")) if (!$util.isString(message.name)) return "name: string expected"; @@ -9971,9 +10383,13 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.Group} Group */ - Group.fromObject = function fromObject(object) { + Group.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.Group) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.Group(); if (object.name != null) message.name = String(object.name); @@ -10308,7 +10724,7 @@ function ListGroupsRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -10437,9 +10853,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ListGroupsRequest.decode = function decode(reader, length, error) { + ListGroupsRequest.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.ListGroupsRequest(); while (reader.pos < end) { var tag = reader.uint32(); @@ -10471,7 +10891,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -10502,9 +10922,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ListGroupsRequest.verify = function verify(message) { + ListGroupsRequest.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; var properties = {}; if (message.name != null && message.hasOwnProperty("name")) if (!$util.isString(message.name)) @@ -10545,9 +10969,13 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.ListGroupsRequest} ListGroupsRequest */ - ListGroupsRequest.fromObject = function fromObject(object) { + ListGroupsRequest.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.ListGroupsRequest) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.ListGroupsRequest(); if (object.name != null) message.name = String(object.name); @@ -10657,7 +11085,7 @@ this.group = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -10733,9 +11161,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ListGroupsResponse.decode = function decode(reader, length, error) { + ListGroupsResponse.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.ListGroupsResponse(); while (reader.pos < end) { var tag = reader.uint32(); @@ -10745,7 +11177,7 @@ case 1: { if (!(message.group && message.group.length)) message.group = []; - message.group.push($root.google.monitoring.v3.Group.decode(reader, reader.uint32())); + message.group.push($root.google.monitoring.v3.Group.decode(reader, reader.uint32(), undefined, long + 1)); break; } case 2: { @@ -10753,7 +11185,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -10784,14 +11216,18 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ListGroupsResponse.verify = function verify(message) { + ListGroupsResponse.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.group != null && message.hasOwnProperty("group")) { if (!Array.isArray(message.group)) return "group: array expected"; for (var i = 0; i < message.group.length; ++i) { - var error = $root.google.monitoring.v3.Group.verify(message.group[i]); + var error = $root.google.monitoring.v3.Group.verify(message.group[i], long + 1); if (error) return "group." + error; } @@ -10810,9 +11246,13 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.ListGroupsResponse} ListGroupsResponse */ - ListGroupsResponse.fromObject = function fromObject(object) { + ListGroupsResponse.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.ListGroupsResponse) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.ListGroupsResponse(); if (object.group) { if (!Array.isArray(object.group)) @@ -10821,7 +11261,7 @@ for (var i = 0; i < object.group.length; ++i) { if (typeof object.group[i] !== "object") throw TypeError(".google.monitoring.v3.ListGroupsResponse.group: object expected"); - message.group[i] = $root.google.monitoring.v3.Group.fromObject(object.group[i]); + message.group[i] = $root.google.monitoring.v3.Group.fromObject(object.group[i], long + 1); } } if (object.nextPageToken != null) @@ -10905,7 +11345,7 @@ function GetGroupRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -10970,9 +11410,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetGroupRequest.decode = function decode(reader, length, error) { + GetGroupRequest.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.GetGroupRequest(); while (reader.pos < end) { var tag = reader.uint32(); @@ -10984,7 +11428,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -11015,9 +11459,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GetGroupRequest.verify = function verify(message) { + GetGroupRequest.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.name != null && message.hasOwnProperty("name")) if (!$util.isString(message.name)) return "name: string expected"; @@ -11032,9 +11480,13 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.GetGroupRequest} GetGroupRequest */ - GetGroupRequest.fromObject = function fromObject(object) { + GetGroupRequest.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.GetGroupRequest) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.GetGroupRequest(); if (object.name != null) message.name = String(object.name); @@ -11112,7 +11564,7 @@ function CreateGroupRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -11197,9 +11649,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - CreateGroupRequest.decode = function decode(reader, length, error) { + CreateGroupRequest.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.CreateGroupRequest(); while (reader.pos < end) { var tag = reader.uint32(); @@ -11211,7 +11667,7 @@ break; } case 2: { - message.group = $root.google.monitoring.v3.Group.decode(reader, reader.uint32()); + message.group = $root.google.monitoring.v3.Group.decode(reader, reader.uint32(), undefined, long + 1); break; } case 3: { @@ -11219,7 +11675,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -11250,14 +11706,18 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - CreateGroupRequest.verify = function verify(message) { + CreateGroupRequest.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.name != null && message.hasOwnProperty("name")) if (!$util.isString(message.name)) return "name: string expected"; if (message.group != null && message.hasOwnProperty("group")) { - var error = $root.google.monitoring.v3.Group.verify(message.group); + var error = $root.google.monitoring.v3.Group.verify(message.group, long + 1); if (error) return "group." + error; } @@ -11275,16 +11735,20 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.CreateGroupRequest} CreateGroupRequest */ - CreateGroupRequest.fromObject = function fromObject(object) { + CreateGroupRequest.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.CreateGroupRequest) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.CreateGroupRequest(); if (object.name != null) message.name = String(object.name); if (object.group != null) { if (typeof object.group !== "object") throw TypeError(".google.monitoring.v3.CreateGroupRequest.group: object expected"); - message.group = $root.google.monitoring.v3.Group.fromObject(object.group); + message.group = $root.google.monitoring.v3.Group.fromObject(object.group, long + 1); } if (object.validateOnly != null) message.validateOnly = Boolean(object.validateOnly); @@ -11368,7 +11832,7 @@ function UpdateGroupRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -11443,9 +11907,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - UpdateGroupRequest.decode = function decode(reader, length, error) { + UpdateGroupRequest.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.UpdateGroupRequest(); while (reader.pos < end) { var tag = reader.uint32(); @@ -11453,7 +11921,7 @@ break; switch (tag >>> 3) { case 2: { - message.group = $root.google.monitoring.v3.Group.decode(reader, reader.uint32()); + message.group = $root.google.monitoring.v3.Group.decode(reader, reader.uint32(), undefined, long + 1); break; } case 3: { @@ -11461,7 +11929,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -11492,11 +11960,15 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - UpdateGroupRequest.verify = function verify(message) { + UpdateGroupRequest.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.group != null && message.hasOwnProperty("group")) { - var error = $root.google.monitoring.v3.Group.verify(message.group); + var error = $root.google.monitoring.v3.Group.verify(message.group, long + 1); if (error) return "group." + error; } @@ -11514,14 +11986,18 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.UpdateGroupRequest} UpdateGroupRequest */ - UpdateGroupRequest.fromObject = function fromObject(object) { + UpdateGroupRequest.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.UpdateGroupRequest) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.UpdateGroupRequest(); if (object.group != null) { if (typeof object.group !== "object") throw TypeError(".google.monitoring.v3.UpdateGroupRequest.group: object expected"); - message.group = $root.google.monitoring.v3.Group.fromObject(object.group); + message.group = $root.google.monitoring.v3.Group.fromObject(object.group, long + 1); } if (object.validateOnly != null) message.validateOnly = Boolean(object.validateOnly); @@ -11602,7 +12078,7 @@ function DeleteGroupRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -11677,9 +12153,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - DeleteGroupRequest.decode = function decode(reader, length, error) { + DeleteGroupRequest.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.DeleteGroupRequest(); while (reader.pos < end) { var tag = reader.uint32(); @@ -11695,7 +12175,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -11726,9 +12206,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - DeleteGroupRequest.verify = function verify(message) { + DeleteGroupRequest.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.name != null && message.hasOwnProperty("name")) if (!$util.isString(message.name)) return "name: string expected"; @@ -11746,9 +12230,13 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.DeleteGroupRequest} DeleteGroupRequest */ - DeleteGroupRequest.fromObject = function fromObject(object) { + DeleteGroupRequest.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.DeleteGroupRequest) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.DeleteGroupRequest(); if (object.name != null) message.name = String(object.name); @@ -11834,7 +12322,7 @@ function ListGroupMembersRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -11939,9 +12427,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ListGroupMembersRequest.decode = function decode(reader, length, error) { + ListGroupMembersRequest.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.ListGroupMembersRequest(); while (reader.pos < end) { var tag = reader.uint32(); @@ -11965,11 +12457,11 @@ break; } case 6: { - message.interval = $root.google.monitoring.v3.TimeInterval.decode(reader, reader.uint32()); + message.interval = $root.google.monitoring.v3.TimeInterval.decode(reader, reader.uint32(), undefined, long + 1); break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -12000,9 +12492,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ListGroupMembersRequest.verify = function verify(message) { + ListGroupMembersRequest.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.name != null && message.hasOwnProperty("name")) if (!$util.isString(message.name)) return "name: string expected"; @@ -12016,7 +12512,7 @@ if (!$util.isString(message.filter)) return "filter: string expected"; if (message.interval != null && message.hasOwnProperty("interval")) { - var error = $root.google.monitoring.v3.TimeInterval.verify(message.interval); + var error = $root.google.monitoring.v3.TimeInterval.verify(message.interval, long + 1); if (error) return "interval." + error; } @@ -12031,9 +12527,13 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.ListGroupMembersRequest} ListGroupMembersRequest */ - ListGroupMembersRequest.fromObject = function fromObject(object) { + ListGroupMembersRequest.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.ListGroupMembersRequest) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.ListGroupMembersRequest(); if (object.name != null) message.name = String(object.name); @@ -12046,7 +12546,7 @@ if (object.interval != null) { if (typeof object.interval !== "object") throw TypeError(".google.monitoring.v3.ListGroupMembersRequest.interval: object expected"); - message.interval = $root.google.monitoring.v3.TimeInterval.fromObject(object.interval); + message.interval = $root.google.monitoring.v3.TimeInterval.fromObject(object.interval, long + 1); } return message; }; @@ -12136,7 +12636,7 @@ this.members = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -12222,9 +12722,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ListGroupMembersResponse.decode = function decode(reader, length, error) { + ListGroupMembersResponse.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.ListGroupMembersResponse(); while (reader.pos < end) { var tag = reader.uint32(); @@ -12234,7 +12738,7 @@ case 1: { if (!(message.members && message.members.length)) message.members = []; - message.members.push($root.google.api.MonitoredResource.decode(reader, reader.uint32())); + message.members.push($root.google.api.MonitoredResource.decode(reader, reader.uint32(), undefined, long + 1)); break; } case 2: { @@ -12246,7 +12750,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -12277,14 +12781,18 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ListGroupMembersResponse.verify = function verify(message) { + ListGroupMembersResponse.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.members != null && message.hasOwnProperty("members")) { if (!Array.isArray(message.members)) return "members: array expected"; for (var i = 0; i < message.members.length; ++i) { - var error = $root.google.api.MonitoredResource.verify(message.members[i]); + var error = $root.google.api.MonitoredResource.verify(message.members[i], long + 1); if (error) return "members." + error; } @@ -12306,9 +12814,13 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.ListGroupMembersResponse} ListGroupMembersResponse */ - ListGroupMembersResponse.fromObject = function fromObject(object) { + ListGroupMembersResponse.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.ListGroupMembersResponse) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.ListGroupMembersResponse(); if (object.members) { if (!Array.isArray(object.members)) @@ -12317,7 +12829,7 @@ for (var i = 0; i < object.members.length; ++i) { if (typeof object.members[i] !== "object") throw TypeError(".google.monitoring.v3.ListGroupMembersResponse.members: object expected"); - message.members[i] = $root.google.api.MonitoredResource.fromObject(object.members[i]); + message.members[i] = $root.google.api.MonitoredResource.fromObject(object.members[i], long + 1); } } if (object.nextPageToken != null) @@ -12408,7 +12920,7 @@ function Point(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -12483,9 +12995,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Point.decode = function decode(reader, length, error) { + Point.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.Point(); while (reader.pos < end) { var tag = reader.uint32(); @@ -12493,15 +13009,15 @@ break; switch (tag >>> 3) { case 1: { - message.interval = $root.google.monitoring.v3.TimeInterval.decode(reader, reader.uint32()); + message.interval = $root.google.monitoring.v3.TimeInterval.decode(reader, reader.uint32(), undefined, long + 1); break; } case 2: { - message.value = $root.google.monitoring.v3.TypedValue.decode(reader, reader.uint32()); + message.value = $root.google.monitoring.v3.TypedValue.decode(reader, reader.uint32(), undefined, long + 1); break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -12532,16 +13048,20 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Point.verify = function verify(message) { + Point.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.interval != null && message.hasOwnProperty("interval")) { - var error = $root.google.monitoring.v3.TimeInterval.verify(message.interval); + var error = $root.google.monitoring.v3.TimeInterval.verify(message.interval, long + 1); if (error) return "interval." + error; } if (message.value != null && message.hasOwnProperty("value")) { - var error = $root.google.monitoring.v3.TypedValue.verify(message.value); + var error = $root.google.monitoring.v3.TypedValue.verify(message.value, long + 1); if (error) return "value." + error; } @@ -12556,19 +13076,23 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.Point} Point */ - Point.fromObject = function fromObject(object) { + Point.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.Point) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.Point(); if (object.interval != null) { if (typeof object.interval !== "object") throw TypeError(".google.monitoring.v3.Point.interval: object expected"); - message.interval = $root.google.monitoring.v3.TimeInterval.fromObject(object.interval); + message.interval = $root.google.monitoring.v3.TimeInterval.fromObject(object.interval, long + 1); } if (object.value != null) { if (typeof object.value !== "object") throw TypeError(".google.monitoring.v3.Point.value: object expected"); - message.value = $root.google.monitoring.v3.TypedValue.fromObject(object.value); + message.value = $root.google.monitoring.v3.TypedValue.fromObject(object.value, long + 1); } return message; }; @@ -12654,7 +13178,7 @@ this.points = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -12790,9 +13314,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - TimeSeries.decode = function decode(reader, length, error) { + TimeSeries.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.TimeSeries(); while (reader.pos < end) { var tag = reader.uint32(); @@ -12800,15 +13328,15 @@ break; switch (tag >>> 3) { case 1: { - message.metric = $root.google.api.Metric.decode(reader, reader.uint32()); + message.metric = $root.google.api.Metric.decode(reader, reader.uint32(), undefined, long + 1); break; } case 2: { - message.resource = $root.google.api.MonitoredResource.decode(reader, reader.uint32()); + message.resource = $root.google.api.MonitoredResource.decode(reader, reader.uint32(), undefined, long + 1); break; } case 7: { - message.metadata = $root.google.api.MonitoredResourceMetadata.decode(reader, reader.uint32()); + message.metadata = $root.google.api.MonitoredResourceMetadata.decode(reader, reader.uint32(), undefined, long + 1); break; } case 3: { @@ -12822,7 +13350,7 @@ case 5: { if (!(message.points && message.points.length)) message.points = []; - message.points.push($root.google.monitoring.v3.Point.decode(reader, reader.uint32())); + message.points.push($root.google.monitoring.v3.Point.decode(reader, reader.uint32(), undefined, long + 1)); break; } case 8: { @@ -12834,7 +13362,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -12865,21 +13393,25 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - TimeSeries.verify = function verify(message) { + TimeSeries.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.metric != null && message.hasOwnProperty("metric")) { - var error = $root.google.api.Metric.verify(message.metric); + var error = $root.google.api.Metric.verify(message.metric, long + 1); if (error) return "metric." + error; } if (message.resource != null && message.hasOwnProperty("resource")) { - var error = $root.google.api.MonitoredResource.verify(message.resource); + var error = $root.google.api.MonitoredResource.verify(message.resource, long + 1); if (error) return "resource." + error; } if (message.metadata != null && message.hasOwnProperty("metadata")) { - var error = $root.google.api.MonitoredResourceMetadata.verify(message.metadata); + var error = $root.google.api.MonitoredResourceMetadata.verify(message.metadata, long + 1); if (error) return "metadata." + error; } @@ -12910,7 +13442,7 @@ if (!Array.isArray(message.points)) return "points: array expected"; for (var i = 0; i < message.points.length; ++i) { - var error = $root.google.monitoring.v3.Point.verify(message.points[i]); + var error = $root.google.monitoring.v3.Point.verify(message.points[i], long + 1); if (error) return "points." + error; } @@ -12932,24 +13464,28 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.TimeSeries} TimeSeries */ - TimeSeries.fromObject = function fromObject(object) { + TimeSeries.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.TimeSeries) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.TimeSeries(); if (object.metric != null) { if (typeof object.metric !== "object") throw TypeError(".google.monitoring.v3.TimeSeries.metric: object expected"); - message.metric = $root.google.api.Metric.fromObject(object.metric); + message.metric = $root.google.api.Metric.fromObject(object.metric, long + 1); } if (object.resource != null) { if (typeof object.resource !== "object") throw TypeError(".google.monitoring.v3.TimeSeries.resource: object expected"); - message.resource = $root.google.api.MonitoredResource.fromObject(object.resource); + message.resource = $root.google.api.MonitoredResource.fromObject(object.resource, long + 1); } if (object.metadata != null) { if (typeof object.metadata !== "object") throw TypeError(".google.monitoring.v3.TimeSeries.metadata: object expected"); - message.metadata = $root.google.api.MonitoredResourceMetadata.fromObject(object.metadata); + message.metadata = $root.google.api.MonitoredResourceMetadata.fromObject(object.metadata, long + 1); } switch (object.metricKind) { default: @@ -13018,7 +13554,7 @@ for (var i = 0; i < object.points.length; ++i) { if (typeof object.points[i] !== "object") throw TypeError(".google.monitoring.v3.TimeSeries.points: object expected"); - message.points[i] = $root.google.monitoring.v3.Point.fromObject(object.points[i]); + message.points[i] = $root.google.monitoring.v3.Point.fromObject(object.points[i], long + 1); } } if (object.unit != null) @@ -13126,7 +13662,7 @@ this.pointDescriptors = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -13203,9 +13739,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - TimeSeriesDescriptor.decode = function decode(reader, length, error) { + TimeSeriesDescriptor.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.TimeSeriesDescriptor(); while (reader.pos < end) { var tag = reader.uint32(); @@ -13215,17 +13755,17 @@ case 1: { if (!(message.labelDescriptors && message.labelDescriptors.length)) message.labelDescriptors = []; - message.labelDescriptors.push($root.google.api.LabelDescriptor.decode(reader, reader.uint32())); + message.labelDescriptors.push($root.google.api.LabelDescriptor.decode(reader, reader.uint32(), undefined, long + 1)); break; } case 5: { if (!(message.pointDescriptors && message.pointDescriptors.length)) message.pointDescriptors = []; - message.pointDescriptors.push($root.google.monitoring.v3.TimeSeriesDescriptor.ValueDescriptor.decode(reader, reader.uint32())); + message.pointDescriptors.push($root.google.monitoring.v3.TimeSeriesDescriptor.ValueDescriptor.decode(reader, reader.uint32(), undefined, long + 1)); break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -13256,14 +13796,18 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - TimeSeriesDescriptor.verify = function verify(message) { + TimeSeriesDescriptor.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.labelDescriptors != null && message.hasOwnProperty("labelDescriptors")) { if (!Array.isArray(message.labelDescriptors)) return "labelDescriptors: array expected"; for (var i = 0; i < message.labelDescriptors.length; ++i) { - var error = $root.google.api.LabelDescriptor.verify(message.labelDescriptors[i]); + var error = $root.google.api.LabelDescriptor.verify(message.labelDescriptors[i], long + 1); if (error) return "labelDescriptors." + error; } @@ -13272,7 +13816,7 @@ if (!Array.isArray(message.pointDescriptors)) return "pointDescriptors: array expected"; for (var i = 0; i < message.pointDescriptors.length; ++i) { - var error = $root.google.monitoring.v3.TimeSeriesDescriptor.ValueDescriptor.verify(message.pointDescriptors[i]); + var error = $root.google.monitoring.v3.TimeSeriesDescriptor.ValueDescriptor.verify(message.pointDescriptors[i], long + 1); if (error) return "pointDescriptors." + error; } @@ -13288,9 +13832,13 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.TimeSeriesDescriptor} TimeSeriesDescriptor */ - TimeSeriesDescriptor.fromObject = function fromObject(object) { + TimeSeriesDescriptor.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.TimeSeriesDescriptor) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.TimeSeriesDescriptor(); if (object.labelDescriptors) { if (!Array.isArray(object.labelDescriptors)) @@ -13299,7 +13847,7 @@ for (var i = 0; i < object.labelDescriptors.length; ++i) { if (typeof object.labelDescriptors[i] !== "object") throw TypeError(".google.monitoring.v3.TimeSeriesDescriptor.labelDescriptors: object expected"); - message.labelDescriptors[i] = $root.google.api.LabelDescriptor.fromObject(object.labelDescriptors[i]); + message.labelDescriptors[i] = $root.google.api.LabelDescriptor.fromObject(object.labelDescriptors[i], long + 1); } } if (object.pointDescriptors) { @@ -13309,7 +13857,7 @@ for (var i = 0; i < object.pointDescriptors.length; ++i) { if (typeof object.pointDescriptors[i] !== "object") throw TypeError(".google.monitoring.v3.TimeSeriesDescriptor.pointDescriptors: object expected"); - message.pointDescriptors[i] = $root.google.monitoring.v3.TimeSeriesDescriptor.ValueDescriptor.fromObject(object.pointDescriptors[i]); + message.pointDescriptors[i] = $root.google.monitoring.v3.TimeSeriesDescriptor.ValueDescriptor.fromObject(object.pointDescriptors[i], long + 1); } } return message; @@ -13394,7 +13942,7 @@ function ValueDescriptor(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -13489,9 +14037,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ValueDescriptor.decode = function decode(reader, length, error) { + ValueDescriptor.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.TimeSeriesDescriptor.ValueDescriptor(); while (reader.pos < end) { var tag = reader.uint32(); @@ -13515,7 +14067,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -13546,9 +14098,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ValueDescriptor.verify = function verify(message) { + ValueDescriptor.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.key != null && message.hasOwnProperty("key")) if (!$util.isString(message.key)) return "key: string expected"; @@ -13589,9 +14145,13 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.TimeSeriesDescriptor.ValueDescriptor} ValueDescriptor */ - ValueDescriptor.fromObject = function fromObject(object) { + ValueDescriptor.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.TimeSeriesDescriptor.ValueDescriptor) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.TimeSeriesDescriptor.ValueDescriptor(); if (object.key != null) message.key = String(object.key); @@ -13745,7 +14305,7 @@ this.pointData = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -13822,9 +14382,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - TimeSeriesData.decode = function decode(reader, length, error) { + TimeSeriesData.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.TimeSeriesData(); while (reader.pos < end) { var tag = reader.uint32(); @@ -13834,17 +14398,17 @@ case 1: { if (!(message.labelValues && message.labelValues.length)) message.labelValues = []; - message.labelValues.push($root.google.monitoring.v3.LabelValue.decode(reader, reader.uint32())); + message.labelValues.push($root.google.monitoring.v3.LabelValue.decode(reader, reader.uint32(), undefined, long + 1)); break; } case 2: { if (!(message.pointData && message.pointData.length)) message.pointData = []; - message.pointData.push($root.google.monitoring.v3.TimeSeriesData.PointData.decode(reader, reader.uint32())); + message.pointData.push($root.google.monitoring.v3.TimeSeriesData.PointData.decode(reader, reader.uint32(), undefined, long + 1)); break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -13875,14 +14439,18 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - TimeSeriesData.verify = function verify(message) { + TimeSeriesData.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.labelValues != null && message.hasOwnProperty("labelValues")) { if (!Array.isArray(message.labelValues)) return "labelValues: array expected"; for (var i = 0; i < message.labelValues.length; ++i) { - var error = $root.google.monitoring.v3.LabelValue.verify(message.labelValues[i]); + var error = $root.google.monitoring.v3.LabelValue.verify(message.labelValues[i], long + 1); if (error) return "labelValues." + error; } @@ -13891,7 +14459,7 @@ if (!Array.isArray(message.pointData)) return "pointData: array expected"; for (var i = 0; i < message.pointData.length; ++i) { - var error = $root.google.monitoring.v3.TimeSeriesData.PointData.verify(message.pointData[i]); + var error = $root.google.monitoring.v3.TimeSeriesData.PointData.verify(message.pointData[i], long + 1); if (error) return "pointData." + error; } @@ -13907,9 +14475,13 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.TimeSeriesData} TimeSeriesData */ - TimeSeriesData.fromObject = function fromObject(object) { + TimeSeriesData.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.TimeSeriesData) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.TimeSeriesData(); if (object.labelValues) { if (!Array.isArray(object.labelValues)) @@ -13918,7 +14490,7 @@ for (var i = 0; i < object.labelValues.length; ++i) { if (typeof object.labelValues[i] !== "object") throw TypeError(".google.monitoring.v3.TimeSeriesData.labelValues: object expected"); - message.labelValues[i] = $root.google.monitoring.v3.LabelValue.fromObject(object.labelValues[i]); + message.labelValues[i] = $root.google.monitoring.v3.LabelValue.fromObject(object.labelValues[i], long + 1); } } if (object.pointData) { @@ -13928,7 +14500,7 @@ for (var i = 0; i < object.pointData.length; ++i) { if (typeof object.pointData[i] !== "object") throw TypeError(".google.monitoring.v3.TimeSeriesData.pointData: object expected"); - message.pointData[i] = $root.google.monitoring.v3.TimeSeriesData.PointData.fromObject(object.pointData[i]); + message.pointData[i] = $root.google.monitoring.v3.TimeSeriesData.PointData.fromObject(object.pointData[i], long + 1); } } return message; @@ -14012,7 +14584,7 @@ this.values = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -14088,9 +14660,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - PointData.decode = function decode(reader, length, error) { + PointData.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.TimeSeriesData.PointData(); while (reader.pos < end) { var tag = reader.uint32(); @@ -14100,15 +14676,15 @@ case 1: { if (!(message.values && message.values.length)) message.values = []; - message.values.push($root.google.monitoring.v3.TypedValue.decode(reader, reader.uint32())); + message.values.push($root.google.monitoring.v3.TypedValue.decode(reader, reader.uint32(), undefined, long + 1)); break; } case 2: { - message.timeInterval = $root.google.monitoring.v3.TimeInterval.decode(reader, reader.uint32()); + message.timeInterval = $root.google.monitoring.v3.TimeInterval.decode(reader, reader.uint32(), undefined, long + 1); break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -14139,20 +14715,24 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - PointData.verify = function verify(message) { + PointData.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.values != null && message.hasOwnProperty("values")) { if (!Array.isArray(message.values)) return "values: array expected"; for (var i = 0; i < message.values.length; ++i) { - var error = $root.google.monitoring.v3.TypedValue.verify(message.values[i]); + var error = $root.google.monitoring.v3.TypedValue.verify(message.values[i], long + 1); if (error) return "values." + error; } } if (message.timeInterval != null && message.hasOwnProperty("timeInterval")) { - var error = $root.google.monitoring.v3.TimeInterval.verify(message.timeInterval); + var error = $root.google.monitoring.v3.TimeInterval.verify(message.timeInterval, long + 1); if (error) return "timeInterval." + error; } @@ -14167,9 +14747,13 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.TimeSeriesData.PointData} PointData */ - PointData.fromObject = function fromObject(object) { + PointData.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.TimeSeriesData.PointData) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.TimeSeriesData.PointData(); if (object.values) { if (!Array.isArray(object.values)) @@ -14178,13 +14762,13 @@ for (var i = 0; i < object.values.length; ++i) { if (typeof object.values[i] !== "object") throw TypeError(".google.monitoring.v3.TimeSeriesData.PointData.values: object expected"); - message.values[i] = $root.google.monitoring.v3.TypedValue.fromObject(object.values[i]); + message.values[i] = $root.google.monitoring.v3.TypedValue.fromObject(object.values[i], long + 1); } } if (object.timeInterval != null) { if (typeof object.timeInterval !== "object") throw TypeError(".google.monitoring.v3.TimeSeriesData.PointData.timeInterval: object expected"); - message.timeInterval = $root.google.monitoring.v3.TimeInterval.fromObject(object.timeInterval); + message.timeInterval = $root.google.monitoring.v3.TimeInterval.fromObject(object.timeInterval, long + 1); } return message; }; @@ -14270,7 +14854,7 @@ function LabelValue(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -14369,9 +14953,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - LabelValue.decode = function decode(reader, length, error) { + LabelValue.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.LabelValue(); while (reader.pos < end) { var tag = reader.uint32(); @@ -14391,7 +14979,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -14422,9 +15010,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - LabelValue.verify = function verify(message) { + LabelValue.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; var properties = {}; if (message.boolValue != null && message.hasOwnProperty("boolValue")) { properties.value = 1; @@ -14456,9 +15048,13 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.LabelValue} LabelValue */ - LabelValue.fromObject = function fromObject(object) { + LabelValue.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.LabelValue) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.LabelValue(); if (object.boolValue != null) message.boolValue = Boolean(object.boolValue); @@ -14560,7 +15156,7 @@ function QueryError(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -14635,9 +15231,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - QueryError.decode = function decode(reader, length, error) { + QueryError.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.QueryError(); while (reader.pos < end) { var tag = reader.uint32(); @@ -14645,7 +15245,7 @@ break; switch (tag >>> 3) { case 1: { - message.locator = $root.google.monitoring.v3.TextLocator.decode(reader, reader.uint32()); + message.locator = $root.google.monitoring.v3.TextLocator.decode(reader, reader.uint32(), undefined, long + 1); break; } case 2: { @@ -14653,7 +15253,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -14684,11 +15284,15 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - QueryError.verify = function verify(message) { + QueryError.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.locator != null && message.hasOwnProperty("locator")) { - var error = $root.google.monitoring.v3.TextLocator.verify(message.locator); + var error = $root.google.monitoring.v3.TextLocator.verify(message.locator, long + 1); if (error) return "locator." + error; } @@ -14706,14 +15310,18 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.QueryError} QueryError */ - QueryError.fromObject = function fromObject(object) { + QueryError.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.QueryError) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.QueryError(); if (object.locator != null) { if (typeof object.locator !== "object") throw TypeError(".google.monitoring.v3.QueryError.locator: object expected"); - message.locator = $root.google.monitoring.v3.TextLocator.fromObject(object.locator); + message.locator = $root.google.monitoring.v3.TextLocator.fromObject(object.locator, long + 1); } if (object.message != null) message.message = String(object.message); @@ -14797,7 +15405,7 @@ function TextLocator(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -14902,9 +15510,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - TextLocator.decode = function decode(reader, length, error) { + TextLocator.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.TextLocator(); while (reader.pos < end) { var tag = reader.uint32(); @@ -14916,15 +15528,15 @@ break; } case 2: { - message.startPosition = $root.google.monitoring.v3.TextLocator.Position.decode(reader, reader.uint32()); + message.startPosition = $root.google.monitoring.v3.TextLocator.Position.decode(reader, reader.uint32(), undefined, long + 1); break; } case 3: { - message.endPosition = $root.google.monitoring.v3.TextLocator.Position.decode(reader, reader.uint32()); + message.endPosition = $root.google.monitoring.v3.TextLocator.Position.decode(reader, reader.uint32(), undefined, long + 1); break; } case 4: { - message.nestedLocator = $root.google.monitoring.v3.TextLocator.decode(reader, reader.uint32()); + message.nestedLocator = $root.google.monitoring.v3.TextLocator.decode(reader, reader.uint32(), undefined, long + 1); break; } case 5: { @@ -14932,7 +15544,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -14963,24 +15575,28 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - TextLocator.verify = function verify(message) { + TextLocator.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.source != null && message.hasOwnProperty("source")) if (!$util.isString(message.source)) return "source: string expected"; if (message.startPosition != null && message.hasOwnProperty("startPosition")) { - var error = $root.google.monitoring.v3.TextLocator.Position.verify(message.startPosition); + var error = $root.google.monitoring.v3.TextLocator.Position.verify(message.startPosition, long + 1); if (error) return "startPosition." + error; } if (message.endPosition != null && message.hasOwnProperty("endPosition")) { - var error = $root.google.monitoring.v3.TextLocator.Position.verify(message.endPosition); + var error = $root.google.monitoring.v3.TextLocator.Position.verify(message.endPosition, long + 1); if (error) return "endPosition." + error; } if (message.nestedLocator != null && message.hasOwnProperty("nestedLocator")) { - var error = $root.google.monitoring.v3.TextLocator.verify(message.nestedLocator); + var error = $root.google.monitoring.v3.TextLocator.verify(message.nestedLocator, long + 1); if (error) return "nestedLocator." + error; } @@ -14998,26 +15614,30 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.TextLocator} TextLocator */ - TextLocator.fromObject = function fromObject(object) { + TextLocator.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.TextLocator) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.TextLocator(); if (object.source != null) message.source = String(object.source); if (object.startPosition != null) { if (typeof object.startPosition !== "object") throw TypeError(".google.monitoring.v3.TextLocator.startPosition: object expected"); - message.startPosition = $root.google.monitoring.v3.TextLocator.Position.fromObject(object.startPosition); + message.startPosition = $root.google.monitoring.v3.TextLocator.Position.fromObject(object.startPosition, long + 1); } if (object.endPosition != null) { if (typeof object.endPosition !== "object") throw TypeError(".google.monitoring.v3.TextLocator.endPosition: object expected"); - message.endPosition = $root.google.monitoring.v3.TextLocator.Position.fromObject(object.endPosition); + message.endPosition = $root.google.monitoring.v3.TextLocator.Position.fromObject(object.endPosition, long + 1); } if (object.nestedLocator != null) { if (typeof object.nestedLocator !== "object") throw TypeError(".google.monitoring.v3.TextLocator.nestedLocator: object expected"); - message.nestedLocator = $root.google.monitoring.v3.TextLocator.fromObject(object.nestedLocator); + message.nestedLocator = $root.google.monitoring.v3.TextLocator.fromObject(object.nestedLocator, long + 1); } if (object.nestingReason != null) message.nestingReason = String(object.nestingReason); @@ -15104,7 +15724,7 @@ function Position(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -15179,9 +15799,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Position.decode = function decode(reader, length, error) { + Position.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.TextLocator.Position(); while (reader.pos < end) { var tag = reader.uint32(); @@ -15197,7 +15821,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -15228,9 +15852,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Position.verify = function verify(message) { + Position.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.line != null && message.hasOwnProperty("line")) if (!$util.isInteger(message.line)) return "line: integer expected"; @@ -15248,9 +15876,13 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.TextLocator.Position} Position */ - Position.fromObject = function fromObject(object) { + Position.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.TextLocator.Position) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.TextLocator.Position(); if (object.line != null) message.line = object.line | 0; @@ -15670,7 +16302,7 @@ function ListMonitoredResourceDescriptorsRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -15765,9 +16397,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ListMonitoredResourceDescriptorsRequest.decode = function decode(reader, length, error) { + ListMonitoredResourceDescriptorsRequest.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.ListMonitoredResourceDescriptorsRequest(); while (reader.pos < end) { var tag = reader.uint32(); @@ -15791,7 +16427,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -15822,9 +16458,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ListMonitoredResourceDescriptorsRequest.verify = function verify(message) { + ListMonitoredResourceDescriptorsRequest.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.name != null && message.hasOwnProperty("name")) if (!$util.isString(message.name)) return "name: string expected"; @@ -15848,9 +16488,13 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.ListMonitoredResourceDescriptorsRequest} ListMonitoredResourceDescriptorsRequest */ - ListMonitoredResourceDescriptorsRequest.fromObject = function fromObject(object) { + ListMonitoredResourceDescriptorsRequest.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.ListMonitoredResourceDescriptorsRequest) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.ListMonitoredResourceDescriptorsRequest(); if (object.name != null) message.name = String(object.name); @@ -15944,7 +16588,7 @@ this.resourceDescriptors = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -16020,9 +16664,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ListMonitoredResourceDescriptorsResponse.decode = function decode(reader, length, error) { + ListMonitoredResourceDescriptorsResponse.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.ListMonitoredResourceDescriptorsResponse(); while (reader.pos < end) { var tag = reader.uint32(); @@ -16032,7 +16680,7 @@ case 1: { if (!(message.resourceDescriptors && message.resourceDescriptors.length)) message.resourceDescriptors = []; - message.resourceDescriptors.push($root.google.api.MonitoredResourceDescriptor.decode(reader, reader.uint32())); + message.resourceDescriptors.push($root.google.api.MonitoredResourceDescriptor.decode(reader, reader.uint32(), undefined, long + 1)); break; } case 2: { @@ -16040,7 +16688,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -16071,14 +16719,18 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ListMonitoredResourceDescriptorsResponse.verify = function verify(message) { + ListMonitoredResourceDescriptorsResponse.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.resourceDescriptors != null && message.hasOwnProperty("resourceDescriptors")) { if (!Array.isArray(message.resourceDescriptors)) return "resourceDescriptors: array expected"; for (var i = 0; i < message.resourceDescriptors.length; ++i) { - var error = $root.google.api.MonitoredResourceDescriptor.verify(message.resourceDescriptors[i]); + var error = $root.google.api.MonitoredResourceDescriptor.verify(message.resourceDescriptors[i], long + 1); if (error) return "resourceDescriptors." + error; } @@ -16097,9 +16749,13 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.ListMonitoredResourceDescriptorsResponse} ListMonitoredResourceDescriptorsResponse */ - ListMonitoredResourceDescriptorsResponse.fromObject = function fromObject(object) { + ListMonitoredResourceDescriptorsResponse.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.ListMonitoredResourceDescriptorsResponse) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.ListMonitoredResourceDescriptorsResponse(); if (object.resourceDescriptors) { if (!Array.isArray(object.resourceDescriptors)) @@ -16108,7 +16764,7 @@ for (var i = 0; i < object.resourceDescriptors.length; ++i) { if (typeof object.resourceDescriptors[i] !== "object") throw TypeError(".google.monitoring.v3.ListMonitoredResourceDescriptorsResponse.resourceDescriptors: object expected"); - message.resourceDescriptors[i] = $root.google.api.MonitoredResourceDescriptor.fromObject(object.resourceDescriptors[i]); + message.resourceDescriptors[i] = $root.google.api.MonitoredResourceDescriptor.fromObject(object.resourceDescriptors[i], long + 1); } } if (object.nextPageToken != null) @@ -16192,7 +16848,7 @@ function GetMonitoredResourceDescriptorRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -16257,9 +16913,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetMonitoredResourceDescriptorRequest.decode = function decode(reader, length, error) { + GetMonitoredResourceDescriptorRequest.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.GetMonitoredResourceDescriptorRequest(); while (reader.pos < end) { var tag = reader.uint32(); @@ -16271,7 +16931,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -16302,9 +16962,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GetMonitoredResourceDescriptorRequest.verify = function verify(message) { + GetMonitoredResourceDescriptorRequest.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.name != null && message.hasOwnProperty("name")) if (!$util.isString(message.name)) return "name: string expected"; @@ -16319,9 +16983,13 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.GetMonitoredResourceDescriptorRequest} GetMonitoredResourceDescriptorRequest */ - GetMonitoredResourceDescriptorRequest.fromObject = function fromObject(object) { + GetMonitoredResourceDescriptorRequest.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.GetMonitoredResourceDescriptorRequest) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.GetMonitoredResourceDescriptorRequest(); if (object.name != null) message.name = String(object.name); @@ -16401,7 +17069,7 @@ function ListMetricDescriptorsRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -16506,9 +17174,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ListMetricDescriptorsRequest.decode = function decode(reader, length, error) { + ListMetricDescriptorsRequest.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.ListMetricDescriptorsRequest(); while (reader.pos < end) { var tag = reader.uint32(); @@ -16536,7 +17208,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -16567,9 +17239,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ListMetricDescriptorsRequest.verify = function verify(message) { + ListMetricDescriptorsRequest.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.name != null && message.hasOwnProperty("name")) if (!$util.isString(message.name)) return "name: string expected"; @@ -16596,9 +17272,13 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.ListMetricDescriptorsRequest} ListMetricDescriptorsRequest */ - ListMetricDescriptorsRequest.fromObject = function fromObject(object) { + ListMetricDescriptorsRequest.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.ListMetricDescriptorsRequest) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.ListMetricDescriptorsRequest(); if (object.name != null) message.name = String(object.name); @@ -16697,7 +17377,7 @@ this.metricDescriptors = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -16773,9 +17453,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ListMetricDescriptorsResponse.decode = function decode(reader, length, error) { + ListMetricDescriptorsResponse.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.ListMetricDescriptorsResponse(); while (reader.pos < end) { var tag = reader.uint32(); @@ -16785,7 +17469,7 @@ case 1: { if (!(message.metricDescriptors && message.metricDescriptors.length)) message.metricDescriptors = []; - message.metricDescriptors.push($root.google.api.MetricDescriptor.decode(reader, reader.uint32())); + message.metricDescriptors.push($root.google.api.MetricDescriptor.decode(reader, reader.uint32(), undefined, long + 1)); break; } case 2: { @@ -16793,7 +17477,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -16824,14 +17508,18 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ListMetricDescriptorsResponse.verify = function verify(message) { + ListMetricDescriptorsResponse.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.metricDescriptors != null && message.hasOwnProperty("metricDescriptors")) { if (!Array.isArray(message.metricDescriptors)) return "metricDescriptors: array expected"; for (var i = 0; i < message.metricDescriptors.length; ++i) { - var error = $root.google.api.MetricDescriptor.verify(message.metricDescriptors[i]); + var error = $root.google.api.MetricDescriptor.verify(message.metricDescriptors[i], long + 1); if (error) return "metricDescriptors." + error; } @@ -16850,9 +17538,13 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.ListMetricDescriptorsResponse} ListMetricDescriptorsResponse */ - ListMetricDescriptorsResponse.fromObject = function fromObject(object) { + ListMetricDescriptorsResponse.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.ListMetricDescriptorsResponse) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.ListMetricDescriptorsResponse(); if (object.metricDescriptors) { if (!Array.isArray(object.metricDescriptors)) @@ -16861,7 +17553,7 @@ for (var i = 0; i < object.metricDescriptors.length; ++i) { if (typeof object.metricDescriptors[i] !== "object") throw TypeError(".google.monitoring.v3.ListMetricDescriptorsResponse.metricDescriptors: object expected"); - message.metricDescriptors[i] = $root.google.api.MetricDescriptor.fromObject(object.metricDescriptors[i]); + message.metricDescriptors[i] = $root.google.api.MetricDescriptor.fromObject(object.metricDescriptors[i], long + 1); } } if (object.nextPageToken != null) @@ -16945,7 +17637,7 @@ function GetMetricDescriptorRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -17010,9 +17702,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetMetricDescriptorRequest.decode = function decode(reader, length, error) { + GetMetricDescriptorRequest.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.GetMetricDescriptorRequest(); while (reader.pos < end) { var tag = reader.uint32(); @@ -17024,7 +17720,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -17055,9 +17751,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GetMetricDescriptorRequest.verify = function verify(message) { + GetMetricDescriptorRequest.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.name != null && message.hasOwnProperty("name")) if (!$util.isString(message.name)) return "name: string expected"; @@ -17072,9 +17772,13 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.GetMetricDescriptorRequest} GetMetricDescriptorRequest */ - GetMetricDescriptorRequest.fromObject = function fromObject(object) { + GetMetricDescriptorRequest.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.GetMetricDescriptorRequest) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.GetMetricDescriptorRequest(); if (object.name != null) message.name = String(object.name); @@ -17151,7 +17855,7 @@ function CreateMetricDescriptorRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -17226,9 +17930,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - CreateMetricDescriptorRequest.decode = function decode(reader, length, error) { + CreateMetricDescriptorRequest.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.CreateMetricDescriptorRequest(); while (reader.pos < end) { var tag = reader.uint32(); @@ -17240,11 +17948,11 @@ break; } case 2: { - message.metricDescriptor = $root.google.api.MetricDescriptor.decode(reader, reader.uint32()); + message.metricDescriptor = $root.google.api.MetricDescriptor.decode(reader, reader.uint32(), undefined, long + 1); break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -17275,14 +17983,18 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - CreateMetricDescriptorRequest.verify = function verify(message) { + CreateMetricDescriptorRequest.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.name != null && message.hasOwnProperty("name")) if (!$util.isString(message.name)) return "name: string expected"; if (message.metricDescriptor != null && message.hasOwnProperty("metricDescriptor")) { - var error = $root.google.api.MetricDescriptor.verify(message.metricDescriptor); + var error = $root.google.api.MetricDescriptor.verify(message.metricDescriptor, long + 1); if (error) return "metricDescriptor." + error; } @@ -17297,16 +18009,20 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.CreateMetricDescriptorRequest} CreateMetricDescriptorRequest */ - CreateMetricDescriptorRequest.fromObject = function fromObject(object) { + CreateMetricDescriptorRequest.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.CreateMetricDescriptorRequest) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.CreateMetricDescriptorRequest(); if (object.name != null) message.name = String(object.name); if (object.metricDescriptor != null) { if (typeof object.metricDescriptor !== "object") throw TypeError(".google.monitoring.v3.CreateMetricDescriptorRequest.metricDescriptor: object expected"); - message.metricDescriptor = $root.google.api.MetricDescriptor.fromObject(object.metricDescriptor); + message.metricDescriptor = $root.google.api.MetricDescriptor.fromObject(object.metricDescriptor, long + 1); } return message; }; @@ -17384,7 +18100,7 @@ function DeleteMetricDescriptorRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -17449,9 +18165,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - DeleteMetricDescriptorRequest.decode = function decode(reader, length, error) { + DeleteMetricDescriptorRequest.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.DeleteMetricDescriptorRequest(); while (reader.pos < end) { var tag = reader.uint32(); @@ -17463,7 +18183,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -17494,9 +18214,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - DeleteMetricDescriptorRequest.verify = function verify(message) { + DeleteMetricDescriptorRequest.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.name != null && message.hasOwnProperty("name")) if (!$util.isString(message.name)) return "name: string expected"; @@ -17511,9 +18235,13 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.DeleteMetricDescriptorRequest} DeleteMetricDescriptorRequest */ - DeleteMetricDescriptorRequest.fromObject = function fromObject(object) { + DeleteMetricDescriptorRequest.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.DeleteMetricDescriptorRequest) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.DeleteMetricDescriptorRequest(); if (object.name != null) message.name = String(object.name); @@ -17597,7 +18325,7 @@ function ListTimeSeriesRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -17742,9 +18470,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ListTimeSeriesRequest.decode = function decode(reader, length, error) { + ListTimeSeriesRequest.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.ListTimeSeriesRequest(); while (reader.pos < end) { var tag = reader.uint32(); @@ -17760,15 +18492,15 @@ break; } case 4: { - message.interval = $root.google.monitoring.v3.TimeInterval.decode(reader, reader.uint32()); + message.interval = $root.google.monitoring.v3.TimeInterval.decode(reader, reader.uint32(), undefined, long + 1); break; } case 5: { - message.aggregation = $root.google.monitoring.v3.Aggregation.decode(reader, reader.uint32()); + message.aggregation = $root.google.monitoring.v3.Aggregation.decode(reader, reader.uint32(), undefined, long + 1); break; } case 11: { - message.secondaryAggregation = $root.google.monitoring.v3.Aggregation.decode(reader, reader.uint32()); + message.secondaryAggregation = $root.google.monitoring.v3.Aggregation.decode(reader, reader.uint32(), undefined, long + 1); break; } case 6: { @@ -17788,7 +18520,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -17819,9 +18551,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ListTimeSeriesRequest.verify = function verify(message) { + ListTimeSeriesRequest.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.name != null && message.hasOwnProperty("name")) if (!$util.isString(message.name)) return "name: string expected"; @@ -17829,17 +18565,17 @@ if (!$util.isString(message.filter)) return "filter: string expected"; if (message.interval != null && message.hasOwnProperty("interval")) { - var error = $root.google.monitoring.v3.TimeInterval.verify(message.interval); + var error = $root.google.monitoring.v3.TimeInterval.verify(message.interval, long + 1); if (error) return "interval." + error; } if (message.aggregation != null && message.hasOwnProperty("aggregation")) { - var error = $root.google.monitoring.v3.Aggregation.verify(message.aggregation); + var error = $root.google.monitoring.v3.Aggregation.verify(message.aggregation, long + 1); if (error) return "aggregation." + error; } if (message.secondaryAggregation != null && message.hasOwnProperty("secondaryAggregation")) { - var error = $root.google.monitoring.v3.Aggregation.verify(message.secondaryAggregation); + var error = $root.google.monitoring.v3.Aggregation.verify(message.secondaryAggregation, long + 1); if (error) return "secondaryAggregation." + error; } @@ -17871,9 +18607,13 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.ListTimeSeriesRequest} ListTimeSeriesRequest */ - ListTimeSeriesRequest.fromObject = function fromObject(object) { + ListTimeSeriesRequest.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.ListTimeSeriesRequest) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.ListTimeSeriesRequest(); if (object.name != null) message.name = String(object.name); @@ -17882,17 +18622,17 @@ if (object.interval != null) { if (typeof object.interval !== "object") throw TypeError(".google.monitoring.v3.ListTimeSeriesRequest.interval: object expected"); - message.interval = $root.google.monitoring.v3.TimeInterval.fromObject(object.interval); + message.interval = $root.google.monitoring.v3.TimeInterval.fromObject(object.interval, long + 1); } if (object.aggregation != null) { if (typeof object.aggregation !== "object") throw TypeError(".google.monitoring.v3.ListTimeSeriesRequest.aggregation: object expected"); - message.aggregation = $root.google.monitoring.v3.Aggregation.fromObject(object.aggregation); + message.aggregation = $root.google.monitoring.v3.Aggregation.fromObject(object.aggregation, long + 1); } if (object.secondaryAggregation != null) { if (typeof object.secondaryAggregation !== "object") throw TypeError(".google.monitoring.v3.ListTimeSeriesRequest.secondaryAggregation: object expected"); - message.secondaryAggregation = $root.google.monitoring.v3.Aggregation.fromObject(object.secondaryAggregation); + message.secondaryAggregation = $root.google.monitoring.v3.Aggregation.fromObject(object.secondaryAggregation, long + 1); } if (object.orderBy != null) message.orderBy = String(object.orderBy); @@ -18032,7 +18772,7 @@ this.executionErrors = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -18129,9 +18869,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ListTimeSeriesResponse.decode = function decode(reader, length, error) { + ListTimeSeriesResponse.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.ListTimeSeriesResponse(); while (reader.pos < end) { var tag = reader.uint32(); @@ -18141,7 +18885,7 @@ case 1: { if (!(message.timeSeries && message.timeSeries.length)) message.timeSeries = []; - message.timeSeries.push($root.google.monitoring.v3.TimeSeries.decode(reader, reader.uint32())); + message.timeSeries.push($root.google.monitoring.v3.TimeSeries.decode(reader, reader.uint32(), undefined, long + 1)); break; } case 2: { @@ -18151,7 +18895,7 @@ case 3: { if (!(message.executionErrors && message.executionErrors.length)) message.executionErrors = []; - message.executionErrors.push($root.google.rpc.Status.decode(reader, reader.uint32())); + message.executionErrors.push($root.google.rpc.Status.decode(reader, reader.uint32(), undefined, long + 1)); break; } case 5: { @@ -18159,7 +18903,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -18190,14 +18934,18 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ListTimeSeriesResponse.verify = function verify(message) { + ListTimeSeriesResponse.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.timeSeries != null && message.hasOwnProperty("timeSeries")) { if (!Array.isArray(message.timeSeries)) return "timeSeries: array expected"; for (var i = 0; i < message.timeSeries.length; ++i) { - var error = $root.google.monitoring.v3.TimeSeries.verify(message.timeSeries[i]); + var error = $root.google.monitoring.v3.TimeSeries.verify(message.timeSeries[i], long + 1); if (error) return "timeSeries." + error; } @@ -18209,7 +18957,7 @@ if (!Array.isArray(message.executionErrors)) return "executionErrors: array expected"; for (var i = 0; i < message.executionErrors.length; ++i) { - var error = $root.google.rpc.Status.verify(message.executionErrors[i]); + var error = $root.google.rpc.Status.verify(message.executionErrors[i], long + 1); if (error) return "executionErrors." + error; } @@ -18228,9 +18976,13 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.ListTimeSeriesResponse} ListTimeSeriesResponse */ - ListTimeSeriesResponse.fromObject = function fromObject(object) { + ListTimeSeriesResponse.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.ListTimeSeriesResponse) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.ListTimeSeriesResponse(); if (object.timeSeries) { if (!Array.isArray(object.timeSeries)) @@ -18239,7 +18991,7 @@ for (var i = 0; i < object.timeSeries.length; ++i) { if (typeof object.timeSeries[i] !== "object") throw TypeError(".google.monitoring.v3.ListTimeSeriesResponse.timeSeries: object expected"); - message.timeSeries[i] = $root.google.monitoring.v3.TimeSeries.fromObject(object.timeSeries[i]); + message.timeSeries[i] = $root.google.monitoring.v3.TimeSeries.fromObject(object.timeSeries[i], long + 1); } } if (object.nextPageToken != null) @@ -18251,7 +19003,7 @@ for (var i = 0; i < object.executionErrors.length; ++i) { if (typeof object.executionErrors[i] !== "object") throw TypeError(".google.monitoring.v3.ListTimeSeriesResponse.executionErrors: object expected"); - message.executionErrors[i] = $root.google.rpc.Status.fromObject(object.executionErrors[i]); + message.executionErrors[i] = $root.google.rpc.Status.fromObject(object.executionErrors[i], long + 1); } } if (object.unit != null) @@ -18348,7 +19100,7 @@ this.timeSeries = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -18424,9 +19176,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - CreateTimeSeriesRequest.decode = function decode(reader, length, error) { + CreateTimeSeriesRequest.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.CreateTimeSeriesRequest(); while (reader.pos < end) { var tag = reader.uint32(); @@ -18440,11 +19196,11 @@ case 2: { if (!(message.timeSeries && message.timeSeries.length)) message.timeSeries = []; - message.timeSeries.push($root.google.monitoring.v3.TimeSeries.decode(reader, reader.uint32())); + message.timeSeries.push($root.google.monitoring.v3.TimeSeries.decode(reader, reader.uint32(), undefined, long + 1)); break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -18475,9 +19231,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - CreateTimeSeriesRequest.verify = function verify(message) { + CreateTimeSeriesRequest.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.name != null && message.hasOwnProperty("name")) if (!$util.isString(message.name)) return "name: string expected"; @@ -18485,7 +19245,7 @@ if (!Array.isArray(message.timeSeries)) return "timeSeries: array expected"; for (var i = 0; i < message.timeSeries.length; ++i) { - var error = $root.google.monitoring.v3.TimeSeries.verify(message.timeSeries[i]); + var error = $root.google.monitoring.v3.TimeSeries.verify(message.timeSeries[i], long + 1); if (error) return "timeSeries." + error; } @@ -18501,9 +19261,13 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.CreateTimeSeriesRequest} CreateTimeSeriesRequest */ - CreateTimeSeriesRequest.fromObject = function fromObject(object) { + CreateTimeSeriesRequest.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.CreateTimeSeriesRequest) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.CreateTimeSeriesRequest(); if (object.name != null) message.name = String(object.name); @@ -18514,7 +19278,7 @@ for (var i = 0; i < object.timeSeries.length; ++i) { if (typeof object.timeSeries[i] !== "object") throw TypeError(".google.monitoring.v3.CreateTimeSeriesRequest.timeSeries: object expected"); - message.timeSeries[i] = $root.google.monitoring.v3.TimeSeries.fromObject(object.timeSeries[i]); + message.timeSeries[i] = $root.google.monitoring.v3.TimeSeries.fromObject(object.timeSeries[i], long + 1); } } return message; @@ -18597,7 +19361,7 @@ function CreateTimeSeriesError(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -18672,9 +19436,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - CreateTimeSeriesError.decode = function decode(reader, length, error) { + CreateTimeSeriesError.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.CreateTimeSeriesError(); while (reader.pos < end) { var tag = reader.uint32(); @@ -18682,15 +19450,15 @@ break; switch (tag >>> 3) { case 1: { - message.timeSeries = $root.google.monitoring.v3.TimeSeries.decode(reader, reader.uint32()); + message.timeSeries = $root.google.monitoring.v3.TimeSeries.decode(reader, reader.uint32(), undefined, long + 1); break; } case 2: { - message.status = $root.google.rpc.Status.decode(reader, reader.uint32()); + message.status = $root.google.rpc.Status.decode(reader, reader.uint32(), undefined, long + 1); break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -18721,16 +19489,20 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - CreateTimeSeriesError.verify = function verify(message) { + CreateTimeSeriesError.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.timeSeries != null && message.hasOwnProperty("timeSeries")) { - var error = $root.google.monitoring.v3.TimeSeries.verify(message.timeSeries); + var error = $root.google.monitoring.v3.TimeSeries.verify(message.timeSeries, long + 1); if (error) return "timeSeries." + error; } if (message.status != null && message.hasOwnProperty("status")) { - var error = $root.google.rpc.Status.verify(message.status); + var error = $root.google.rpc.Status.verify(message.status, long + 1); if (error) return "status." + error; } @@ -18745,19 +19517,23 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.CreateTimeSeriesError} CreateTimeSeriesError */ - CreateTimeSeriesError.fromObject = function fromObject(object) { + CreateTimeSeriesError.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.CreateTimeSeriesError) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.CreateTimeSeriesError(); if (object.timeSeries != null) { if (typeof object.timeSeries !== "object") throw TypeError(".google.monitoring.v3.CreateTimeSeriesError.timeSeries: object expected"); - message.timeSeries = $root.google.monitoring.v3.TimeSeries.fromObject(object.timeSeries); + message.timeSeries = $root.google.monitoring.v3.TimeSeries.fromObject(object.timeSeries, long + 1); } if (object.status != null) { if (typeof object.status !== "object") throw TypeError(".google.monitoring.v3.CreateTimeSeriesError.status: object expected"); - message.status = $root.google.rpc.Status.fromObject(object.status); + message.status = $root.google.rpc.Status.fromObject(object.status, long + 1); } return message; }; @@ -18838,7 +19614,7 @@ this.errors = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -18924,9 +19700,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - CreateTimeSeriesSummary.decode = function decode(reader, length, error) { + CreateTimeSeriesSummary.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.CreateTimeSeriesSummary(); while (reader.pos < end) { var tag = reader.uint32(); @@ -18944,11 +19724,11 @@ case 3: { if (!(message.errors && message.errors.length)) message.errors = []; - message.errors.push($root.google.monitoring.v3.CreateTimeSeriesSummary.Error.decode(reader, reader.uint32())); + message.errors.push($root.google.monitoring.v3.CreateTimeSeriesSummary.Error.decode(reader, reader.uint32(), undefined, long + 1)); break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -18979,9 +19759,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - CreateTimeSeriesSummary.verify = function verify(message) { + CreateTimeSeriesSummary.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.totalPointCount != null && message.hasOwnProperty("totalPointCount")) if (!$util.isInteger(message.totalPointCount)) return "totalPointCount: integer expected"; @@ -18992,7 +19776,7 @@ if (!Array.isArray(message.errors)) return "errors: array expected"; for (var i = 0; i < message.errors.length; ++i) { - var error = $root.google.monitoring.v3.CreateTimeSeriesSummary.Error.verify(message.errors[i]); + var error = $root.google.monitoring.v3.CreateTimeSeriesSummary.Error.verify(message.errors[i], long + 1); if (error) return "errors." + error; } @@ -19008,9 +19792,13 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.CreateTimeSeriesSummary} CreateTimeSeriesSummary */ - CreateTimeSeriesSummary.fromObject = function fromObject(object) { + CreateTimeSeriesSummary.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.CreateTimeSeriesSummary) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.CreateTimeSeriesSummary(); if (object.totalPointCount != null) message.totalPointCount = object.totalPointCount | 0; @@ -19023,7 +19811,7 @@ for (var i = 0; i < object.errors.length; ++i) { if (typeof object.errors[i] !== "object") throw TypeError(".google.monitoring.v3.CreateTimeSeriesSummary.errors: object expected"); - message.errors[i] = $root.google.monitoring.v3.CreateTimeSeriesSummary.Error.fromObject(object.errors[i]); + message.errors[i] = $root.google.monitoring.v3.CreateTimeSeriesSummary.Error.fromObject(object.errors[i], long + 1); } } return message; @@ -19107,7 +19895,7 @@ function Error(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -19182,9 +19970,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Error.decode = function decode(reader, length, error) { + Error.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.CreateTimeSeriesSummary.Error(); while (reader.pos < end) { var tag = reader.uint32(); @@ -19192,7 +19984,7 @@ break; switch (tag >>> 3) { case 1: { - message.status = $root.google.rpc.Status.decode(reader, reader.uint32()); + message.status = $root.google.rpc.Status.decode(reader, reader.uint32(), undefined, long + 1); break; } case 2: { @@ -19200,7 +19992,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -19231,11 +20023,15 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Error.verify = function verify(message) { + Error.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.status != null && message.hasOwnProperty("status")) { - var error = $root.google.rpc.Status.verify(message.status); + var error = $root.google.rpc.Status.verify(message.status, long + 1); if (error) return "status." + error; } @@ -19253,14 +20049,18 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.CreateTimeSeriesSummary.Error} Error */ - Error.fromObject = function fromObject(object) { + Error.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.CreateTimeSeriesSummary.Error) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.CreateTimeSeriesSummary.Error(); if (object.status != null) { if (typeof object.status !== "object") throw TypeError(".google.monitoring.v3.CreateTimeSeriesSummary.Error.status: object expected"); - message.status = $root.google.rpc.Status.fromObject(object.status); + message.status = $root.google.rpc.Status.fromObject(object.status, long + 1); } if (object.pointCount != null) message.pointCount = object.pointCount | 0; @@ -19346,7 +20146,7 @@ function QueryTimeSeriesRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -19441,9 +20241,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - QueryTimeSeriesRequest.decode = function decode(reader, length, error) { + QueryTimeSeriesRequest.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.QueryTimeSeriesRequest(); while (reader.pos < end) { var tag = reader.uint32(); @@ -19467,7 +20271,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -19498,9 +20302,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - QueryTimeSeriesRequest.verify = function verify(message) { + QueryTimeSeriesRequest.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.name != null && message.hasOwnProperty("name")) if (!$util.isString(message.name)) return "name: string expected"; @@ -19524,9 +20332,13 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.QueryTimeSeriesRequest} QueryTimeSeriesRequest */ - QueryTimeSeriesRequest.fromObject = function fromObject(object) { + QueryTimeSeriesRequest.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.QueryTimeSeriesRequest) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.QueryTimeSeriesRequest(); if (object.name != null) message.name = String(object.name); @@ -19623,7 +20435,7 @@ this.partialErrors = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -19720,9 +20532,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - QueryTimeSeriesResponse.decode = function decode(reader, length, error) { + QueryTimeSeriesResponse.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.QueryTimeSeriesResponse(); while (reader.pos < end) { var tag = reader.uint32(); @@ -19730,13 +20546,13 @@ break; switch (tag >>> 3) { case 8: { - message.timeSeriesDescriptor = $root.google.monitoring.v3.TimeSeriesDescriptor.decode(reader, reader.uint32()); + message.timeSeriesDescriptor = $root.google.monitoring.v3.TimeSeriesDescriptor.decode(reader, reader.uint32(), undefined, long + 1); break; } case 9: { if (!(message.timeSeriesData && message.timeSeriesData.length)) message.timeSeriesData = []; - message.timeSeriesData.push($root.google.monitoring.v3.TimeSeriesData.decode(reader, reader.uint32())); + message.timeSeriesData.push($root.google.monitoring.v3.TimeSeriesData.decode(reader, reader.uint32(), undefined, long + 1)); break; } case 10: { @@ -19746,11 +20562,11 @@ case 11: { if (!(message.partialErrors && message.partialErrors.length)) message.partialErrors = []; - message.partialErrors.push($root.google.rpc.Status.decode(reader, reader.uint32())); + message.partialErrors.push($root.google.rpc.Status.decode(reader, reader.uint32(), undefined, long + 1)); break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -19781,11 +20597,15 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - QueryTimeSeriesResponse.verify = function verify(message) { + QueryTimeSeriesResponse.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.timeSeriesDescriptor != null && message.hasOwnProperty("timeSeriesDescriptor")) { - var error = $root.google.monitoring.v3.TimeSeriesDescriptor.verify(message.timeSeriesDescriptor); + var error = $root.google.monitoring.v3.TimeSeriesDescriptor.verify(message.timeSeriesDescriptor, long + 1); if (error) return "timeSeriesDescriptor." + error; } @@ -19793,7 +20613,7 @@ if (!Array.isArray(message.timeSeriesData)) return "timeSeriesData: array expected"; for (var i = 0; i < message.timeSeriesData.length; ++i) { - var error = $root.google.monitoring.v3.TimeSeriesData.verify(message.timeSeriesData[i]); + var error = $root.google.monitoring.v3.TimeSeriesData.verify(message.timeSeriesData[i], long + 1); if (error) return "timeSeriesData." + error; } @@ -19805,7 +20625,7 @@ if (!Array.isArray(message.partialErrors)) return "partialErrors: array expected"; for (var i = 0; i < message.partialErrors.length; ++i) { - var error = $root.google.rpc.Status.verify(message.partialErrors[i]); + var error = $root.google.rpc.Status.verify(message.partialErrors[i], long + 1); if (error) return "partialErrors." + error; } @@ -19821,14 +20641,18 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.QueryTimeSeriesResponse} QueryTimeSeriesResponse */ - QueryTimeSeriesResponse.fromObject = function fromObject(object) { + QueryTimeSeriesResponse.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.QueryTimeSeriesResponse) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.QueryTimeSeriesResponse(); if (object.timeSeriesDescriptor != null) { if (typeof object.timeSeriesDescriptor !== "object") throw TypeError(".google.monitoring.v3.QueryTimeSeriesResponse.timeSeriesDescriptor: object expected"); - message.timeSeriesDescriptor = $root.google.monitoring.v3.TimeSeriesDescriptor.fromObject(object.timeSeriesDescriptor); + message.timeSeriesDescriptor = $root.google.monitoring.v3.TimeSeriesDescriptor.fromObject(object.timeSeriesDescriptor, long + 1); } if (object.timeSeriesData) { if (!Array.isArray(object.timeSeriesData)) @@ -19837,7 +20661,7 @@ for (var i = 0; i < object.timeSeriesData.length; ++i) { if (typeof object.timeSeriesData[i] !== "object") throw TypeError(".google.monitoring.v3.QueryTimeSeriesResponse.timeSeriesData: object expected"); - message.timeSeriesData[i] = $root.google.monitoring.v3.TimeSeriesData.fromObject(object.timeSeriesData[i]); + message.timeSeriesData[i] = $root.google.monitoring.v3.TimeSeriesData.fromObject(object.timeSeriesData[i], long + 1); } } if (object.nextPageToken != null) @@ -19849,7 +20673,7 @@ for (var i = 0; i < object.partialErrors.length; ++i) { if (typeof object.partialErrors[i] !== "object") throw TypeError(".google.monitoring.v3.QueryTimeSeriesResponse.partialErrors: object expected"); - message.partialErrors[i] = $root.google.rpc.Status.fromObject(object.partialErrors[i]); + message.partialErrors[i] = $root.google.rpc.Status.fromObject(object.partialErrors[i], long + 1); } } return message; @@ -19944,7 +20768,7 @@ this.errors = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -20020,9 +20844,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - QueryErrorList.decode = function decode(reader, length, error) { + QueryErrorList.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.QueryErrorList(); while (reader.pos < end) { var tag = reader.uint32(); @@ -20032,7 +20860,7 @@ case 1: { if (!(message.errors && message.errors.length)) message.errors = []; - message.errors.push($root.google.monitoring.v3.QueryError.decode(reader, reader.uint32())); + message.errors.push($root.google.monitoring.v3.QueryError.decode(reader, reader.uint32(), undefined, long + 1)); break; } case 2: { @@ -20040,7 +20868,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -20071,14 +20899,18 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - QueryErrorList.verify = function verify(message) { + QueryErrorList.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.errors != null && message.hasOwnProperty("errors")) { if (!Array.isArray(message.errors)) return "errors: array expected"; for (var i = 0; i < message.errors.length; ++i) { - var error = $root.google.monitoring.v3.QueryError.verify(message.errors[i]); + var error = $root.google.monitoring.v3.QueryError.verify(message.errors[i], long + 1); if (error) return "errors." + error; } @@ -20097,9 +20929,13 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.QueryErrorList} QueryErrorList */ - QueryErrorList.fromObject = function fromObject(object) { + QueryErrorList.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.QueryErrorList) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.QueryErrorList(); if (object.errors) { if (!Array.isArray(object.errors)) @@ -20108,7 +20944,7 @@ for (var i = 0; i < object.errors.length; ++i) { if (typeof object.errors[i] !== "object") throw TypeError(".google.monitoring.v3.QueryErrorList.errors: object expected"); - message.errors[i] = $root.google.monitoring.v3.QueryError.fromObject(object.errors[i]); + message.errors[i] = $root.google.monitoring.v3.QueryError.fromObject(object.errors[i], long + 1); } } if (object.errorSummary != null) @@ -20200,7 +21036,7 @@ this.supportedTiers = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -20330,9 +21166,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - NotificationChannelDescriptor.decode = function decode(reader, length, error) { + NotificationChannelDescriptor.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.NotificationChannelDescriptor(); while (reader.pos < end) { var tag = reader.uint32(); @@ -20358,7 +21198,7 @@ case 4: { if (!(message.labels && message.labels.length)) message.labels = []; - message.labels.push($root.google.api.LabelDescriptor.decode(reader, reader.uint32())); + message.labels.push($root.google.api.LabelDescriptor.decode(reader, reader.uint32(), undefined, long + 1)); break; } case 5: { @@ -20377,7 +21217,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -20408,9 +21248,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - NotificationChannelDescriptor.verify = function verify(message) { + NotificationChannelDescriptor.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.name != null && message.hasOwnProperty("name")) if (!$util.isString(message.name)) return "name: string expected"; @@ -20427,7 +21271,7 @@ if (!Array.isArray(message.labels)) return "labels: array expected"; for (var i = 0; i < message.labels.length; ++i) { - var error = $root.google.api.LabelDescriptor.verify(message.labels[i]); + var error = $root.google.api.LabelDescriptor.verify(message.labels[i], long + 1); if (error) return "labels." + error; } @@ -20470,9 +21314,13 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.NotificationChannelDescriptor} NotificationChannelDescriptor */ - NotificationChannelDescriptor.fromObject = function fromObject(object) { + NotificationChannelDescriptor.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.NotificationChannelDescriptor) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.NotificationChannelDescriptor(); if (object.name != null) message.name = String(object.name); @@ -20489,7 +21337,7 @@ for (var i = 0; i < object.labels.length; ++i) { if (typeof object.labels[i] !== "object") throw TypeError(".google.monitoring.v3.NotificationChannelDescriptor.labels: object expected"); - message.labels[i] = $root.google.api.LabelDescriptor.fromObject(object.labels[i]); + message.labels[i] = $root.google.api.LabelDescriptor.fromObject(object.labels[i], long + 1); } } if (object.supportedTiers) { @@ -20668,7 +21516,7 @@ this.mutationRecords = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -20826,9 +21674,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - NotificationChannel.decode = function decode(reader, length, error) { + NotificationChannel.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.NotificationChannel(), key, value; while (reader.pos < end) { var tag = reader.uint32(); @@ -20867,10 +21719,12 @@ value = reader.string(); break; default: - reader.skipType(tag2 & 7); + reader.skipType(tag2 & 7, long); break; } } + if (key === "__proto__") + $util.makeProp(message.labels, key); message.labels[key] = value; break; } @@ -20890,10 +21744,12 @@ value = reader.string(); break; default: - reader.skipType(tag2 & 7); + reader.skipType(tag2 & 7, long); break; } } + if (key === "__proto__") + $util.makeProp(message.userLabels, key); message.userLabels[key] = value; break; } @@ -20902,21 +21758,21 @@ break; } case 11: { - message.enabled = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); + message.enabled = $root.google.protobuf.BoolValue.decode(reader, reader.uint32(), undefined, long + 1); break; } case 12: { - message.creationRecord = $root.google.monitoring.v3.MutationRecord.decode(reader, reader.uint32()); + message.creationRecord = $root.google.monitoring.v3.MutationRecord.decode(reader, reader.uint32(), undefined, long + 1); break; } case 13: { if (!(message.mutationRecords && message.mutationRecords.length)) message.mutationRecords = []; - message.mutationRecords.push($root.google.monitoring.v3.MutationRecord.decode(reader, reader.uint32())); + message.mutationRecords.push($root.google.monitoring.v3.MutationRecord.decode(reader, reader.uint32(), undefined, long + 1)); break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -20947,9 +21803,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - NotificationChannel.verify = function verify(message) { + NotificationChannel.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.type != null && message.hasOwnProperty("type")) if (!$util.isString(message.type)) return "type: string expected"; @@ -20988,12 +21848,12 @@ break; } if (message.enabled != null && message.hasOwnProperty("enabled")) { - var error = $root.google.protobuf.BoolValue.verify(message.enabled); + var error = $root.google.protobuf.BoolValue.verify(message.enabled, long + 1); if (error) return "enabled." + error; } if (message.creationRecord != null && message.hasOwnProperty("creationRecord")) { - var error = $root.google.monitoring.v3.MutationRecord.verify(message.creationRecord); + var error = $root.google.monitoring.v3.MutationRecord.verify(message.creationRecord, long + 1); if (error) return "creationRecord." + error; } @@ -21001,7 +21861,7 @@ if (!Array.isArray(message.mutationRecords)) return "mutationRecords: array expected"; for (var i = 0; i < message.mutationRecords.length; ++i) { - var error = $root.google.monitoring.v3.MutationRecord.verify(message.mutationRecords[i]); + var error = $root.google.monitoring.v3.MutationRecord.verify(message.mutationRecords[i], long + 1); if (error) return "mutationRecords." + error; } @@ -21017,9 +21877,13 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.NotificationChannel} NotificationChannel */ - NotificationChannel.fromObject = function fromObject(object) { + NotificationChannel.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.NotificationChannel) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.NotificationChannel(); if (object.type != null) message.type = String(object.type); @@ -21033,15 +21897,21 @@ if (typeof object.labels !== "object") throw TypeError(".google.monitoring.v3.NotificationChannel.labels: object expected"); message.labels = {}; - for (var keys = Object.keys(object.labels), i = 0; i < keys.length; ++i) + for (var keys = Object.keys(object.labels), i = 0; i < keys.length; ++i) { + if (keys[i] === "__proto__") + $util.makeProp(message.labels, keys[i]); message.labels[keys[i]] = String(object.labels[keys[i]]); + } } if (object.userLabels) { if (typeof object.userLabels !== "object") throw TypeError(".google.monitoring.v3.NotificationChannel.userLabels: object expected"); message.userLabels = {}; - for (var keys = Object.keys(object.userLabels), i = 0; i < keys.length; ++i) + for (var keys = Object.keys(object.userLabels), i = 0; i < keys.length; ++i) { + if (keys[i] === "__proto__") + $util.makeProp(message.userLabels, keys[i]); message.userLabels[keys[i]] = String(object.userLabels[keys[i]]); + } } switch (object.verificationStatus) { default: @@ -21066,12 +21936,12 @@ if (object.enabled != null) { if (typeof object.enabled !== "object") throw TypeError(".google.monitoring.v3.NotificationChannel.enabled: object expected"); - message.enabled = $root.google.protobuf.BoolValue.fromObject(object.enabled); + message.enabled = $root.google.protobuf.BoolValue.fromObject(object.enabled, long + 1); } if (object.creationRecord != null) { if (typeof object.creationRecord !== "object") throw TypeError(".google.monitoring.v3.NotificationChannel.creationRecord: object expected"); - message.creationRecord = $root.google.monitoring.v3.MutationRecord.fromObject(object.creationRecord); + message.creationRecord = $root.google.monitoring.v3.MutationRecord.fromObject(object.creationRecord, long + 1); } if (object.mutationRecords) { if (!Array.isArray(object.mutationRecords)) @@ -21080,7 +21950,7 @@ for (var i = 0; i < object.mutationRecords.length; ++i) { if (typeof object.mutationRecords[i] !== "object") throw TypeError(".google.monitoring.v3.NotificationChannel.mutationRecords: object expected"); - message.mutationRecords[i] = $root.google.monitoring.v3.MutationRecord.fromObject(object.mutationRecords[i]); + message.mutationRecords[i] = $root.google.monitoring.v3.MutationRecord.fromObject(object.mutationRecords[i], long + 1); } } return message; @@ -21123,15 +21993,21 @@ var keys2; if (message.labels && (keys2 = Object.keys(message.labels)).length) { object.labels = {}; - for (var j = 0; j < keys2.length; ++j) + for (var j = 0; j < keys2.length; ++j) { + if (keys2[j] === "__proto__") + $util.makeProp(object.labels, keys2[j]); object.labels[keys2[j]] = message.labels[keys2[j]]; + } } if (message.name != null && message.hasOwnProperty("name")) object.name = message.name; if (message.userLabels && (keys2 = Object.keys(message.userLabels)).length) { object.userLabels = {}; - for (var j = 0; j < keys2.length; ++j) + for (var j = 0; j < keys2.length; ++j) { + if (keys2[j] === "__proto__") + $util.makeProp(object.userLabels, keys2[j]); object.userLabels[keys2[j]] = message.userLabels[keys2[j]]; + } } if (message.verificationStatus != null && message.hasOwnProperty("verificationStatus")) object.verificationStatus = options.enums === String ? $root.google.monitoring.v3.NotificationChannel.VerificationStatus[message.verificationStatus] === undefined ? message.verificationStatus : $root.google.monitoring.v3.NotificationChannel.VerificationStatus[message.verificationStatus] : message.verificationStatus; @@ -21579,7 +22455,7 @@ function ListNotificationChannelDescriptorsRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -21664,9 +22540,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ListNotificationChannelDescriptorsRequest.decode = function decode(reader, length, error) { + ListNotificationChannelDescriptorsRequest.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.ListNotificationChannelDescriptorsRequest(); while (reader.pos < end) { var tag = reader.uint32(); @@ -21686,7 +22566,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -21717,9 +22597,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ListNotificationChannelDescriptorsRequest.verify = function verify(message) { + ListNotificationChannelDescriptorsRequest.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.name != null && message.hasOwnProperty("name")) if (!$util.isString(message.name)) return "name: string expected"; @@ -21740,9 +22624,13 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.ListNotificationChannelDescriptorsRequest} ListNotificationChannelDescriptorsRequest */ - ListNotificationChannelDescriptorsRequest.fromObject = function fromObject(object) { + ListNotificationChannelDescriptorsRequest.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.ListNotificationChannelDescriptorsRequest) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.ListNotificationChannelDescriptorsRequest(); if (object.name != null) message.name = String(object.name); @@ -21831,7 +22719,7 @@ this.channelDescriptors = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -21907,9 +22795,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ListNotificationChannelDescriptorsResponse.decode = function decode(reader, length, error) { + ListNotificationChannelDescriptorsResponse.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.ListNotificationChannelDescriptorsResponse(); while (reader.pos < end) { var tag = reader.uint32(); @@ -21919,7 +22811,7 @@ case 1: { if (!(message.channelDescriptors && message.channelDescriptors.length)) message.channelDescriptors = []; - message.channelDescriptors.push($root.google.monitoring.v3.NotificationChannelDescriptor.decode(reader, reader.uint32())); + message.channelDescriptors.push($root.google.monitoring.v3.NotificationChannelDescriptor.decode(reader, reader.uint32(), undefined, long + 1)); break; } case 2: { @@ -21927,7 +22819,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -21958,14 +22850,18 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ListNotificationChannelDescriptorsResponse.verify = function verify(message) { + ListNotificationChannelDescriptorsResponse.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.channelDescriptors != null && message.hasOwnProperty("channelDescriptors")) { if (!Array.isArray(message.channelDescriptors)) return "channelDescriptors: array expected"; for (var i = 0; i < message.channelDescriptors.length; ++i) { - var error = $root.google.monitoring.v3.NotificationChannelDescriptor.verify(message.channelDescriptors[i]); + var error = $root.google.monitoring.v3.NotificationChannelDescriptor.verify(message.channelDescriptors[i], long + 1); if (error) return "channelDescriptors." + error; } @@ -21984,9 +22880,13 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.ListNotificationChannelDescriptorsResponse} ListNotificationChannelDescriptorsResponse */ - ListNotificationChannelDescriptorsResponse.fromObject = function fromObject(object) { + ListNotificationChannelDescriptorsResponse.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.ListNotificationChannelDescriptorsResponse) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.ListNotificationChannelDescriptorsResponse(); if (object.channelDescriptors) { if (!Array.isArray(object.channelDescriptors)) @@ -21995,7 +22895,7 @@ for (var i = 0; i < object.channelDescriptors.length; ++i) { if (typeof object.channelDescriptors[i] !== "object") throw TypeError(".google.monitoring.v3.ListNotificationChannelDescriptorsResponse.channelDescriptors: object expected"); - message.channelDescriptors[i] = $root.google.monitoring.v3.NotificationChannelDescriptor.fromObject(object.channelDescriptors[i]); + message.channelDescriptors[i] = $root.google.monitoring.v3.NotificationChannelDescriptor.fromObject(object.channelDescriptors[i], long + 1); } } if (object.nextPageToken != null) @@ -22079,7 +22979,7 @@ function GetNotificationChannelDescriptorRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -22144,9 +23044,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetNotificationChannelDescriptorRequest.decode = function decode(reader, length, error) { + GetNotificationChannelDescriptorRequest.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.GetNotificationChannelDescriptorRequest(); while (reader.pos < end) { var tag = reader.uint32(); @@ -22158,7 +23062,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -22189,9 +23093,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GetNotificationChannelDescriptorRequest.verify = function verify(message) { + GetNotificationChannelDescriptorRequest.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.name != null && message.hasOwnProperty("name")) if (!$util.isString(message.name)) return "name: string expected"; @@ -22206,9 +23114,13 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.GetNotificationChannelDescriptorRequest} GetNotificationChannelDescriptorRequest */ - GetNotificationChannelDescriptorRequest.fromObject = function fromObject(object) { + GetNotificationChannelDescriptorRequest.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.GetNotificationChannelDescriptorRequest) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.GetNotificationChannelDescriptorRequest(); if (object.name != null) message.name = String(object.name); @@ -22285,7 +23197,7 @@ function CreateNotificationChannelRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -22360,9 +23272,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - CreateNotificationChannelRequest.decode = function decode(reader, length, error) { + CreateNotificationChannelRequest.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.CreateNotificationChannelRequest(); while (reader.pos < end) { var tag = reader.uint32(); @@ -22374,11 +23290,11 @@ break; } case 2: { - message.notificationChannel = $root.google.monitoring.v3.NotificationChannel.decode(reader, reader.uint32()); + message.notificationChannel = $root.google.monitoring.v3.NotificationChannel.decode(reader, reader.uint32(), undefined, long + 1); break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -22409,14 +23325,18 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - CreateNotificationChannelRequest.verify = function verify(message) { + CreateNotificationChannelRequest.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.name != null && message.hasOwnProperty("name")) if (!$util.isString(message.name)) return "name: string expected"; if (message.notificationChannel != null && message.hasOwnProperty("notificationChannel")) { - var error = $root.google.monitoring.v3.NotificationChannel.verify(message.notificationChannel); + var error = $root.google.monitoring.v3.NotificationChannel.verify(message.notificationChannel, long + 1); if (error) return "notificationChannel." + error; } @@ -22431,16 +23351,20 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.CreateNotificationChannelRequest} CreateNotificationChannelRequest */ - CreateNotificationChannelRequest.fromObject = function fromObject(object) { + CreateNotificationChannelRequest.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.CreateNotificationChannelRequest) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.CreateNotificationChannelRequest(); if (object.name != null) message.name = String(object.name); if (object.notificationChannel != null) { if (typeof object.notificationChannel !== "object") throw TypeError(".google.monitoring.v3.CreateNotificationChannelRequest.notificationChannel: object expected"); - message.notificationChannel = $root.google.monitoring.v3.NotificationChannel.fromObject(object.notificationChannel); + message.notificationChannel = $root.google.monitoring.v3.NotificationChannel.fromObject(object.notificationChannel, long + 1); } return message; }; @@ -22522,7 +23446,7 @@ function ListNotificationChannelsRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -22627,9 +23551,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ListNotificationChannelsRequest.decode = function decode(reader, length, error) { + ListNotificationChannelsRequest.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.ListNotificationChannelsRequest(); while (reader.pos < end) { var tag = reader.uint32(); @@ -22657,7 +23585,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -22688,9 +23616,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ListNotificationChannelsRequest.verify = function verify(message) { + ListNotificationChannelsRequest.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.name != null && message.hasOwnProperty("name")) if (!$util.isString(message.name)) return "name: string expected"; @@ -22717,9 +23649,13 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.ListNotificationChannelsRequest} ListNotificationChannelsRequest */ - ListNotificationChannelsRequest.fromObject = function fromObject(object) { + ListNotificationChannelsRequest.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.ListNotificationChannelsRequest) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.ListNotificationChannelsRequest(); if (object.name != null) message.name = String(object.name); @@ -22819,7 +23755,7 @@ this.notificationChannels = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -22905,9 +23841,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ListNotificationChannelsResponse.decode = function decode(reader, length, error) { + ListNotificationChannelsResponse.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.ListNotificationChannelsResponse(); while (reader.pos < end) { var tag = reader.uint32(); @@ -22917,7 +23857,7 @@ case 3: { if (!(message.notificationChannels && message.notificationChannels.length)) message.notificationChannels = []; - message.notificationChannels.push($root.google.monitoring.v3.NotificationChannel.decode(reader, reader.uint32())); + message.notificationChannels.push($root.google.monitoring.v3.NotificationChannel.decode(reader, reader.uint32(), undefined, long + 1)); break; } case 2: { @@ -22929,7 +23869,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -22960,14 +23900,18 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ListNotificationChannelsResponse.verify = function verify(message) { + ListNotificationChannelsResponse.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.notificationChannels != null && message.hasOwnProperty("notificationChannels")) { if (!Array.isArray(message.notificationChannels)) return "notificationChannels: array expected"; for (var i = 0; i < message.notificationChannels.length; ++i) { - var error = $root.google.monitoring.v3.NotificationChannel.verify(message.notificationChannels[i]); + var error = $root.google.monitoring.v3.NotificationChannel.verify(message.notificationChannels[i], long + 1); if (error) return "notificationChannels." + error; } @@ -22989,9 +23933,13 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.ListNotificationChannelsResponse} ListNotificationChannelsResponse */ - ListNotificationChannelsResponse.fromObject = function fromObject(object) { + ListNotificationChannelsResponse.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.ListNotificationChannelsResponse) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.ListNotificationChannelsResponse(); if (object.notificationChannels) { if (!Array.isArray(object.notificationChannels)) @@ -23000,7 +23948,7 @@ for (var i = 0; i < object.notificationChannels.length; ++i) { if (typeof object.notificationChannels[i] !== "object") throw TypeError(".google.monitoring.v3.ListNotificationChannelsResponse.notificationChannels: object expected"); - message.notificationChannels[i] = $root.google.monitoring.v3.NotificationChannel.fromObject(object.notificationChannels[i]); + message.notificationChannels[i] = $root.google.monitoring.v3.NotificationChannel.fromObject(object.notificationChannels[i], long + 1); } } if (object.nextPageToken != null) @@ -23090,7 +24038,7 @@ function GetNotificationChannelRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -23155,9 +24103,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetNotificationChannelRequest.decode = function decode(reader, length, error) { + GetNotificationChannelRequest.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.GetNotificationChannelRequest(); while (reader.pos < end) { var tag = reader.uint32(); @@ -23169,7 +24121,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -23200,9 +24152,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GetNotificationChannelRequest.verify = function verify(message) { + GetNotificationChannelRequest.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.name != null && message.hasOwnProperty("name")) if (!$util.isString(message.name)) return "name: string expected"; @@ -23217,9 +24173,13 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.GetNotificationChannelRequest} GetNotificationChannelRequest */ - GetNotificationChannelRequest.fromObject = function fromObject(object) { + GetNotificationChannelRequest.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.GetNotificationChannelRequest) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.GetNotificationChannelRequest(); if (object.name != null) message.name = String(object.name); @@ -23296,7 +24256,7 @@ function UpdateNotificationChannelRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -23371,9 +24331,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - UpdateNotificationChannelRequest.decode = function decode(reader, length, error) { + UpdateNotificationChannelRequest.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.UpdateNotificationChannelRequest(); while (reader.pos < end) { var tag = reader.uint32(); @@ -23381,15 +24345,15 @@ break; switch (tag >>> 3) { case 2: { - message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32(), undefined, long + 1); break; } case 3: { - message.notificationChannel = $root.google.monitoring.v3.NotificationChannel.decode(reader, reader.uint32()); + message.notificationChannel = $root.google.monitoring.v3.NotificationChannel.decode(reader, reader.uint32(), undefined, long + 1); break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -23420,16 +24384,20 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - UpdateNotificationChannelRequest.verify = function verify(message) { + UpdateNotificationChannelRequest.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.updateMask != null && message.hasOwnProperty("updateMask")) { - var error = $root.google.protobuf.FieldMask.verify(message.updateMask); + var error = $root.google.protobuf.FieldMask.verify(message.updateMask, long + 1); if (error) return "updateMask." + error; } if (message.notificationChannel != null && message.hasOwnProperty("notificationChannel")) { - var error = $root.google.monitoring.v3.NotificationChannel.verify(message.notificationChannel); + var error = $root.google.monitoring.v3.NotificationChannel.verify(message.notificationChannel, long + 1); if (error) return "notificationChannel." + error; } @@ -23444,19 +24412,23 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.UpdateNotificationChannelRequest} UpdateNotificationChannelRequest */ - UpdateNotificationChannelRequest.fromObject = function fromObject(object) { + UpdateNotificationChannelRequest.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.UpdateNotificationChannelRequest) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.UpdateNotificationChannelRequest(); if (object.updateMask != null) { if (typeof object.updateMask !== "object") throw TypeError(".google.monitoring.v3.UpdateNotificationChannelRequest.updateMask: object expected"); - message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); + message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask, long + 1); } if (object.notificationChannel != null) { if (typeof object.notificationChannel !== "object") throw TypeError(".google.monitoring.v3.UpdateNotificationChannelRequest.notificationChannel: object expected"); - message.notificationChannel = $root.google.monitoring.v3.NotificationChannel.fromObject(object.notificationChannel); + message.notificationChannel = $root.google.monitoring.v3.NotificationChannel.fromObject(object.notificationChannel, long + 1); } return message; }; @@ -23535,7 +24507,7 @@ function DeleteNotificationChannelRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -23610,9 +24582,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - DeleteNotificationChannelRequest.decode = function decode(reader, length, error) { + DeleteNotificationChannelRequest.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.DeleteNotificationChannelRequest(); while (reader.pos < end) { var tag = reader.uint32(); @@ -23628,7 +24604,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -23659,9 +24635,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - DeleteNotificationChannelRequest.verify = function verify(message) { + DeleteNotificationChannelRequest.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.name != null && message.hasOwnProperty("name")) if (!$util.isString(message.name)) return "name: string expected"; @@ -23679,9 +24659,13 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.DeleteNotificationChannelRequest} DeleteNotificationChannelRequest */ - DeleteNotificationChannelRequest.fromObject = function fromObject(object) { + DeleteNotificationChannelRequest.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.DeleteNotificationChannelRequest) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.DeleteNotificationChannelRequest(); if (object.name != null) message.name = String(object.name); @@ -23763,7 +24747,7 @@ function SendNotificationChannelVerificationCodeRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -23828,9 +24812,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - SendNotificationChannelVerificationCodeRequest.decode = function decode(reader, length, error) { + SendNotificationChannelVerificationCodeRequest.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.SendNotificationChannelVerificationCodeRequest(); while (reader.pos < end) { var tag = reader.uint32(); @@ -23842,7 +24830,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -23873,9 +24861,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - SendNotificationChannelVerificationCodeRequest.verify = function verify(message) { + SendNotificationChannelVerificationCodeRequest.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.name != null && message.hasOwnProperty("name")) if (!$util.isString(message.name)) return "name: string expected"; @@ -23890,9 +24882,13 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.SendNotificationChannelVerificationCodeRequest} SendNotificationChannelVerificationCodeRequest */ - SendNotificationChannelVerificationCodeRequest.fromObject = function fromObject(object) { + SendNotificationChannelVerificationCodeRequest.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.SendNotificationChannelVerificationCodeRequest) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.SendNotificationChannelVerificationCodeRequest(); if (object.name != null) message.name = String(object.name); @@ -23969,7 +24965,7 @@ function GetNotificationChannelVerificationCodeRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -24044,9 +25040,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetNotificationChannelVerificationCodeRequest.decode = function decode(reader, length, error) { + GetNotificationChannelVerificationCodeRequest.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.GetNotificationChannelVerificationCodeRequest(); while (reader.pos < end) { var tag = reader.uint32(); @@ -24058,11 +25058,11 @@ break; } case 2: { - message.expireTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + message.expireTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32(), undefined, long + 1); break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -24093,14 +25093,18 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GetNotificationChannelVerificationCodeRequest.verify = function verify(message) { + GetNotificationChannelVerificationCodeRequest.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.name != null && message.hasOwnProperty("name")) if (!$util.isString(message.name)) return "name: string expected"; if (message.expireTime != null && message.hasOwnProperty("expireTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.expireTime); + var error = $root.google.protobuf.Timestamp.verify(message.expireTime, long + 1); if (error) return "expireTime." + error; } @@ -24115,16 +25119,20 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.GetNotificationChannelVerificationCodeRequest} GetNotificationChannelVerificationCodeRequest */ - GetNotificationChannelVerificationCodeRequest.fromObject = function fromObject(object) { + GetNotificationChannelVerificationCodeRequest.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.GetNotificationChannelVerificationCodeRequest) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.GetNotificationChannelVerificationCodeRequest(); if (object.name != null) message.name = String(object.name); if (object.expireTime != null) { if (typeof object.expireTime !== "object") throw TypeError(".google.monitoring.v3.GetNotificationChannelVerificationCodeRequest.expireTime: object expected"); - message.expireTime = $root.google.protobuf.Timestamp.fromObject(object.expireTime); + message.expireTime = $root.google.protobuf.Timestamp.fromObject(object.expireTime, long + 1); } return message; }; @@ -24203,7 +25211,7 @@ function GetNotificationChannelVerificationCodeResponse(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -24278,9 +25286,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetNotificationChannelVerificationCodeResponse.decode = function decode(reader, length, error) { + GetNotificationChannelVerificationCodeResponse.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.GetNotificationChannelVerificationCodeResponse(); while (reader.pos < end) { var tag = reader.uint32(); @@ -24292,11 +25304,11 @@ break; } case 2: { - message.expireTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + message.expireTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32(), undefined, long + 1); break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -24327,14 +25339,18 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GetNotificationChannelVerificationCodeResponse.verify = function verify(message) { + GetNotificationChannelVerificationCodeResponse.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.code != null && message.hasOwnProperty("code")) if (!$util.isString(message.code)) return "code: string expected"; if (message.expireTime != null && message.hasOwnProperty("expireTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.expireTime); + var error = $root.google.protobuf.Timestamp.verify(message.expireTime, long + 1); if (error) return "expireTime." + error; } @@ -24349,16 +25365,20 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.GetNotificationChannelVerificationCodeResponse} GetNotificationChannelVerificationCodeResponse */ - GetNotificationChannelVerificationCodeResponse.fromObject = function fromObject(object) { + GetNotificationChannelVerificationCodeResponse.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.GetNotificationChannelVerificationCodeResponse) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.GetNotificationChannelVerificationCodeResponse(); if (object.code != null) message.code = String(object.code); if (object.expireTime != null) { if (typeof object.expireTime !== "object") throw TypeError(".google.monitoring.v3.GetNotificationChannelVerificationCodeResponse.expireTime: object expected"); - message.expireTime = $root.google.protobuf.Timestamp.fromObject(object.expireTime); + message.expireTime = $root.google.protobuf.Timestamp.fromObject(object.expireTime, long + 1); } return message; }; @@ -24437,7 +25457,7 @@ function VerifyNotificationChannelRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -24512,9 +25532,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - VerifyNotificationChannelRequest.decode = function decode(reader, length, error) { + VerifyNotificationChannelRequest.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.VerifyNotificationChannelRequest(); while (reader.pos < end) { var tag = reader.uint32(); @@ -24530,7 +25554,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -24561,9 +25585,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - VerifyNotificationChannelRequest.verify = function verify(message) { + VerifyNotificationChannelRequest.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.name != null && message.hasOwnProperty("name")) if (!$util.isString(message.name)) return "name: string expected"; @@ -24581,9 +25609,13 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.VerifyNotificationChannelRequest} VerifyNotificationChannelRequest */ - VerifyNotificationChannelRequest.fromObject = function fromObject(object) { + VerifyNotificationChannelRequest.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.VerifyNotificationChannelRequest) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.VerifyNotificationChannelRequest(); if (object.name != null) message.name = String(object.name); @@ -24748,7 +25780,7 @@ this.userLabels = {}; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -24968,9 +26000,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Service.decode = function decode(reader, length, error) { + Service.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.Service(), key, value; while (reader.pos < end) { var tag = reader.uint32(); @@ -24986,51 +26022,51 @@ break; } case 6: { - message.custom = $root.google.monitoring.v3.Service.Custom.decode(reader, reader.uint32()); + message.custom = $root.google.monitoring.v3.Service.Custom.decode(reader, reader.uint32(), undefined, long + 1); break; } case 7: { - message.appEngine = $root.google.monitoring.v3.Service.AppEngine.decode(reader, reader.uint32()); + message.appEngine = $root.google.monitoring.v3.Service.AppEngine.decode(reader, reader.uint32(), undefined, long + 1); break; } case 8: { - message.cloudEndpoints = $root.google.monitoring.v3.Service.CloudEndpoints.decode(reader, reader.uint32()); + message.cloudEndpoints = $root.google.monitoring.v3.Service.CloudEndpoints.decode(reader, reader.uint32(), undefined, long + 1); break; } case 9: { - message.clusterIstio = $root.google.monitoring.v3.Service.ClusterIstio.decode(reader, reader.uint32()); + message.clusterIstio = $root.google.monitoring.v3.Service.ClusterIstio.decode(reader, reader.uint32(), undefined, long + 1); break; } case 10: { - message.meshIstio = $root.google.monitoring.v3.Service.MeshIstio.decode(reader, reader.uint32()); + message.meshIstio = $root.google.monitoring.v3.Service.MeshIstio.decode(reader, reader.uint32(), undefined, long + 1); break; } case 11: { - message.istioCanonicalService = $root.google.monitoring.v3.Service.IstioCanonicalService.decode(reader, reader.uint32()); + message.istioCanonicalService = $root.google.monitoring.v3.Service.IstioCanonicalService.decode(reader, reader.uint32(), undefined, long + 1); break; } case 12: { - message.cloudRun = $root.google.monitoring.v3.Service.CloudRun.decode(reader, reader.uint32()); + message.cloudRun = $root.google.monitoring.v3.Service.CloudRun.decode(reader, reader.uint32(), undefined, long + 1); break; } case 15: { - message.gkeNamespace = $root.google.monitoring.v3.Service.GkeNamespace.decode(reader, reader.uint32()); + message.gkeNamespace = $root.google.monitoring.v3.Service.GkeNamespace.decode(reader, reader.uint32(), undefined, long + 1); break; } case 16: { - message.gkeWorkload = $root.google.monitoring.v3.Service.GkeWorkload.decode(reader, reader.uint32()); + message.gkeWorkload = $root.google.monitoring.v3.Service.GkeWorkload.decode(reader, reader.uint32(), undefined, long + 1); break; } case 17: { - message.gkeService = $root.google.monitoring.v3.Service.GkeService.decode(reader, reader.uint32()); + message.gkeService = $root.google.monitoring.v3.Service.GkeService.decode(reader, reader.uint32(), undefined, long + 1); break; } case 19: { - message.basicService = $root.google.monitoring.v3.Service.BasicService.decode(reader, reader.uint32()); + message.basicService = $root.google.monitoring.v3.Service.BasicService.decode(reader, reader.uint32(), undefined, long + 1); break; } case 13: { - message.telemetry = $root.google.monitoring.v3.Service.Telemetry.decode(reader, reader.uint32()); + message.telemetry = $root.google.monitoring.v3.Service.Telemetry.decode(reader, reader.uint32(), undefined, long + 1); break; } case 14: { @@ -25049,15 +26085,17 @@ value = reader.string(); break; default: - reader.skipType(tag2 & 7); + reader.skipType(tag2 & 7, long); break; } } + if (key === "__proto__") + $util.makeProp(message.userLabels, key); message.userLabels[key] = value; break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -25088,9 +26126,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Service.verify = function verify(message) { + Service.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; var properties = {}; if (message.name != null && message.hasOwnProperty("name")) if (!$util.isString(message.name)) @@ -25101,7 +26143,7 @@ if (message.custom != null && message.hasOwnProperty("custom")) { properties.identifier = 1; { - var error = $root.google.monitoring.v3.Service.Custom.verify(message.custom); + var error = $root.google.monitoring.v3.Service.Custom.verify(message.custom, long + 1); if (error) return "custom." + error; } @@ -25111,7 +26153,7 @@ return "identifier: multiple values"; properties.identifier = 1; { - var error = $root.google.monitoring.v3.Service.AppEngine.verify(message.appEngine); + var error = $root.google.monitoring.v3.Service.AppEngine.verify(message.appEngine, long + 1); if (error) return "appEngine." + error; } @@ -25121,7 +26163,7 @@ return "identifier: multiple values"; properties.identifier = 1; { - var error = $root.google.monitoring.v3.Service.CloudEndpoints.verify(message.cloudEndpoints); + var error = $root.google.monitoring.v3.Service.CloudEndpoints.verify(message.cloudEndpoints, long + 1); if (error) return "cloudEndpoints." + error; } @@ -25131,7 +26173,7 @@ return "identifier: multiple values"; properties.identifier = 1; { - var error = $root.google.monitoring.v3.Service.ClusterIstio.verify(message.clusterIstio); + var error = $root.google.monitoring.v3.Service.ClusterIstio.verify(message.clusterIstio, long + 1); if (error) return "clusterIstio." + error; } @@ -25141,7 +26183,7 @@ return "identifier: multiple values"; properties.identifier = 1; { - var error = $root.google.monitoring.v3.Service.MeshIstio.verify(message.meshIstio); + var error = $root.google.monitoring.v3.Service.MeshIstio.verify(message.meshIstio, long + 1); if (error) return "meshIstio." + error; } @@ -25151,7 +26193,7 @@ return "identifier: multiple values"; properties.identifier = 1; { - var error = $root.google.monitoring.v3.Service.IstioCanonicalService.verify(message.istioCanonicalService); + var error = $root.google.monitoring.v3.Service.IstioCanonicalService.verify(message.istioCanonicalService, long + 1); if (error) return "istioCanonicalService." + error; } @@ -25161,7 +26203,7 @@ return "identifier: multiple values"; properties.identifier = 1; { - var error = $root.google.monitoring.v3.Service.CloudRun.verify(message.cloudRun); + var error = $root.google.monitoring.v3.Service.CloudRun.verify(message.cloudRun, long + 1); if (error) return "cloudRun." + error; } @@ -25171,7 +26213,7 @@ return "identifier: multiple values"; properties.identifier = 1; { - var error = $root.google.monitoring.v3.Service.GkeNamespace.verify(message.gkeNamespace); + var error = $root.google.monitoring.v3.Service.GkeNamespace.verify(message.gkeNamespace, long + 1); if (error) return "gkeNamespace." + error; } @@ -25181,7 +26223,7 @@ return "identifier: multiple values"; properties.identifier = 1; { - var error = $root.google.monitoring.v3.Service.GkeWorkload.verify(message.gkeWorkload); + var error = $root.google.monitoring.v3.Service.GkeWorkload.verify(message.gkeWorkload, long + 1); if (error) return "gkeWorkload." + error; } @@ -25191,18 +26233,18 @@ return "identifier: multiple values"; properties.identifier = 1; { - var error = $root.google.monitoring.v3.Service.GkeService.verify(message.gkeService); + var error = $root.google.monitoring.v3.Service.GkeService.verify(message.gkeService, long + 1); if (error) return "gkeService." + error; } } if (message.basicService != null && message.hasOwnProperty("basicService")) { - var error = $root.google.monitoring.v3.Service.BasicService.verify(message.basicService); + var error = $root.google.monitoring.v3.Service.BasicService.verify(message.basicService, long + 1); if (error) return "basicService." + error; } if (message.telemetry != null && message.hasOwnProperty("telemetry")) { - var error = $root.google.monitoring.v3.Service.Telemetry.verify(message.telemetry); + var error = $root.google.monitoring.v3.Service.Telemetry.verify(message.telemetry, long + 1); if (error) return "telemetry." + error; } @@ -25225,9 +26267,13 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.Service} Service */ - Service.fromObject = function fromObject(object) { + Service.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.Service) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.Service(); if (object.name != null) message.name = String(object.name); @@ -25236,69 +26282,72 @@ if (object.custom != null) { if (typeof object.custom !== "object") throw TypeError(".google.monitoring.v3.Service.custom: object expected"); - message.custom = $root.google.monitoring.v3.Service.Custom.fromObject(object.custom); + message.custom = $root.google.monitoring.v3.Service.Custom.fromObject(object.custom, long + 1); } if (object.appEngine != null) { if (typeof object.appEngine !== "object") throw TypeError(".google.monitoring.v3.Service.appEngine: object expected"); - message.appEngine = $root.google.monitoring.v3.Service.AppEngine.fromObject(object.appEngine); + message.appEngine = $root.google.monitoring.v3.Service.AppEngine.fromObject(object.appEngine, long + 1); } if (object.cloudEndpoints != null) { if (typeof object.cloudEndpoints !== "object") throw TypeError(".google.monitoring.v3.Service.cloudEndpoints: object expected"); - message.cloudEndpoints = $root.google.monitoring.v3.Service.CloudEndpoints.fromObject(object.cloudEndpoints); + message.cloudEndpoints = $root.google.monitoring.v3.Service.CloudEndpoints.fromObject(object.cloudEndpoints, long + 1); } if (object.clusterIstio != null) { if (typeof object.clusterIstio !== "object") throw TypeError(".google.monitoring.v3.Service.clusterIstio: object expected"); - message.clusterIstio = $root.google.monitoring.v3.Service.ClusterIstio.fromObject(object.clusterIstio); + message.clusterIstio = $root.google.monitoring.v3.Service.ClusterIstio.fromObject(object.clusterIstio, long + 1); } if (object.meshIstio != null) { if (typeof object.meshIstio !== "object") throw TypeError(".google.monitoring.v3.Service.meshIstio: object expected"); - message.meshIstio = $root.google.monitoring.v3.Service.MeshIstio.fromObject(object.meshIstio); + message.meshIstio = $root.google.monitoring.v3.Service.MeshIstio.fromObject(object.meshIstio, long + 1); } if (object.istioCanonicalService != null) { if (typeof object.istioCanonicalService !== "object") throw TypeError(".google.monitoring.v3.Service.istioCanonicalService: object expected"); - message.istioCanonicalService = $root.google.monitoring.v3.Service.IstioCanonicalService.fromObject(object.istioCanonicalService); + message.istioCanonicalService = $root.google.monitoring.v3.Service.IstioCanonicalService.fromObject(object.istioCanonicalService, long + 1); } if (object.cloudRun != null) { if (typeof object.cloudRun !== "object") throw TypeError(".google.monitoring.v3.Service.cloudRun: object expected"); - message.cloudRun = $root.google.monitoring.v3.Service.CloudRun.fromObject(object.cloudRun); + message.cloudRun = $root.google.monitoring.v3.Service.CloudRun.fromObject(object.cloudRun, long + 1); } if (object.gkeNamespace != null) { if (typeof object.gkeNamespace !== "object") throw TypeError(".google.monitoring.v3.Service.gkeNamespace: object expected"); - message.gkeNamespace = $root.google.monitoring.v3.Service.GkeNamespace.fromObject(object.gkeNamespace); + message.gkeNamespace = $root.google.monitoring.v3.Service.GkeNamespace.fromObject(object.gkeNamespace, long + 1); } if (object.gkeWorkload != null) { if (typeof object.gkeWorkload !== "object") throw TypeError(".google.monitoring.v3.Service.gkeWorkload: object expected"); - message.gkeWorkload = $root.google.monitoring.v3.Service.GkeWorkload.fromObject(object.gkeWorkload); + message.gkeWorkload = $root.google.monitoring.v3.Service.GkeWorkload.fromObject(object.gkeWorkload, long + 1); } if (object.gkeService != null) { if (typeof object.gkeService !== "object") throw TypeError(".google.monitoring.v3.Service.gkeService: object expected"); - message.gkeService = $root.google.monitoring.v3.Service.GkeService.fromObject(object.gkeService); + message.gkeService = $root.google.monitoring.v3.Service.GkeService.fromObject(object.gkeService, long + 1); } if (object.basicService != null) { if (typeof object.basicService !== "object") throw TypeError(".google.monitoring.v3.Service.basicService: object expected"); - message.basicService = $root.google.monitoring.v3.Service.BasicService.fromObject(object.basicService); + message.basicService = $root.google.monitoring.v3.Service.BasicService.fromObject(object.basicService, long + 1); } if (object.telemetry != null) { if (typeof object.telemetry !== "object") throw TypeError(".google.monitoring.v3.Service.telemetry: object expected"); - message.telemetry = $root.google.monitoring.v3.Service.Telemetry.fromObject(object.telemetry); + message.telemetry = $root.google.monitoring.v3.Service.Telemetry.fromObject(object.telemetry, long + 1); } if (object.userLabels) { if (typeof object.userLabels !== "object") throw TypeError(".google.monitoring.v3.Service.userLabels: object expected"); message.userLabels = {}; - for (var keys = Object.keys(object.userLabels), i = 0; i < keys.length; ++i) + for (var keys = Object.keys(object.userLabels), i = 0; i < keys.length; ++i) { + if (keys[i] === "__proto__") + $util.makeProp(message.userLabels, keys[i]); message.userLabels[keys[i]] = String(object.userLabels[keys[i]]); + } } return message; }; @@ -25368,8 +26417,11 @@ var keys2; if (message.userLabels && (keys2 = Object.keys(message.userLabels)).length) { object.userLabels = {}; - for (var j = 0; j < keys2.length; ++j) + for (var j = 0; j < keys2.length; ++j) { + if (keys2[j] === "__proto__") + $util.makeProp(object.userLabels, keys2[j]); object.userLabels[keys2[j]] = message.userLabels[keys2[j]]; + } } if (message.gkeNamespace != null && message.hasOwnProperty("gkeNamespace")) { object.gkeNamespace = $root.google.monitoring.v3.Service.GkeNamespace.toObject(message.gkeNamespace, options); @@ -25436,7 +26488,7 @@ function Custom(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -25491,9 +26543,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Custom.decode = function decode(reader, length, error) { + Custom.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.Service.Custom(); while (reader.pos < end) { var tag = reader.uint32(); @@ -25501,7 +26557,7 @@ break; switch (tag >>> 3) { default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -25532,9 +26588,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Custom.verify = function verify(message) { + Custom.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; return null; }; @@ -25546,9 +26606,13 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.Service.Custom} Custom */ - Custom.fromObject = function fromObject(object) { + Custom.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.Service.Custom) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); return new $root.google.monitoring.v3.Service.Custom(); }; @@ -25614,7 +26678,7 @@ function AppEngine(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -25679,9 +26743,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - AppEngine.decode = function decode(reader, length, error) { + AppEngine.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.Service.AppEngine(); while (reader.pos < end) { var tag = reader.uint32(); @@ -25693,7 +26761,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -25724,9 +26792,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - AppEngine.verify = function verify(message) { + AppEngine.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.moduleId != null && message.hasOwnProperty("moduleId")) if (!$util.isString(message.moduleId)) return "moduleId: string expected"; @@ -25741,9 +26813,13 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.Service.AppEngine} AppEngine */ - AppEngine.fromObject = function fromObject(object) { + AppEngine.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.Service.AppEngine) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.Service.AppEngine(); if (object.moduleId != null) message.moduleId = String(object.moduleId); @@ -25819,7 +26895,7 @@ function CloudEndpoints(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -25884,9 +26960,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - CloudEndpoints.decode = function decode(reader, length, error) { + CloudEndpoints.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.Service.CloudEndpoints(); while (reader.pos < end) { var tag = reader.uint32(); @@ -25898,7 +26978,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -25929,9 +27009,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - CloudEndpoints.verify = function verify(message) { + CloudEndpoints.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.service != null && message.hasOwnProperty("service")) if (!$util.isString(message.service)) return "service: string expected"; @@ -25946,9 +27030,13 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.Service.CloudEndpoints} CloudEndpoints */ - CloudEndpoints.fromObject = function fromObject(object) { + CloudEndpoints.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.Service.CloudEndpoints) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.Service.CloudEndpoints(); if (object.service != null) message.service = String(object.service); @@ -26027,7 +27115,7 @@ function ClusterIstio(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -26122,9 +27210,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ClusterIstio.decode = function decode(reader, length, error) { + ClusterIstio.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.Service.ClusterIstio(); while (reader.pos < end) { var tag = reader.uint32(); @@ -26148,7 +27240,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -26179,9 +27271,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ClusterIstio.verify = function verify(message) { + ClusterIstio.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.location != null && message.hasOwnProperty("location")) if (!$util.isString(message.location)) return "location: string expected"; @@ -26205,9 +27301,13 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.Service.ClusterIstio} ClusterIstio */ - ClusterIstio.fromObject = function fromObject(object) { + ClusterIstio.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.Service.ClusterIstio) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.Service.ClusterIstio(); if (object.location != null) message.location = String(object.location); @@ -26301,7 +27401,7 @@ function MeshIstio(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -26386,9 +27486,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - MeshIstio.decode = function decode(reader, length, error) { + MeshIstio.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.Service.MeshIstio(); while (reader.pos < end) { var tag = reader.uint32(); @@ -26408,7 +27512,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -26439,9 +27543,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - MeshIstio.verify = function verify(message) { + MeshIstio.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.meshUid != null && message.hasOwnProperty("meshUid")) if (!$util.isString(message.meshUid)) return "meshUid: string expected"; @@ -26462,9 +27570,13 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.Service.MeshIstio} MeshIstio */ - MeshIstio.fromObject = function fromObject(object) { + MeshIstio.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.Service.MeshIstio) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.Service.MeshIstio(); if (object.meshUid != null) message.meshUid = String(object.meshUid); @@ -26553,7 +27665,7 @@ function IstioCanonicalService(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -26638,9 +27750,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - IstioCanonicalService.decode = function decode(reader, length, error) { + IstioCanonicalService.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.Service.IstioCanonicalService(); while (reader.pos < end) { var tag = reader.uint32(); @@ -26660,7 +27776,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -26691,9 +27807,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - IstioCanonicalService.verify = function verify(message) { + IstioCanonicalService.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.meshUid != null && message.hasOwnProperty("meshUid")) if (!$util.isString(message.meshUid)) return "meshUid: string expected"; @@ -26714,9 +27834,13 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.Service.IstioCanonicalService} IstioCanonicalService */ - IstioCanonicalService.fromObject = function fromObject(object) { + IstioCanonicalService.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.Service.IstioCanonicalService) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.Service.IstioCanonicalService(); if (object.meshUid != null) message.meshUid = String(object.meshUid); @@ -26804,7 +27928,7 @@ function CloudRun(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -26879,9 +28003,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - CloudRun.decode = function decode(reader, length, error) { + CloudRun.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.Service.CloudRun(); while (reader.pos < end) { var tag = reader.uint32(); @@ -26897,7 +28025,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -26928,9 +28056,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - CloudRun.verify = function verify(message) { + CloudRun.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.serviceName != null && message.hasOwnProperty("serviceName")) if (!$util.isString(message.serviceName)) return "serviceName: string expected"; @@ -26948,9 +28080,13 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.Service.CloudRun} CloudRun */ - CloudRun.fromObject = function fromObject(object) { + CloudRun.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.Service.CloudRun) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.Service.CloudRun(); if (object.serviceName != null) message.serviceName = String(object.serviceName); @@ -27035,7 +28171,7 @@ function GkeNamespace(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -27130,9 +28266,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GkeNamespace.decode = function decode(reader, length, error) { + GkeNamespace.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.Service.GkeNamespace(); while (reader.pos < end) { var tag = reader.uint32(); @@ -27156,7 +28296,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -27187,9 +28327,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GkeNamespace.verify = function verify(message) { + GkeNamespace.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.projectId != null && message.hasOwnProperty("projectId")) if (!$util.isString(message.projectId)) return "projectId: string expected"; @@ -27213,9 +28357,13 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.Service.GkeNamespace} GkeNamespace */ - GkeNamespace.fromObject = function fromObject(object) { + GkeNamespace.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.Service.GkeNamespace) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.Service.GkeNamespace(); if (object.projectId != null) message.projectId = String(object.projectId); @@ -27312,7 +28460,7 @@ function GkeWorkload(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -27427,9 +28575,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GkeWorkload.decode = function decode(reader, length, error) { + GkeWorkload.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.Service.GkeWorkload(); while (reader.pos < end) { var tag = reader.uint32(); @@ -27461,7 +28613,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -27492,9 +28644,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GkeWorkload.verify = function verify(message) { + GkeWorkload.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.projectId != null && message.hasOwnProperty("projectId")) if (!$util.isString(message.projectId)) return "projectId: string expected"; @@ -27524,9 +28680,13 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.Service.GkeWorkload} GkeWorkload */ - GkeWorkload.fromObject = function fromObject(object) { + GkeWorkload.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.Service.GkeWorkload) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.Service.GkeWorkload(); if (object.projectId != null) message.projectId = String(object.projectId); @@ -27632,7 +28792,7 @@ function GkeService(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -27737,9 +28897,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GkeService.decode = function decode(reader, length, error) { + GkeService.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.Service.GkeService(); while (reader.pos < end) { var tag = reader.uint32(); @@ -27767,7 +28931,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -27798,9 +28962,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GkeService.verify = function verify(message) { + GkeService.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.projectId != null && message.hasOwnProperty("projectId")) if (!$util.isString(message.projectId)) return "projectId: string expected"; @@ -27827,9 +28995,13 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.Service.GkeService} GkeService */ - GkeService.fromObject = function fromObject(object) { + GkeService.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.Service.GkeService) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.Service.GkeService(); if (object.projectId != null) message.projectId = String(object.projectId); @@ -27928,7 +29100,7 @@ this.serviceLabels = {}; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -28004,9 +29176,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - BasicService.decode = function decode(reader, length, error) { + BasicService.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.Service.BasicService(), key, value; while (reader.pos < end) { var tag = reader.uint32(); @@ -28033,15 +29209,17 @@ value = reader.string(); break; default: - reader.skipType(tag2 & 7); + reader.skipType(tag2 & 7, long); break; } } + if (key === "__proto__") + $util.makeProp(message.serviceLabels, key); message.serviceLabels[key] = value; break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -28072,9 +29250,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - BasicService.verify = function verify(message) { + BasicService.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.serviceType != null && message.hasOwnProperty("serviceType")) if (!$util.isString(message.serviceType)) return "serviceType: string expected"; @@ -28097,9 +29279,13 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.Service.BasicService} BasicService */ - BasicService.fromObject = function fromObject(object) { + BasicService.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.Service.BasicService) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.Service.BasicService(); if (object.serviceType != null) message.serviceType = String(object.serviceType); @@ -28107,8 +29293,11 @@ if (typeof object.serviceLabels !== "object") throw TypeError(".google.monitoring.v3.Service.BasicService.serviceLabels: object expected"); message.serviceLabels = {}; - for (var keys = Object.keys(object.serviceLabels), i = 0; i < keys.length; ++i) + for (var keys = Object.keys(object.serviceLabels), i = 0; i < keys.length; ++i) { + if (keys[i] === "__proto__") + $util.makeProp(message.serviceLabels, keys[i]); message.serviceLabels[keys[i]] = String(object.serviceLabels[keys[i]]); + } } return message; }; @@ -28135,8 +29324,11 @@ var keys2; if (message.serviceLabels && (keys2 = Object.keys(message.serviceLabels)).length) { object.serviceLabels = {}; - for (var j = 0; j < keys2.length; ++j) + for (var j = 0; j < keys2.length; ++j) { + if (keys2[j] === "__proto__") + $util.makeProp(object.serviceLabels, keys2[j]); object.serviceLabels[keys2[j]] = message.serviceLabels[keys2[j]]; + } } return object; }; @@ -28190,7 +29382,7 @@ function Telemetry(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -28255,9 +29447,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Telemetry.decode = function decode(reader, length, error) { + Telemetry.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.Service.Telemetry(); while (reader.pos < end) { var tag = reader.uint32(); @@ -28269,7 +29465,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -28300,9 +29496,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Telemetry.verify = function verify(message) { + Telemetry.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.resourceName != null && message.hasOwnProperty("resourceName")) if (!$util.isString(message.resourceName)) return "resourceName: string expected"; @@ -28317,9 +29517,13 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.Service.Telemetry} Telemetry */ - Telemetry.fromObject = function fromObject(object) { + Telemetry.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.Service.Telemetry) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.Service.Telemetry(); if (object.resourceName != null) message.resourceName = String(object.resourceName); @@ -28405,7 +29609,7 @@ this.userLabels = {}; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -28545,9 +29749,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ServiceLevelObjective.decode = function decode(reader, length, error) { + ServiceLevelObjective.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.ServiceLevelObjective(), key, value; while (reader.pos < end) { var tag = reader.uint32(); @@ -28563,7 +29771,7 @@ break; } case 3: { - message.serviceLevelIndicator = $root.google.monitoring.v3.ServiceLevelIndicator.decode(reader, reader.uint32()); + message.serviceLevelIndicator = $root.google.monitoring.v3.ServiceLevelIndicator.decode(reader, reader.uint32(), undefined, long + 1); break; } case 4: { @@ -28571,7 +29779,7 @@ break; } case 5: { - message.rollingPeriod = $root.google.protobuf.Duration.decode(reader, reader.uint32()); + message.rollingPeriod = $root.google.protobuf.Duration.decode(reader, reader.uint32(), undefined, long + 1); break; } case 6: { @@ -28594,15 +29802,17 @@ value = reader.string(); break; default: - reader.skipType(tag2 & 7); + reader.skipType(tag2 & 7, long); break; } } + if (key === "__proto__") + $util.makeProp(message.userLabels, key); message.userLabels[key] = value; break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -28633,9 +29843,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ServiceLevelObjective.verify = function verify(message) { + ServiceLevelObjective.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; var properties = {}; if (message.name != null && message.hasOwnProperty("name")) if (!$util.isString(message.name)) @@ -28644,7 +29858,7 @@ if (!$util.isString(message.displayName)) return "displayName: string expected"; if (message.serviceLevelIndicator != null && message.hasOwnProperty("serviceLevelIndicator")) { - var error = $root.google.monitoring.v3.ServiceLevelIndicator.verify(message.serviceLevelIndicator); + var error = $root.google.monitoring.v3.ServiceLevelIndicator.verify(message.serviceLevelIndicator, long + 1); if (error) return "serviceLevelIndicator." + error; } @@ -28654,7 +29868,7 @@ if (message.rollingPeriod != null && message.hasOwnProperty("rollingPeriod")) { properties.period = 1; { - var error = $root.google.protobuf.Duration.verify(message.rollingPeriod); + var error = $root.google.protobuf.Duration.verify(message.rollingPeriod, long + 1); if (error) return "rollingPeriod." + error; } @@ -28696,9 +29910,13 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.ServiceLevelObjective} ServiceLevelObjective */ - ServiceLevelObjective.fromObject = function fromObject(object) { + ServiceLevelObjective.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.ServiceLevelObjective) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.ServiceLevelObjective(); if (object.name != null) message.name = String(object.name); @@ -28707,14 +29925,14 @@ if (object.serviceLevelIndicator != null) { if (typeof object.serviceLevelIndicator !== "object") throw TypeError(".google.monitoring.v3.ServiceLevelObjective.serviceLevelIndicator: object expected"); - message.serviceLevelIndicator = $root.google.monitoring.v3.ServiceLevelIndicator.fromObject(object.serviceLevelIndicator); + message.serviceLevelIndicator = $root.google.monitoring.v3.ServiceLevelIndicator.fromObject(object.serviceLevelIndicator, long + 1); } if (object.goal != null) message.goal = Number(object.goal); if (object.rollingPeriod != null) { if (typeof object.rollingPeriod !== "object") throw TypeError(".google.monitoring.v3.ServiceLevelObjective.rollingPeriod: object expected"); - message.rollingPeriod = $root.google.protobuf.Duration.fromObject(object.rollingPeriod); + message.rollingPeriod = $root.google.protobuf.Duration.fromObject(object.rollingPeriod, long + 1); } switch (object.calendarPeriod) { default: @@ -28760,8 +29978,11 @@ if (typeof object.userLabels !== "object") throw TypeError(".google.monitoring.v3.ServiceLevelObjective.userLabels: object expected"); message.userLabels = {}; - for (var keys = Object.keys(object.userLabels), i = 0; i < keys.length; ++i) + for (var keys = Object.keys(object.userLabels), i = 0; i < keys.length; ++i) { + if (keys[i] === "__proto__") + $util.makeProp(message.userLabels, keys[i]); message.userLabels[keys[i]] = String(object.userLabels[keys[i]]); + } } return message; }; @@ -28808,8 +30029,11 @@ var keys2; if (message.userLabels && (keys2 = Object.keys(message.userLabels)).length) { object.userLabels = {}; - for (var j = 0; j < keys2.length; ++j) + for (var j = 0; j < keys2.length; ++j) { + if (keys2[j] === "__proto__") + $util.makeProp(object.userLabels, keys2[j]); object.userLabels[keys2[j]] = message.userLabels[keys2[j]]; + } } return object; }; @@ -28881,7 +30105,7 @@ function ServiceLevelIndicator(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -28980,9 +30204,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ServiceLevelIndicator.decode = function decode(reader, length, error) { + ServiceLevelIndicator.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.ServiceLevelIndicator(); while (reader.pos < end) { var tag = reader.uint32(); @@ -28990,19 +30218,19 @@ break; switch (tag >>> 3) { case 4: { - message.basicSli = $root.google.monitoring.v3.BasicSli.decode(reader, reader.uint32()); + message.basicSli = $root.google.monitoring.v3.BasicSli.decode(reader, reader.uint32(), undefined, long + 1); break; } case 1: { - message.requestBased = $root.google.monitoring.v3.RequestBasedSli.decode(reader, reader.uint32()); + message.requestBased = $root.google.monitoring.v3.RequestBasedSli.decode(reader, reader.uint32(), undefined, long + 1); break; } case 2: { - message.windowsBased = $root.google.monitoring.v3.WindowsBasedSli.decode(reader, reader.uint32()); + message.windowsBased = $root.google.monitoring.v3.WindowsBasedSli.decode(reader, reader.uint32(), undefined, long + 1); break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -29033,14 +30261,18 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ServiceLevelIndicator.verify = function verify(message) { + ServiceLevelIndicator.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; var properties = {}; if (message.basicSli != null && message.hasOwnProperty("basicSli")) { properties.type = 1; { - var error = $root.google.monitoring.v3.BasicSli.verify(message.basicSli); + var error = $root.google.monitoring.v3.BasicSli.verify(message.basicSli, long + 1); if (error) return "basicSli." + error; } @@ -29050,7 +30282,7 @@ return "type: multiple values"; properties.type = 1; { - var error = $root.google.monitoring.v3.RequestBasedSli.verify(message.requestBased); + var error = $root.google.monitoring.v3.RequestBasedSli.verify(message.requestBased, long + 1); if (error) return "requestBased." + error; } @@ -29060,7 +30292,7 @@ return "type: multiple values"; properties.type = 1; { - var error = $root.google.monitoring.v3.WindowsBasedSli.verify(message.windowsBased); + var error = $root.google.monitoring.v3.WindowsBasedSli.verify(message.windowsBased, long + 1); if (error) return "windowsBased." + error; } @@ -29076,24 +30308,28 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.ServiceLevelIndicator} ServiceLevelIndicator */ - ServiceLevelIndicator.fromObject = function fromObject(object) { + ServiceLevelIndicator.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.ServiceLevelIndicator) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.ServiceLevelIndicator(); if (object.basicSli != null) { if (typeof object.basicSli !== "object") throw TypeError(".google.monitoring.v3.ServiceLevelIndicator.basicSli: object expected"); - message.basicSli = $root.google.monitoring.v3.BasicSli.fromObject(object.basicSli); + message.basicSli = $root.google.monitoring.v3.BasicSli.fromObject(object.basicSli, long + 1); } if (object.requestBased != null) { if (typeof object.requestBased !== "object") throw TypeError(".google.monitoring.v3.ServiceLevelIndicator.requestBased: object expected"); - message.requestBased = $root.google.monitoring.v3.RequestBasedSli.fromObject(object.requestBased); + message.requestBased = $root.google.monitoring.v3.RequestBasedSli.fromObject(object.requestBased, long + 1); } if (object.windowsBased != null) { if (typeof object.windowsBased !== "object") throw TypeError(".google.monitoring.v3.ServiceLevelIndicator.windowsBased: object expected"); - message.windowsBased = $root.google.monitoring.v3.WindowsBasedSli.fromObject(object.windowsBased); + message.windowsBased = $root.google.monitoring.v3.WindowsBasedSli.fromObject(object.windowsBased, long + 1); } return message; }; @@ -29185,7 +30421,7 @@ this.version = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -29307,9 +30543,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - BasicSli.decode = function decode(reader, length, error) { + BasicSli.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.BasicSli(); while (reader.pos < end) { var tag = reader.uint32(); @@ -29335,15 +30575,15 @@ break; } case 2: { - message.availability = $root.google.monitoring.v3.BasicSli.AvailabilityCriteria.decode(reader, reader.uint32()); + message.availability = $root.google.monitoring.v3.BasicSli.AvailabilityCriteria.decode(reader, reader.uint32(), undefined, long + 1); break; } case 3: { - message.latency = $root.google.monitoring.v3.BasicSli.LatencyCriteria.decode(reader, reader.uint32()); + message.latency = $root.google.monitoring.v3.BasicSli.LatencyCriteria.decode(reader, reader.uint32(), undefined, long + 1); break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -29374,9 +30614,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - BasicSli.verify = function verify(message) { + BasicSli.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; var properties = {}; if (message.method != null && message.hasOwnProperty("method")) { if (!Array.isArray(message.method)) @@ -29402,7 +30646,7 @@ if (message.availability != null && message.hasOwnProperty("availability")) { properties.sliCriteria = 1; { - var error = $root.google.monitoring.v3.BasicSli.AvailabilityCriteria.verify(message.availability); + var error = $root.google.monitoring.v3.BasicSli.AvailabilityCriteria.verify(message.availability, long + 1); if (error) return "availability." + error; } @@ -29412,7 +30656,7 @@ return "sliCriteria: multiple values"; properties.sliCriteria = 1; { - var error = $root.google.monitoring.v3.BasicSli.LatencyCriteria.verify(message.latency); + var error = $root.google.monitoring.v3.BasicSli.LatencyCriteria.verify(message.latency, long + 1); if (error) return "latency." + error; } @@ -29428,9 +30672,13 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.BasicSli} BasicSli */ - BasicSli.fromObject = function fromObject(object) { + BasicSli.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.BasicSli) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.BasicSli(); if (object.method) { if (!Array.isArray(object.method)) @@ -29456,12 +30704,12 @@ if (object.availability != null) { if (typeof object.availability !== "object") throw TypeError(".google.monitoring.v3.BasicSli.availability: object expected"); - message.availability = $root.google.monitoring.v3.BasicSli.AvailabilityCriteria.fromObject(object.availability); + message.availability = $root.google.monitoring.v3.BasicSli.AvailabilityCriteria.fromObject(object.availability, long + 1); } if (object.latency != null) { if (typeof object.latency !== "object") throw TypeError(".google.monitoring.v3.BasicSli.latency: object expected"); - message.latency = $root.google.monitoring.v3.BasicSli.LatencyCriteria.fromObject(object.latency); + message.latency = $root.google.monitoring.v3.BasicSli.LatencyCriteria.fromObject(object.latency, long + 1); } return message; }; @@ -29557,7 +30805,7 @@ function AvailabilityCriteria(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -29612,9 +30860,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - AvailabilityCriteria.decode = function decode(reader, length, error) { + AvailabilityCriteria.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.BasicSli.AvailabilityCriteria(); while (reader.pos < end) { var tag = reader.uint32(); @@ -29622,7 +30874,7 @@ break; switch (tag >>> 3) { default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -29653,9 +30905,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - AvailabilityCriteria.verify = function verify(message) { + AvailabilityCriteria.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; return null; }; @@ -29667,9 +30923,13 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.BasicSli.AvailabilityCriteria} AvailabilityCriteria */ - AvailabilityCriteria.fromObject = function fromObject(object) { + AvailabilityCriteria.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.BasicSli.AvailabilityCriteria) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); return new $root.google.monitoring.v3.BasicSli.AvailabilityCriteria(); }; @@ -29735,7 +30995,7 @@ function LatencyCriteria(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -29800,9 +31060,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - LatencyCriteria.decode = function decode(reader, length, error) { + LatencyCriteria.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.BasicSli.LatencyCriteria(); while (reader.pos < end) { var tag = reader.uint32(); @@ -29810,11 +31074,11 @@ break; switch (tag >>> 3) { case 3: { - message.threshold = $root.google.protobuf.Duration.decode(reader, reader.uint32()); + message.threshold = $root.google.protobuf.Duration.decode(reader, reader.uint32(), undefined, long + 1); break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -29845,11 +31109,15 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - LatencyCriteria.verify = function verify(message) { + LatencyCriteria.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.threshold != null && message.hasOwnProperty("threshold")) { - var error = $root.google.protobuf.Duration.verify(message.threshold); + var error = $root.google.protobuf.Duration.verify(message.threshold, long + 1); if (error) return "threshold." + error; } @@ -29864,14 +31132,18 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.BasicSli.LatencyCriteria} LatencyCriteria */ - LatencyCriteria.fromObject = function fromObject(object) { + LatencyCriteria.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.BasicSli.LatencyCriteria) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.BasicSli.LatencyCriteria(); if (object.threshold != null) { if (typeof object.threshold !== "object") throw TypeError(".google.monitoring.v3.BasicSli.LatencyCriteria.threshold: object expected"); - message.threshold = $root.google.protobuf.Duration.fromObject(object.threshold); + message.threshold = $root.google.protobuf.Duration.fromObject(object.threshold, long + 1); } return message; }; @@ -29949,7 +31221,7 @@ function Range(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -30024,9 +31296,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Range.decode = function decode(reader, length, error) { + Range.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.Range(); while (reader.pos < end) { var tag = reader.uint32(); @@ -30042,7 +31318,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -30073,9 +31349,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Range.verify = function verify(message) { + Range.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.min != null && message.hasOwnProperty("min")) if (typeof message.min !== "number") return "min: number expected"; @@ -30093,9 +31373,13 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.Range} Range */ - Range.fromObject = function fromObject(object) { + Range.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.Range) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.Range(); if (object.min != null) message.min = Number(object.min); @@ -30178,7 +31462,7 @@ function RequestBasedSli(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -30267,9 +31551,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - RequestBasedSli.decode = function decode(reader, length, error) { + RequestBasedSli.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.RequestBasedSli(); while (reader.pos < end) { var tag = reader.uint32(); @@ -30277,15 +31565,15 @@ break; switch (tag >>> 3) { case 1: { - message.goodTotalRatio = $root.google.monitoring.v3.TimeSeriesRatio.decode(reader, reader.uint32()); + message.goodTotalRatio = $root.google.monitoring.v3.TimeSeriesRatio.decode(reader, reader.uint32(), undefined, long + 1); break; } case 3: { - message.distributionCut = $root.google.monitoring.v3.DistributionCut.decode(reader, reader.uint32()); + message.distributionCut = $root.google.monitoring.v3.DistributionCut.decode(reader, reader.uint32(), undefined, long + 1); break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -30316,14 +31604,18 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - RequestBasedSli.verify = function verify(message) { + RequestBasedSli.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; var properties = {}; if (message.goodTotalRatio != null && message.hasOwnProperty("goodTotalRatio")) { properties.method = 1; { - var error = $root.google.monitoring.v3.TimeSeriesRatio.verify(message.goodTotalRatio); + var error = $root.google.monitoring.v3.TimeSeriesRatio.verify(message.goodTotalRatio, long + 1); if (error) return "goodTotalRatio." + error; } @@ -30333,7 +31625,7 @@ return "method: multiple values"; properties.method = 1; { - var error = $root.google.monitoring.v3.DistributionCut.verify(message.distributionCut); + var error = $root.google.monitoring.v3.DistributionCut.verify(message.distributionCut, long + 1); if (error) return "distributionCut." + error; } @@ -30349,19 +31641,23 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.RequestBasedSli} RequestBasedSli */ - RequestBasedSli.fromObject = function fromObject(object) { + RequestBasedSli.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.RequestBasedSli) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.RequestBasedSli(); if (object.goodTotalRatio != null) { if (typeof object.goodTotalRatio !== "object") throw TypeError(".google.monitoring.v3.RequestBasedSli.goodTotalRatio: object expected"); - message.goodTotalRatio = $root.google.monitoring.v3.TimeSeriesRatio.fromObject(object.goodTotalRatio); + message.goodTotalRatio = $root.google.monitoring.v3.TimeSeriesRatio.fromObject(object.goodTotalRatio, long + 1); } if (object.distributionCut != null) { if (typeof object.distributionCut !== "object") throw TypeError(".google.monitoring.v3.RequestBasedSli.distributionCut: object expected"); - message.distributionCut = $root.google.monitoring.v3.DistributionCut.fromObject(object.distributionCut); + message.distributionCut = $root.google.monitoring.v3.DistributionCut.fromObject(object.distributionCut, long + 1); } return message; }; @@ -30443,7 +31739,7 @@ function TimeSeriesRatio(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -30528,9 +31824,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - TimeSeriesRatio.decode = function decode(reader, length, error) { + TimeSeriesRatio.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.TimeSeriesRatio(); while (reader.pos < end) { var tag = reader.uint32(); @@ -30550,7 +31850,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -30581,9 +31881,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - TimeSeriesRatio.verify = function verify(message) { + TimeSeriesRatio.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.goodServiceFilter != null && message.hasOwnProperty("goodServiceFilter")) if (!$util.isString(message.goodServiceFilter)) return "goodServiceFilter: string expected"; @@ -30604,9 +31908,13 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.TimeSeriesRatio} TimeSeriesRatio */ - TimeSeriesRatio.fromObject = function fromObject(object) { + TimeSeriesRatio.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.TimeSeriesRatio) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.TimeSeriesRatio(); if (object.goodServiceFilter != null) message.goodServiceFilter = String(object.goodServiceFilter); @@ -30694,7 +32002,7 @@ function DistributionCut(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -30769,9 +32077,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - DistributionCut.decode = function decode(reader, length, error) { + DistributionCut.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.DistributionCut(); while (reader.pos < end) { var tag = reader.uint32(); @@ -30783,11 +32095,11 @@ break; } case 5: { - message.range = $root.google.monitoring.v3.Range.decode(reader, reader.uint32()); + message.range = $root.google.monitoring.v3.Range.decode(reader, reader.uint32(), undefined, long + 1); break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -30818,14 +32130,18 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - DistributionCut.verify = function verify(message) { + DistributionCut.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.distributionFilter != null && message.hasOwnProperty("distributionFilter")) if (!$util.isString(message.distributionFilter)) return "distributionFilter: string expected"; if (message.range != null && message.hasOwnProperty("range")) { - var error = $root.google.monitoring.v3.Range.verify(message.range); + var error = $root.google.monitoring.v3.Range.verify(message.range, long + 1); if (error) return "range." + error; } @@ -30840,16 +32156,20 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.DistributionCut} DistributionCut */ - DistributionCut.fromObject = function fromObject(object) { + DistributionCut.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.DistributionCut) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.DistributionCut(); if (object.distributionFilter != null) message.distributionFilter = String(object.distributionFilter); if (object.range != null) { if (typeof object.range !== "object") throw TypeError(".google.monitoring.v3.DistributionCut.range: object expected"); - message.range = $root.google.monitoring.v3.Range.fromObject(object.range); + message.range = $root.google.monitoring.v3.Range.fromObject(object.range, long + 1); } return message; }; @@ -30931,7 +32251,7 @@ function WindowsBasedSli(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -31050,9 +32370,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - WindowsBasedSli.decode = function decode(reader, length, error) { + WindowsBasedSli.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.WindowsBasedSli(); while (reader.pos < end) { var tag = reader.uint32(); @@ -31064,23 +32388,23 @@ break; } case 2: { - message.goodTotalRatioThreshold = $root.google.monitoring.v3.WindowsBasedSli.PerformanceThreshold.decode(reader, reader.uint32()); + message.goodTotalRatioThreshold = $root.google.monitoring.v3.WindowsBasedSli.PerformanceThreshold.decode(reader, reader.uint32(), undefined, long + 1); break; } case 6: { - message.metricMeanInRange = $root.google.monitoring.v3.WindowsBasedSli.MetricRange.decode(reader, reader.uint32()); + message.metricMeanInRange = $root.google.monitoring.v3.WindowsBasedSli.MetricRange.decode(reader, reader.uint32(), undefined, long + 1); break; } case 7: { - message.metricSumInRange = $root.google.monitoring.v3.WindowsBasedSli.MetricRange.decode(reader, reader.uint32()); + message.metricSumInRange = $root.google.monitoring.v3.WindowsBasedSli.MetricRange.decode(reader, reader.uint32(), undefined, long + 1); break; } case 4: { - message.windowPeriod = $root.google.protobuf.Duration.decode(reader, reader.uint32()); + message.windowPeriod = $root.google.protobuf.Duration.decode(reader, reader.uint32(), undefined, long + 1); break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -31111,9 +32435,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - WindowsBasedSli.verify = function verify(message) { + WindowsBasedSli.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; var properties = {}; if (message.goodBadMetricFilter != null && message.hasOwnProperty("goodBadMetricFilter")) { properties.windowCriterion = 1; @@ -31125,7 +32453,7 @@ return "windowCriterion: multiple values"; properties.windowCriterion = 1; { - var error = $root.google.monitoring.v3.WindowsBasedSli.PerformanceThreshold.verify(message.goodTotalRatioThreshold); + var error = $root.google.monitoring.v3.WindowsBasedSli.PerformanceThreshold.verify(message.goodTotalRatioThreshold, long + 1); if (error) return "goodTotalRatioThreshold." + error; } @@ -31135,7 +32463,7 @@ return "windowCriterion: multiple values"; properties.windowCriterion = 1; { - var error = $root.google.monitoring.v3.WindowsBasedSli.MetricRange.verify(message.metricMeanInRange); + var error = $root.google.monitoring.v3.WindowsBasedSli.MetricRange.verify(message.metricMeanInRange, long + 1); if (error) return "metricMeanInRange." + error; } @@ -31145,13 +32473,13 @@ return "windowCriterion: multiple values"; properties.windowCriterion = 1; { - var error = $root.google.monitoring.v3.WindowsBasedSli.MetricRange.verify(message.metricSumInRange); + var error = $root.google.monitoring.v3.WindowsBasedSli.MetricRange.verify(message.metricSumInRange, long + 1); if (error) return "metricSumInRange." + error; } } if (message.windowPeriod != null && message.hasOwnProperty("windowPeriod")) { - var error = $root.google.protobuf.Duration.verify(message.windowPeriod); + var error = $root.google.protobuf.Duration.verify(message.windowPeriod, long + 1); if (error) return "windowPeriod." + error; } @@ -31166,31 +32494,35 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.WindowsBasedSli} WindowsBasedSli */ - WindowsBasedSli.fromObject = function fromObject(object) { + WindowsBasedSli.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.WindowsBasedSli) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.WindowsBasedSli(); if (object.goodBadMetricFilter != null) message.goodBadMetricFilter = String(object.goodBadMetricFilter); if (object.goodTotalRatioThreshold != null) { if (typeof object.goodTotalRatioThreshold !== "object") throw TypeError(".google.monitoring.v3.WindowsBasedSli.goodTotalRatioThreshold: object expected"); - message.goodTotalRatioThreshold = $root.google.monitoring.v3.WindowsBasedSli.PerformanceThreshold.fromObject(object.goodTotalRatioThreshold); + message.goodTotalRatioThreshold = $root.google.monitoring.v3.WindowsBasedSli.PerformanceThreshold.fromObject(object.goodTotalRatioThreshold, long + 1); } if (object.metricMeanInRange != null) { if (typeof object.metricMeanInRange !== "object") throw TypeError(".google.monitoring.v3.WindowsBasedSli.metricMeanInRange: object expected"); - message.metricMeanInRange = $root.google.monitoring.v3.WindowsBasedSli.MetricRange.fromObject(object.metricMeanInRange); + message.metricMeanInRange = $root.google.monitoring.v3.WindowsBasedSli.MetricRange.fromObject(object.metricMeanInRange, long + 1); } if (object.metricSumInRange != null) { if (typeof object.metricSumInRange !== "object") throw TypeError(".google.monitoring.v3.WindowsBasedSli.metricSumInRange: object expected"); - message.metricSumInRange = $root.google.monitoring.v3.WindowsBasedSli.MetricRange.fromObject(object.metricSumInRange); + message.metricSumInRange = $root.google.monitoring.v3.WindowsBasedSli.MetricRange.fromObject(object.metricSumInRange, long + 1); } if (object.windowPeriod != null) { if (typeof object.windowPeriod !== "object") throw TypeError(".google.monitoring.v3.WindowsBasedSli.windowPeriod: object expected"); - message.windowPeriod = $root.google.protobuf.Duration.fromObject(object.windowPeriod); + message.windowPeriod = $root.google.protobuf.Duration.fromObject(object.windowPeriod, long + 1); } return message; }; @@ -31283,7 +32615,7 @@ function PerformanceThreshold(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -31382,9 +32714,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - PerformanceThreshold.decode = function decode(reader, length, error) { + PerformanceThreshold.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.WindowsBasedSli.PerformanceThreshold(); while (reader.pos < end) { var tag = reader.uint32(); @@ -31392,11 +32728,11 @@ break; switch (tag >>> 3) { case 1: { - message.performance = $root.google.monitoring.v3.RequestBasedSli.decode(reader, reader.uint32()); + message.performance = $root.google.monitoring.v3.RequestBasedSli.decode(reader, reader.uint32(), undefined, long + 1); break; } case 3: { - message.basicSliPerformance = $root.google.monitoring.v3.BasicSli.decode(reader, reader.uint32()); + message.basicSliPerformance = $root.google.monitoring.v3.BasicSli.decode(reader, reader.uint32(), undefined, long + 1); break; } case 2: { @@ -31404,7 +32740,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -31435,14 +32771,18 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - PerformanceThreshold.verify = function verify(message) { + PerformanceThreshold.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; var properties = {}; if (message.performance != null && message.hasOwnProperty("performance")) { properties.type = 1; { - var error = $root.google.monitoring.v3.RequestBasedSli.verify(message.performance); + var error = $root.google.monitoring.v3.RequestBasedSli.verify(message.performance, long + 1); if (error) return "performance." + error; } @@ -31452,7 +32792,7 @@ return "type: multiple values"; properties.type = 1; { - var error = $root.google.monitoring.v3.BasicSli.verify(message.basicSliPerformance); + var error = $root.google.monitoring.v3.BasicSli.verify(message.basicSliPerformance, long + 1); if (error) return "basicSliPerformance." + error; } @@ -31471,19 +32811,23 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.WindowsBasedSli.PerformanceThreshold} PerformanceThreshold */ - PerformanceThreshold.fromObject = function fromObject(object) { + PerformanceThreshold.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.WindowsBasedSli.PerformanceThreshold) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.WindowsBasedSli.PerformanceThreshold(); if (object.performance != null) { if (typeof object.performance !== "object") throw TypeError(".google.monitoring.v3.WindowsBasedSli.PerformanceThreshold.performance: object expected"); - message.performance = $root.google.monitoring.v3.RequestBasedSli.fromObject(object.performance); + message.performance = $root.google.monitoring.v3.RequestBasedSli.fromObject(object.performance, long + 1); } if (object.basicSliPerformance != null) { if (typeof object.basicSliPerformance !== "object") throw TypeError(".google.monitoring.v3.WindowsBasedSli.PerformanceThreshold.basicSliPerformance: object expected"); - message.basicSliPerformance = $root.google.monitoring.v3.BasicSli.fromObject(object.basicSliPerformance); + message.basicSliPerformance = $root.google.monitoring.v3.BasicSli.fromObject(object.basicSliPerformance, long + 1); } if (object.threshold != null) message.threshold = Number(object.threshold); @@ -31570,7 +32914,7 @@ function MetricRange(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -31645,9 +32989,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - MetricRange.decode = function decode(reader, length, error) { + MetricRange.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.WindowsBasedSli.MetricRange(); while (reader.pos < end) { var tag = reader.uint32(); @@ -31659,11 +33007,11 @@ break; } case 4: { - message.range = $root.google.monitoring.v3.Range.decode(reader, reader.uint32()); + message.range = $root.google.monitoring.v3.Range.decode(reader, reader.uint32(), undefined, long + 1); break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -31694,14 +33042,18 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - MetricRange.verify = function verify(message) { + MetricRange.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.timeSeries != null && message.hasOwnProperty("timeSeries")) if (!$util.isString(message.timeSeries)) return "timeSeries: string expected"; if (message.range != null && message.hasOwnProperty("range")) { - var error = $root.google.monitoring.v3.Range.verify(message.range); + var error = $root.google.monitoring.v3.Range.verify(message.range, long + 1); if (error) return "range." + error; } @@ -31716,16 +33068,20 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.WindowsBasedSli.MetricRange} MetricRange */ - MetricRange.fromObject = function fromObject(object) { + MetricRange.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.WindowsBasedSli.MetricRange) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.WindowsBasedSli.MetricRange(); if (object.timeSeries != null) message.timeSeries = String(object.timeSeries); if (object.range != null) { if (typeof object.range !== "object") throw TypeError(".google.monitoring.v3.WindowsBasedSli.MetricRange.range: object expected"); - message.range = $root.google.monitoring.v3.Range.fromObject(object.range); + message.range = $root.google.monitoring.v3.Range.fromObject(object.range, long + 1); } return message; }; @@ -32173,7 +33529,7 @@ function CreateServiceRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -32258,9 +33614,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - CreateServiceRequest.decode = function decode(reader, length, error) { + CreateServiceRequest.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.CreateServiceRequest(); while (reader.pos < end) { var tag = reader.uint32(); @@ -32276,11 +33636,11 @@ break; } case 2: { - message.service = $root.google.monitoring.v3.Service.decode(reader, reader.uint32()); + message.service = $root.google.monitoring.v3.Service.decode(reader, reader.uint32(), undefined, long + 1); break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -32311,9 +33671,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - CreateServiceRequest.verify = function verify(message) { + CreateServiceRequest.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.parent != null && message.hasOwnProperty("parent")) if (!$util.isString(message.parent)) return "parent: string expected"; @@ -32321,7 +33685,7 @@ if (!$util.isString(message.serviceId)) return "serviceId: string expected"; if (message.service != null && message.hasOwnProperty("service")) { - var error = $root.google.monitoring.v3.Service.verify(message.service); + var error = $root.google.monitoring.v3.Service.verify(message.service, long + 1); if (error) return "service." + error; } @@ -32336,9 +33700,13 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.CreateServiceRequest} CreateServiceRequest */ - CreateServiceRequest.fromObject = function fromObject(object) { + CreateServiceRequest.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.CreateServiceRequest) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.CreateServiceRequest(); if (object.parent != null) message.parent = String(object.parent); @@ -32347,7 +33715,7 @@ if (object.service != null) { if (typeof object.service !== "object") throw TypeError(".google.monitoring.v3.CreateServiceRequest.service: object expected"); - message.service = $root.google.monitoring.v3.Service.fromObject(object.service); + message.service = $root.google.monitoring.v3.Service.fromObject(object.service, long + 1); } return message; }; @@ -32428,7 +33796,7 @@ function GetServiceRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -32493,9 +33861,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetServiceRequest.decode = function decode(reader, length, error) { + GetServiceRequest.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.GetServiceRequest(); while (reader.pos < end) { var tag = reader.uint32(); @@ -32507,7 +33879,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -32538,9 +33910,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GetServiceRequest.verify = function verify(message) { + GetServiceRequest.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.name != null && message.hasOwnProperty("name")) if (!$util.isString(message.name)) return "name: string expected"; @@ -32555,9 +33931,13 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.GetServiceRequest} GetServiceRequest */ - GetServiceRequest.fromObject = function fromObject(object) { + GetServiceRequest.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.GetServiceRequest) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.GetServiceRequest(); if (object.name != null) message.name = String(object.name); @@ -32636,7 +34016,7 @@ function ListServicesRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -32731,9 +34111,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ListServicesRequest.decode = function decode(reader, length, error) { + ListServicesRequest.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.ListServicesRequest(); while (reader.pos < end) { var tag = reader.uint32(); @@ -32757,7 +34141,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -32788,9 +34172,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ListServicesRequest.verify = function verify(message) { + ListServicesRequest.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.parent != null && message.hasOwnProperty("parent")) if (!$util.isString(message.parent)) return "parent: string expected"; @@ -32814,9 +34202,13 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.ListServicesRequest} ListServicesRequest */ - ListServicesRequest.fromObject = function fromObject(object) { + ListServicesRequest.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.ListServicesRequest) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.ListServicesRequest(); if (object.parent != null) message.parent = String(object.parent); @@ -32910,7 +34302,7 @@ this.services = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -32986,9 +34378,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ListServicesResponse.decode = function decode(reader, length, error) { + ListServicesResponse.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.ListServicesResponse(); while (reader.pos < end) { var tag = reader.uint32(); @@ -32998,7 +34394,7 @@ case 1: { if (!(message.services && message.services.length)) message.services = []; - message.services.push($root.google.monitoring.v3.Service.decode(reader, reader.uint32())); + message.services.push($root.google.monitoring.v3.Service.decode(reader, reader.uint32(), undefined, long + 1)); break; } case 2: { @@ -33006,7 +34402,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -33037,14 +34433,18 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ListServicesResponse.verify = function verify(message) { + ListServicesResponse.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.services != null && message.hasOwnProperty("services")) { if (!Array.isArray(message.services)) return "services: array expected"; for (var i = 0; i < message.services.length; ++i) { - var error = $root.google.monitoring.v3.Service.verify(message.services[i]); + var error = $root.google.monitoring.v3.Service.verify(message.services[i], long + 1); if (error) return "services." + error; } @@ -33063,9 +34463,13 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.ListServicesResponse} ListServicesResponse */ - ListServicesResponse.fromObject = function fromObject(object) { + ListServicesResponse.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.ListServicesResponse) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.ListServicesResponse(); if (object.services) { if (!Array.isArray(object.services)) @@ -33074,7 +34478,7 @@ for (var i = 0; i < object.services.length; ++i) { if (typeof object.services[i] !== "object") throw TypeError(".google.monitoring.v3.ListServicesResponse.services: object expected"); - message.services[i] = $root.google.monitoring.v3.Service.fromObject(object.services[i]); + message.services[i] = $root.google.monitoring.v3.Service.fromObject(object.services[i], long + 1); } } if (object.nextPageToken != null) @@ -33159,7 +34563,7 @@ function UpdateServiceRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -33234,9 +34638,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - UpdateServiceRequest.decode = function decode(reader, length, error) { + UpdateServiceRequest.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.UpdateServiceRequest(); while (reader.pos < end) { var tag = reader.uint32(); @@ -33244,15 +34652,15 @@ break; switch (tag >>> 3) { case 1: { - message.service = $root.google.monitoring.v3.Service.decode(reader, reader.uint32()); + message.service = $root.google.monitoring.v3.Service.decode(reader, reader.uint32(), undefined, long + 1); break; } case 2: { - message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32(), undefined, long + 1); break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -33283,16 +34691,20 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - UpdateServiceRequest.verify = function verify(message) { + UpdateServiceRequest.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.service != null && message.hasOwnProperty("service")) { - var error = $root.google.monitoring.v3.Service.verify(message.service); + var error = $root.google.monitoring.v3.Service.verify(message.service, long + 1); if (error) return "service." + error; } if (message.updateMask != null && message.hasOwnProperty("updateMask")) { - var error = $root.google.protobuf.FieldMask.verify(message.updateMask); + var error = $root.google.protobuf.FieldMask.verify(message.updateMask, long + 1); if (error) return "updateMask." + error; } @@ -33307,19 +34719,23 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.UpdateServiceRequest} UpdateServiceRequest */ - UpdateServiceRequest.fromObject = function fromObject(object) { + UpdateServiceRequest.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.UpdateServiceRequest) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.UpdateServiceRequest(); if (object.service != null) { if (typeof object.service !== "object") throw TypeError(".google.monitoring.v3.UpdateServiceRequest.service: object expected"); - message.service = $root.google.monitoring.v3.Service.fromObject(object.service); + message.service = $root.google.monitoring.v3.Service.fromObject(object.service, long + 1); } if (object.updateMask != null) { if (typeof object.updateMask !== "object") throw TypeError(".google.monitoring.v3.UpdateServiceRequest.updateMask: object expected"); - message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); + message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask, long + 1); } return message; }; @@ -33397,7 +34813,7 @@ function DeleteServiceRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -33462,9 +34878,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - DeleteServiceRequest.decode = function decode(reader, length, error) { + DeleteServiceRequest.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.DeleteServiceRequest(); while (reader.pos < end) { var tag = reader.uint32(); @@ -33476,7 +34896,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -33507,9 +34927,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - DeleteServiceRequest.verify = function verify(message) { + DeleteServiceRequest.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.name != null && message.hasOwnProperty("name")) if (!$util.isString(message.name)) return "name: string expected"; @@ -33524,9 +34948,13 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.DeleteServiceRequest} DeleteServiceRequest */ - DeleteServiceRequest.fromObject = function fromObject(object) { + DeleteServiceRequest.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.DeleteServiceRequest) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.DeleteServiceRequest(); if (object.name != null) message.name = String(object.name); @@ -33604,7 +35032,7 @@ function CreateServiceLevelObjectiveRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -33689,9 +35117,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - CreateServiceLevelObjectiveRequest.decode = function decode(reader, length, error) { + CreateServiceLevelObjectiveRequest.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.CreateServiceLevelObjectiveRequest(); while (reader.pos < end) { var tag = reader.uint32(); @@ -33707,11 +35139,11 @@ break; } case 2: { - message.serviceLevelObjective = $root.google.monitoring.v3.ServiceLevelObjective.decode(reader, reader.uint32()); + message.serviceLevelObjective = $root.google.monitoring.v3.ServiceLevelObjective.decode(reader, reader.uint32(), undefined, long + 1); break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -33742,9 +35174,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - CreateServiceLevelObjectiveRequest.verify = function verify(message) { + CreateServiceLevelObjectiveRequest.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.parent != null && message.hasOwnProperty("parent")) if (!$util.isString(message.parent)) return "parent: string expected"; @@ -33752,7 +35188,7 @@ if (!$util.isString(message.serviceLevelObjectiveId)) return "serviceLevelObjectiveId: string expected"; if (message.serviceLevelObjective != null && message.hasOwnProperty("serviceLevelObjective")) { - var error = $root.google.monitoring.v3.ServiceLevelObjective.verify(message.serviceLevelObjective); + var error = $root.google.monitoring.v3.ServiceLevelObjective.verify(message.serviceLevelObjective, long + 1); if (error) return "serviceLevelObjective." + error; } @@ -33767,9 +35203,13 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.CreateServiceLevelObjectiveRequest} CreateServiceLevelObjectiveRequest */ - CreateServiceLevelObjectiveRequest.fromObject = function fromObject(object) { + CreateServiceLevelObjectiveRequest.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.CreateServiceLevelObjectiveRequest) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.CreateServiceLevelObjectiveRequest(); if (object.parent != null) message.parent = String(object.parent); @@ -33778,7 +35218,7 @@ if (object.serviceLevelObjective != null) { if (typeof object.serviceLevelObjective !== "object") throw TypeError(".google.monitoring.v3.CreateServiceLevelObjectiveRequest.serviceLevelObjective: object expected"); - message.serviceLevelObjective = $root.google.monitoring.v3.ServiceLevelObjective.fromObject(object.serviceLevelObjective); + message.serviceLevelObjective = $root.google.monitoring.v3.ServiceLevelObjective.fromObject(object.serviceLevelObjective, long + 1); } return message; }; @@ -33860,7 +35300,7 @@ function GetServiceLevelObjectiveRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -33935,9 +35375,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetServiceLevelObjectiveRequest.decode = function decode(reader, length, error) { + GetServiceLevelObjectiveRequest.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.GetServiceLevelObjectiveRequest(); while (reader.pos < end) { var tag = reader.uint32(); @@ -33953,7 +35397,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -33984,9 +35428,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GetServiceLevelObjectiveRequest.verify = function verify(message) { + GetServiceLevelObjectiveRequest.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.name != null && message.hasOwnProperty("name")) if (!$util.isString(message.name)) return "name: string expected"; @@ -34010,9 +35458,13 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.GetServiceLevelObjectiveRequest} GetServiceLevelObjectiveRequest */ - GetServiceLevelObjectiveRequest.fromObject = function fromObject(object) { + GetServiceLevelObjectiveRequest.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.GetServiceLevelObjectiveRequest) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.GetServiceLevelObjectiveRequest(); if (object.name != null) message.name = String(object.name); @@ -34116,7 +35568,7 @@ function ListServiceLevelObjectivesRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -34221,9 +35673,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ListServiceLevelObjectivesRequest.decode = function decode(reader, length, error) { + ListServiceLevelObjectivesRequest.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.ListServiceLevelObjectivesRequest(); while (reader.pos < end) { var tag = reader.uint32(); @@ -34251,7 +35707,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -34282,9 +35738,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ListServiceLevelObjectivesRequest.verify = function verify(message) { + ListServiceLevelObjectivesRequest.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.parent != null && message.hasOwnProperty("parent")) if (!$util.isString(message.parent)) return "parent: string expected"; @@ -34317,9 +35777,13 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.ListServiceLevelObjectivesRequest} ListServiceLevelObjectivesRequest */ - ListServiceLevelObjectivesRequest.fromObject = function fromObject(object) { + ListServiceLevelObjectivesRequest.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.ListServiceLevelObjectivesRequest) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.ListServiceLevelObjectivesRequest(); if (object.parent != null) message.parent = String(object.parent); @@ -34436,7 +35900,7 @@ this.serviceLevelObjectives = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -34512,9 +35976,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ListServiceLevelObjectivesResponse.decode = function decode(reader, length, error) { + ListServiceLevelObjectivesResponse.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.ListServiceLevelObjectivesResponse(); while (reader.pos < end) { var tag = reader.uint32(); @@ -34524,7 +35992,7 @@ case 1: { if (!(message.serviceLevelObjectives && message.serviceLevelObjectives.length)) message.serviceLevelObjectives = []; - message.serviceLevelObjectives.push($root.google.monitoring.v3.ServiceLevelObjective.decode(reader, reader.uint32())); + message.serviceLevelObjectives.push($root.google.monitoring.v3.ServiceLevelObjective.decode(reader, reader.uint32(), undefined, long + 1)); break; } case 2: { @@ -34532,7 +36000,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -34563,14 +36031,18 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ListServiceLevelObjectivesResponse.verify = function verify(message) { + ListServiceLevelObjectivesResponse.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.serviceLevelObjectives != null && message.hasOwnProperty("serviceLevelObjectives")) { if (!Array.isArray(message.serviceLevelObjectives)) return "serviceLevelObjectives: array expected"; for (var i = 0; i < message.serviceLevelObjectives.length; ++i) { - var error = $root.google.monitoring.v3.ServiceLevelObjective.verify(message.serviceLevelObjectives[i]); + var error = $root.google.monitoring.v3.ServiceLevelObjective.verify(message.serviceLevelObjectives[i], long + 1); if (error) return "serviceLevelObjectives." + error; } @@ -34589,9 +36061,13 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.ListServiceLevelObjectivesResponse} ListServiceLevelObjectivesResponse */ - ListServiceLevelObjectivesResponse.fromObject = function fromObject(object) { + ListServiceLevelObjectivesResponse.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.ListServiceLevelObjectivesResponse) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.ListServiceLevelObjectivesResponse(); if (object.serviceLevelObjectives) { if (!Array.isArray(object.serviceLevelObjectives)) @@ -34600,7 +36076,7 @@ for (var i = 0; i < object.serviceLevelObjectives.length; ++i) { if (typeof object.serviceLevelObjectives[i] !== "object") throw TypeError(".google.monitoring.v3.ListServiceLevelObjectivesResponse.serviceLevelObjectives: object expected"); - message.serviceLevelObjectives[i] = $root.google.monitoring.v3.ServiceLevelObjective.fromObject(object.serviceLevelObjectives[i]); + message.serviceLevelObjectives[i] = $root.google.monitoring.v3.ServiceLevelObjective.fromObject(object.serviceLevelObjectives[i], long + 1); } } if (object.nextPageToken != null) @@ -34685,7 +36161,7 @@ function UpdateServiceLevelObjectiveRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -34760,9 +36236,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - UpdateServiceLevelObjectiveRequest.decode = function decode(reader, length, error) { + UpdateServiceLevelObjectiveRequest.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.UpdateServiceLevelObjectiveRequest(); while (reader.pos < end) { var tag = reader.uint32(); @@ -34770,15 +36250,15 @@ break; switch (tag >>> 3) { case 1: { - message.serviceLevelObjective = $root.google.monitoring.v3.ServiceLevelObjective.decode(reader, reader.uint32()); + message.serviceLevelObjective = $root.google.monitoring.v3.ServiceLevelObjective.decode(reader, reader.uint32(), undefined, long + 1); break; } case 2: { - message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32(), undefined, long + 1); break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -34809,16 +36289,20 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - UpdateServiceLevelObjectiveRequest.verify = function verify(message) { + UpdateServiceLevelObjectiveRequest.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.serviceLevelObjective != null && message.hasOwnProperty("serviceLevelObjective")) { - var error = $root.google.monitoring.v3.ServiceLevelObjective.verify(message.serviceLevelObjective); + var error = $root.google.monitoring.v3.ServiceLevelObjective.verify(message.serviceLevelObjective, long + 1); if (error) return "serviceLevelObjective." + error; } if (message.updateMask != null && message.hasOwnProperty("updateMask")) { - var error = $root.google.protobuf.FieldMask.verify(message.updateMask); + var error = $root.google.protobuf.FieldMask.verify(message.updateMask, long + 1); if (error) return "updateMask." + error; } @@ -34833,19 +36317,23 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.UpdateServiceLevelObjectiveRequest} UpdateServiceLevelObjectiveRequest */ - UpdateServiceLevelObjectiveRequest.fromObject = function fromObject(object) { + UpdateServiceLevelObjectiveRequest.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.UpdateServiceLevelObjectiveRequest) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.UpdateServiceLevelObjectiveRequest(); if (object.serviceLevelObjective != null) { if (typeof object.serviceLevelObjective !== "object") throw TypeError(".google.monitoring.v3.UpdateServiceLevelObjectiveRequest.serviceLevelObjective: object expected"); - message.serviceLevelObjective = $root.google.monitoring.v3.ServiceLevelObjective.fromObject(object.serviceLevelObjective); + message.serviceLevelObjective = $root.google.monitoring.v3.ServiceLevelObjective.fromObject(object.serviceLevelObjective, long + 1); } if (object.updateMask != null) { if (typeof object.updateMask !== "object") throw TypeError(".google.monitoring.v3.UpdateServiceLevelObjectiveRequest.updateMask: object expected"); - message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); + message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask, long + 1); } return message; }; @@ -34923,7 +36411,7 @@ function DeleteServiceLevelObjectiveRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -34988,9 +36476,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - DeleteServiceLevelObjectiveRequest.decode = function decode(reader, length, error) { + DeleteServiceLevelObjectiveRequest.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.DeleteServiceLevelObjectiveRequest(); while (reader.pos < end) { var tag = reader.uint32(); @@ -35002,7 +36494,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -35033,9 +36525,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - DeleteServiceLevelObjectiveRequest.verify = function verify(message) { + DeleteServiceLevelObjectiveRequest.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.name != null && message.hasOwnProperty("name")) if (!$util.isString(message.name)) return "name: string expected"; @@ -35050,9 +36546,13 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.DeleteServiceLevelObjectiveRequest} DeleteServiceLevelObjectiveRequest */ - DeleteServiceLevelObjectiveRequest.fromObject = function fromObject(object) { + DeleteServiceLevelObjectiveRequest.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.DeleteServiceLevelObjectiveRequest) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.DeleteServiceLevelObjectiveRequest(); if (object.name != null) message.name = String(object.name); @@ -35131,7 +36631,7 @@ function Snooze(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -35226,9 +36726,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Snooze.decode = function decode(reader, length, error) { + Snooze.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.Snooze(); while (reader.pos < end) { var tag = reader.uint32(); @@ -35240,11 +36744,11 @@ break; } case 3: { - message.criteria = $root.google.monitoring.v3.Snooze.Criteria.decode(reader, reader.uint32()); + message.criteria = $root.google.monitoring.v3.Snooze.Criteria.decode(reader, reader.uint32(), undefined, long + 1); break; } case 4: { - message.interval = $root.google.monitoring.v3.TimeInterval.decode(reader, reader.uint32()); + message.interval = $root.google.monitoring.v3.TimeInterval.decode(reader, reader.uint32(), undefined, long + 1); break; } case 5: { @@ -35252,7 +36756,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -35283,19 +36787,23 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Snooze.verify = function verify(message) { + Snooze.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.name != null && message.hasOwnProperty("name")) if (!$util.isString(message.name)) return "name: string expected"; if (message.criteria != null && message.hasOwnProperty("criteria")) { - var error = $root.google.monitoring.v3.Snooze.Criteria.verify(message.criteria); + var error = $root.google.monitoring.v3.Snooze.Criteria.verify(message.criteria, long + 1); if (error) return "criteria." + error; } if (message.interval != null && message.hasOwnProperty("interval")) { - var error = $root.google.monitoring.v3.TimeInterval.verify(message.interval); + var error = $root.google.monitoring.v3.TimeInterval.verify(message.interval, long + 1); if (error) return "interval." + error; } @@ -35313,21 +36821,25 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.Snooze} Snooze */ - Snooze.fromObject = function fromObject(object) { + Snooze.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.Snooze) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.Snooze(); if (object.name != null) message.name = String(object.name); if (object.criteria != null) { if (typeof object.criteria !== "object") throw TypeError(".google.monitoring.v3.Snooze.criteria: object expected"); - message.criteria = $root.google.monitoring.v3.Snooze.Criteria.fromObject(object.criteria); + message.criteria = $root.google.monitoring.v3.Snooze.Criteria.fromObject(object.criteria, long + 1); } if (object.interval != null) { if (typeof object.interval !== "object") throw TypeError(".google.monitoring.v3.Snooze.interval: object expected"); - message.interval = $root.google.monitoring.v3.TimeInterval.fromObject(object.interval); + message.interval = $root.google.monitoring.v3.TimeInterval.fromObject(object.interval, long + 1); } if (object.displayName != null) message.displayName = String(object.displayName); @@ -35412,7 +36924,7 @@ this.policies = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -35488,9 +37000,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Criteria.decode = function decode(reader, length, error) { + Criteria.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.Snooze.Criteria(); while (reader.pos < end) { var tag = reader.uint32(); @@ -35508,7 +37024,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -35539,9 +37055,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Criteria.verify = function verify(message) { + Criteria.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.policies != null && message.hasOwnProperty("policies")) { if (!Array.isArray(message.policies)) return "policies: array expected"; @@ -35563,9 +37083,13 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.Snooze.Criteria} Criteria */ - Criteria.fromObject = function fromObject(object) { + Criteria.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.Snooze.Criteria) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.Snooze.Criteria(); if (object.policies) { if (!Array.isArray(object.policies)) @@ -35826,7 +37350,7 @@ function CreateSnoozeRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -35901,9 +37425,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - CreateSnoozeRequest.decode = function decode(reader, length, error) { + CreateSnoozeRequest.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.CreateSnoozeRequest(); while (reader.pos < end) { var tag = reader.uint32(); @@ -35915,11 +37443,11 @@ break; } case 2: { - message.snooze = $root.google.monitoring.v3.Snooze.decode(reader, reader.uint32()); + message.snooze = $root.google.monitoring.v3.Snooze.decode(reader, reader.uint32(), undefined, long + 1); break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -35950,14 +37478,18 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - CreateSnoozeRequest.verify = function verify(message) { + CreateSnoozeRequest.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.parent != null && message.hasOwnProperty("parent")) if (!$util.isString(message.parent)) return "parent: string expected"; if (message.snooze != null && message.hasOwnProperty("snooze")) { - var error = $root.google.monitoring.v3.Snooze.verify(message.snooze); + var error = $root.google.monitoring.v3.Snooze.verify(message.snooze, long + 1); if (error) return "snooze." + error; } @@ -35972,16 +37504,20 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.CreateSnoozeRequest} CreateSnoozeRequest */ - CreateSnoozeRequest.fromObject = function fromObject(object) { + CreateSnoozeRequest.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.CreateSnoozeRequest) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.CreateSnoozeRequest(); if (object.parent != null) message.parent = String(object.parent); if (object.snooze != null) { if (typeof object.snooze !== "object") throw TypeError(".google.monitoring.v3.CreateSnoozeRequest.snooze: object expected"); - message.snooze = $root.google.monitoring.v3.Snooze.fromObject(object.snooze); + message.snooze = $root.google.monitoring.v3.Snooze.fromObject(object.snooze, long + 1); } return message; }; @@ -36062,7 +37598,7 @@ function ListSnoozesRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -36157,9 +37693,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ListSnoozesRequest.decode = function decode(reader, length, error) { + ListSnoozesRequest.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.ListSnoozesRequest(); while (reader.pos < end) { var tag = reader.uint32(); @@ -36183,7 +37723,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -36214,9 +37754,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ListSnoozesRequest.verify = function verify(message) { + ListSnoozesRequest.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.parent != null && message.hasOwnProperty("parent")) if (!$util.isString(message.parent)) return "parent: string expected"; @@ -36240,9 +37784,13 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.ListSnoozesRequest} ListSnoozesRequest */ - ListSnoozesRequest.fromObject = function fromObject(object) { + ListSnoozesRequest.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.ListSnoozesRequest) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.ListSnoozesRequest(); if (object.parent != null) message.parent = String(object.parent); @@ -36336,7 +37884,7 @@ this.snoozes = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -36412,9 +37960,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ListSnoozesResponse.decode = function decode(reader, length, error) { + ListSnoozesResponse.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.ListSnoozesResponse(); while (reader.pos < end) { var tag = reader.uint32(); @@ -36424,7 +37976,7 @@ case 1: { if (!(message.snoozes && message.snoozes.length)) message.snoozes = []; - message.snoozes.push($root.google.monitoring.v3.Snooze.decode(reader, reader.uint32())); + message.snoozes.push($root.google.monitoring.v3.Snooze.decode(reader, reader.uint32(), undefined, long + 1)); break; } case 2: { @@ -36432,7 +37984,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -36463,14 +38015,18 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ListSnoozesResponse.verify = function verify(message) { + ListSnoozesResponse.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.snoozes != null && message.hasOwnProperty("snoozes")) { if (!Array.isArray(message.snoozes)) return "snoozes: array expected"; for (var i = 0; i < message.snoozes.length; ++i) { - var error = $root.google.monitoring.v3.Snooze.verify(message.snoozes[i]); + var error = $root.google.monitoring.v3.Snooze.verify(message.snoozes[i], long + 1); if (error) return "snoozes." + error; } @@ -36489,9 +38045,13 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.ListSnoozesResponse} ListSnoozesResponse */ - ListSnoozesResponse.fromObject = function fromObject(object) { + ListSnoozesResponse.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.ListSnoozesResponse) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.ListSnoozesResponse(); if (object.snoozes) { if (!Array.isArray(object.snoozes)) @@ -36500,7 +38060,7 @@ for (var i = 0; i < object.snoozes.length; ++i) { if (typeof object.snoozes[i] !== "object") throw TypeError(".google.monitoring.v3.ListSnoozesResponse.snoozes: object expected"); - message.snoozes[i] = $root.google.monitoring.v3.Snooze.fromObject(object.snoozes[i]); + message.snoozes[i] = $root.google.monitoring.v3.Snooze.fromObject(object.snoozes[i], long + 1); } } if (object.nextPageToken != null) @@ -36584,7 +38144,7 @@ function GetSnoozeRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -36649,9 +38209,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetSnoozeRequest.decode = function decode(reader, length, error) { + GetSnoozeRequest.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.GetSnoozeRequest(); while (reader.pos < end) { var tag = reader.uint32(); @@ -36663,7 +38227,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -36694,9 +38258,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GetSnoozeRequest.verify = function verify(message) { + GetSnoozeRequest.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.name != null && message.hasOwnProperty("name")) if (!$util.isString(message.name)) return "name: string expected"; @@ -36711,9 +38279,13 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.GetSnoozeRequest} GetSnoozeRequest */ - GetSnoozeRequest.fromObject = function fromObject(object) { + GetSnoozeRequest.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.GetSnoozeRequest) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.GetSnoozeRequest(); if (object.name != null) message.name = String(object.name); @@ -36790,7 +38362,7 @@ function UpdateSnoozeRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -36865,9 +38437,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - UpdateSnoozeRequest.decode = function decode(reader, length, error) { + UpdateSnoozeRequest.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.UpdateSnoozeRequest(); while (reader.pos < end) { var tag = reader.uint32(); @@ -36875,15 +38451,15 @@ break; switch (tag >>> 3) { case 1: { - message.snooze = $root.google.monitoring.v3.Snooze.decode(reader, reader.uint32()); + message.snooze = $root.google.monitoring.v3.Snooze.decode(reader, reader.uint32(), undefined, long + 1); break; } case 2: { - message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32(), undefined, long + 1); break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -36914,16 +38490,20 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - UpdateSnoozeRequest.verify = function verify(message) { + UpdateSnoozeRequest.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.snooze != null && message.hasOwnProperty("snooze")) { - var error = $root.google.monitoring.v3.Snooze.verify(message.snooze); + var error = $root.google.monitoring.v3.Snooze.verify(message.snooze, long + 1); if (error) return "snooze." + error; } if (message.updateMask != null && message.hasOwnProperty("updateMask")) { - var error = $root.google.protobuf.FieldMask.verify(message.updateMask); + var error = $root.google.protobuf.FieldMask.verify(message.updateMask, long + 1); if (error) return "updateMask." + error; } @@ -36938,19 +38518,23 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.UpdateSnoozeRequest} UpdateSnoozeRequest */ - UpdateSnoozeRequest.fromObject = function fromObject(object) { + UpdateSnoozeRequest.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.UpdateSnoozeRequest) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.UpdateSnoozeRequest(); if (object.snooze != null) { if (typeof object.snooze !== "object") throw TypeError(".google.monitoring.v3.UpdateSnoozeRequest.snooze: object expected"); - message.snooze = $root.google.monitoring.v3.Snooze.fromObject(object.snooze); + message.snooze = $root.google.monitoring.v3.Snooze.fromObject(object.snooze, long + 1); } if (object.updateMask != null) { if (typeof object.updateMask !== "object") throw TypeError(".google.monitoring.v3.UpdateSnoozeRequest.updateMask: object expected"); - message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); + message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask, long + 1); } return message; }; @@ -37028,7 +38612,7 @@ function SpanContext(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -37093,9 +38677,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - SpanContext.decode = function decode(reader, length, error) { + SpanContext.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.SpanContext(); while (reader.pos < end) { var tag = reader.uint32(); @@ -37107,7 +38695,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -37138,9 +38726,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - SpanContext.verify = function verify(message) { + SpanContext.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.spanName != null && message.hasOwnProperty("spanName")) if (!$util.isString(message.spanName)) return "spanName: string expected"; @@ -37155,9 +38747,13 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.SpanContext} SpanContext */ - SpanContext.fromObject = function fromObject(object) { + SpanContext.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.SpanContext) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.SpanContext(); if (object.spanName != null) message.spanName = String(object.spanName); @@ -37238,7 +38834,7 @@ function InternalChecker(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -37353,9 +38949,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - InternalChecker.decode = function decode(reader, length, error) { + InternalChecker.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.InternalChecker(); while (reader.pos < end) { var tag = reader.uint32(); @@ -37387,7 +38987,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -37418,9 +39018,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - InternalChecker.verify = function verify(message) { + InternalChecker.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.name != null && message.hasOwnProperty("name")) if (!$util.isString(message.name)) return "name: string expected"; @@ -37456,9 +39060,13 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.InternalChecker} InternalChecker */ - InternalChecker.fromObject = function fromObject(object) { + InternalChecker.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.InternalChecker) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.InternalChecker(); if (object.name != null) message.name = String(object.name); @@ -37594,7 +39202,7 @@ function SyntheticMonitorTarget(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -37673,9 +39281,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - SyntheticMonitorTarget.decode = function decode(reader, length, error) { + SyntheticMonitorTarget.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.SyntheticMonitorTarget(); while (reader.pos < end) { var tag = reader.uint32(); @@ -37683,11 +39295,11 @@ break; switch (tag >>> 3) { case 1: { - message.cloudFunctionV2 = $root.google.monitoring.v3.SyntheticMonitorTarget.CloudFunctionV2Target.decode(reader, reader.uint32()); + message.cloudFunctionV2 = $root.google.monitoring.v3.SyntheticMonitorTarget.CloudFunctionV2Target.decode(reader, reader.uint32(), undefined, long + 1); break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -37718,14 +39330,18 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - SyntheticMonitorTarget.verify = function verify(message) { + SyntheticMonitorTarget.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; var properties = {}; if (message.cloudFunctionV2 != null && message.hasOwnProperty("cloudFunctionV2")) { properties.target = 1; { - var error = $root.google.monitoring.v3.SyntheticMonitorTarget.CloudFunctionV2Target.verify(message.cloudFunctionV2); + var error = $root.google.monitoring.v3.SyntheticMonitorTarget.CloudFunctionV2Target.verify(message.cloudFunctionV2, long + 1); if (error) return "cloudFunctionV2." + error; } @@ -37741,14 +39357,18 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.SyntheticMonitorTarget} SyntheticMonitorTarget */ - SyntheticMonitorTarget.fromObject = function fromObject(object) { + SyntheticMonitorTarget.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.SyntheticMonitorTarget) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.SyntheticMonitorTarget(); if (object.cloudFunctionV2 != null) { if (typeof object.cloudFunctionV2 !== "object") throw TypeError(".google.monitoring.v3.SyntheticMonitorTarget.cloudFunctionV2: object expected"); - message.cloudFunctionV2 = $root.google.monitoring.v3.SyntheticMonitorTarget.CloudFunctionV2Target.fromObject(object.cloudFunctionV2); + message.cloudFunctionV2 = $root.google.monitoring.v3.SyntheticMonitorTarget.CloudFunctionV2Target.fromObject(object.cloudFunctionV2, long + 1); } return message; }; @@ -37821,7 +39441,7 @@ function CloudFunctionV2Target(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -37896,9 +39516,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - CloudFunctionV2Target.decode = function decode(reader, length, error) { + CloudFunctionV2Target.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.SyntheticMonitorTarget.CloudFunctionV2Target(); while (reader.pos < end) { var tag = reader.uint32(); @@ -37910,11 +39534,11 @@ break; } case 2: { - message.cloudRunRevision = $root.google.api.MonitoredResource.decode(reader, reader.uint32()); + message.cloudRunRevision = $root.google.api.MonitoredResource.decode(reader, reader.uint32(), undefined, long + 1); break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -37945,14 +39569,18 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - CloudFunctionV2Target.verify = function verify(message) { + CloudFunctionV2Target.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.name != null && message.hasOwnProperty("name")) if (!$util.isString(message.name)) return "name: string expected"; if (message.cloudRunRevision != null && message.hasOwnProperty("cloudRunRevision")) { - var error = $root.google.api.MonitoredResource.verify(message.cloudRunRevision); + var error = $root.google.api.MonitoredResource.verify(message.cloudRunRevision, long + 1); if (error) return "cloudRunRevision." + error; } @@ -37967,16 +39595,20 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.SyntheticMonitorTarget.CloudFunctionV2Target} CloudFunctionV2Target */ - CloudFunctionV2Target.fromObject = function fromObject(object) { + CloudFunctionV2Target.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.SyntheticMonitorTarget.CloudFunctionV2Target) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.SyntheticMonitorTarget.CloudFunctionV2Target(); if (object.name != null) message.name = String(object.name); if (object.cloudRunRevision != null) { if (typeof object.cloudRunRevision !== "object") throw TypeError(".google.monitoring.v3.SyntheticMonitorTarget.CloudFunctionV2Target.cloudRunRevision: object expected"); - message.cloudRunRevision = $root.google.api.MonitoredResource.fromObject(object.cloudRunRevision); + message.cloudRunRevision = $root.google.api.MonitoredResource.fromObject(object.cloudRunRevision, long + 1); } return message; }; @@ -38075,7 +39707,7 @@ this.userLabels = {}; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -38312,9 +39944,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - UptimeCheckConfig.decode = function decode(reader, length, error) { + UptimeCheckConfig.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.UptimeCheckConfig(), key, value; while (reader.pos < end) { var tag = reader.uint32(); @@ -38330,37 +39966,37 @@ break; } case 3: { - message.monitoredResource = $root.google.api.MonitoredResource.decode(reader, reader.uint32()); + message.monitoredResource = $root.google.api.MonitoredResource.decode(reader, reader.uint32(), undefined, long + 1); break; } case 4: { - message.resourceGroup = $root.google.monitoring.v3.UptimeCheckConfig.ResourceGroup.decode(reader, reader.uint32()); + message.resourceGroup = $root.google.monitoring.v3.UptimeCheckConfig.ResourceGroup.decode(reader, reader.uint32(), undefined, long + 1); break; } case 21: { - message.syntheticMonitor = $root.google.monitoring.v3.SyntheticMonitorTarget.decode(reader, reader.uint32()); + message.syntheticMonitor = $root.google.monitoring.v3.SyntheticMonitorTarget.decode(reader, reader.uint32(), undefined, long + 1); break; } case 5: { - message.httpCheck = $root.google.monitoring.v3.UptimeCheckConfig.HttpCheck.decode(reader, reader.uint32()); + message.httpCheck = $root.google.monitoring.v3.UptimeCheckConfig.HttpCheck.decode(reader, reader.uint32(), undefined, long + 1); break; } case 6: { - message.tcpCheck = $root.google.monitoring.v3.UptimeCheckConfig.TcpCheck.decode(reader, reader.uint32()); + message.tcpCheck = $root.google.monitoring.v3.UptimeCheckConfig.TcpCheck.decode(reader, reader.uint32(), undefined, long + 1); break; } case 7: { - message.period = $root.google.protobuf.Duration.decode(reader, reader.uint32()); + message.period = $root.google.protobuf.Duration.decode(reader, reader.uint32(), undefined, long + 1); break; } case 8: { - message.timeout = $root.google.protobuf.Duration.decode(reader, reader.uint32()); + message.timeout = $root.google.protobuf.Duration.decode(reader, reader.uint32(), undefined, long + 1); break; } case 9: { if (!(message.contentMatchers && message.contentMatchers.length)) message.contentMatchers = []; - message.contentMatchers.push($root.google.monitoring.v3.UptimeCheckConfig.ContentMatcher.decode(reader, reader.uint32())); + message.contentMatchers.push($root.google.monitoring.v3.UptimeCheckConfig.ContentMatcher.decode(reader, reader.uint32(), undefined, long + 1)); break; } case 17: { @@ -38385,7 +40021,7 @@ case 14: { if (!(message.internalCheckers && message.internalCheckers.length)) message.internalCheckers = []; - message.internalCheckers.push($root.google.monitoring.v3.InternalChecker.decode(reader, reader.uint32())); + message.internalCheckers.push($root.google.monitoring.v3.InternalChecker.decode(reader, reader.uint32(), undefined, long + 1)); break; } case 20: { @@ -38404,15 +40040,17 @@ value = reader.string(); break; default: - reader.skipType(tag2 & 7); + reader.skipType(tag2 & 7, long); break; } } + if (key === "__proto__") + $util.makeProp(message.userLabels, key); message.userLabels[key] = value; break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -38443,9 +40081,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - UptimeCheckConfig.verify = function verify(message) { + UptimeCheckConfig.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; var properties = {}; if (message.name != null && message.hasOwnProperty("name")) if (!$util.isString(message.name)) @@ -38456,7 +40098,7 @@ if (message.monitoredResource != null && message.hasOwnProperty("monitoredResource")) { properties.resource = 1; { - var error = $root.google.api.MonitoredResource.verify(message.monitoredResource); + var error = $root.google.api.MonitoredResource.verify(message.monitoredResource, long + 1); if (error) return "monitoredResource." + error; } @@ -38466,7 +40108,7 @@ return "resource: multiple values"; properties.resource = 1; { - var error = $root.google.monitoring.v3.UptimeCheckConfig.ResourceGroup.verify(message.resourceGroup); + var error = $root.google.monitoring.v3.UptimeCheckConfig.ResourceGroup.verify(message.resourceGroup, long + 1); if (error) return "resourceGroup." + error; } @@ -38476,7 +40118,7 @@ return "resource: multiple values"; properties.resource = 1; { - var error = $root.google.monitoring.v3.SyntheticMonitorTarget.verify(message.syntheticMonitor); + var error = $root.google.monitoring.v3.SyntheticMonitorTarget.verify(message.syntheticMonitor, long + 1); if (error) return "syntheticMonitor." + error; } @@ -38484,7 +40126,7 @@ if (message.httpCheck != null && message.hasOwnProperty("httpCheck")) { properties.checkRequestType = 1; { - var error = $root.google.monitoring.v3.UptimeCheckConfig.HttpCheck.verify(message.httpCheck); + var error = $root.google.monitoring.v3.UptimeCheckConfig.HttpCheck.verify(message.httpCheck, long + 1); if (error) return "httpCheck." + error; } @@ -38494,18 +40136,18 @@ return "checkRequestType: multiple values"; properties.checkRequestType = 1; { - var error = $root.google.monitoring.v3.UptimeCheckConfig.TcpCheck.verify(message.tcpCheck); + var error = $root.google.monitoring.v3.UptimeCheckConfig.TcpCheck.verify(message.tcpCheck, long + 1); if (error) return "tcpCheck." + error; } } if (message.period != null && message.hasOwnProperty("period")) { - var error = $root.google.protobuf.Duration.verify(message.period); + var error = $root.google.protobuf.Duration.verify(message.period, long + 1); if (error) return "period." + error; } if (message.timeout != null && message.hasOwnProperty("timeout")) { - var error = $root.google.protobuf.Duration.verify(message.timeout); + var error = $root.google.protobuf.Duration.verify(message.timeout, long + 1); if (error) return "timeout." + error; } @@ -38513,7 +40155,7 @@ if (!Array.isArray(message.contentMatchers)) return "contentMatchers: array expected"; for (var i = 0; i < message.contentMatchers.length; ++i) { - var error = $root.google.monitoring.v3.UptimeCheckConfig.ContentMatcher.verify(message.contentMatchers[i]); + var error = $root.google.monitoring.v3.UptimeCheckConfig.ContentMatcher.verify(message.contentMatchers[i], long + 1); if (error) return "contentMatchers." + error; } @@ -38552,7 +40194,7 @@ if (!Array.isArray(message.internalCheckers)) return "internalCheckers: array expected"; for (var i = 0; i < message.internalCheckers.length; ++i) { - var error = $root.google.monitoring.v3.InternalChecker.verify(message.internalCheckers[i]); + var error = $root.google.monitoring.v3.InternalChecker.verify(message.internalCheckers[i], long + 1); if (error) return "internalCheckers." + error; } @@ -38576,9 +40218,13 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.UptimeCheckConfig} UptimeCheckConfig */ - UptimeCheckConfig.fromObject = function fromObject(object) { + UptimeCheckConfig.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.UptimeCheckConfig) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.UptimeCheckConfig(); if (object.name != null) message.name = String(object.name); @@ -38587,37 +40233,37 @@ if (object.monitoredResource != null) { if (typeof object.monitoredResource !== "object") throw TypeError(".google.monitoring.v3.UptimeCheckConfig.monitoredResource: object expected"); - message.monitoredResource = $root.google.api.MonitoredResource.fromObject(object.monitoredResource); + message.monitoredResource = $root.google.api.MonitoredResource.fromObject(object.monitoredResource, long + 1); } if (object.resourceGroup != null) { if (typeof object.resourceGroup !== "object") throw TypeError(".google.monitoring.v3.UptimeCheckConfig.resourceGroup: object expected"); - message.resourceGroup = $root.google.monitoring.v3.UptimeCheckConfig.ResourceGroup.fromObject(object.resourceGroup); + message.resourceGroup = $root.google.monitoring.v3.UptimeCheckConfig.ResourceGroup.fromObject(object.resourceGroup, long + 1); } if (object.syntheticMonitor != null) { if (typeof object.syntheticMonitor !== "object") throw TypeError(".google.monitoring.v3.UptimeCheckConfig.syntheticMonitor: object expected"); - message.syntheticMonitor = $root.google.monitoring.v3.SyntheticMonitorTarget.fromObject(object.syntheticMonitor); + message.syntheticMonitor = $root.google.monitoring.v3.SyntheticMonitorTarget.fromObject(object.syntheticMonitor, long + 1); } if (object.httpCheck != null) { if (typeof object.httpCheck !== "object") throw TypeError(".google.monitoring.v3.UptimeCheckConfig.httpCheck: object expected"); - message.httpCheck = $root.google.monitoring.v3.UptimeCheckConfig.HttpCheck.fromObject(object.httpCheck); + message.httpCheck = $root.google.monitoring.v3.UptimeCheckConfig.HttpCheck.fromObject(object.httpCheck, long + 1); } if (object.tcpCheck != null) { if (typeof object.tcpCheck !== "object") throw TypeError(".google.monitoring.v3.UptimeCheckConfig.tcpCheck: object expected"); - message.tcpCheck = $root.google.monitoring.v3.UptimeCheckConfig.TcpCheck.fromObject(object.tcpCheck); + message.tcpCheck = $root.google.monitoring.v3.UptimeCheckConfig.TcpCheck.fromObject(object.tcpCheck, long + 1); } if (object.period != null) { if (typeof object.period !== "object") throw TypeError(".google.monitoring.v3.UptimeCheckConfig.period: object expected"); - message.period = $root.google.protobuf.Duration.fromObject(object.period); + message.period = $root.google.protobuf.Duration.fromObject(object.period, long + 1); } if (object.timeout != null) { if (typeof object.timeout !== "object") throw TypeError(".google.monitoring.v3.UptimeCheckConfig.timeout: object expected"); - message.timeout = $root.google.protobuf.Duration.fromObject(object.timeout); + message.timeout = $root.google.protobuf.Duration.fromObject(object.timeout, long + 1); } if (object.contentMatchers) { if (!Array.isArray(object.contentMatchers)) @@ -38626,7 +40272,7 @@ for (var i = 0; i < object.contentMatchers.length; ++i) { if (typeof object.contentMatchers[i] !== "object") throw TypeError(".google.monitoring.v3.UptimeCheckConfig.contentMatchers: object expected"); - message.contentMatchers[i] = $root.google.monitoring.v3.UptimeCheckConfig.ContentMatcher.fromObject(object.contentMatchers[i]); + message.contentMatchers[i] = $root.google.monitoring.v3.UptimeCheckConfig.ContentMatcher.fromObject(object.contentMatchers[i], long + 1); } } switch (object.checkerType) { @@ -38703,15 +40349,18 @@ for (var i = 0; i < object.internalCheckers.length; ++i) { if (typeof object.internalCheckers[i] !== "object") throw TypeError(".google.monitoring.v3.UptimeCheckConfig.internalCheckers: object expected"); - message.internalCheckers[i] = $root.google.monitoring.v3.InternalChecker.fromObject(object.internalCheckers[i]); + message.internalCheckers[i] = $root.google.monitoring.v3.InternalChecker.fromObject(object.internalCheckers[i], long + 1); } } if (object.userLabels) { if (typeof object.userLabels !== "object") throw TypeError(".google.monitoring.v3.UptimeCheckConfig.userLabels: object expected"); message.userLabels = {}; - for (var keys = Object.keys(object.userLabels), i = 0; i < keys.length; ++i) + for (var keys = Object.keys(object.userLabels), i = 0; i < keys.length; ++i) { + if (keys[i] === "__proto__") + $util.makeProp(message.userLabels, keys[i]); message.userLabels[keys[i]] = String(object.userLabels[keys[i]]); + } } return message; }; @@ -38794,8 +40443,11 @@ var keys2; if (message.userLabels && (keys2 = Object.keys(message.userLabels)).length) { object.userLabels = {}; - for (var j = 0; j < keys2.length; ++j) + for (var j = 0; j < keys2.length; ++j) { + if (keys2[j] === "__proto__") + $util.makeProp(object.userLabels, keys2[j]); object.userLabels[keys2[j]] = message.userLabels[keys2[j]]; + } } if (message.syntheticMonitor != null && message.hasOwnProperty("syntheticMonitor")) { object.syntheticMonitor = $root.google.monitoring.v3.SyntheticMonitorTarget.toObject(message.syntheticMonitor, options); @@ -38852,7 +40504,7 @@ function ResourceGroup(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -38927,9 +40579,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ResourceGroup.decode = function decode(reader, length, error) { + ResourceGroup.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.UptimeCheckConfig.ResourceGroup(); while (reader.pos < end) { var tag = reader.uint32(); @@ -38945,7 +40601,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -38976,9 +40632,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ResourceGroup.verify = function verify(message) { + ResourceGroup.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.groupId != null && message.hasOwnProperty("groupId")) if (!$util.isString(message.groupId)) return "groupId: string expected"; @@ -39002,9 +40662,13 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.UptimeCheckConfig.ResourceGroup} ResourceGroup */ - ResourceGroup.fromObject = function fromObject(object) { + ResourceGroup.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.UptimeCheckConfig.ResourceGroup) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.UptimeCheckConfig.ResourceGroup(); if (object.groupId != null) message.groupId = String(object.groupId); @@ -39104,7 +40768,7 @@ function PingConfig(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -39169,9 +40833,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - PingConfig.decode = function decode(reader, length, error) { + PingConfig.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.UptimeCheckConfig.PingConfig(); while (reader.pos < end) { var tag = reader.uint32(); @@ -39183,7 +40851,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -39214,9 +40882,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - PingConfig.verify = function verify(message) { + PingConfig.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.pingsCount != null && message.hasOwnProperty("pingsCount")) if (!$util.isInteger(message.pingsCount)) return "pingsCount: integer expected"; @@ -39231,9 +40903,13 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.UptimeCheckConfig.PingConfig} PingConfig */ - PingConfig.fromObject = function fromObject(object) { + PingConfig.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.UptimeCheckConfig.PingConfig) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.UptimeCheckConfig.PingConfig(); if (object.pingsCount != null) message.pingsCount = object.pingsCount | 0; @@ -39324,7 +41000,7 @@ this.acceptedResponseStatusCodes = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -39535,9 +41211,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - HttpCheck.decode = function decode(reader, length, error) { + HttpCheck.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.UptimeCheckConfig.HttpCheck(), key, value; while (reader.pos < end) { var tag = reader.uint32(); @@ -39561,7 +41241,7 @@ break; } case 4: { - message.authInfo = $root.google.monitoring.v3.UptimeCheckConfig.HttpCheck.BasicAuthentication.decode(reader, reader.uint32()); + message.authInfo = $root.google.monitoring.v3.UptimeCheckConfig.HttpCheck.BasicAuthentication.decode(reader, reader.uint32(), undefined, long + 1); break; } case 5: { @@ -39584,10 +41264,12 @@ value = reader.string(); break; default: - reader.skipType(tag2 & 7); + reader.skipType(tag2 & 7, long); break; } } + if (key === "__proto__") + $util.makeProp(message.headers, key); message.headers[key] = value; break; } @@ -39610,19 +41292,19 @@ case 11: { if (!(message.acceptedResponseStatusCodes && message.acceptedResponseStatusCodes.length)) message.acceptedResponseStatusCodes = []; - message.acceptedResponseStatusCodes.push($root.google.monitoring.v3.UptimeCheckConfig.HttpCheck.ResponseStatusCode.decode(reader, reader.uint32())); + message.acceptedResponseStatusCodes.push($root.google.monitoring.v3.UptimeCheckConfig.HttpCheck.ResponseStatusCode.decode(reader, reader.uint32(), undefined, long + 1)); break; } case 12: { - message.pingConfig = $root.google.monitoring.v3.UptimeCheckConfig.PingConfig.decode(reader, reader.uint32()); + message.pingConfig = $root.google.monitoring.v3.UptimeCheckConfig.PingConfig.decode(reader, reader.uint32(), undefined, long + 1); break; } case 14: { - message.serviceAgentAuthentication = $root.google.monitoring.v3.UptimeCheckConfig.HttpCheck.ServiceAgentAuthentication.decode(reader, reader.uint32()); + message.serviceAgentAuthentication = $root.google.monitoring.v3.UptimeCheckConfig.HttpCheck.ServiceAgentAuthentication.decode(reader, reader.uint32(), undefined, long + 1); break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -39653,9 +41335,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - HttpCheck.verify = function verify(message) { + HttpCheck.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; var properties = {}; if (message.requestMethod != null && message.hasOwnProperty("requestMethod")) switch (message.requestMethod) { @@ -39676,7 +41362,7 @@ if (!$util.isInteger(message.port)) return "port: integer expected"; if (message.authInfo != null && message.hasOwnProperty("authInfo")) { - var error = $root.google.monitoring.v3.UptimeCheckConfig.HttpCheck.BasicAuthentication.verify(message.authInfo); + var error = $root.google.monitoring.v3.UptimeCheckConfig.HttpCheck.BasicAuthentication.verify(message.authInfo, long + 1); if (error) return "authInfo." + error; } @@ -39713,20 +41399,20 @@ if (!Array.isArray(message.acceptedResponseStatusCodes)) return "acceptedResponseStatusCodes: array expected"; for (var i = 0; i < message.acceptedResponseStatusCodes.length; ++i) { - var error = $root.google.monitoring.v3.UptimeCheckConfig.HttpCheck.ResponseStatusCode.verify(message.acceptedResponseStatusCodes[i]); + var error = $root.google.monitoring.v3.UptimeCheckConfig.HttpCheck.ResponseStatusCode.verify(message.acceptedResponseStatusCodes[i], long + 1); if (error) return "acceptedResponseStatusCodes." + error; } } if (message.pingConfig != null && message.hasOwnProperty("pingConfig")) { - var error = $root.google.monitoring.v3.UptimeCheckConfig.PingConfig.verify(message.pingConfig); + var error = $root.google.monitoring.v3.UptimeCheckConfig.PingConfig.verify(message.pingConfig, long + 1); if (error) return "pingConfig." + error; } if (message.serviceAgentAuthentication != null && message.hasOwnProperty("serviceAgentAuthentication")) { properties.authMethod = 1; { - var error = $root.google.monitoring.v3.UptimeCheckConfig.HttpCheck.ServiceAgentAuthentication.verify(message.serviceAgentAuthentication); + var error = $root.google.monitoring.v3.UptimeCheckConfig.HttpCheck.ServiceAgentAuthentication.verify(message.serviceAgentAuthentication, long + 1); if (error) return "serviceAgentAuthentication." + error; } @@ -39742,9 +41428,13 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.UptimeCheckConfig.HttpCheck} HttpCheck */ - HttpCheck.fromObject = function fromObject(object) { + HttpCheck.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.UptimeCheckConfig.HttpCheck) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.UptimeCheckConfig.HttpCheck(); switch (object.requestMethod) { default: @@ -39775,7 +41465,7 @@ if (object.authInfo != null) { if (typeof object.authInfo !== "object") throw TypeError(".google.monitoring.v3.UptimeCheckConfig.HttpCheck.authInfo: object expected"); - message.authInfo = $root.google.monitoring.v3.UptimeCheckConfig.HttpCheck.BasicAuthentication.fromObject(object.authInfo); + message.authInfo = $root.google.monitoring.v3.UptimeCheckConfig.HttpCheck.BasicAuthentication.fromObject(object.authInfo, long + 1); } if (object.maskHeaders != null) message.maskHeaders = Boolean(object.maskHeaders); @@ -39783,8 +41473,11 @@ if (typeof object.headers !== "object") throw TypeError(".google.monitoring.v3.UptimeCheckConfig.HttpCheck.headers: object expected"); message.headers = {}; - for (var keys = Object.keys(object.headers), i = 0; i < keys.length; ++i) + for (var keys = Object.keys(object.headers), i = 0; i < keys.length; ++i) { + if (keys[i] === "__proto__") + $util.makeProp(message.headers, keys[i]); message.headers[keys[i]] = String(object.headers[keys[i]]); + } } switch (object.contentType) { default: @@ -39822,18 +41515,18 @@ for (var i = 0; i < object.acceptedResponseStatusCodes.length; ++i) { if (typeof object.acceptedResponseStatusCodes[i] !== "object") throw TypeError(".google.monitoring.v3.UptimeCheckConfig.HttpCheck.acceptedResponseStatusCodes: object expected"); - message.acceptedResponseStatusCodes[i] = $root.google.monitoring.v3.UptimeCheckConfig.HttpCheck.ResponseStatusCode.fromObject(object.acceptedResponseStatusCodes[i]); + message.acceptedResponseStatusCodes[i] = $root.google.monitoring.v3.UptimeCheckConfig.HttpCheck.ResponseStatusCode.fromObject(object.acceptedResponseStatusCodes[i], long + 1); } } if (object.pingConfig != null) { if (typeof object.pingConfig !== "object") throw TypeError(".google.monitoring.v3.UptimeCheckConfig.HttpCheck.pingConfig: object expected"); - message.pingConfig = $root.google.monitoring.v3.UptimeCheckConfig.PingConfig.fromObject(object.pingConfig); + message.pingConfig = $root.google.monitoring.v3.UptimeCheckConfig.PingConfig.fromObject(object.pingConfig, long + 1); } if (object.serviceAgentAuthentication != null) { if (typeof object.serviceAgentAuthentication !== "object") throw TypeError(".google.monitoring.v3.UptimeCheckConfig.HttpCheck.serviceAgentAuthentication: object expected"); - message.serviceAgentAuthentication = $root.google.monitoring.v3.UptimeCheckConfig.HttpCheck.ServiceAgentAuthentication.fromObject(object.serviceAgentAuthentication); + message.serviceAgentAuthentication = $root.google.monitoring.v3.UptimeCheckConfig.HttpCheck.ServiceAgentAuthentication.fromObject(object.serviceAgentAuthentication, long + 1); } return message; }; @@ -39887,8 +41580,11 @@ var keys2; if (message.headers && (keys2 = Object.keys(message.headers)).length) { object.headers = {}; - for (var j = 0; j < keys2.length; ++j) + for (var j = 0; j < keys2.length; ++j) { + if (keys2[j] === "__proto__") + $util.makeProp(object.headers, keys2[j]); object.headers[keys2[j]] = message.headers[keys2[j]]; + } } if (message.validateSsl != null && message.hasOwnProperty("validateSsl")) object.validateSsl = message.validateSsl; @@ -39978,7 +41674,7 @@ function BasicAuthentication(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -40053,9 +41749,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - BasicAuthentication.decode = function decode(reader, length, error) { + BasicAuthentication.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.UptimeCheckConfig.HttpCheck.BasicAuthentication(); while (reader.pos < end) { var tag = reader.uint32(); @@ -40071,7 +41771,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -40102,9 +41802,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - BasicAuthentication.verify = function verify(message) { + BasicAuthentication.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.username != null && message.hasOwnProperty("username")) if (!$util.isString(message.username)) return "username: string expected"; @@ -40122,9 +41826,13 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.UptimeCheckConfig.HttpCheck.BasicAuthentication} BasicAuthentication */ - BasicAuthentication.fromObject = function fromObject(object) { + BasicAuthentication.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.UptimeCheckConfig.HttpCheck.BasicAuthentication) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.UptimeCheckConfig.HttpCheck.BasicAuthentication(); if (object.username != null) message.username = String(object.username); @@ -40223,7 +41931,7 @@ function ResponseStatusCode(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -40312,9 +42020,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ResponseStatusCode.decode = function decode(reader, length, error) { + ResponseStatusCode.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.UptimeCheckConfig.HttpCheck.ResponseStatusCode(); while (reader.pos < end) { var tag = reader.uint32(); @@ -40330,7 +42042,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -40361,9 +42073,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ResponseStatusCode.verify = function verify(message) { + ResponseStatusCode.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; var properties = {}; if (message.statusValue != null && message.hasOwnProperty("statusValue")) { properties.statusCode = 1; @@ -40398,9 +42114,13 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.UptimeCheckConfig.HttpCheck.ResponseStatusCode} ResponseStatusCode */ - ResponseStatusCode.fromObject = function fromObject(object) { + ResponseStatusCode.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.UptimeCheckConfig.HttpCheck.ResponseStatusCode) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.UptimeCheckConfig.HttpCheck.ResponseStatusCode(); if (object.statusValue != null) message.statusValue = object.statusValue | 0; @@ -40542,7 +42262,7 @@ function ServiceAgentAuthentication(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -40607,9 +42327,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ServiceAgentAuthentication.decode = function decode(reader, length, error) { + ServiceAgentAuthentication.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.UptimeCheckConfig.HttpCheck.ServiceAgentAuthentication(); while (reader.pos < end) { var tag = reader.uint32(); @@ -40621,7 +42345,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -40652,9 +42376,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ServiceAgentAuthentication.verify = function verify(message) { + ServiceAgentAuthentication.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.type != null && message.hasOwnProperty("type")) switch (message.type) { default: @@ -40674,9 +42402,13 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.UptimeCheckConfig.HttpCheck.ServiceAgentAuthentication} ServiceAgentAuthentication */ - ServiceAgentAuthentication.fromObject = function fromObject(object) { + ServiceAgentAuthentication.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.UptimeCheckConfig.HttpCheck.ServiceAgentAuthentication) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.UptimeCheckConfig.HttpCheck.ServiceAgentAuthentication(); switch (object.type) { default: @@ -40784,7 +42516,7 @@ function TcpCheck(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -40859,9 +42591,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - TcpCheck.decode = function decode(reader, length, error) { + TcpCheck.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.UptimeCheckConfig.TcpCheck(); while (reader.pos < end) { var tag = reader.uint32(); @@ -40873,11 +42609,11 @@ break; } case 2: { - message.pingConfig = $root.google.monitoring.v3.UptimeCheckConfig.PingConfig.decode(reader, reader.uint32()); + message.pingConfig = $root.google.monitoring.v3.UptimeCheckConfig.PingConfig.decode(reader, reader.uint32(), undefined, long + 1); break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -40908,14 +42644,18 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - TcpCheck.verify = function verify(message) { + TcpCheck.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.port != null && message.hasOwnProperty("port")) if (!$util.isInteger(message.port)) return "port: integer expected"; if (message.pingConfig != null && message.hasOwnProperty("pingConfig")) { - var error = $root.google.monitoring.v3.UptimeCheckConfig.PingConfig.verify(message.pingConfig); + var error = $root.google.monitoring.v3.UptimeCheckConfig.PingConfig.verify(message.pingConfig, long + 1); if (error) return "pingConfig." + error; } @@ -40930,16 +42670,20 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.UptimeCheckConfig.TcpCheck} TcpCheck */ - TcpCheck.fromObject = function fromObject(object) { + TcpCheck.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.UptimeCheckConfig.TcpCheck) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.UptimeCheckConfig.TcpCheck(); if (object.port != null) message.port = object.port | 0; if (object.pingConfig != null) { if (typeof object.pingConfig !== "object") throw TypeError(".google.monitoring.v3.UptimeCheckConfig.TcpCheck.pingConfig: object expected"); - message.pingConfig = $root.google.monitoring.v3.UptimeCheckConfig.PingConfig.fromObject(object.pingConfig); + message.pingConfig = $root.google.monitoring.v3.UptimeCheckConfig.PingConfig.fromObject(object.pingConfig, long + 1); } return message; }; @@ -41019,7 +42763,7 @@ function ContentMatcher(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -41118,9 +42862,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ContentMatcher.decode = function decode(reader, length, error) { + ContentMatcher.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.UptimeCheckConfig.ContentMatcher(); while (reader.pos < end) { var tag = reader.uint32(); @@ -41136,11 +42884,11 @@ break; } case 3: { - message.jsonPathMatcher = $root.google.monitoring.v3.UptimeCheckConfig.ContentMatcher.JsonPathMatcher.decode(reader, reader.uint32()); + message.jsonPathMatcher = $root.google.monitoring.v3.UptimeCheckConfig.ContentMatcher.JsonPathMatcher.decode(reader, reader.uint32(), undefined, long + 1); break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -41171,9 +42919,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ContentMatcher.verify = function verify(message) { + ContentMatcher.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; var properties = {}; if (message.content != null && message.hasOwnProperty("content")) if (!$util.isString(message.content)) @@ -41194,7 +42946,7 @@ if (message.jsonPathMatcher != null && message.hasOwnProperty("jsonPathMatcher")) { properties.additionalMatcherInfo = 1; { - var error = $root.google.monitoring.v3.UptimeCheckConfig.ContentMatcher.JsonPathMatcher.verify(message.jsonPathMatcher); + var error = $root.google.monitoring.v3.UptimeCheckConfig.ContentMatcher.JsonPathMatcher.verify(message.jsonPathMatcher, long + 1); if (error) return "jsonPathMatcher." + error; } @@ -41210,9 +42962,13 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.UptimeCheckConfig.ContentMatcher} ContentMatcher */ - ContentMatcher.fromObject = function fromObject(object) { + ContentMatcher.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.UptimeCheckConfig.ContentMatcher) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.UptimeCheckConfig.ContentMatcher(); if (object.content != null) message.content = String(object.content); @@ -41255,7 +43011,7 @@ if (object.jsonPathMatcher != null) { if (typeof object.jsonPathMatcher !== "object") throw TypeError(".google.monitoring.v3.UptimeCheckConfig.ContentMatcher.jsonPathMatcher: object expected"); - message.jsonPathMatcher = $root.google.monitoring.v3.UptimeCheckConfig.ContentMatcher.JsonPathMatcher.fromObject(object.jsonPathMatcher); + message.jsonPathMatcher = $root.google.monitoring.v3.UptimeCheckConfig.ContentMatcher.JsonPathMatcher.fromObject(object.jsonPathMatcher, long + 1); } return message; }; @@ -41360,7 +43116,7 @@ function JsonPathMatcher(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -41435,9 +43191,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - JsonPathMatcher.decode = function decode(reader, length, error) { + JsonPathMatcher.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.UptimeCheckConfig.ContentMatcher.JsonPathMatcher(); while (reader.pos < end) { var tag = reader.uint32(); @@ -41453,7 +43213,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -41484,9 +43244,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - JsonPathMatcher.verify = function verify(message) { + JsonPathMatcher.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.jsonPath != null && message.hasOwnProperty("jsonPath")) if (!$util.isString(message.jsonPath)) return "jsonPath: string expected"; @@ -41510,9 +43274,13 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.UptimeCheckConfig.ContentMatcher.JsonPathMatcher} JsonPathMatcher */ - JsonPathMatcher.fromObject = function fromObject(object) { + JsonPathMatcher.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.UptimeCheckConfig.ContentMatcher.JsonPathMatcher) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.UptimeCheckConfig.ContentMatcher.JsonPathMatcher(); if (object.jsonPath != null) message.jsonPath = String(object.jsonPath); @@ -41652,7 +43420,7 @@ function UptimeCheckIp(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -41737,9 +43505,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - UptimeCheckIp.decode = function decode(reader, length, error) { + UptimeCheckIp.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.UptimeCheckIp(); while (reader.pos < end) { var tag = reader.uint32(); @@ -41759,7 +43531,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -41790,9 +43562,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - UptimeCheckIp.verify = function verify(message) { + UptimeCheckIp.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.region != null && message.hasOwnProperty("region")) switch (message.region) { default: @@ -41824,9 +43600,13 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.UptimeCheckIp} UptimeCheckIp */ - UptimeCheckIp.fromObject = function fromObject(object) { + UptimeCheckIp.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.UptimeCheckIp) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.UptimeCheckIp(); switch (object.region) { default: @@ -42229,7 +44009,7 @@ function ListUptimeCheckConfigsRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -42324,9 +44104,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ListUptimeCheckConfigsRequest.decode = function decode(reader, length, error) { + ListUptimeCheckConfigsRequest.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.ListUptimeCheckConfigsRequest(); while (reader.pos < end) { var tag = reader.uint32(); @@ -42350,7 +44134,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -42381,9 +44165,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ListUptimeCheckConfigsRequest.verify = function verify(message) { + ListUptimeCheckConfigsRequest.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.parent != null && message.hasOwnProperty("parent")) if (!$util.isString(message.parent)) return "parent: string expected"; @@ -42407,9 +44195,13 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.ListUptimeCheckConfigsRequest} ListUptimeCheckConfigsRequest */ - ListUptimeCheckConfigsRequest.fromObject = function fromObject(object) { + ListUptimeCheckConfigsRequest.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.ListUptimeCheckConfigsRequest) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.ListUptimeCheckConfigsRequest(); if (object.parent != null) message.parent = String(object.parent); @@ -42504,7 +44296,7 @@ this.uptimeCheckConfigs = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -42590,9 +44382,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ListUptimeCheckConfigsResponse.decode = function decode(reader, length, error) { + ListUptimeCheckConfigsResponse.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.ListUptimeCheckConfigsResponse(); while (reader.pos < end) { var tag = reader.uint32(); @@ -42602,7 +44398,7 @@ case 1: { if (!(message.uptimeCheckConfigs && message.uptimeCheckConfigs.length)) message.uptimeCheckConfigs = []; - message.uptimeCheckConfigs.push($root.google.monitoring.v3.UptimeCheckConfig.decode(reader, reader.uint32())); + message.uptimeCheckConfigs.push($root.google.monitoring.v3.UptimeCheckConfig.decode(reader, reader.uint32(), undefined, long + 1)); break; } case 2: { @@ -42614,7 +44410,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -42645,14 +44441,18 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ListUptimeCheckConfigsResponse.verify = function verify(message) { + ListUptimeCheckConfigsResponse.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.uptimeCheckConfigs != null && message.hasOwnProperty("uptimeCheckConfigs")) { if (!Array.isArray(message.uptimeCheckConfigs)) return "uptimeCheckConfigs: array expected"; for (var i = 0; i < message.uptimeCheckConfigs.length; ++i) { - var error = $root.google.monitoring.v3.UptimeCheckConfig.verify(message.uptimeCheckConfigs[i]); + var error = $root.google.monitoring.v3.UptimeCheckConfig.verify(message.uptimeCheckConfigs[i], long + 1); if (error) return "uptimeCheckConfigs." + error; } @@ -42674,9 +44474,13 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.ListUptimeCheckConfigsResponse} ListUptimeCheckConfigsResponse */ - ListUptimeCheckConfigsResponse.fromObject = function fromObject(object) { + ListUptimeCheckConfigsResponse.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.ListUptimeCheckConfigsResponse) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.ListUptimeCheckConfigsResponse(); if (object.uptimeCheckConfigs) { if (!Array.isArray(object.uptimeCheckConfigs)) @@ -42685,7 +44489,7 @@ for (var i = 0; i < object.uptimeCheckConfigs.length; ++i) { if (typeof object.uptimeCheckConfigs[i] !== "object") throw TypeError(".google.monitoring.v3.ListUptimeCheckConfigsResponse.uptimeCheckConfigs: object expected"); - message.uptimeCheckConfigs[i] = $root.google.monitoring.v3.UptimeCheckConfig.fromObject(object.uptimeCheckConfigs[i]); + message.uptimeCheckConfigs[i] = $root.google.monitoring.v3.UptimeCheckConfig.fromObject(object.uptimeCheckConfigs[i], long + 1); } } if (object.nextPageToken != null) @@ -42775,7 +44579,7 @@ function GetUptimeCheckConfigRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -42840,9 +44644,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetUptimeCheckConfigRequest.decode = function decode(reader, length, error) { + GetUptimeCheckConfigRequest.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.GetUptimeCheckConfigRequest(); while (reader.pos < end) { var tag = reader.uint32(); @@ -42854,7 +44662,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -42885,9 +44693,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GetUptimeCheckConfigRequest.verify = function verify(message) { + GetUptimeCheckConfigRequest.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.name != null && message.hasOwnProperty("name")) if (!$util.isString(message.name)) return "name: string expected"; @@ -42902,9 +44714,13 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.GetUptimeCheckConfigRequest} GetUptimeCheckConfigRequest */ - GetUptimeCheckConfigRequest.fromObject = function fromObject(object) { + GetUptimeCheckConfigRequest.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.GetUptimeCheckConfigRequest) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.GetUptimeCheckConfigRequest(); if (object.name != null) message.name = String(object.name); @@ -42981,7 +44797,7 @@ function CreateUptimeCheckConfigRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -43056,9 +44872,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - CreateUptimeCheckConfigRequest.decode = function decode(reader, length, error) { + CreateUptimeCheckConfigRequest.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.CreateUptimeCheckConfigRequest(); while (reader.pos < end) { var tag = reader.uint32(); @@ -43070,11 +44890,11 @@ break; } case 2: { - message.uptimeCheckConfig = $root.google.monitoring.v3.UptimeCheckConfig.decode(reader, reader.uint32()); + message.uptimeCheckConfig = $root.google.monitoring.v3.UptimeCheckConfig.decode(reader, reader.uint32(), undefined, long + 1); break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -43105,14 +44925,18 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - CreateUptimeCheckConfigRequest.verify = function verify(message) { + CreateUptimeCheckConfigRequest.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.parent != null && message.hasOwnProperty("parent")) if (!$util.isString(message.parent)) return "parent: string expected"; if (message.uptimeCheckConfig != null && message.hasOwnProperty("uptimeCheckConfig")) { - var error = $root.google.monitoring.v3.UptimeCheckConfig.verify(message.uptimeCheckConfig); + var error = $root.google.monitoring.v3.UptimeCheckConfig.verify(message.uptimeCheckConfig, long + 1); if (error) return "uptimeCheckConfig." + error; } @@ -43127,16 +44951,20 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.CreateUptimeCheckConfigRequest} CreateUptimeCheckConfigRequest */ - CreateUptimeCheckConfigRequest.fromObject = function fromObject(object) { + CreateUptimeCheckConfigRequest.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.CreateUptimeCheckConfigRequest) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.CreateUptimeCheckConfigRequest(); if (object.parent != null) message.parent = String(object.parent); if (object.uptimeCheckConfig != null) { if (typeof object.uptimeCheckConfig !== "object") throw TypeError(".google.monitoring.v3.CreateUptimeCheckConfigRequest.uptimeCheckConfig: object expected"); - message.uptimeCheckConfig = $root.google.monitoring.v3.UptimeCheckConfig.fromObject(object.uptimeCheckConfig); + message.uptimeCheckConfig = $root.google.monitoring.v3.UptimeCheckConfig.fromObject(object.uptimeCheckConfig, long + 1); } return message; }; @@ -43215,7 +45043,7 @@ function UpdateUptimeCheckConfigRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -43290,9 +45118,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - UpdateUptimeCheckConfigRequest.decode = function decode(reader, length, error) { + UpdateUptimeCheckConfigRequest.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.UpdateUptimeCheckConfigRequest(); while (reader.pos < end) { var tag = reader.uint32(); @@ -43300,15 +45132,15 @@ break; switch (tag >>> 3) { case 2: { - message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32(), undefined, long + 1); break; } case 3: { - message.uptimeCheckConfig = $root.google.monitoring.v3.UptimeCheckConfig.decode(reader, reader.uint32()); + message.uptimeCheckConfig = $root.google.monitoring.v3.UptimeCheckConfig.decode(reader, reader.uint32(), undefined, long + 1); break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -43339,16 +45171,20 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - UpdateUptimeCheckConfigRequest.verify = function verify(message) { + UpdateUptimeCheckConfigRequest.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.updateMask != null && message.hasOwnProperty("updateMask")) { - var error = $root.google.protobuf.FieldMask.verify(message.updateMask); + var error = $root.google.protobuf.FieldMask.verify(message.updateMask, long + 1); if (error) return "updateMask." + error; } if (message.uptimeCheckConfig != null && message.hasOwnProperty("uptimeCheckConfig")) { - var error = $root.google.monitoring.v3.UptimeCheckConfig.verify(message.uptimeCheckConfig); + var error = $root.google.monitoring.v3.UptimeCheckConfig.verify(message.uptimeCheckConfig, long + 1); if (error) return "uptimeCheckConfig." + error; } @@ -43363,19 +45199,23 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.UpdateUptimeCheckConfigRequest} UpdateUptimeCheckConfigRequest */ - UpdateUptimeCheckConfigRequest.fromObject = function fromObject(object) { + UpdateUptimeCheckConfigRequest.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.UpdateUptimeCheckConfigRequest) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.UpdateUptimeCheckConfigRequest(); if (object.updateMask != null) { if (typeof object.updateMask !== "object") throw TypeError(".google.monitoring.v3.UpdateUptimeCheckConfigRequest.updateMask: object expected"); - message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); + message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask, long + 1); } if (object.uptimeCheckConfig != null) { if (typeof object.uptimeCheckConfig !== "object") throw TypeError(".google.monitoring.v3.UpdateUptimeCheckConfigRequest.uptimeCheckConfig: object expected"); - message.uptimeCheckConfig = $root.google.monitoring.v3.UptimeCheckConfig.fromObject(object.uptimeCheckConfig); + message.uptimeCheckConfig = $root.google.monitoring.v3.UptimeCheckConfig.fromObject(object.uptimeCheckConfig, long + 1); } return message; }; @@ -43453,7 +45293,7 @@ function DeleteUptimeCheckConfigRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -43518,9 +45358,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - DeleteUptimeCheckConfigRequest.decode = function decode(reader, length, error) { + DeleteUptimeCheckConfigRequest.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.DeleteUptimeCheckConfigRequest(); while (reader.pos < end) { var tag = reader.uint32(); @@ -43532,7 +45376,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -43563,9 +45407,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - DeleteUptimeCheckConfigRequest.verify = function verify(message) { + DeleteUptimeCheckConfigRequest.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.name != null && message.hasOwnProperty("name")) if (!$util.isString(message.name)) return "name: string expected"; @@ -43580,9 +45428,13 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.DeleteUptimeCheckConfigRequest} DeleteUptimeCheckConfigRequest */ - DeleteUptimeCheckConfigRequest.fromObject = function fromObject(object) { + DeleteUptimeCheckConfigRequest.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.DeleteUptimeCheckConfigRequest) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.DeleteUptimeCheckConfigRequest(); if (object.name != null) message.name = String(object.name); @@ -43659,7 +45511,7 @@ function ListUptimeCheckIpsRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -43734,9 +45586,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ListUptimeCheckIpsRequest.decode = function decode(reader, length, error) { + ListUptimeCheckIpsRequest.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.ListUptimeCheckIpsRequest(); while (reader.pos < end) { var tag = reader.uint32(); @@ -43752,7 +45608,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -43783,9 +45639,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ListUptimeCheckIpsRequest.verify = function verify(message) { + ListUptimeCheckIpsRequest.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.pageSize != null && message.hasOwnProperty("pageSize")) if (!$util.isInteger(message.pageSize)) return "pageSize: integer expected"; @@ -43803,9 +45663,13 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.ListUptimeCheckIpsRequest} ListUptimeCheckIpsRequest */ - ListUptimeCheckIpsRequest.fromObject = function fromObject(object) { + ListUptimeCheckIpsRequest.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.ListUptimeCheckIpsRequest) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.ListUptimeCheckIpsRequest(); if (object.pageSize != null) message.pageSize = object.pageSize | 0; @@ -43889,7 +45753,7 @@ this.uptimeCheckIps = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -43965,9 +45829,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ListUptimeCheckIpsResponse.decode = function decode(reader, length, error) { + ListUptimeCheckIpsResponse.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.ListUptimeCheckIpsResponse(); while (reader.pos < end) { var tag = reader.uint32(); @@ -43977,7 +45845,7 @@ case 1: { if (!(message.uptimeCheckIps && message.uptimeCheckIps.length)) message.uptimeCheckIps = []; - message.uptimeCheckIps.push($root.google.monitoring.v3.UptimeCheckIp.decode(reader, reader.uint32())); + message.uptimeCheckIps.push($root.google.monitoring.v3.UptimeCheckIp.decode(reader, reader.uint32(), undefined, long + 1)); break; } case 2: { @@ -43985,7 +45853,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -44016,14 +45884,18 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ListUptimeCheckIpsResponse.verify = function verify(message) { + ListUptimeCheckIpsResponse.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.uptimeCheckIps != null && message.hasOwnProperty("uptimeCheckIps")) { if (!Array.isArray(message.uptimeCheckIps)) return "uptimeCheckIps: array expected"; for (var i = 0; i < message.uptimeCheckIps.length; ++i) { - var error = $root.google.monitoring.v3.UptimeCheckIp.verify(message.uptimeCheckIps[i]); + var error = $root.google.monitoring.v3.UptimeCheckIp.verify(message.uptimeCheckIps[i], long + 1); if (error) return "uptimeCheckIps." + error; } @@ -44042,9 +45914,13 @@ * @param {Object.} object Plain object * @returns {google.monitoring.v3.ListUptimeCheckIpsResponse} ListUptimeCheckIpsResponse */ - ListUptimeCheckIpsResponse.fromObject = function fromObject(object) { + ListUptimeCheckIpsResponse.fromObject = function fromObject(object, long) { if (object instanceof $root.google.monitoring.v3.ListUptimeCheckIpsResponse) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.monitoring.v3.ListUptimeCheckIpsResponse(); if (object.uptimeCheckIps) { if (!Array.isArray(object.uptimeCheckIps)) @@ -44053,7 +45929,7 @@ for (var i = 0; i < object.uptimeCheckIps.length; ++i) { if (typeof object.uptimeCheckIps[i] !== "object") throw TypeError(".google.monitoring.v3.ListUptimeCheckIpsResponse.uptimeCheckIps: object expected"); - message.uptimeCheckIps[i] = $root.google.monitoring.v3.UptimeCheckIp.fromObject(object.uptimeCheckIps[i]); + message.uptimeCheckIps[i] = $root.google.monitoring.v3.UptimeCheckIp.fromObject(object.uptimeCheckIps[i], long + 1); } } if (object.nextPageToken != null) @@ -44188,7 +46064,7 @@ this.style = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -44318,9 +46194,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ResourceDescriptor.decode = function decode(reader, length, error) { + ResourceDescriptor.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.ResourceDescriptor(); while (reader.pos < end) { var tag = reader.uint32(); @@ -44365,7 +46245,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -44396,9 +46276,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ResourceDescriptor.verify = function verify(message) { + ResourceDescriptor.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.type != null && message.hasOwnProperty("type")) if (!$util.isString(message.type)) return "type: string expected"; @@ -44450,9 +46334,13 @@ * @param {Object.} object Plain object * @returns {google.api.ResourceDescriptor} ResourceDescriptor */ - ResourceDescriptor.fromObject = function fromObject(object) { + ResourceDescriptor.fromObject = function fromObject(object, long) { if (object instanceof $root.google.api.ResourceDescriptor) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.api.ResourceDescriptor(); if (object.type != null) message.type = String(object.type); @@ -44640,7 +46528,7 @@ function ResourceReference(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -44715,9 +46603,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ResourceReference.decode = function decode(reader, length, error) { + ResourceReference.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.ResourceReference(); while (reader.pos < end) { var tag = reader.uint32(); @@ -44733,7 +46625,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -44764,9 +46656,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ResourceReference.verify = function verify(message) { + ResourceReference.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.type != null && message.hasOwnProperty("type")) if (!$util.isString(message.type)) return "type: string expected"; @@ -44784,9 +46680,13 @@ * @param {Object.} object Plain object * @returns {google.api.ResourceReference} ResourceReference */ - ResourceReference.fromObject = function fromObject(object) { + ResourceReference.fromObject = function fromObject(object, long) { if (object instanceof $root.google.api.ResourceReference) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.api.ResourceReference(); if (object.type != null) message.type = String(object.type); @@ -44876,7 +46776,7 @@ this.exemplars = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -45006,9 +46906,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Distribution.decode = function decode(reader, length, error) { + Distribution.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.Distribution(); while (reader.pos < end) { var tag = reader.uint32(); @@ -45028,11 +46932,11 @@ break; } case 4: { - message.range = $root.google.api.Distribution.Range.decode(reader, reader.uint32()); + message.range = $root.google.api.Distribution.Range.decode(reader, reader.uint32(), undefined, long + 1); break; } case 6: { - message.bucketOptions = $root.google.api.Distribution.BucketOptions.decode(reader, reader.uint32()); + message.bucketOptions = $root.google.api.Distribution.BucketOptions.decode(reader, reader.uint32(), undefined, long + 1); break; } case 7: { @@ -45049,11 +46953,11 @@ case 10: { if (!(message.exemplars && message.exemplars.length)) message.exemplars = []; - message.exemplars.push($root.google.api.Distribution.Exemplar.decode(reader, reader.uint32())); + message.exemplars.push($root.google.api.Distribution.Exemplar.decode(reader, reader.uint32(), undefined, long + 1)); break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -45084,9 +46988,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Distribution.verify = function verify(message) { + Distribution.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.count != null && message.hasOwnProperty("count")) if (!$util.isInteger(message.count) && !(message.count && $util.isInteger(message.count.low) && $util.isInteger(message.count.high))) return "count: integer|Long expected"; @@ -45097,12 +47005,12 @@ if (typeof message.sumOfSquaredDeviation !== "number") return "sumOfSquaredDeviation: number expected"; if (message.range != null && message.hasOwnProperty("range")) { - var error = $root.google.api.Distribution.Range.verify(message.range); + var error = $root.google.api.Distribution.Range.verify(message.range, long + 1); if (error) return "range." + error; } if (message.bucketOptions != null && message.hasOwnProperty("bucketOptions")) { - var error = $root.google.api.Distribution.BucketOptions.verify(message.bucketOptions); + var error = $root.google.api.Distribution.BucketOptions.verify(message.bucketOptions, long + 1); if (error) return "bucketOptions." + error; } @@ -45117,7 +47025,7 @@ if (!Array.isArray(message.exemplars)) return "exemplars: array expected"; for (var i = 0; i < message.exemplars.length; ++i) { - var error = $root.google.api.Distribution.Exemplar.verify(message.exemplars[i]); + var error = $root.google.api.Distribution.Exemplar.verify(message.exemplars[i], long + 1); if (error) return "exemplars." + error; } @@ -45133,9 +47041,13 @@ * @param {Object.} object Plain object * @returns {google.api.Distribution} Distribution */ - Distribution.fromObject = function fromObject(object) { + Distribution.fromObject = function fromObject(object, long) { if (object instanceof $root.google.api.Distribution) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.api.Distribution(); if (object.count != null) if ($util.Long) @@ -45153,12 +47065,12 @@ if (object.range != null) { if (typeof object.range !== "object") throw TypeError(".google.api.Distribution.range: object expected"); - message.range = $root.google.api.Distribution.Range.fromObject(object.range); + message.range = $root.google.api.Distribution.Range.fromObject(object.range, long + 1); } if (object.bucketOptions != null) { if (typeof object.bucketOptions !== "object") throw TypeError(".google.api.Distribution.bucketOptions: object expected"); - message.bucketOptions = $root.google.api.Distribution.BucketOptions.fromObject(object.bucketOptions); + message.bucketOptions = $root.google.api.Distribution.BucketOptions.fromObject(object.bucketOptions, long + 1); } if (object.bucketCounts) { if (!Array.isArray(object.bucketCounts)) @@ -45181,7 +47093,7 @@ for (var i = 0; i < object.exemplars.length; ++i) { if (typeof object.exemplars[i] !== "object") throw TypeError(".google.api.Distribution.exemplars: object expected"); - message.exemplars[i] = $root.google.api.Distribution.Exemplar.fromObject(object.exemplars[i]); + message.exemplars[i] = $root.google.api.Distribution.Exemplar.fromObject(object.exemplars[i], long + 1); } } return message; @@ -45291,7 +47203,7 @@ function Range(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -45366,9 +47278,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Range.decode = function decode(reader, length, error) { + Range.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.Distribution.Range(); while (reader.pos < end) { var tag = reader.uint32(); @@ -45384,7 +47300,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -45415,9 +47331,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Range.verify = function verify(message) { + Range.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.min != null && message.hasOwnProperty("min")) if (typeof message.min !== "number") return "min: number expected"; @@ -45435,9 +47355,13 @@ * @param {Object.} object Plain object * @returns {google.api.Distribution.Range} Range */ - Range.fromObject = function fromObject(object) { + Range.fromObject = function fromObject(object, long) { if (object instanceof $root.google.api.Distribution.Range) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.api.Distribution.Range(); if (object.min != null) message.min = Number(object.min); @@ -45521,7 +47445,7 @@ function BucketOptions(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -45620,9 +47544,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - BucketOptions.decode = function decode(reader, length, error) { + BucketOptions.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.Distribution.BucketOptions(); while (reader.pos < end) { var tag = reader.uint32(); @@ -45630,19 +47558,19 @@ break; switch (tag >>> 3) { case 1: { - message.linearBuckets = $root.google.api.Distribution.BucketOptions.Linear.decode(reader, reader.uint32()); + message.linearBuckets = $root.google.api.Distribution.BucketOptions.Linear.decode(reader, reader.uint32(), undefined, long + 1); break; } case 2: { - message.exponentialBuckets = $root.google.api.Distribution.BucketOptions.Exponential.decode(reader, reader.uint32()); + message.exponentialBuckets = $root.google.api.Distribution.BucketOptions.Exponential.decode(reader, reader.uint32(), undefined, long + 1); break; } case 3: { - message.explicitBuckets = $root.google.api.Distribution.BucketOptions.Explicit.decode(reader, reader.uint32()); + message.explicitBuckets = $root.google.api.Distribution.BucketOptions.Explicit.decode(reader, reader.uint32(), undefined, long + 1); break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -45673,14 +47601,18 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - BucketOptions.verify = function verify(message) { + BucketOptions.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; var properties = {}; if (message.linearBuckets != null && message.hasOwnProperty("linearBuckets")) { properties.options = 1; { - var error = $root.google.api.Distribution.BucketOptions.Linear.verify(message.linearBuckets); + var error = $root.google.api.Distribution.BucketOptions.Linear.verify(message.linearBuckets, long + 1); if (error) return "linearBuckets." + error; } @@ -45690,7 +47622,7 @@ return "options: multiple values"; properties.options = 1; { - var error = $root.google.api.Distribution.BucketOptions.Exponential.verify(message.exponentialBuckets); + var error = $root.google.api.Distribution.BucketOptions.Exponential.verify(message.exponentialBuckets, long + 1); if (error) return "exponentialBuckets." + error; } @@ -45700,7 +47632,7 @@ return "options: multiple values"; properties.options = 1; { - var error = $root.google.api.Distribution.BucketOptions.Explicit.verify(message.explicitBuckets); + var error = $root.google.api.Distribution.BucketOptions.Explicit.verify(message.explicitBuckets, long + 1); if (error) return "explicitBuckets." + error; } @@ -45716,24 +47648,28 @@ * @param {Object.} object Plain object * @returns {google.api.Distribution.BucketOptions} BucketOptions */ - BucketOptions.fromObject = function fromObject(object) { + BucketOptions.fromObject = function fromObject(object, long) { if (object instanceof $root.google.api.Distribution.BucketOptions) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.api.Distribution.BucketOptions(); if (object.linearBuckets != null) { if (typeof object.linearBuckets !== "object") throw TypeError(".google.api.Distribution.BucketOptions.linearBuckets: object expected"); - message.linearBuckets = $root.google.api.Distribution.BucketOptions.Linear.fromObject(object.linearBuckets); + message.linearBuckets = $root.google.api.Distribution.BucketOptions.Linear.fromObject(object.linearBuckets, long + 1); } if (object.exponentialBuckets != null) { if (typeof object.exponentialBuckets !== "object") throw TypeError(".google.api.Distribution.BucketOptions.exponentialBuckets: object expected"); - message.exponentialBuckets = $root.google.api.Distribution.BucketOptions.Exponential.fromObject(object.exponentialBuckets); + message.exponentialBuckets = $root.google.api.Distribution.BucketOptions.Exponential.fromObject(object.exponentialBuckets, long + 1); } if (object.explicitBuckets != null) { if (typeof object.explicitBuckets !== "object") throw TypeError(".google.api.Distribution.BucketOptions.explicitBuckets: object expected"); - message.explicitBuckets = $root.google.api.Distribution.BucketOptions.Explicit.fromObject(object.explicitBuckets); + message.explicitBuckets = $root.google.api.Distribution.BucketOptions.Explicit.fromObject(object.explicitBuckets, long + 1); } return message; }; @@ -45817,7 +47753,7 @@ function Linear(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -45902,9 +47838,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Linear.decode = function decode(reader, length, error) { + Linear.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.Distribution.BucketOptions.Linear(); while (reader.pos < end) { var tag = reader.uint32(); @@ -45924,7 +47864,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -45955,9 +47895,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Linear.verify = function verify(message) { + Linear.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.numFiniteBuckets != null && message.hasOwnProperty("numFiniteBuckets")) if (!$util.isInteger(message.numFiniteBuckets)) return "numFiniteBuckets: integer expected"; @@ -45978,9 +47922,13 @@ * @param {Object.} object Plain object * @returns {google.api.Distribution.BucketOptions.Linear} Linear */ - Linear.fromObject = function fromObject(object) { + Linear.fromObject = function fromObject(object, long) { if (object instanceof $root.google.api.Distribution.BucketOptions.Linear) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.api.Distribution.BucketOptions.Linear(); if (object.numFiniteBuckets != null) message.numFiniteBuckets = object.numFiniteBuckets | 0; @@ -46069,7 +48017,7 @@ function Exponential(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -46154,9 +48102,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Exponential.decode = function decode(reader, length, error) { + Exponential.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.Distribution.BucketOptions.Exponential(); while (reader.pos < end) { var tag = reader.uint32(); @@ -46176,7 +48128,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -46207,9 +48159,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Exponential.verify = function verify(message) { + Exponential.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.numFiniteBuckets != null && message.hasOwnProperty("numFiniteBuckets")) if (!$util.isInteger(message.numFiniteBuckets)) return "numFiniteBuckets: integer expected"; @@ -46230,9 +48186,13 @@ * @param {Object.} object Plain object * @returns {google.api.Distribution.BucketOptions.Exponential} Exponential */ - Exponential.fromObject = function fromObject(object) { + Exponential.fromObject = function fromObject(object, long) { if (object instanceof $root.google.api.Distribution.BucketOptions.Exponential) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.api.Distribution.BucketOptions.Exponential(); if (object.numFiniteBuckets != null) message.numFiniteBuckets = object.numFiniteBuckets | 0; @@ -46320,7 +48280,7 @@ this.bounds = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -46389,9 +48349,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Explicit.decode = function decode(reader, length, error) { + Explicit.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.Distribution.BucketOptions.Explicit(); while (reader.pos < end) { var tag = reader.uint32(); @@ -46410,7 +48374,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -46441,9 +48405,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Explicit.verify = function verify(message) { + Explicit.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.bounds != null && message.hasOwnProperty("bounds")) { if (!Array.isArray(message.bounds)) return "bounds: array expected"; @@ -46462,9 +48430,13 @@ * @param {Object.} object Plain object * @returns {google.api.Distribution.BucketOptions.Explicit} Explicit */ - Explicit.fromObject = function fromObject(object) { + Explicit.fromObject = function fromObject(object, long) { if (object instanceof $root.google.api.Distribution.BucketOptions.Explicit) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.api.Distribution.BucketOptions.Explicit(); if (object.bounds) { if (!Array.isArray(object.bounds)) @@ -46554,7 +48526,7 @@ this.attachments = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -46640,9 +48612,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Exemplar.decode = function decode(reader, length, error) { + Exemplar.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.Distribution.Exemplar(); while (reader.pos < end) { var tag = reader.uint32(); @@ -46654,17 +48630,17 @@ break; } case 2: { - message.timestamp = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + message.timestamp = $root.google.protobuf.Timestamp.decode(reader, reader.uint32(), undefined, long + 1); break; } case 3: { if (!(message.attachments && message.attachments.length)) message.attachments = []; - message.attachments.push($root.google.protobuf.Any.decode(reader, reader.uint32())); + message.attachments.push($root.google.protobuf.Any.decode(reader, reader.uint32(), undefined, long + 1)); break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -46695,14 +48671,18 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Exemplar.verify = function verify(message) { + Exemplar.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.value != null && message.hasOwnProperty("value")) if (typeof message.value !== "number") return "value: number expected"; if (message.timestamp != null && message.hasOwnProperty("timestamp")) { - var error = $root.google.protobuf.Timestamp.verify(message.timestamp); + var error = $root.google.protobuf.Timestamp.verify(message.timestamp, long + 1); if (error) return "timestamp." + error; } @@ -46710,7 +48690,7 @@ if (!Array.isArray(message.attachments)) return "attachments: array expected"; for (var i = 0; i < message.attachments.length; ++i) { - var error = $root.google.protobuf.Any.verify(message.attachments[i]); + var error = $root.google.protobuf.Any.verify(message.attachments[i], long + 1); if (error) return "attachments." + error; } @@ -46726,16 +48706,20 @@ * @param {Object.} object Plain object * @returns {google.api.Distribution.Exemplar} Exemplar */ - Exemplar.fromObject = function fromObject(object) { + Exemplar.fromObject = function fromObject(object, long) { if (object instanceof $root.google.api.Distribution.Exemplar) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.api.Distribution.Exemplar(); if (object.value != null) message.value = Number(object.value); if (object.timestamp != null) { if (typeof object.timestamp !== "object") throw TypeError(".google.api.Distribution.Exemplar.timestamp: object expected"); - message.timestamp = $root.google.protobuf.Timestamp.fromObject(object.timestamp); + message.timestamp = $root.google.protobuf.Timestamp.fromObject(object.timestamp, long + 1); } if (object.attachments) { if (!Array.isArray(object.attachments)) @@ -46744,7 +48728,7 @@ for (var i = 0; i < object.attachments.length; ++i) { if (typeof object.attachments[i] !== "object") throw TypeError(".google.api.Distribution.Exemplar.attachments: object expected"); - message.attachments[i] = $root.google.protobuf.Any.fromObject(object.attachments[i]); + message.attachments[i] = $root.google.protobuf.Any.fromObject(object.attachments[i], long + 1); } } return message; @@ -46835,7 +48819,7 @@ this.rules = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -46911,9 +48895,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Http.decode = function decode(reader, length, error) { + Http.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.Http(); while (reader.pos < end) { var tag = reader.uint32(); @@ -46923,7 +48911,7 @@ case 1: { if (!(message.rules && message.rules.length)) message.rules = []; - message.rules.push($root.google.api.HttpRule.decode(reader, reader.uint32())); + message.rules.push($root.google.api.HttpRule.decode(reader, reader.uint32(), undefined, long + 1)); break; } case 2: { @@ -46931,7 +48919,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -46962,14 +48950,18 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Http.verify = function verify(message) { + Http.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.rules != null && message.hasOwnProperty("rules")) { if (!Array.isArray(message.rules)) return "rules: array expected"; for (var i = 0; i < message.rules.length; ++i) { - var error = $root.google.api.HttpRule.verify(message.rules[i]); + var error = $root.google.api.HttpRule.verify(message.rules[i], long + 1); if (error) return "rules." + error; } @@ -46988,9 +48980,13 @@ * @param {Object.} object Plain object * @returns {google.api.Http} Http */ - Http.fromObject = function fromObject(object) { + Http.fromObject = function fromObject(object, long) { if (object instanceof $root.google.api.Http) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.api.Http(); if (object.rules) { if (!Array.isArray(object.rules)) @@ -46999,7 +48995,7 @@ for (var i = 0; i < object.rules.length; ++i) { if (typeof object.rules[i] !== "object") throw TypeError(".google.api.Http.rules: object expected"); - message.rules[i] = $root.google.api.HttpRule.fromObject(object.rules[i]); + message.rules[i] = $root.google.api.HttpRule.fromObject(object.rules[i], long + 1); } } if (object.fullyDecodeReservedExpansion != null) @@ -47093,7 +49089,7 @@ this.additionalBindings = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -47263,9 +49259,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - HttpRule.decode = function decode(reader, length, error) { + HttpRule.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.HttpRule(); while (reader.pos < end) { var tag = reader.uint32(); @@ -47297,7 +49297,7 @@ break; } case 8: { - message.custom = $root.google.api.CustomHttpPattern.decode(reader, reader.uint32()); + message.custom = $root.google.api.CustomHttpPattern.decode(reader, reader.uint32(), undefined, long + 1); break; } case 7: { @@ -47311,11 +49311,11 @@ case 11: { if (!(message.additionalBindings && message.additionalBindings.length)) message.additionalBindings = []; - message.additionalBindings.push($root.google.api.HttpRule.decode(reader, reader.uint32())); + message.additionalBindings.push($root.google.api.HttpRule.decode(reader, reader.uint32(), undefined, long + 1)); break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -47346,9 +49346,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - HttpRule.verify = function verify(message) { + HttpRule.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; var properties = {}; if (message.selector != null && message.hasOwnProperty("selector")) if (!$util.isString(message.selector)) @@ -47391,7 +49395,7 @@ return "pattern: multiple values"; properties.pattern = 1; { - var error = $root.google.api.CustomHttpPattern.verify(message.custom); + var error = $root.google.api.CustomHttpPattern.verify(message.custom, long + 1); if (error) return "custom." + error; } @@ -47406,7 +49410,7 @@ if (!Array.isArray(message.additionalBindings)) return "additionalBindings: array expected"; for (var i = 0; i < message.additionalBindings.length; ++i) { - var error = $root.google.api.HttpRule.verify(message.additionalBindings[i]); + var error = $root.google.api.HttpRule.verify(message.additionalBindings[i], long + 1); if (error) return "additionalBindings." + error; } @@ -47422,9 +49426,13 @@ * @param {Object.} object Plain object * @returns {google.api.HttpRule} HttpRule */ - HttpRule.fromObject = function fromObject(object) { + HttpRule.fromObject = function fromObject(object, long) { if (object instanceof $root.google.api.HttpRule) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.api.HttpRule(); if (object.selector != null) message.selector = String(object.selector); @@ -47441,7 +49449,7 @@ if (object.custom != null) { if (typeof object.custom !== "object") throw TypeError(".google.api.HttpRule.custom: object expected"); - message.custom = $root.google.api.CustomHttpPattern.fromObject(object.custom); + message.custom = $root.google.api.CustomHttpPattern.fromObject(object.custom, long + 1); } if (object.body != null) message.body = String(object.body); @@ -47454,7 +49462,7 @@ for (var i = 0; i < object.additionalBindings.length; ++i) { if (typeof object.additionalBindings[i] !== "object") throw TypeError(".google.api.HttpRule.additionalBindings: object expected"); - message.additionalBindings[i] = $root.google.api.HttpRule.fromObject(object.additionalBindings[i]); + message.additionalBindings[i] = $root.google.api.HttpRule.fromObject(object.additionalBindings[i], long + 1); } } return message; @@ -47574,7 +49582,7 @@ function CustomHttpPattern(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -47649,9 +49657,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - CustomHttpPattern.decode = function decode(reader, length, error) { + CustomHttpPattern.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.CustomHttpPattern(); while (reader.pos < end) { var tag = reader.uint32(); @@ -47667,7 +49679,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -47698,9 +49710,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - CustomHttpPattern.verify = function verify(message) { + CustomHttpPattern.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.kind != null && message.hasOwnProperty("kind")) if (!$util.isString(message.kind)) return "kind: string expected"; @@ -47718,9 +49734,13 @@ * @param {Object.} object Plain object * @returns {google.api.CustomHttpPattern} CustomHttpPattern */ - CustomHttpPattern.fromObject = function fromObject(object) { + CustomHttpPattern.fromObject = function fromObject(object, long) { if (object instanceof $root.google.api.CustomHttpPattern) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.api.CustomHttpPattern(); if (object.kind != null) message.kind = String(object.kind); @@ -47805,7 +49825,7 @@ this.destinations = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -47894,9 +49914,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - CommonLanguageSettings.decode = function decode(reader, length, error) { + CommonLanguageSettings.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.CommonLanguageSettings(); while (reader.pos < end) { var tag = reader.uint32(); @@ -47919,11 +49943,11 @@ break; } case 3: { - message.selectiveGapicGeneration = $root.google.api.SelectiveGapicGeneration.decode(reader, reader.uint32()); + message.selectiveGapicGeneration = $root.google.api.SelectiveGapicGeneration.decode(reader, reader.uint32(), undefined, long + 1); break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -47954,9 +49978,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - CommonLanguageSettings.verify = function verify(message) { + CommonLanguageSettings.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.referenceDocsUri != null && message.hasOwnProperty("referenceDocsUri")) if (!$util.isString(message.referenceDocsUri)) return "referenceDocsUri: string expected"; @@ -47974,7 +50002,7 @@ } } if (message.selectiveGapicGeneration != null && message.hasOwnProperty("selectiveGapicGeneration")) { - var error = $root.google.api.SelectiveGapicGeneration.verify(message.selectiveGapicGeneration); + var error = $root.google.api.SelectiveGapicGeneration.verify(message.selectiveGapicGeneration, long + 1); if (error) return "selectiveGapicGeneration." + error; } @@ -47989,9 +50017,13 @@ * @param {Object.} object Plain object * @returns {google.api.CommonLanguageSettings} CommonLanguageSettings */ - CommonLanguageSettings.fromObject = function fromObject(object) { + CommonLanguageSettings.fromObject = function fromObject(object, long) { if (object instanceof $root.google.api.CommonLanguageSettings) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.api.CommonLanguageSettings(); if (object.referenceDocsUri != null) message.referenceDocsUri = String(object.referenceDocsUri); @@ -48023,7 +50055,7 @@ if (object.selectiveGapicGeneration != null) { if (typeof object.selectiveGapicGeneration !== "object") throw TypeError(".google.api.CommonLanguageSettings.selectiveGapicGeneration: object expected"); - message.selectiveGapicGeneration = $root.google.api.SelectiveGapicGeneration.fromObject(object.selectiveGapicGeneration); + message.selectiveGapicGeneration = $root.google.api.SelectiveGapicGeneration.fromObject(object.selectiveGapicGeneration, long + 1); } return message; }; @@ -48118,7 +50150,7 @@ function ClientLibrarySettings(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -48283,9 +50315,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ClientLibrarySettings.decode = function decode(reader, length, error) { + ClientLibrarySettings.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.ClientLibrarySettings(); while (reader.pos < end) { var tag = reader.uint32(); @@ -48305,39 +50341,39 @@ break; } case 21: { - message.javaSettings = $root.google.api.JavaSettings.decode(reader, reader.uint32()); + message.javaSettings = $root.google.api.JavaSettings.decode(reader, reader.uint32(), undefined, long + 1); break; } case 22: { - message.cppSettings = $root.google.api.CppSettings.decode(reader, reader.uint32()); + message.cppSettings = $root.google.api.CppSettings.decode(reader, reader.uint32(), undefined, long + 1); break; } case 23: { - message.phpSettings = $root.google.api.PhpSettings.decode(reader, reader.uint32()); + message.phpSettings = $root.google.api.PhpSettings.decode(reader, reader.uint32(), undefined, long + 1); break; } case 24: { - message.pythonSettings = $root.google.api.PythonSettings.decode(reader, reader.uint32()); + message.pythonSettings = $root.google.api.PythonSettings.decode(reader, reader.uint32(), undefined, long + 1); break; } case 25: { - message.nodeSettings = $root.google.api.NodeSettings.decode(reader, reader.uint32()); + message.nodeSettings = $root.google.api.NodeSettings.decode(reader, reader.uint32(), undefined, long + 1); break; } case 26: { - message.dotnetSettings = $root.google.api.DotnetSettings.decode(reader, reader.uint32()); + message.dotnetSettings = $root.google.api.DotnetSettings.decode(reader, reader.uint32(), undefined, long + 1); break; } case 27: { - message.rubySettings = $root.google.api.RubySettings.decode(reader, reader.uint32()); + message.rubySettings = $root.google.api.RubySettings.decode(reader, reader.uint32(), undefined, long + 1); break; } case 28: { - message.goSettings = $root.google.api.GoSettings.decode(reader, reader.uint32()); + message.goSettings = $root.google.api.GoSettings.decode(reader, reader.uint32(), undefined, long + 1); break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -48368,9 +50404,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ClientLibrarySettings.verify = function verify(message) { + ClientLibrarySettings.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.version != null && message.hasOwnProperty("version")) if (!$util.isString(message.version)) return "version: string expected"; @@ -48392,42 +50432,42 @@ if (typeof message.restNumericEnums !== "boolean") return "restNumericEnums: boolean expected"; if (message.javaSettings != null && message.hasOwnProperty("javaSettings")) { - var error = $root.google.api.JavaSettings.verify(message.javaSettings); + var error = $root.google.api.JavaSettings.verify(message.javaSettings, long + 1); if (error) return "javaSettings." + error; } if (message.cppSettings != null && message.hasOwnProperty("cppSettings")) { - var error = $root.google.api.CppSettings.verify(message.cppSettings); + var error = $root.google.api.CppSettings.verify(message.cppSettings, long + 1); if (error) return "cppSettings." + error; } if (message.phpSettings != null && message.hasOwnProperty("phpSettings")) { - var error = $root.google.api.PhpSettings.verify(message.phpSettings); + var error = $root.google.api.PhpSettings.verify(message.phpSettings, long + 1); if (error) return "phpSettings." + error; } if (message.pythonSettings != null && message.hasOwnProperty("pythonSettings")) { - var error = $root.google.api.PythonSettings.verify(message.pythonSettings); + var error = $root.google.api.PythonSettings.verify(message.pythonSettings, long + 1); if (error) return "pythonSettings." + error; } if (message.nodeSettings != null && message.hasOwnProperty("nodeSettings")) { - var error = $root.google.api.NodeSettings.verify(message.nodeSettings); + var error = $root.google.api.NodeSettings.verify(message.nodeSettings, long + 1); if (error) return "nodeSettings." + error; } if (message.dotnetSettings != null && message.hasOwnProperty("dotnetSettings")) { - var error = $root.google.api.DotnetSettings.verify(message.dotnetSettings); + var error = $root.google.api.DotnetSettings.verify(message.dotnetSettings, long + 1); if (error) return "dotnetSettings." + error; } if (message.rubySettings != null && message.hasOwnProperty("rubySettings")) { - var error = $root.google.api.RubySettings.verify(message.rubySettings); + var error = $root.google.api.RubySettings.verify(message.rubySettings, long + 1); if (error) return "rubySettings." + error; } if (message.goSettings != null && message.hasOwnProperty("goSettings")) { - var error = $root.google.api.GoSettings.verify(message.goSettings); + var error = $root.google.api.GoSettings.verify(message.goSettings, long + 1); if (error) return "goSettings." + error; } @@ -48442,9 +50482,13 @@ * @param {Object.} object Plain object * @returns {google.api.ClientLibrarySettings} ClientLibrarySettings */ - ClientLibrarySettings.fromObject = function fromObject(object) { + ClientLibrarySettings.fromObject = function fromObject(object, long) { if (object instanceof $root.google.api.ClientLibrarySettings) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.api.ClientLibrarySettings(); if (object.version != null) message.version = String(object.version); @@ -48493,42 +50537,42 @@ if (object.javaSettings != null) { if (typeof object.javaSettings !== "object") throw TypeError(".google.api.ClientLibrarySettings.javaSettings: object expected"); - message.javaSettings = $root.google.api.JavaSettings.fromObject(object.javaSettings); + message.javaSettings = $root.google.api.JavaSettings.fromObject(object.javaSettings, long + 1); } if (object.cppSettings != null) { if (typeof object.cppSettings !== "object") throw TypeError(".google.api.ClientLibrarySettings.cppSettings: object expected"); - message.cppSettings = $root.google.api.CppSettings.fromObject(object.cppSettings); + message.cppSettings = $root.google.api.CppSettings.fromObject(object.cppSettings, long + 1); } if (object.phpSettings != null) { if (typeof object.phpSettings !== "object") throw TypeError(".google.api.ClientLibrarySettings.phpSettings: object expected"); - message.phpSettings = $root.google.api.PhpSettings.fromObject(object.phpSettings); + message.phpSettings = $root.google.api.PhpSettings.fromObject(object.phpSettings, long + 1); } if (object.pythonSettings != null) { if (typeof object.pythonSettings !== "object") throw TypeError(".google.api.ClientLibrarySettings.pythonSettings: object expected"); - message.pythonSettings = $root.google.api.PythonSettings.fromObject(object.pythonSettings); + message.pythonSettings = $root.google.api.PythonSettings.fromObject(object.pythonSettings, long + 1); } if (object.nodeSettings != null) { if (typeof object.nodeSettings !== "object") throw TypeError(".google.api.ClientLibrarySettings.nodeSettings: object expected"); - message.nodeSettings = $root.google.api.NodeSettings.fromObject(object.nodeSettings); + message.nodeSettings = $root.google.api.NodeSettings.fromObject(object.nodeSettings, long + 1); } if (object.dotnetSettings != null) { if (typeof object.dotnetSettings !== "object") throw TypeError(".google.api.ClientLibrarySettings.dotnetSettings: object expected"); - message.dotnetSettings = $root.google.api.DotnetSettings.fromObject(object.dotnetSettings); + message.dotnetSettings = $root.google.api.DotnetSettings.fromObject(object.dotnetSettings, long + 1); } if (object.rubySettings != null) { if (typeof object.rubySettings !== "object") throw TypeError(".google.api.ClientLibrarySettings.rubySettings: object expected"); - message.rubySettings = $root.google.api.RubySettings.fromObject(object.rubySettings); + message.rubySettings = $root.google.api.RubySettings.fromObject(object.rubySettings, long + 1); } if (object.goSettings != null) { if (typeof object.goSettings !== "object") throw TypeError(".google.api.ClientLibrarySettings.goSettings: object expected"); - message.goSettings = $root.google.api.GoSettings.fromObject(object.goSettings); + message.goSettings = $root.google.api.GoSettings.fromObject(object.goSettings, long + 1); } return message; }; @@ -48646,7 +50690,7 @@ this.librarySettings = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -48814,9 +50858,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Publishing.decode = function decode(reader, length, error) { + Publishing.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.Publishing(); while (reader.pos < end) { var tag = reader.uint32(); @@ -48826,7 +50874,7 @@ case 2: { if (!(message.methodSettings && message.methodSettings.length)) message.methodSettings = []; - message.methodSettings.push($root.google.api.MethodSettings.decode(reader, reader.uint32())); + message.methodSettings.push($root.google.api.MethodSettings.decode(reader, reader.uint32(), undefined, long + 1)); break; } case 101: { @@ -48862,7 +50910,7 @@ case 109: { if (!(message.librarySettings && message.librarySettings.length)) message.librarySettings = []; - message.librarySettings.push($root.google.api.ClientLibrarySettings.decode(reader, reader.uint32())); + message.librarySettings.push($root.google.api.ClientLibrarySettings.decode(reader, reader.uint32(), undefined, long + 1)); break; } case 110: { @@ -48874,7 +50922,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -48905,14 +50953,18 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Publishing.verify = function verify(message) { + Publishing.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.methodSettings != null && message.hasOwnProperty("methodSettings")) { if (!Array.isArray(message.methodSettings)) return "methodSettings: array expected"; for (var i = 0; i < message.methodSettings.length; ++i) { - var error = $root.google.api.MethodSettings.verify(message.methodSettings[i]); + var error = $root.google.api.MethodSettings.verify(message.methodSettings[i], long + 1); if (error) return "methodSettings." + error; } @@ -48957,7 +51009,7 @@ if (!Array.isArray(message.librarySettings)) return "librarySettings: array expected"; for (var i = 0; i < message.librarySettings.length; ++i) { - var error = $root.google.api.ClientLibrarySettings.verify(message.librarySettings[i]); + var error = $root.google.api.ClientLibrarySettings.verify(message.librarySettings[i], long + 1); if (error) return "librarySettings." + error; } @@ -48979,9 +51031,13 @@ * @param {Object.} object Plain object * @returns {google.api.Publishing} Publishing */ - Publishing.fromObject = function fromObject(object) { + Publishing.fromObject = function fromObject(object, long) { if (object instanceof $root.google.api.Publishing) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.api.Publishing(); if (object.methodSettings) { if (!Array.isArray(object.methodSettings)) @@ -48990,7 +51046,7 @@ for (var i = 0; i < object.methodSettings.length; ++i) { if (typeof object.methodSettings[i] !== "object") throw TypeError(".google.api.Publishing.methodSettings: object expected"); - message.methodSettings[i] = $root.google.api.MethodSettings.fromObject(object.methodSettings[i]); + message.methodSettings[i] = $root.google.api.MethodSettings.fromObject(object.methodSettings[i], long + 1); } } if (object.newIssueUri != null) @@ -49057,7 +51113,7 @@ for (var i = 0; i < object.librarySettings.length; ++i) { if (typeof object.librarySettings[i] !== "object") throw TypeError(".google.api.Publishing.librarySettings: object expected"); - message.librarySettings[i] = $root.google.api.ClientLibrarySettings.fromObject(object.librarySettings[i]); + message.librarySettings[i] = $root.google.api.ClientLibrarySettings.fromObject(object.librarySettings[i], long + 1); } } if (object.protoReferenceDocumentationUri != null) @@ -49181,7 +51237,7 @@ this.serviceClassNames = {}; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -49267,9 +51323,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - JavaSettings.decode = function decode(reader, length, error) { + JavaSettings.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.JavaSettings(), key, value; while (reader.pos < end) { var tag = reader.uint32(); @@ -49296,19 +51356,21 @@ value = reader.string(); break; default: - reader.skipType(tag2 & 7); + reader.skipType(tag2 & 7, long); break; } } + if (key === "__proto__") + $util.makeProp(message.serviceClassNames, key); message.serviceClassNames[key] = value; break; } case 3: { - message.common = $root.google.api.CommonLanguageSettings.decode(reader, reader.uint32()); + message.common = $root.google.api.CommonLanguageSettings.decode(reader, reader.uint32(), undefined, long + 1); break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -49339,9 +51401,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - JavaSettings.verify = function verify(message) { + JavaSettings.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.libraryPackage != null && message.hasOwnProperty("libraryPackage")) if (!$util.isString(message.libraryPackage)) return "libraryPackage: string expected"; @@ -49354,7 +51420,7 @@ return "serviceClassNames: string{k:string} expected"; } if (message.common != null && message.hasOwnProperty("common")) { - var error = $root.google.api.CommonLanguageSettings.verify(message.common); + var error = $root.google.api.CommonLanguageSettings.verify(message.common, long + 1); if (error) return "common." + error; } @@ -49369,9 +51435,13 @@ * @param {Object.} object Plain object * @returns {google.api.JavaSettings} JavaSettings */ - JavaSettings.fromObject = function fromObject(object) { + JavaSettings.fromObject = function fromObject(object, long) { if (object instanceof $root.google.api.JavaSettings) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.api.JavaSettings(); if (object.libraryPackage != null) message.libraryPackage = String(object.libraryPackage); @@ -49379,13 +51449,16 @@ if (typeof object.serviceClassNames !== "object") throw TypeError(".google.api.JavaSettings.serviceClassNames: object expected"); message.serviceClassNames = {}; - for (var keys = Object.keys(object.serviceClassNames), i = 0; i < keys.length; ++i) + for (var keys = Object.keys(object.serviceClassNames), i = 0; i < keys.length; ++i) { + if (keys[i] === "__proto__") + $util.makeProp(message.serviceClassNames, keys[i]); message.serviceClassNames[keys[i]] = String(object.serviceClassNames[keys[i]]); + } } if (object.common != null) { if (typeof object.common !== "object") throw TypeError(".google.api.JavaSettings.common: object expected"); - message.common = $root.google.api.CommonLanguageSettings.fromObject(object.common); + message.common = $root.google.api.CommonLanguageSettings.fromObject(object.common, long + 1); } return message; }; @@ -49414,8 +51487,11 @@ var keys2; if (message.serviceClassNames && (keys2 = Object.keys(message.serviceClassNames)).length) { object.serviceClassNames = {}; - for (var j = 0; j < keys2.length; ++j) + for (var j = 0; j < keys2.length; ++j) { + if (keys2[j] === "__proto__") + $util.makeProp(object.serviceClassNames, keys2[j]); object.serviceClassNames[keys2[j]] = message.serviceClassNames[keys2[j]]; + } } if (message.common != null && message.hasOwnProperty("common")) object.common = $root.google.api.CommonLanguageSettings.toObject(message.common, options); @@ -49471,7 +51547,7 @@ function CppSettings(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -49536,9 +51612,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - CppSettings.decode = function decode(reader, length, error) { + CppSettings.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.CppSettings(); while (reader.pos < end) { var tag = reader.uint32(); @@ -49546,11 +51626,11 @@ break; switch (tag >>> 3) { case 1: { - message.common = $root.google.api.CommonLanguageSettings.decode(reader, reader.uint32()); + message.common = $root.google.api.CommonLanguageSettings.decode(reader, reader.uint32(), undefined, long + 1); break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -49581,11 +51661,15 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - CppSettings.verify = function verify(message) { + CppSettings.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.common != null && message.hasOwnProperty("common")) { - var error = $root.google.api.CommonLanguageSettings.verify(message.common); + var error = $root.google.api.CommonLanguageSettings.verify(message.common, long + 1); if (error) return "common." + error; } @@ -49600,14 +51684,18 @@ * @param {Object.} object Plain object * @returns {google.api.CppSettings} CppSettings */ - CppSettings.fromObject = function fromObject(object) { + CppSettings.fromObject = function fromObject(object, long) { if (object instanceof $root.google.api.CppSettings) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.api.CppSettings(); if (object.common != null) { if (typeof object.common !== "object") throw TypeError(".google.api.CppSettings.common: object expected"); - message.common = $root.google.api.CommonLanguageSettings.fromObject(object.common); + message.common = $root.google.api.CommonLanguageSettings.fromObject(object.common, long + 1); } return message; }; @@ -49681,7 +51769,7 @@ function PhpSettings(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -49746,9 +51834,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - PhpSettings.decode = function decode(reader, length, error) { + PhpSettings.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.PhpSettings(); while (reader.pos < end) { var tag = reader.uint32(); @@ -49756,11 +51848,11 @@ break; switch (tag >>> 3) { case 1: { - message.common = $root.google.api.CommonLanguageSettings.decode(reader, reader.uint32()); + message.common = $root.google.api.CommonLanguageSettings.decode(reader, reader.uint32(), undefined, long + 1); break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -49791,11 +51883,15 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - PhpSettings.verify = function verify(message) { + PhpSettings.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.common != null && message.hasOwnProperty("common")) { - var error = $root.google.api.CommonLanguageSettings.verify(message.common); + var error = $root.google.api.CommonLanguageSettings.verify(message.common, long + 1); if (error) return "common." + error; } @@ -49810,14 +51906,18 @@ * @param {Object.} object Plain object * @returns {google.api.PhpSettings} PhpSettings */ - PhpSettings.fromObject = function fromObject(object) { + PhpSettings.fromObject = function fromObject(object, long) { if (object instanceof $root.google.api.PhpSettings) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.api.PhpSettings(); if (object.common != null) { if (typeof object.common !== "object") throw TypeError(".google.api.PhpSettings.common: object expected"); - message.common = $root.google.api.CommonLanguageSettings.fromObject(object.common); + message.common = $root.google.api.CommonLanguageSettings.fromObject(object.common, long + 1); } return message; }; @@ -49892,7 +51992,7 @@ function PythonSettings(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -49967,9 +52067,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - PythonSettings.decode = function decode(reader, length, error) { + PythonSettings.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.PythonSettings(); while (reader.pos < end) { var tag = reader.uint32(); @@ -49977,15 +52081,15 @@ break; switch (tag >>> 3) { case 1: { - message.common = $root.google.api.CommonLanguageSettings.decode(reader, reader.uint32()); + message.common = $root.google.api.CommonLanguageSettings.decode(reader, reader.uint32(), undefined, long + 1); break; } case 2: { - message.experimentalFeatures = $root.google.api.PythonSettings.ExperimentalFeatures.decode(reader, reader.uint32()); + message.experimentalFeatures = $root.google.api.PythonSettings.ExperimentalFeatures.decode(reader, reader.uint32(), undefined, long + 1); break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -50016,16 +52120,20 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - PythonSettings.verify = function verify(message) { + PythonSettings.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.common != null && message.hasOwnProperty("common")) { - var error = $root.google.api.CommonLanguageSettings.verify(message.common); + var error = $root.google.api.CommonLanguageSettings.verify(message.common, long + 1); if (error) return "common." + error; } if (message.experimentalFeatures != null && message.hasOwnProperty("experimentalFeatures")) { - var error = $root.google.api.PythonSettings.ExperimentalFeatures.verify(message.experimentalFeatures); + var error = $root.google.api.PythonSettings.ExperimentalFeatures.verify(message.experimentalFeatures, long + 1); if (error) return "experimentalFeatures." + error; } @@ -50040,19 +52148,23 @@ * @param {Object.} object Plain object * @returns {google.api.PythonSettings} PythonSettings */ - PythonSettings.fromObject = function fromObject(object) { + PythonSettings.fromObject = function fromObject(object, long) { if (object instanceof $root.google.api.PythonSettings) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.api.PythonSettings(); if (object.common != null) { if (typeof object.common !== "object") throw TypeError(".google.api.PythonSettings.common: object expected"); - message.common = $root.google.api.CommonLanguageSettings.fromObject(object.common); + message.common = $root.google.api.CommonLanguageSettings.fromObject(object.common, long + 1); } if (object.experimentalFeatures != null) { if (typeof object.experimentalFeatures !== "object") throw TypeError(".google.api.PythonSettings.experimentalFeatures: object expected"); - message.experimentalFeatures = $root.google.api.PythonSettings.ExperimentalFeatures.fromObject(object.experimentalFeatures); + message.experimentalFeatures = $root.google.api.PythonSettings.ExperimentalFeatures.fromObject(object.experimentalFeatures, long + 1); } return message; }; @@ -50129,7 +52241,7 @@ function ExperimentalFeatures(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -50214,9 +52326,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ExperimentalFeatures.decode = function decode(reader, length, error) { + ExperimentalFeatures.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.PythonSettings.ExperimentalFeatures(); while (reader.pos < end) { var tag = reader.uint32(); @@ -50236,7 +52352,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -50267,9 +52383,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ExperimentalFeatures.verify = function verify(message) { + ExperimentalFeatures.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.restAsyncIoEnabled != null && message.hasOwnProperty("restAsyncIoEnabled")) if (typeof message.restAsyncIoEnabled !== "boolean") return "restAsyncIoEnabled: boolean expected"; @@ -50290,9 +52410,13 @@ * @param {Object.} object Plain object * @returns {google.api.PythonSettings.ExperimentalFeatures} ExperimentalFeatures */ - ExperimentalFeatures.fromObject = function fromObject(object) { + ExperimentalFeatures.fromObject = function fromObject(object, long) { if (object instanceof $root.google.api.PythonSettings.ExperimentalFeatures) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.api.PythonSettings.ExperimentalFeatures(); if (object.restAsyncIoEnabled != null) message.restAsyncIoEnabled = Boolean(object.restAsyncIoEnabled); @@ -50382,7 +52506,7 @@ function NodeSettings(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -50447,9 +52571,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - NodeSettings.decode = function decode(reader, length, error) { + NodeSettings.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.NodeSettings(); while (reader.pos < end) { var tag = reader.uint32(); @@ -50457,11 +52585,11 @@ break; switch (tag >>> 3) { case 1: { - message.common = $root.google.api.CommonLanguageSettings.decode(reader, reader.uint32()); + message.common = $root.google.api.CommonLanguageSettings.decode(reader, reader.uint32(), undefined, long + 1); break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -50492,11 +52620,15 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - NodeSettings.verify = function verify(message) { + NodeSettings.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.common != null && message.hasOwnProperty("common")) { - var error = $root.google.api.CommonLanguageSettings.verify(message.common); + var error = $root.google.api.CommonLanguageSettings.verify(message.common, long + 1); if (error) return "common." + error; } @@ -50511,14 +52643,18 @@ * @param {Object.} object Plain object * @returns {google.api.NodeSettings} NodeSettings */ - NodeSettings.fromObject = function fromObject(object) { + NodeSettings.fromObject = function fromObject(object, long) { if (object instanceof $root.google.api.NodeSettings) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.api.NodeSettings(); if (object.common != null) { if (typeof object.common !== "object") throw TypeError(".google.api.NodeSettings.common: object expected"); - message.common = $root.google.api.CommonLanguageSettings.fromObject(object.common); + message.common = $root.google.api.CommonLanguageSettings.fromObject(object.common, long + 1); } return message; }; @@ -50602,7 +52738,7 @@ this.handwrittenSignatures = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -50722,9 +52858,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - DotnetSettings.decode = function decode(reader, length, error) { + DotnetSettings.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.DotnetSettings(), key, value; while (reader.pos < end) { var tag = reader.uint32(); @@ -50732,7 +52872,7 @@ break; switch (tag >>> 3) { case 1: { - message.common = $root.google.api.CommonLanguageSettings.decode(reader, reader.uint32()); + message.common = $root.google.api.CommonLanguageSettings.decode(reader, reader.uint32(), undefined, long + 1); break; } case 2: { @@ -50751,10 +52891,12 @@ value = reader.string(); break; default: - reader.skipType(tag2 & 7); + reader.skipType(tag2 & 7, long); break; } } + if (key === "__proto__") + $util.makeProp(message.renamedServices, key); message.renamedServices[key] = value; break; } @@ -50774,10 +52916,12 @@ value = reader.string(); break; default: - reader.skipType(tag2 & 7); + reader.skipType(tag2 & 7, long); break; } } + if (key === "__proto__") + $util.makeProp(message.renamedResources, key); message.renamedResources[key] = value; break; } @@ -50800,7 +52944,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -50831,11 +52975,15 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - DotnetSettings.verify = function verify(message) { + DotnetSettings.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.common != null && message.hasOwnProperty("common")) { - var error = $root.google.api.CommonLanguageSettings.verify(message.common); + var error = $root.google.api.CommonLanguageSettings.verify(message.common, long + 1); if (error) return "common." + error; } @@ -50887,28 +53035,38 @@ * @param {Object.} object Plain object * @returns {google.api.DotnetSettings} DotnetSettings */ - DotnetSettings.fromObject = function fromObject(object) { + DotnetSettings.fromObject = function fromObject(object, long) { if (object instanceof $root.google.api.DotnetSettings) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.api.DotnetSettings(); if (object.common != null) { if (typeof object.common !== "object") throw TypeError(".google.api.DotnetSettings.common: object expected"); - message.common = $root.google.api.CommonLanguageSettings.fromObject(object.common); + message.common = $root.google.api.CommonLanguageSettings.fromObject(object.common, long + 1); } if (object.renamedServices) { if (typeof object.renamedServices !== "object") throw TypeError(".google.api.DotnetSettings.renamedServices: object expected"); message.renamedServices = {}; - for (var keys = Object.keys(object.renamedServices), i = 0; i < keys.length; ++i) + for (var keys = Object.keys(object.renamedServices), i = 0; i < keys.length; ++i) { + if (keys[i] === "__proto__") + $util.makeProp(message.renamedServices, keys[i]); message.renamedServices[keys[i]] = String(object.renamedServices[keys[i]]); + } } if (object.renamedResources) { if (typeof object.renamedResources !== "object") throw TypeError(".google.api.DotnetSettings.renamedResources: object expected"); message.renamedResources = {}; - for (var keys = Object.keys(object.renamedResources), i = 0; i < keys.length; ++i) + for (var keys = Object.keys(object.renamedResources), i = 0; i < keys.length; ++i) { + if (keys[i] === "__proto__") + $util.makeProp(message.renamedResources, keys[i]); message.renamedResources[keys[i]] = String(object.renamedResources[keys[i]]); + } } if (object.ignoredResources) { if (!Array.isArray(object.ignoredResources)) @@ -50963,13 +53121,19 @@ var keys2; if (message.renamedServices && (keys2 = Object.keys(message.renamedServices)).length) { object.renamedServices = {}; - for (var j = 0; j < keys2.length; ++j) + for (var j = 0; j < keys2.length; ++j) { + if (keys2[j] === "__proto__") + $util.makeProp(object.renamedServices, keys2[j]); object.renamedServices[keys2[j]] = message.renamedServices[keys2[j]]; + } } if (message.renamedResources && (keys2 = Object.keys(message.renamedResources)).length) { object.renamedResources = {}; - for (var j = 0; j < keys2.length; ++j) + for (var j = 0; j < keys2.length; ++j) { + if (keys2[j] === "__proto__") + $util.makeProp(object.renamedResources, keys2[j]); object.renamedResources[keys2[j]] = message.renamedResources[keys2[j]]; + } } if (message.ignoredResources && message.ignoredResources.length) { object.ignoredResources = []; @@ -51038,7 +53202,7 @@ function RubySettings(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -51103,9 +53267,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - RubySettings.decode = function decode(reader, length, error) { + RubySettings.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.RubySettings(); while (reader.pos < end) { var tag = reader.uint32(); @@ -51113,11 +53281,11 @@ break; switch (tag >>> 3) { case 1: { - message.common = $root.google.api.CommonLanguageSettings.decode(reader, reader.uint32()); + message.common = $root.google.api.CommonLanguageSettings.decode(reader, reader.uint32(), undefined, long + 1); break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -51148,11 +53316,15 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - RubySettings.verify = function verify(message) { + RubySettings.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.common != null && message.hasOwnProperty("common")) { - var error = $root.google.api.CommonLanguageSettings.verify(message.common); + var error = $root.google.api.CommonLanguageSettings.verify(message.common, long + 1); if (error) return "common." + error; } @@ -51167,14 +53339,18 @@ * @param {Object.} object Plain object * @returns {google.api.RubySettings} RubySettings */ - RubySettings.fromObject = function fromObject(object) { + RubySettings.fromObject = function fromObject(object, long) { if (object instanceof $root.google.api.RubySettings) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.api.RubySettings(); if (object.common != null) { if (typeof object.common !== "object") throw TypeError(".google.api.RubySettings.common: object expected"); - message.common = $root.google.api.CommonLanguageSettings.fromObject(object.common); + message.common = $root.google.api.CommonLanguageSettings.fromObject(object.common, long + 1); } return message; }; @@ -51250,7 +53426,7 @@ this.renamedServices = {}; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -51326,9 +53502,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GoSettings.decode = function decode(reader, length, error) { + GoSettings.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.GoSettings(), key, value; while (reader.pos < end) { var tag = reader.uint32(); @@ -51336,7 +53516,7 @@ break; switch (tag >>> 3) { case 1: { - message.common = $root.google.api.CommonLanguageSettings.decode(reader, reader.uint32()); + message.common = $root.google.api.CommonLanguageSettings.decode(reader, reader.uint32(), undefined, long + 1); break; } case 2: { @@ -51355,15 +53535,17 @@ value = reader.string(); break; default: - reader.skipType(tag2 & 7); + reader.skipType(tag2 & 7, long); break; } } + if (key === "__proto__") + $util.makeProp(message.renamedServices, key); message.renamedServices[key] = value; break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -51394,11 +53576,15 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GoSettings.verify = function verify(message) { + GoSettings.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.common != null && message.hasOwnProperty("common")) { - var error = $root.google.api.CommonLanguageSettings.verify(message.common); + var error = $root.google.api.CommonLanguageSettings.verify(message.common, long + 1); if (error) return "common." + error; } @@ -51421,21 +53607,28 @@ * @param {Object.} object Plain object * @returns {google.api.GoSettings} GoSettings */ - GoSettings.fromObject = function fromObject(object) { + GoSettings.fromObject = function fromObject(object, long) { if (object instanceof $root.google.api.GoSettings) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.api.GoSettings(); if (object.common != null) { if (typeof object.common !== "object") throw TypeError(".google.api.GoSettings.common: object expected"); - message.common = $root.google.api.CommonLanguageSettings.fromObject(object.common); + message.common = $root.google.api.CommonLanguageSettings.fromObject(object.common, long + 1); } if (object.renamedServices) { if (typeof object.renamedServices !== "object") throw TypeError(".google.api.GoSettings.renamedServices: object expected"); message.renamedServices = {}; - for (var keys = Object.keys(object.renamedServices), i = 0; i < keys.length; ++i) + for (var keys = Object.keys(object.renamedServices), i = 0; i < keys.length; ++i) { + if (keys[i] === "__proto__") + $util.makeProp(message.renamedServices, keys[i]); message.renamedServices[keys[i]] = String(object.renamedServices[keys[i]]); + } } return message; }; @@ -51462,8 +53655,11 @@ var keys2; if (message.renamedServices && (keys2 = Object.keys(message.renamedServices)).length) { object.renamedServices = {}; - for (var j = 0; j < keys2.length; ++j) + for (var j = 0; j < keys2.length; ++j) { + if (keys2[j] === "__proto__") + $util.makeProp(object.renamedServices, keys2[j]); object.renamedServices[keys2[j]] = message.renamedServices[keys2[j]]; + } } return object; }; @@ -51520,7 +53716,7 @@ this.autoPopulatedFields = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -51606,9 +53802,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - MethodSettings.decode = function decode(reader, length, error) { + MethodSettings.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.MethodSettings(); while (reader.pos < end) { var tag = reader.uint32(); @@ -51620,7 +53820,7 @@ break; } case 2: { - message.longRunning = $root.google.api.MethodSettings.LongRunning.decode(reader, reader.uint32()); + message.longRunning = $root.google.api.MethodSettings.LongRunning.decode(reader, reader.uint32(), undefined, long + 1); break; } case 3: { @@ -51630,7 +53830,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -51661,14 +53861,18 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - MethodSettings.verify = function verify(message) { + MethodSettings.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.selector != null && message.hasOwnProperty("selector")) if (!$util.isString(message.selector)) return "selector: string expected"; if (message.longRunning != null && message.hasOwnProperty("longRunning")) { - var error = $root.google.api.MethodSettings.LongRunning.verify(message.longRunning); + var error = $root.google.api.MethodSettings.LongRunning.verify(message.longRunning, long + 1); if (error) return "longRunning." + error; } @@ -51690,16 +53894,20 @@ * @param {Object.} object Plain object * @returns {google.api.MethodSettings} MethodSettings */ - MethodSettings.fromObject = function fromObject(object) { + MethodSettings.fromObject = function fromObject(object, long) { if (object instanceof $root.google.api.MethodSettings) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.api.MethodSettings(); if (object.selector != null) message.selector = String(object.selector); if (object.longRunning != null) { if (typeof object.longRunning !== "object") throw TypeError(".google.api.MethodSettings.longRunning: object expected"); - message.longRunning = $root.google.api.MethodSettings.LongRunning.fromObject(object.longRunning); + message.longRunning = $root.google.api.MethodSettings.LongRunning.fromObject(object.longRunning, long + 1); } if (object.autoPopulatedFields) { if (!Array.isArray(object.autoPopulatedFields)) @@ -51791,7 +53999,7 @@ function LongRunning(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -51886,9 +54094,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - LongRunning.decode = function decode(reader, length, error) { + LongRunning.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.MethodSettings.LongRunning(); while (reader.pos < end) { var tag = reader.uint32(); @@ -51896,7 +54108,7 @@ break; switch (tag >>> 3) { case 1: { - message.initialPollDelay = $root.google.protobuf.Duration.decode(reader, reader.uint32()); + message.initialPollDelay = $root.google.protobuf.Duration.decode(reader, reader.uint32(), undefined, long + 1); break; } case 2: { @@ -51904,15 +54116,15 @@ break; } case 3: { - message.maxPollDelay = $root.google.protobuf.Duration.decode(reader, reader.uint32()); + message.maxPollDelay = $root.google.protobuf.Duration.decode(reader, reader.uint32(), undefined, long + 1); break; } case 4: { - message.totalPollTimeout = $root.google.protobuf.Duration.decode(reader, reader.uint32()); + message.totalPollTimeout = $root.google.protobuf.Duration.decode(reader, reader.uint32(), undefined, long + 1); break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -51943,11 +54155,15 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - LongRunning.verify = function verify(message) { + LongRunning.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.initialPollDelay != null && message.hasOwnProperty("initialPollDelay")) { - var error = $root.google.protobuf.Duration.verify(message.initialPollDelay); + var error = $root.google.protobuf.Duration.verify(message.initialPollDelay, long + 1); if (error) return "initialPollDelay." + error; } @@ -51955,12 +54171,12 @@ if (typeof message.pollDelayMultiplier !== "number") return "pollDelayMultiplier: number expected"; if (message.maxPollDelay != null && message.hasOwnProperty("maxPollDelay")) { - var error = $root.google.protobuf.Duration.verify(message.maxPollDelay); + var error = $root.google.protobuf.Duration.verify(message.maxPollDelay, long + 1); if (error) return "maxPollDelay." + error; } if (message.totalPollTimeout != null && message.hasOwnProperty("totalPollTimeout")) { - var error = $root.google.protobuf.Duration.verify(message.totalPollTimeout); + var error = $root.google.protobuf.Duration.verify(message.totalPollTimeout, long + 1); if (error) return "totalPollTimeout." + error; } @@ -51975,26 +54191,30 @@ * @param {Object.} object Plain object * @returns {google.api.MethodSettings.LongRunning} LongRunning */ - LongRunning.fromObject = function fromObject(object) { + LongRunning.fromObject = function fromObject(object, long) { if (object instanceof $root.google.api.MethodSettings.LongRunning) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.api.MethodSettings.LongRunning(); if (object.initialPollDelay != null) { if (typeof object.initialPollDelay !== "object") throw TypeError(".google.api.MethodSettings.LongRunning.initialPollDelay: object expected"); - message.initialPollDelay = $root.google.protobuf.Duration.fromObject(object.initialPollDelay); + message.initialPollDelay = $root.google.protobuf.Duration.fromObject(object.initialPollDelay, long + 1); } if (object.pollDelayMultiplier != null) message.pollDelayMultiplier = Number(object.pollDelayMultiplier); if (object.maxPollDelay != null) { if (typeof object.maxPollDelay !== "object") throw TypeError(".google.api.MethodSettings.LongRunning.maxPollDelay: object expected"); - message.maxPollDelay = $root.google.protobuf.Duration.fromObject(object.maxPollDelay); + message.maxPollDelay = $root.google.protobuf.Duration.fromObject(object.maxPollDelay, long + 1); } if (object.totalPollTimeout != null) { if (typeof object.totalPollTimeout !== "object") throw TypeError(".google.api.MethodSettings.LongRunning.totalPollTimeout: object expected"); - message.totalPollTimeout = $root.google.protobuf.Duration.fromObject(object.totalPollTimeout); + message.totalPollTimeout = $root.google.protobuf.Duration.fromObject(object.totalPollTimeout, long + 1); } return message; }; @@ -52125,7 +54345,7 @@ this.methods = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -52201,9 +54421,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - SelectiveGapicGeneration.decode = function decode(reader, length, error) { + SelectiveGapicGeneration.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.SelectiveGapicGeneration(); while (reader.pos < end) { var tag = reader.uint32(); @@ -52221,7 +54445,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -52252,9 +54476,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - SelectiveGapicGeneration.verify = function verify(message) { + SelectiveGapicGeneration.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.methods != null && message.hasOwnProperty("methods")) { if (!Array.isArray(message.methods)) return "methods: array expected"; @@ -52276,9 +54504,13 @@ * @param {Object.} object Plain object * @returns {google.api.SelectiveGapicGeneration} SelectiveGapicGeneration */ - SelectiveGapicGeneration.fromObject = function fromObject(object) { + SelectiveGapicGeneration.fromObject = function fromObject(object, long) { if (object instanceof $root.google.api.SelectiveGapicGeneration) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.api.SelectiveGapicGeneration(); if (object.methods) { if (!Array.isArray(object.methods)) @@ -52400,7 +54632,7 @@ this.labels = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -52516,9 +54748,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - MonitoredResourceDescriptor.decode = function decode(reader, length, error) { + MonitoredResourceDescriptor.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.MonitoredResourceDescriptor(); while (reader.pos < end) { var tag = reader.uint32(); @@ -52544,7 +54780,7 @@ case 4: { if (!(message.labels && message.labels.length)) message.labels = []; - message.labels.push($root.google.api.LabelDescriptor.decode(reader, reader.uint32())); + message.labels.push($root.google.api.LabelDescriptor.decode(reader, reader.uint32(), undefined, long + 1)); break; } case 7: { @@ -52552,7 +54788,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -52583,9 +54819,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - MonitoredResourceDescriptor.verify = function verify(message) { + MonitoredResourceDescriptor.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.name != null && message.hasOwnProperty("name")) if (!$util.isString(message.name)) return "name: string expected"; @@ -52602,7 +54842,7 @@ if (!Array.isArray(message.labels)) return "labels: array expected"; for (var i = 0; i < message.labels.length; ++i) { - var error = $root.google.api.LabelDescriptor.verify(message.labels[i]); + var error = $root.google.api.LabelDescriptor.verify(message.labels[i], long + 1); if (error) return "labels." + error; } @@ -52632,9 +54872,13 @@ * @param {Object.} object Plain object * @returns {google.api.MonitoredResourceDescriptor} MonitoredResourceDescriptor */ - MonitoredResourceDescriptor.fromObject = function fromObject(object) { + MonitoredResourceDescriptor.fromObject = function fromObject(object, long) { if (object instanceof $root.google.api.MonitoredResourceDescriptor) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.api.MonitoredResourceDescriptor(); if (object.name != null) message.name = String(object.name); @@ -52651,7 +54895,7 @@ for (var i = 0; i < object.labels.length; ++i) { if (typeof object.labels[i] !== "object") throw TypeError(".google.api.MonitoredResourceDescriptor.labels: object expected"); - message.labels[i] = $root.google.api.LabelDescriptor.fromObject(object.labels[i]); + message.labels[i] = $root.google.api.LabelDescriptor.fromObject(object.labels[i], long + 1); } } switch (object.launchStage) { @@ -52788,7 +55032,7 @@ this.labels = {}; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -52864,9 +55108,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - MonitoredResource.decode = function decode(reader, length, error) { + MonitoredResource.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.MonitoredResource(), key, value; while (reader.pos < end) { var tag = reader.uint32(); @@ -52893,15 +55141,17 @@ value = reader.string(); break; default: - reader.skipType(tag2 & 7); + reader.skipType(tag2 & 7, long); break; } } + if (key === "__proto__") + $util.makeProp(message.labels, key); message.labels[key] = value; break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -52932,9 +55182,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - MonitoredResource.verify = function verify(message) { + MonitoredResource.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.type != null && message.hasOwnProperty("type")) if (!$util.isString(message.type)) return "type: string expected"; @@ -52957,9 +55211,13 @@ * @param {Object.} object Plain object * @returns {google.api.MonitoredResource} MonitoredResource */ - MonitoredResource.fromObject = function fromObject(object) { + MonitoredResource.fromObject = function fromObject(object, long) { if (object instanceof $root.google.api.MonitoredResource) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.api.MonitoredResource(); if (object.type != null) message.type = String(object.type); @@ -52967,8 +55225,11 @@ if (typeof object.labels !== "object") throw TypeError(".google.api.MonitoredResource.labels: object expected"); message.labels = {}; - for (var keys = Object.keys(object.labels), i = 0; i < keys.length; ++i) + for (var keys = Object.keys(object.labels), i = 0; i < keys.length; ++i) { + if (keys[i] === "__proto__") + $util.makeProp(message.labels, keys[i]); message.labels[keys[i]] = String(object.labels[keys[i]]); + } } return message; }; @@ -52995,8 +55256,11 @@ var keys2; if (message.labels && (keys2 = Object.keys(message.labels)).length) { object.labels = {}; - for (var j = 0; j < keys2.length; ++j) + for (var j = 0; j < keys2.length; ++j) { + if (keys2[j] === "__proto__") + $util.makeProp(object.labels, keys2[j]); object.labels[keys2[j]] = message.labels[keys2[j]]; + } } return object; }; @@ -53052,7 +55316,7 @@ this.userLabels = {}; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -53128,9 +55392,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - MonitoredResourceMetadata.decode = function decode(reader, length, error) { + MonitoredResourceMetadata.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.MonitoredResourceMetadata(), key, value; while (reader.pos < end) { var tag = reader.uint32(); @@ -53138,7 +55406,7 @@ break; switch (tag >>> 3) { case 1: { - message.systemLabels = $root.google.protobuf.Struct.decode(reader, reader.uint32()); + message.systemLabels = $root.google.protobuf.Struct.decode(reader, reader.uint32(), undefined, long + 1); break; } case 2: { @@ -53157,15 +55425,17 @@ value = reader.string(); break; default: - reader.skipType(tag2 & 7); + reader.skipType(tag2 & 7, long); break; } } + if (key === "__proto__") + $util.makeProp(message.userLabels, key); message.userLabels[key] = value; break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -53196,11 +55466,15 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - MonitoredResourceMetadata.verify = function verify(message) { + MonitoredResourceMetadata.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.systemLabels != null && message.hasOwnProperty("systemLabels")) { - var error = $root.google.protobuf.Struct.verify(message.systemLabels); + var error = $root.google.protobuf.Struct.verify(message.systemLabels, long + 1); if (error) return "systemLabels." + error; } @@ -53223,21 +55497,28 @@ * @param {Object.} object Plain object * @returns {google.api.MonitoredResourceMetadata} MonitoredResourceMetadata */ - MonitoredResourceMetadata.fromObject = function fromObject(object) { + MonitoredResourceMetadata.fromObject = function fromObject(object, long) { if (object instanceof $root.google.api.MonitoredResourceMetadata) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.api.MonitoredResourceMetadata(); if (object.systemLabels != null) { if (typeof object.systemLabels !== "object") throw TypeError(".google.api.MonitoredResourceMetadata.systemLabels: object expected"); - message.systemLabels = $root.google.protobuf.Struct.fromObject(object.systemLabels); + message.systemLabels = $root.google.protobuf.Struct.fromObject(object.systemLabels, long + 1); } if (object.userLabels) { if (typeof object.userLabels !== "object") throw TypeError(".google.api.MonitoredResourceMetadata.userLabels: object expected"); message.userLabels = {}; - for (var keys = Object.keys(object.userLabels), i = 0; i < keys.length; ++i) + for (var keys = Object.keys(object.userLabels), i = 0; i < keys.length; ++i) { + if (keys[i] === "__proto__") + $util.makeProp(message.userLabels, keys[i]); message.userLabels[keys[i]] = String(object.userLabels[keys[i]]); + } } return message; }; @@ -53264,8 +55545,11 @@ var keys2; if (message.userLabels && (keys2 = Object.keys(message.userLabels)).length) { object.userLabels = {}; - for (var j = 0; j < keys2.length; ++j) + for (var j = 0; j < keys2.length; ++j) { + if (keys2[j] === "__proto__") + $util.makeProp(object.userLabels, keys2[j]); object.userLabels[keys2[j]] = message.userLabels[keys2[j]]; + } } return object; }; @@ -53321,7 +55605,7 @@ function LabelDescriptor(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -53406,9 +55690,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - LabelDescriptor.decode = function decode(reader, length, error) { + LabelDescriptor.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.LabelDescriptor(); while (reader.pos < end) { var tag = reader.uint32(); @@ -53428,7 +55716,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -53459,9 +55747,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - LabelDescriptor.verify = function verify(message) { + LabelDescriptor.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.key != null && message.hasOwnProperty("key")) if (!$util.isString(message.key)) return "key: string expected"; @@ -53488,9 +55780,13 @@ * @param {Object.} object Plain object * @returns {google.api.LabelDescriptor} LabelDescriptor */ - LabelDescriptor.fromObject = function fromObject(object) { + LabelDescriptor.fromObject = function fromObject(object, long) { if (object instanceof $root.google.api.LabelDescriptor) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.api.LabelDescriptor(); if (object.key != null) message.key = String(object.key); @@ -53623,7 +55919,7 @@ this.monitoredResourceTypes = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -53790,9 +56086,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - MetricDescriptor.decode = function decode(reader, length, error) { + MetricDescriptor.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.MetricDescriptor(); while (reader.pos < end) { var tag = reader.uint32(); @@ -53810,7 +56110,7 @@ case 2: { if (!(message.labels && message.labels.length)) message.labels = []; - message.labels.push($root.google.api.LabelDescriptor.decode(reader, reader.uint32())); + message.labels.push($root.google.api.LabelDescriptor.decode(reader, reader.uint32(), undefined, long + 1)); break; } case 3: { @@ -53834,7 +56134,7 @@ break; } case 10: { - message.metadata = $root.google.api.MetricDescriptor.MetricDescriptorMetadata.decode(reader, reader.uint32()); + message.metadata = $root.google.api.MetricDescriptor.MetricDescriptorMetadata.decode(reader, reader.uint32(), undefined, long + 1); break; } case 12: { @@ -53848,7 +56148,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -53879,9 +56179,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - MetricDescriptor.verify = function verify(message) { + MetricDescriptor.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.name != null && message.hasOwnProperty("name")) if (!$util.isString(message.name)) return "name: string expected"; @@ -53892,7 +56196,7 @@ if (!Array.isArray(message.labels)) return "labels: array expected"; for (var i = 0; i < message.labels.length; ++i) { - var error = $root.google.api.LabelDescriptor.verify(message.labels[i]); + var error = $root.google.api.LabelDescriptor.verify(message.labels[i], long + 1); if (error) return "labels." + error; } @@ -53930,7 +56234,7 @@ if (!$util.isString(message.displayName)) return "displayName: string expected"; if (message.metadata != null && message.hasOwnProperty("metadata")) { - var error = $root.google.api.MetricDescriptor.MetricDescriptorMetadata.verify(message.metadata); + var error = $root.google.api.MetricDescriptor.MetricDescriptorMetadata.verify(message.metadata, long + 1); if (error) return "metadata." + error; } @@ -53966,9 +56270,13 @@ * @param {Object.} object Plain object * @returns {google.api.MetricDescriptor} MetricDescriptor */ - MetricDescriptor.fromObject = function fromObject(object) { + MetricDescriptor.fromObject = function fromObject(object, long) { if (object instanceof $root.google.api.MetricDescriptor) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.api.MetricDescriptor(); if (object.name != null) message.name = String(object.name); @@ -53981,7 +56289,7 @@ for (var i = 0; i < object.labels.length; ++i) { if (typeof object.labels[i] !== "object") throw TypeError(".google.api.MetricDescriptor.labels: object expected"); - message.labels[i] = $root.google.api.LabelDescriptor.fromObject(object.labels[i]); + message.labels[i] = $root.google.api.LabelDescriptor.fromObject(object.labels[i], long + 1); } } switch (object.metricKind) { @@ -54053,7 +56361,7 @@ if (object.metadata != null) { if (typeof object.metadata !== "object") throw TypeError(".google.api.MetricDescriptor.metadata: object expected"); - message.metadata = $root.google.api.MetricDescriptor.MetricDescriptorMetadata.fromObject(object.metadata); + message.metadata = $root.google.api.MetricDescriptor.MetricDescriptorMetadata.fromObject(object.metadata, long + 1); } switch (object.launchStage) { default: @@ -54256,7 +56564,7 @@ this.timeSeriesResourceHierarchyLevel = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -54355,9 +56663,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - MetricDescriptorMetadata.decode = function decode(reader, length, error) { + MetricDescriptorMetadata.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.MetricDescriptor.MetricDescriptorMetadata(); while (reader.pos < end) { var tag = reader.uint32(); @@ -54369,11 +56681,11 @@ break; } case 2: { - message.samplePeriod = $root.google.protobuf.Duration.decode(reader, reader.uint32()); + message.samplePeriod = $root.google.protobuf.Duration.decode(reader, reader.uint32(), undefined, long + 1); break; } case 3: { - message.ingestDelay = $root.google.protobuf.Duration.decode(reader, reader.uint32()); + message.ingestDelay = $root.google.protobuf.Duration.decode(reader, reader.uint32(), undefined, long + 1); break; } case 4: { @@ -54388,7 +56700,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -54419,9 +56731,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - MetricDescriptorMetadata.verify = function verify(message) { + MetricDescriptorMetadata.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.launchStage != null && message.hasOwnProperty("launchStage")) switch (message.launchStage) { default: @@ -54437,12 +56753,12 @@ break; } if (message.samplePeriod != null && message.hasOwnProperty("samplePeriod")) { - var error = $root.google.protobuf.Duration.verify(message.samplePeriod); + var error = $root.google.protobuf.Duration.verify(message.samplePeriod, long + 1); if (error) return "samplePeriod." + error; } if (message.ingestDelay != null && message.hasOwnProperty("ingestDelay")) { - var error = $root.google.protobuf.Duration.verify(message.ingestDelay); + var error = $root.google.protobuf.Duration.verify(message.ingestDelay, long + 1); if (error) return "ingestDelay." + error; } @@ -54471,9 +56787,13 @@ * @param {Object.} object Plain object * @returns {google.api.MetricDescriptor.MetricDescriptorMetadata} MetricDescriptorMetadata */ - MetricDescriptorMetadata.fromObject = function fromObject(object) { + MetricDescriptorMetadata.fromObject = function fromObject(object, long) { if (object instanceof $root.google.api.MetricDescriptor.MetricDescriptorMetadata) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.api.MetricDescriptor.MetricDescriptorMetadata(); switch (object.launchStage) { default: @@ -54518,12 +56838,12 @@ if (object.samplePeriod != null) { if (typeof object.samplePeriod !== "object") throw TypeError(".google.api.MetricDescriptor.MetricDescriptorMetadata.samplePeriod: object expected"); - message.samplePeriod = $root.google.protobuf.Duration.fromObject(object.samplePeriod); + message.samplePeriod = $root.google.protobuf.Duration.fromObject(object.samplePeriod, long + 1); } if (object.ingestDelay != null) { if (typeof object.ingestDelay !== "object") throw TypeError(".google.api.MetricDescriptor.MetricDescriptorMetadata.ingestDelay: object expected"); - message.ingestDelay = $root.google.protobuf.Duration.fromObject(object.ingestDelay); + message.ingestDelay = $root.google.protobuf.Duration.fromObject(object.ingestDelay, long + 1); } if (object.timeSeriesResourceHierarchyLevel) { if (!Array.isArray(object.timeSeriesResourceHierarchyLevel)) @@ -54663,7 +56983,7 @@ this.labels = {}; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -54739,9 +57059,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Metric.decode = function decode(reader, length, error) { + Metric.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.Metric(), key, value; while (reader.pos < end) { var tag = reader.uint32(); @@ -54768,15 +57092,17 @@ value = reader.string(); break; default: - reader.skipType(tag2 & 7); + reader.skipType(tag2 & 7, long); break; } } + if (key === "__proto__") + $util.makeProp(message.labels, key); message.labels[key] = value; break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -54807,9 +57133,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Metric.verify = function verify(message) { + Metric.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.type != null && message.hasOwnProperty("type")) if (!$util.isString(message.type)) return "type: string expected"; @@ -54832,9 +57162,13 @@ * @param {Object.} object Plain object * @returns {google.api.Metric} Metric */ - Metric.fromObject = function fromObject(object) { + Metric.fromObject = function fromObject(object, long) { if (object instanceof $root.google.api.Metric) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.api.Metric(); if (object.type != null) message.type = String(object.type); @@ -54842,8 +57176,11 @@ if (typeof object.labels !== "object") throw TypeError(".google.api.Metric.labels: object expected"); message.labels = {}; - for (var keys = Object.keys(object.labels), i = 0; i < keys.length; ++i) + for (var keys = Object.keys(object.labels), i = 0; i < keys.length; ++i) { + if (keys[i] === "__proto__") + $util.makeProp(message.labels, keys[i]); message.labels[keys[i]] = String(object.labels[keys[i]]); + } } return message; }; @@ -54868,8 +57205,11 @@ var keys2; if (message.labels && (keys2 = Object.keys(message.labels)).length) { object.labels = {}; - for (var j = 0; j < keys2.length; ++j) + for (var j = 0; j < keys2.length; ++j) { + if (keys2[j] === "__proto__") + $util.makeProp(object.labels, keys2[j]); object.labels[keys2[j]] = message.labels[keys2[j]]; + } } if (message.type != null && message.hasOwnProperty("type")) object.type = message.type; @@ -54927,7 +57267,7 @@ this.referencedTypes = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -55003,9 +57343,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - FieldInfo.decode = function decode(reader, length, error) { + FieldInfo.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.FieldInfo(); while (reader.pos < end) { var tag = reader.uint32(); @@ -55019,11 +57363,11 @@ case 2: { if (!(message.referencedTypes && message.referencedTypes.length)) message.referencedTypes = []; - message.referencedTypes.push($root.google.api.TypeReference.decode(reader, reader.uint32())); + message.referencedTypes.push($root.google.api.TypeReference.decode(reader, reader.uint32(), undefined, long + 1)); break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -55054,9 +57398,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - FieldInfo.verify = function verify(message) { + FieldInfo.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.format != null && message.hasOwnProperty("format")) switch (message.format) { default: @@ -55072,7 +57420,7 @@ if (!Array.isArray(message.referencedTypes)) return "referencedTypes: array expected"; for (var i = 0; i < message.referencedTypes.length; ++i) { - var error = $root.google.api.TypeReference.verify(message.referencedTypes[i]); + var error = $root.google.api.TypeReference.verify(message.referencedTypes[i], long + 1); if (error) return "referencedTypes." + error; } @@ -55088,9 +57436,13 @@ * @param {Object.} object Plain object * @returns {google.api.FieldInfo} FieldInfo */ - FieldInfo.fromObject = function fromObject(object) { + FieldInfo.fromObject = function fromObject(object, long) { if (object instanceof $root.google.api.FieldInfo) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.api.FieldInfo(); switch (object.format) { default: @@ -55127,7 +57479,7 @@ for (var i = 0; i < object.referencedTypes.length; ++i) { if (typeof object.referencedTypes[i] !== "object") throw TypeError(".google.api.FieldInfo.referencedTypes: object expected"); - message.referencedTypes[i] = $root.google.api.TypeReference.fromObject(object.referencedTypes[i]); + message.referencedTypes[i] = $root.google.api.TypeReference.fromObject(object.referencedTypes[i], long + 1); } } return message; @@ -55229,7 +57581,7 @@ function TypeReference(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -55294,9 +57646,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - TypeReference.decode = function decode(reader, length, error) { + TypeReference.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.TypeReference(); while (reader.pos < end) { var tag = reader.uint32(); @@ -55308,7 +57664,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -55339,9 +57695,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - TypeReference.verify = function verify(message) { + TypeReference.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.typeName != null && message.hasOwnProperty("typeName")) if (!$util.isString(message.typeName)) return "typeName: string expected"; @@ -55356,9 +57716,13 @@ * @param {Object.} object Plain object * @returns {google.api.TypeReference} TypeReference */ - TypeReference.fromObject = function fromObject(object) { + TypeReference.fromObject = function fromObject(object, long) { if (object instanceof $root.google.api.TypeReference) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.api.TypeReference(); if (object.typeName != null) message.typeName = String(object.typeName); @@ -55447,7 +57811,7 @@ this.file = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -55513,9 +57877,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - FileDescriptorSet.decode = function decode(reader, length, error) { + FileDescriptorSet.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FileDescriptorSet(); while (reader.pos < end) { var tag = reader.uint32(); @@ -55525,11 +57893,11 @@ case 1: { if (!(message.file && message.file.length)) message.file = []; - message.file.push($root.google.protobuf.FileDescriptorProto.decode(reader, reader.uint32())); + message.file.push($root.google.protobuf.FileDescriptorProto.decode(reader, reader.uint32(), undefined, long + 1)); break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -55560,14 +57928,18 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - FileDescriptorSet.verify = function verify(message) { + FileDescriptorSet.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.file != null && message.hasOwnProperty("file")) { if (!Array.isArray(message.file)) return "file: array expected"; for (var i = 0; i < message.file.length; ++i) { - var error = $root.google.protobuf.FileDescriptorProto.verify(message.file[i]); + var error = $root.google.protobuf.FileDescriptorProto.verify(message.file[i], long + 1); if (error) return "file." + error; } @@ -55583,9 +57955,13 @@ * @param {Object.} object Plain object * @returns {google.protobuf.FileDescriptorSet} FileDescriptorSet */ - FileDescriptorSet.fromObject = function fromObject(object) { + FileDescriptorSet.fromObject = function fromObject(object, long) { if (object instanceof $root.google.protobuf.FileDescriptorSet) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.protobuf.FileDescriptorSet(); if (object.file) { if (!Array.isArray(object.file)) @@ -55594,7 +57970,7 @@ for (var i = 0; i < object.file.length; ++i) { if (typeof object.file[i] !== "object") throw TypeError(".google.protobuf.FileDescriptorSet.file: object expected"); - message.file[i] = $root.google.protobuf.FileDescriptorProto.fromObject(object.file[i]); + message.file[i] = $root.google.protobuf.FileDescriptorProto.fromObject(object.file[i], long + 1); } } return message; @@ -55727,7 +58103,7 @@ this.extension = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -55930,9 +58306,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - FileDescriptorProto.decode = function decode(reader, length, error) { + FileDescriptorProto.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FileDescriptorProto(); while (reader.pos < end) { var tag = reader.uint32(); @@ -55984,33 +58364,33 @@ case 4: { if (!(message.messageType && message.messageType.length)) message.messageType = []; - message.messageType.push($root.google.protobuf.DescriptorProto.decode(reader, reader.uint32())); + message.messageType.push($root.google.protobuf.DescriptorProto.decode(reader, reader.uint32(), undefined, long + 1)); break; } case 5: { if (!(message.enumType && message.enumType.length)) message.enumType = []; - message.enumType.push($root.google.protobuf.EnumDescriptorProto.decode(reader, reader.uint32())); + message.enumType.push($root.google.protobuf.EnumDescriptorProto.decode(reader, reader.uint32(), undefined, long + 1)); break; } case 6: { if (!(message.service && message.service.length)) message.service = []; - message.service.push($root.google.protobuf.ServiceDescriptorProto.decode(reader, reader.uint32())); + message.service.push($root.google.protobuf.ServiceDescriptorProto.decode(reader, reader.uint32(), undefined, long + 1)); break; } case 7: { if (!(message.extension && message.extension.length)) message.extension = []; - message.extension.push($root.google.protobuf.FieldDescriptorProto.decode(reader, reader.uint32())); + message.extension.push($root.google.protobuf.FieldDescriptorProto.decode(reader, reader.uint32(), undefined, long + 1)); break; } case 8: { - message.options = $root.google.protobuf.FileOptions.decode(reader, reader.uint32()); + message.options = $root.google.protobuf.FileOptions.decode(reader, reader.uint32(), undefined, long + 1); break; } case 9: { - message.sourceCodeInfo = $root.google.protobuf.SourceCodeInfo.decode(reader, reader.uint32()); + message.sourceCodeInfo = $root.google.protobuf.SourceCodeInfo.decode(reader, reader.uint32(), undefined, long + 1); break; } case 12: { @@ -56022,7 +58402,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -56053,9 +58433,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - FileDescriptorProto.verify = function verify(message) { + FileDescriptorProto.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.name != null && message.hasOwnProperty("name")) if (!$util.isString(message.name)) return "name: string expected"; @@ -56094,7 +58478,7 @@ if (!Array.isArray(message.messageType)) return "messageType: array expected"; for (var i = 0; i < message.messageType.length; ++i) { - var error = $root.google.protobuf.DescriptorProto.verify(message.messageType[i]); + var error = $root.google.protobuf.DescriptorProto.verify(message.messageType[i], long + 1); if (error) return "messageType." + error; } @@ -56103,7 +58487,7 @@ if (!Array.isArray(message.enumType)) return "enumType: array expected"; for (var i = 0; i < message.enumType.length; ++i) { - var error = $root.google.protobuf.EnumDescriptorProto.verify(message.enumType[i]); + var error = $root.google.protobuf.EnumDescriptorProto.verify(message.enumType[i], long + 1); if (error) return "enumType." + error; } @@ -56112,7 +58496,7 @@ if (!Array.isArray(message.service)) return "service: array expected"; for (var i = 0; i < message.service.length; ++i) { - var error = $root.google.protobuf.ServiceDescriptorProto.verify(message.service[i]); + var error = $root.google.protobuf.ServiceDescriptorProto.verify(message.service[i], long + 1); if (error) return "service." + error; } @@ -56121,18 +58505,18 @@ if (!Array.isArray(message.extension)) return "extension: array expected"; for (var i = 0; i < message.extension.length; ++i) { - var error = $root.google.protobuf.FieldDescriptorProto.verify(message.extension[i]); + var error = $root.google.protobuf.FieldDescriptorProto.verify(message.extension[i], long + 1); if (error) return "extension." + error; } } if (message.options != null && message.hasOwnProperty("options")) { - var error = $root.google.protobuf.FileOptions.verify(message.options); + var error = $root.google.protobuf.FileOptions.verify(message.options, long + 1); if (error) return "options." + error; } if (message.sourceCodeInfo != null && message.hasOwnProperty("sourceCodeInfo")) { - var error = $root.google.protobuf.SourceCodeInfo.verify(message.sourceCodeInfo); + var error = $root.google.protobuf.SourceCodeInfo.verify(message.sourceCodeInfo, long + 1); if (error) return "sourceCodeInfo." + error; } @@ -56168,9 +58552,13 @@ * @param {Object.} object Plain object * @returns {google.protobuf.FileDescriptorProto} FileDescriptorProto */ - FileDescriptorProto.fromObject = function fromObject(object) { + FileDescriptorProto.fromObject = function fromObject(object, long) { if (object instanceof $root.google.protobuf.FileDescriptorProto) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.protobuf.FileDescriptorProto(); if (object.name != null) message.name = String(object.name); @@ -56211,7 +58599,7 @@ for (var i = 0; i < object.messageType.length; ++i) { if (typeof object.messageType[i] !== "object") throw TypeError(".google.protobuf.FileDescriptorProto.messageType: object expected"); - message.messageType[i] = $root.google.protobuf.DescriptorProto.fromObject(object.messageType[i]); + message.messageType[i] = $root.google.protobuf.DescriptorProto.fromObject(object.messageType[i], long + 1); } } if (object.enumType) { @@ -56221,7 +58609,7 @@ for (var i = 0; i < object.enumType.length; ++i) { if (typeof object.enumType[i] !== "object") throw TypeError(".google.protobuf.FileDescriptorProto.enumType: object expected"); - message.enumType[i] = $root.google.protobuf.EnumDescriptorProto.fromObject(object.enumType[i]); + message.enumType[i] = $root.google.protobuf.EnumDescriptorProto.fromObject(object.enumType[i], long + 1); } } if (object.service) { @@ -56231,7 +58619,7 @@ for (var i = 0; i < object.service.length; ++i) { if (typeof object.service[i] !== "object") throw TypeError(".google.protobuf.FileDescriptorProto.service: object expected"); - message.service[i] = $root.google.protobuf.ServiceDescriptorProto.fromObject(object.service[i]); + message.service[i] = $root.google.protobuf.ServiceDescriptorProto.fromObject(object.service[i], long + 1); } } if (object.extension) { @@ -56241,18 +58629,18 @@ for (var i = 0; i < object.extension.length; ++i) { if (typeof object.extension[i] !== "object") throw TypeError(".google.protobuf.FileDescriptorProto.extension: object expected"); - message.extension[i] = $root.google.protobuf.FieldDescriptorProto.fromObject(object.extension[i]); + message.extension[i] = $root.google.protobuf.FieldDescriptorProto.fromObject(object.extension[i], long + 1); } } if (object.options != null) { if (typeof object.options !== "object") throw TypeError(".google.protobuf.FileDescriptorProto.options: object expected"); - message.options = $root.google.protobuf.FileOptions.fromObject(object.options); + message.options = $root.google.protobuf.FileOptions.fromObject(object.options, long + 1); } if (object.sourceCodeInfo != null) { if (typeof object.sourceCodeInfo !== "object") throw TypeError(".google.protobuf.FileDescriptorProto.sourceCodeInfo: object expected"); - message.sourceCodeInfo = $root.google.protobuf.SourceCodeInfo.fromObject(object.sourceCodeInfo); + message.sourceCodeInfo = $root.google.protobuf.SourceCodeInfo.fromObject(object.sourceCodeInfo, long + 1); } if (object.syntax != null) message.syntax = String(object.syntax); @@ -56468,7 +58856,7 @@ this.reservedName = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -56641,9 +59029,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - DescriptorProto.decode = function decode(reader, length, error) { + DescriptorProto.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.DescriptorProto(); while (reader.pos < end) { var tag = reader.uint32(); @@ -56657,47 +59049,47 @@ case 2: { if (!(message.field && message.field.length)) message.field = []; - message.field.push($root.google.protobuf.FieldDescriptorProto.decode(reader, reader.uint32())); + message.field.push($root.google.protobuf.FieldDescriptorProto.decode(reader, reader.uint32(), undefined, long + 1)); break; } case 6: { if (!(message.extension && message.extension.length)) message.extension = []; - message.extension.push($root.google.protobuf.FieldDescriptorProto.decode(reader, reader.uint32())); + message.extension.push($root.google.protobuf.FieldDescriptorProto.decode(reader, reader.uint32(), undefined, long + 1)); break; } case 3: { if (!(message.nestedType && message.nestedType.length)) message.nestedType = []; - message.nestedType.push($root.google.protobuf.DescriptorProto.decode(reader, reader.uint32())); + message.nestedType.push($root.google.protobuf.DescriptorProto.decode(reader, reader.uint32(), undefined, long + 1)); break; } case 4: { if (!(message.enumType && message.enumType.length)) message.enumType = []; - message.enumType.push($root.google.protobuf.EnumDescriptorProto.decode(reader, reader.uint32())); + message.enumType.push($root.google.protobuf.EnumDescriptorProto.decode(reader, reader.uint32(), undefined, long + 1)); break; } case 5: { if (!(message.extensionRange && message.extensionRange.length)) message.extensionRange = []; - message.extensionRange.push($root.google.protobuf.DescriptorProto.ExtensionRange.decode(reader, reader.uint32())); + message.extensionRange.push($root.google.protobuf.DescriptorProto.ExtensionRange.decode(reader, reader.uint32(), undefined, long + 1)); break; } case 8: { if (!(message.oneofDecl && message.oneofDecl.length)) message.oneofDecl = []; - message.oneofDecl.push($root.google.protobuf.OneofDescriptorProto.decode(reader, reader.uint32())); + message.oneofDecl.push($root.google.protobuf.OneofDescriptorProto.decode(reader, reader.uint32(), undefined, long + 1)); break; } case 7: { - message.options = $root.google.protobuf.MessageOptions.decode(reader, reader.uint32()); + message.options = $root.google.protobuf.MessageOptions.decode(reader, reader.uint32(), undefined, long + 1); break; } case 9: { if (!(message.reservedRange && message.reservedRange.length)) message.reservedRange = []; - message.reservedRange.push($root.google.protobuf.DescriptorProto.ReservedRange.decode(reader, reader.uint32())); + message.reservedRange.push($root.google.protobuf.DescriptorProto.ReservedRange.decode(reader, reader.uint32(), undefined, long + 1)); break; } case 10: { @@ -56711,7 +59103,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -56742,9 +59134,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - DescriptorProto.verify = function verify(message) { + DescriptorProto.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.name != null && message.hasOwnProperty("name")) if (!$util.isString(message.name)) return "name: string expected"; @@ -56752,7 +59148,7 @@ if (!Array.isArray(message.field)) return "field: array expected"; for (var i = 0; i < message.field.length; ++i) { - var error = $root.google.protobuf.FieldDescriptorProto.verify(message.field[i]); + var error = $root.google.protobuf.FieldDescriptorProto.verify(message.field[i], long + 1); if (error) return "field." + error; } @@ -56761,7 +59157,7 @@ if (!Array.isArray(message.extension)) return "extension: array expected"; for (var i = 0; i < message.extension.length; ++i) { - var error = $root.google.protobuf.FieldDescriptorProto.verify(message.extension[i]); + var error = $root.google.protobuf.FieldDescriptorProto.verify(message.extension[i], long + 1); if (error) return "extension." + error; } @@ -56770,7 +59166,7 @@ if (!Array.isArray(message.nestedType)) return "nestedType: array expected"; for (var i = 0; i < message.nestedType.length; ++i) { - var error = $root.google.protobuf.DescriptorProto.verify(message.nestedType[i]); + var error = $root.google.protobuf.DescriptorProto.verify(message.nestedType[i], long + 1); if (error) return "nestedType." + error; } @@ -56779,7 +59175,7 @@ if (!Array.isArray(message.enumType)) return "enumType: array expected"; for (var i = 0; i < message.enumType.length; ++i) { - var error = $root.google.protobuf.EnumDescriptorProto.verify(message.enumType[i]); + var error = $root.google.protobuf.EnumDescriptorProto.verify(message.enumType[i], long + 1); if (error) return "enumType." + error; } @@ -56788,7 +59184,7 @@ if (!Array.isArray(message.extensionRange)) return "extensionRange: array expected"; for (var i = 0; i < message.extensionRange.length; ++i) { - var error = $root.google.protobuf.DescriptorProto.ExtensionRange.verify(message.extensionRange[i]); + var error = $root.google.protobuf.DescriptorProto.ExtensionRange.verify(message.extensionRange[i], long + 1); if (error) return "extensionRange." + error; } @@ -56797,13 +59193,13 @@ if (!Array.isArray(message.oneofDecl)) return "oneofDecl: array expected"; for (var i = 0; i < message.oneofDecl.length; ++i) { - var error = $root.google.protobuf.OneofDescriptorProto.verify(message.oneofDecl[i]); + var error = $root.google.protobuf.OneofDescriptorProto.verify(message.oneofDecl[i], long + 1); if (error) return "oneofDecl." + error; } } if (message.options != null && message.hasOwnProperty("options")) { - var error = $root.google.protobuf.MessageOptions.verify(message.options); + var error = $root.google.protobuf.MessageOptions.verify(message.options, long + 1); if (error) return "options." + error; } @@ -56811,7 +59207,7 @@ if (!Array.isArray(message.reservedRange)) return "reservedRange: array expected"; for (var i = 0; i < message.reservedRange.length; ++i) { - var error = $root.google.protobuf.DescriptorProto.ReservedRange.verify(message.reservedRange[i]); + var error = $root.google.protobuf.DescriptorProto.ReservedRange.verify(message.reservedRange[i], long + 1); if (error) return "reservedRange." + error; } @@ -56843,9 +59239,13 @@ * @param {Object.} object Plain object * @returns {google.protobuf.DescriptorProto} DescriptorProto */ - DescriptorProto.fromObject = function fromObject(object) { + DescriptorProto.fromObject = function fromObject(object, long) { if (object instanceof $root.google.protobuf.DescriptorProto) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.protobuf.DescriptorProto(); if (object.name != null) message.name = String(object.name); @@ -56856,7 +59256,7 @@ for (var i = 0; i < object.field.length; ++i) { if (typeof object.field[i] !== "object") throw TypeError(".google.protobuf.DescriptorProto.field: object expected"); - message.field[i] = $root.google.protobuf.FieldDescriptorProto.fromObject(object.field[i]); + message.field[i] = $root.google.protobuf.FieldDescriptorProto.fromObject(object.field[i], long + 1); } } if (object.extension) { @@ -56866,7 +59266,7 @@ for (var i = 0; i < object.extension.length; ++i) { if (typeof object.extension[i] !== "object") throw TypeError(".google.protobuf.DescriptorProto.extension: object expected"); - message.extension[i] = $root.google.protobuf.FieldDescriptorProto.fromObject(object.extension[i]); + message.extension[i] = $root.google.protobuf.FieldDescriptorProto.fromObject(object.extension[i], long + 1); } } if (object.nestedType) { @@ -56876,7 +59276,7 @@ for (var i = 0; i < object.nestedType.length; ++i) { if (typeof object.nestedType[i] !== "object") throw TypeError(".google.protobuf.DescriptorProto.nestedType: object expected"); - message.nestedType[i] = $root.google.protobuf.DescriptorProto.fromObject(object.nestedType[i]); + message.nestedType[i] = $root.google.protobuf.DescriptorProto.fromObject(object.nestedType[i], long + 1); } } if (object.enumType) { @@ -56886,7 +59286,7 @@ for (var i = 0; i < object.enumType.length; ++i) { if (typeof object.enumType[i] !== "object") throw TypeError(".google.protobuf.DescriptorProto.enumType: object expected"); - message.enumType[i] = $root.google.protobuf.EnumDescriptorProto.fromObject(object.enumType[i]); + message.enumType[i] = $root.google.protobuf.EnumDescriptorProto.fromObject(object.enumType[i], long + 1); } } if (object.extensionRange) { @@ -56896,7 +59296,7 @@ for (var i = 0; i < object.extensionRange.length; ++i) { if (typeof object.extensionRange[i] !== "object") throw TypeError(".google.protobuf.DescriptorProto.extensionRange: object expected"); - message.extensionRange[i] = $root.google.protobuf.DescriptorProto.ExtensionRange.fromObject(object.extensionRange[i]); + message.extensionRange[i] = $root.google.protobuf.DescriptorProto.ExtensionRange.fromObject(object.extensionRange[i], long + 1); } } if (object.oneofDecl) { @@ -56906,13 +59306,13 @@ for (var i = 0; i < object.oneofDecl.length; ++i) { if (typeof object.oneofDecl[i] !== "object") throw TypeError(".google.protobuf.DescriptorProto.oneofDecl: object expected"); - message.oneofDecl[i] = $root.google.protobuf.OneofDescriptorProto.fromObject(object.oneofDecl[i]); + message.oneofDecl[i] = $root.google.protobuf.OneofDescriptorProto.fromObject(object.oneofDecl[i], long + 1); } } if (object.options != null) { if (typeof object.options !== "object") throw TypeError(".google.protobuf.DescriptorProto.options: object expected"); - message.options = $root.google.protobuf.MessageOptions.fromObject(object.options); + message.options = $root.google.protobuf.MessageOptions.fromObject(object.options, long + 1); } if (object.reservedRange) { if (!Array.isArray(object.reservedRange)) @@ -56921,7 +59321,7 @@ for (var i = 0; i < object.reservedRange.length; ++i) { if (typeof object.reservedRange[i] !== "object") throw TypeError(".google.protobuf.DescriptorProto.reservedRange: object expected"); - message.reservedRange[i] = $root.google.protobuf.DescriptorProto.ReservedRange.fromObject(object.reservedRange[i]); + message.reservedRange[i] = $root.google.protobuf.DescriptorProto.ReservedRange.fromObject(object.reservedRange[i], long + 1); } } if (object.reservedName) { @@ -57079,7 +59479,7 @@ function ExtensionRange(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -57164,9 +59564,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ExtensionRange.decode = function decode(reader, length, error) { + ExtensionRange.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.DescriptorProto.ExtensionRange(); while (reader.pos < end) { var tag = reader.uint32(); @@ -57182,11 +59586,11 @@ break; } case 3: { - message.options = $root.google.protobuf.ExtensionRangeOptions.decode(reader, reader.uint32()); + message.options = $root.google.protobuf.ExtensionRangeOptions.decode(reader, reader.uint32(), undefined, long + 1); break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -57217,9 +59621,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ExtensionRange.verify = function verify(message) { + ExtensionRange.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.start != null && message.hasOwnProperty("start")) if (!$util.isInteger(message.start)) return "start: integer expected"; @@ -57227,7 +59635,7 @@ if (!$util.isInteger(message.end)) return "end: integer expected"; if (message.options != null && message.hasOwnProperty("options")) { - var error = $root.google.protobuf.ExtensionRangeOptions.verify(message.options); + var error = $root.google.protobuf.ExtensionRangeOptions.verify(message.options, long + 1); if (error) return "options." + error; } @@ -57242,9 +59650,13 @@ * @param {Object.} object Plain object * @returns {google.protobuf.DescriptorProto.ExtensionRange} ExtensionRange */ - ExtensionRange.fromObject = function fromObject(object) { + ExtensionRange.fromObject = function fromObject(object, long) { if (object instanceof $root.google.protobuf.DescriptorProto.ExtensionRange) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.protobuf.DescriptorProto.ExtensionRange(); if (object.start != null) message.start = object.start | 0; @@ -57253,7 +59665,7 @@ if (object.options != null) { if (typeof object.options !== "object") throw TypeError(".google.protobuf.DescriptorProto.ExtensionRange.options: object expected"); - message.options = $root.google.protobuf.ExtensionRangeOptions.fromObject(object.options); + message.options = $root.google.protobuf.ExtensionRangeOptions.fromObject(object.options, long + 1); } return message; }; @@ -57335,7 +59747,7 @@ function ReservedRange(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -57410,9 +59822,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ReservedRange.decode = function decode(reader, length, error) { + ReservedRange.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.DescriptorProto.ReservedRange(); while (reader.pos < end) { var tag = reader.uint32(); @@ -57428,7 +59844,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -57459,9 +59875,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ReservedRange.verify = function verify(message) { + ReservedRange.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.start != null && message.hasOwnProperty("start")) if (!$util.isInteger(message.start)) return "start: integer expected"; @@ -57479,9 +59899,13 @@ * @param {Object.} object Plain object * @returns {google.protobuf.DescriptorProto.ReservedRange} ReservedRange */ - ReservedRange.fromObject = function fromObject(object) { + ReservedRange.fromObject = function fromObject(object, long) { if (object instanceof $root.google.protobuf.DescriptorProto.ReservedRange) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.protobuf.DescriptorProto.ReservedRange(); if (object.start != null) message.start = object.start | 0; @@ -57571,7 +59995,7 @@ this.declaration = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -57668,9 +60092,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ExtensionRangeOptions.decode = function decode(reader, length, error) { + ExtensionRangeOptions.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.ExtensionRangeOptions(); while (reader.pos < end) { var tag = reader.uint32(); @@ -57680,17 +60108,17 @@ case 999: { if (!(message.uninterpretedOption && message.uninterpretedOption.length)) message.uninterpretedOption = []; - message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); + message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32(), undefined, long + 1)); break; } case 2: { if (!(message.declaration && message.declaration.length)) message.declaration = []; - message.declaration.push($root.google.protobuf.ExtensionRangeOptions.Declaration.decode(reader, reader.uint32())); + message.declaration.push($root.google.protobuf.ExtensionRangeOptions.Declaration.decode(reader, reader.uint32(), undefined, long + 1)); break; } case 50: { - message.features = $root.google.protobuf.FeatureSet.decode(reader, reader.uint32()); + message.features = $root.google.protobuf.FeatureSet.decode(reader, reader.uint32(), undefined, long + 1); break; } case 3: { @@ -57698,7 +60126,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -57729,14 +60157,18 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ExtensionRangeOptions.verify = function verify(message) { + ExtensionRangeOptions.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { if (!Array.isArray(message.uninterpretedOption)) return "uninterpretedOption: array expected"; for (var i = 0; i < message.uninterpretedOption.length; ++i) { - var error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpretedOption[i]); + var error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpretedOption[i], long + 1); if (error) return "uninterpretedOption." + error; } @@ -57745,13 +60177,13 @@ if (!Array.isArray(message.declaration)) return "declaration: array expected"; for (var i = 0; i < message.declaration.length; ++i) { - var error = $root.google.protobuf.ExtensionRangeOptions.Declaration.verify(message.declaration[i]); + var error = $root.google.protobuf.ExtensionRangeOptions.Declaration.verify(message.declaration[i], long + 1); if (error) return "declaration." + error; } } if (message.features != null && message.hasOwnProperty("features")) { - var error = $root.google.protobuf.FeatureSet.verify(message.features); + var error = $root.google.protobuf.FeatureSet.verify(message.features, long + 1); if (error) return "features." + error; } @@ -57774,9 +60206,13 @@ * @param {Object.} object Plain object * @returns {google.protobuf.ExtensionRangeOptions} ExtensionRangeOptions */ - ExtensionRangeOptions.fromObject = function fromObject(object) { + ExtensionRangeOptions.fromObject = function fromObject(object, long) { if (object instanceof $root.google.protobuf.ExtensionRangeOptions) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.protobuf.ExtensionRangeOptions(); if (object.uninterpretedOption) { if (!Array.isArray(object.uninterpretedOption)) @@ -57785,7 +60221,7 @@ for (var i = 0; i < object.uninterpretedOption.length; ++i) { if (typeof object.uninterpretedOption[i] !== "object") throw TypeError(".google.protobuf.ExtensionRangeOptions.uninterpretedOption: object expected"); - message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i]); + message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i], long + 1); } } if (object.declaration) { @@ -57795,13 +60231,13 @@ for (var i = 0; i < object.declaration.length; ++i) { if (typeof object.declaration[i] !== "object") throw TypeError(".google.protobuf.ExtensionRangeOptions.declaration: object expected"); - message.declaration[i] = $root.google.protobuf.ExtensionRangeOptions.Declaration.fromObject(object.declaration[i]); + message.declaration[i] = $root.google.protobuf.ExtensionRangeOptions.Declaration.fromObject(object.declaration[i], long + 1); } } if (object.features != null) { if (typeof object.features !== "object") throw TypeError(".google.protobuf.ExtensionRangeOptions.features: object expected"); - message.features = $root.google.protobuf.FeatureSet.fromObject(object.features); + message.features = $root.google.protobuf.FeatureSet.fromObject(object.features, long + 1); } switch (object.verification) { case "DECLARATION": @@ -57910,7 +60346,7 @@ function Declaration(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -58015,9 +60451,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Declaration.decode = function decode(reader, length, error) { + Declaration.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.ExtensionRangeOptions.Declaration(); while (reader.pos < end) { var tag = reader.uint32(); @@ -58045,7 +60485,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -58076,9 +60516,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Declaration.verify = function verify(message) { + Declaration.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.number != null && message.hasOwnProperty("number")) if (!$util.isInteger(message.number)) return "number: integer expected"; @@ -58105,9 +60549,13 @@ * @param {Object.} object Plain object * @returns {google.protobuf.ExtensionRangeOptions.Declaration} Declaration */ - Declaration.fromObject = function fromObject(object) { + Declaration.fromObject = function fromObject(object, long) { if (object instanceof $root.google.protobuf.ExtensionRangeOptions.Declaration) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.protobuf.ExtensionRangeOptions.Declaration(); if (object.number != null) message.number = object.number | 0; @@ -58231,7 +60679,7 @@ function FieldDescriptorProto(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -58396,9 +60844,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - FieldDescriptorProto.decode = function decode(reader, length, error) { + FieldDescriptorProto.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FieldDescriptorProto(); while (reader.pos < end) { var tag = reader.uint32(); @@ -58442,7 +60894,7 @@ break; } case 8: { - message.options = $root.google.protobuf.FieldOptions.decode(reader, reader.uint32()); + message.options = $root.google.protobuf.FieldOptions.decode(reader, reader.uint32(), undefined, long + 1); break; } case 17: { @@ -58450,7 +60902,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -58481,9 +60933,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - FieldDescriptorProto.verify = function verify(message) { + FieldDescriptorProto.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.name != null && message.hasOwnProperty("name")) if (!$util.isString(message.name)) return "name: string expected"; @@ -58539,7 +60995,7 @@ if (!$util.isString(message.jsonName)) return "jsonName: string expected"; if (message.options != null && message.hasOwnProperty("options")) { - var error = $root.google.protobuf.FieldOptions.verify(message.options); + var error = $root.google.protobuf.FieldOptions.verify(message.options, long + 1); if (error) return "options." + error; } @@ -58557,9 +61013,13 @@ * @param {Object.} object Plain object * @returns {google.protobuf.FieldDescriptorProto} FieldDescriptorProto */ - FieldDescriptorProto.fromObject = function fromObject(object) { + FieldDescriptorProto.fromObject = function fromObject(object, long) { if (object instanceof $root.google.protobuf.FieldDescriptorProto) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.protobuf.FieldDescriptorProto(); if (object.name != null) message.name = String(object.name); @@ -58678,7 +61138,7 @@ if (object.options != null) { if (typeof object.options !== "object") throw TypeError(".google.protobuf.FieldDescriptorProto.options: object expected"); - message.options = $root.google.protobuf.FieldOptions.fromObject(object.options); + message.options = $root.google.protobuf.FieldOptions.fromObject(object.options, long + 1); } if (object.proto3Optional != null) message.proto3Optional = Boolean(object.proto3Optional); @@ -58848,7 +61308,7 @@ function OneofDescriptorProto(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -58923,9 +61383,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - OneofDescriptorProto.decode = function decode(reader, length, error) { + OneofDescriptorProto.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.OneofDescriptorProto(); while (reader.pos < end) { var tag = reader.uint32(); @@ -58937,11 +61401,11 @@ break; } case 2: { - message.options = $root.google.protobuf.OneofOptions.decode(reader, reader.uint32()); + message.options = $root.google.protobuf.OneofOptions.decode(reader, reader.uint32(), undefined, long + 1); break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -58972,14 +61436,18 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - OneofDescriptorProto.verify = function verify(message) { + OneofDescriptorProto.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.name != null && message.hasOwnProperty("name")) if (!$util.isString(message.name)) return "name: string expected"; if (message.options != null && message.hasOwnProperty("options")) { - var error = $root.google.protobuf.OneofOptions.verify(message.options); + var error = $root.google.protobuf.OneofOptions.verify(message.options, long + 1); if (error) return "options." + error; } @@ -58994,16 +61462,20 @@ * @param {Object.} object Plain object * @returns {google.protobuf.OneofDescriptorProto} OneofDescriptorProto */ - OneofDescriptorProto.fromObject = function fromObject(object) { + OneofDescriptorProto.fromObject = function fromObject(object, long) { if (object instanceof $root.google.protobuf.OneofDescriptorProto) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.protobuf.OneofDescriptorProto(); if (object.name != null) message.name = String(object.name); if (object.options != null) { if (typeof object.options !== "object") throw TypeError(".google.protobuf.OneofDescriptorProto.options: object expected"); - message.options = $root.google.protobuf.OneofOptions.fromObject(object.options); + message.options = $root.google.protobuf.OneofOptions.fromObject(object.options, long + 1); } return message; }; @@ -59089,7 +61561,7 @@ this.reservedName = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -59207,9 +61679,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - EnumDescriptorProto.decode = function decode(reader, length, error) { + EnumDescriptorProto.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.EnumDescriptorProto(); while (reader.pos < end) { var tag = reader.uint32(); @@ -59223,17 +61699,17 @@ case 2: { if (!(message.value && message.value.length)) message.value = []; - message.value.push($root.google.protobuf.EnumValueDescriptorProto.decode(reader, reader.uint32())); + message.value.push($root.google.protobuf.EnumValueDescriptorProto.decode(reader, reader.uint32(), undefined, long + 1)); break; } case 3: { - message.options = $root.google.protobuf.EnumOptions.decode(reader, reader.uint32()); + message.options = $root.google.protobuf.EnumOptions.decode(reader, reader.uint32(), undefined, long + 1); break; } case 4: { if (!(message.reservedRange && message.reservedRange.length)) message.reservedRange = []; - message.reservedRange.push($root.google.protobuf.EnumDescriptorProto.EnumReservedRange.decode(reader, reader.uint32())); + message.reservedRange.push($root.google.protobuf.EnumDescriptorProto.EnumReservedRange.decode(reader, reader.uint32(), undefined, long + 1)); break; } case 5: { @@ -59247,7 +61723,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -59278,9 +61754,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - EnumDescriptorProto.verify = function verify(message) { + EnumDescriptorProto.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.name != null && message.hasOwnProperty("name")) if (!$util.isString(message.name)) return "name: string expected"; @@ -59288,13 +61768,13 @@ if (!Array.isArray(message.value)) return "value: array expected"; for (var i = 0; i < message.value.length; ++i) { - var error = $root.google.protobuf.EnumValueDescriptorProto.verify(message.value[i]); + var error = $root.google.protobuf.EnumValueDescriptorProto.verify(message.value[i], long + 1); if (error) return "value." + error; } } if (message.options != null && message.hasOwnProperty("options")) { - var error = $root.google.protobuf.EnumOptions.verify(message.options); + var error = $root.google.protobuf.EnumOptions.verify(message.options, long + 1); if (error) return "options." + error; } @@ -59302,7 +61782,7 @@ if (!Array.isArray(message.reservedRange)) return "reservedRange: array expected"; for (var i = 0; i < message.reservedRange.length; ++i) { - var error = $root.google.protobuf.EnumDescriptorProto.EnumReservedRange.verify(message.reservedRange[i]); + var error = $root.google.protobuf.EnumDescriptorProto.EnumReservedRange.verify(message.reservedRange[i], long + 1); if (error) return "reservedRange." + error; } @@ -59334,9 +61814,13 @@ * @param {Object.} object Plain object * @returns {google.protobuf.EnumDescriptorProto} EnumDescriptorProto */ - EnumDescriptorProto.fromObject = function fromObject(object) { + EnumDescriptorProto.fromObject = function fromObject(object, long) { if (object instanceof $root.google.protobuf.EnumDescriptorProto) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.protobuf.EnumDescriptorProto(); if (object.name != null) message.name = String(object.name); @@ -59347,13 +61831,13 @@ for (var i = 0; i < object.value.length; ++i) { if (typeof object.value[i] !== "object") throw TypeError(".google.protobuf.EnumDescriptorProto.value: object expected"); - message.value[i] = $root.google.protobuf.EnumValueDescriptorProto.fromObject(object.value[i]); + message.value[i] = $root.google.protobuf.EnumValueDescriptorProto.fromObject(object.value[i], long + 1); } } if (object.options != null) { if (typeof object.options !== "object") throw TypeError(".google.protobuf.EnumDescriptorProto.options: object expected"); - message.options = $root.google.protobuf.EnumOptions.fromObject(object.options); + message.options = $root.google.protobuf.EnumOptions.fromObject(object.options, long + 1); } if (object.reservedRange) { if (!Array.isArray(object.reservedRange)) @@ -59362,7 +61846,7 @@ for (var i = 0; i < object.reservedRange.length; ++i) { if (typeof object.reservedRange[i] !== "object") throw TypeError(".google.protobuf.EnumDescriptorProto.reservedRange: object expected"); - message.reservedRange[i] = $root.google.protobuf.EnumDescriptorProto.EnumReservedRange.fromObject(object.reservedRange[i]); + message.reservedRange[i] = $root.google.protobuf.EnumDescriptorProto.EnumReservedRange.fromObject(object.reservedRange[i], long + 1); } } if (object.reservedName) { @@ -59489,7 +61973,7 @@ function EnumReservedRange(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -59564,9 +62048,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - EnumReservedRange.decode = function decode(reader, length, error) { + EnumReservedRange.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.EnumDescriptorProto.EnumReservedRange(); while (reader.pos < end) { var tag = reader.uint32(); @@ -59582,7 +62070,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -59613,9 +62101,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - EnumReservedRange.verify = function verify(message) { + EnumReservedRange.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.start != null && message.hasOwnProperty("start")) if (!$util.isInteger(message.start)) return "start: integer expected"; @@ -59633,9 +62125,13 @@ * @param {Object.} object Plain object * @returns {google.protobuf.EnumDescriptorProto.EnumReservedRange} EnumReservedRange */ - EnumReservedRange.fromObject = function fromObject(object) { + EnumReservedRange.fromObject = function fromObject(object, long) { if (object instanceof $root.google.protobuf.EnumDescriptorProto.EnumReservedRange) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.protobuf.EnumDescriptorProto.EnumReservedRange(); if (object.start != null) message.start = object.start | 0; @@ -59722,7 +62218,7 @@ function EnumValueDescriptorProto(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -59807,9 +62303,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - EnumValueDescriptorProto.decode = function decode(reader, length, error) { + EnumValueDescriptorProto.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.EnumValueDescriptorProto(); while (reader.pos < end) { var tag = reader.uint32(); @@ -59825,11 +62325,11 @@ break; } case 3: { - message.options = $root.google.protobuf.EnumValueOptions.decode(reader, reader.uint32()); + message.options = $root.google.protobuf.EnumValueOptions.decode(reader, reader.uint32(), undefined, long + 1); break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -59860,9 +62360,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - EnumValueDescriptorProto.verify = function verify(message) { + EnumValueDescriptorProto.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.name != null && message.hasOwnProperty("name")) if (!$util.isString(message.name)) return "name: string expected"; @@ -59870,7 +62374,7 @@ if (!$util.isInteger(message.number)) return "number: integer expected"; if (message.options != null && message.hasOwnProperty("options")) { - var error = $root.google.protobuf.EnumValueOptions.verify(message.options); + var error = $root.google.protobuf.EnumValueOptions.verify(message.options, long + 1); if (error) return "options." + error; } @@ -59885,9 +62389,13 @@ * @param {Object.} object Plain object * @returns {google.protobuf.EnumValueDescriptorProto} EnumValueDescriptorProto */ - EnumValueDescriptorProto.fromObject = function fromObject(object) { + EnumValueDescriptorProto.fromObject = function fromObject(object, long) { if (object instanceof $root.google.protobuf.EnumValueDescriptorProto) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.protobuf.EnumValueDescriptorProto(); if (object.name != null) message.name = String(object.name); @@ -59896,7 +62404,7 @@ if (object.options != null) { if (typeof object.options !== "object") throw TypeError(".google.protobuf.EnumValueDescriptorProto.options: object expected"); - message.options = $root.google.protobuf.EnumValueOptions.fromObject(object.options); + message.options = $root.google.protobuf.EnumValueOptions.fromObject(object.options, long + 1); } return message; }; @@ -59980,7 +62488,7 @@ this.method = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -60066,9 +62574,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ServiceDescriptorProto.decode = function decode(reader, length, error) { + ServiceDescriptorProto.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.ServiceDescriptorProto(); while (reader.pos < end) { var tag = reader.uint32(); @@ -60082,15 +62594,15 @@ case 2: { if (!(message.method && message.method.length)) message.method = []; - message.method.push($root.google.protobuf.MethodDescriptorProto.decode(reader, reader.uint32())); + message.method.push($root.google.protobuf.MethodDescriptorProto.decode(reader, reader.uint32(), undefined, long + 1)); break; } case 3: { - message.options = $root.google.protobuf.ServiceOptions.decode(reader, reader.uint32()); + message.options = $root.google.protobuf.ServiceOptions.decode(reader, reader.uint32(), undefined, long + 1); break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -60121,9 +62633,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ServiceDescriptorProto.verify = function verify(message) { + ServiceDescriptorProto.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.name != null && message.hasOwnProperty("name")) if (!$util.isString(message.name)) return "name: string expected"; @@ -60131,13 +62647,13 @@ if (!Array.isArray(message.method)) return "method: array expected"; for (var i = 0; i < message.method.length; ++i) { - var error = $root.google.protobuf.MethodDescriptorProto.verify(message.method[i]); + var error = $root.google.protobuf.MethodDescriptorProto.verify(message.method[i], long + 1); if (error) return "method." + error; } } if (message.options != null && message.hasOwnProperty("options")) { - var error = $root.google.protobuf.ServiceOptions.verify(message.options); + var error = $root.google.protobuf.ServiceOptions.verify(message.options, long + 1); if (error) return "options." + error; } @@ -60152,9 +62668,13 @@ * @param {Object.} object Plain object * @returns {google.protobuf.ServiceDescriptorProto} ServiceDescriptorProto */ - ServiceDescriptorProto.fromObject = function fromObject(object) { + ServiceDescriptorProto.fromObject = function fromObject(object, long) { if (object instanceof $root.google.protobuf.ServiceDescriptorProto) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.protobuf.ServiceDescriptorProto(); if (object.name != null) message.name = String(object.name); @@ -60165,13 +62685,13 @@ for (var i = 0; i < object.method.length; ++i) { if (typeof object.method[i] !== "object") throw TypeError(".google.protobuf.ServiceDescriptorProto.method: object expected"); - message.method[i] = $root.google.protobuf.MethodDescriptorProto.fromObject(object.method[i]); + message.method[i] = $root.google.protobuf.MethodDescriptorProto.fromObject(object.method[i], long + 1); } } if (object.options != null) { if (typeof object.options !== "object") throw TypeError(".google.protobuf.ServiceDescriptorProto.options: object expected"); - message.options = $root.google.protobuf.ServiceOptions.fromObject(object.options); + message.options = $root.google.protobuf.ServiceOptions.fromObject(object.options, long + 1); } return message; }; @@ -60261,7 +62781,7 @@ function MethodDescriptorProto(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -60376,9 +62896,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - MethodDescriptorProto.decode = function decode(reader, length, error) { + MethodDescriptorProto.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.MethodDescriptorProto(); while (reader.pos < end) { var tag = reader.uint32(); @@ -60398,7 +62922,7 @@ break; } case 4: { - message.options = $root.google.protobuf.MethodOptions.decode(reader, reader.uint32()); + message.options = $root.google.protobuf.MethodOptions.decode(reader, reader.uint32(), undefined, long + 1); break; } case 5: { @@ -60410,7 +62934,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -60441,9 +62965,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - MethodDescriptorProto.verify = function verify(message) { + MethodDescriptorProto.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.name != null && message.hasOwnProperty("name")) if (!$util.isString(message.name)) return "name: string expected"; @@ -60454,7 +62982,7 @@ if (!$util.isString(message.outputType)) return "outputType: string expected"; if (message.options != null && message.hasOwnProperty("options")) { - var error = $root.google.protobuf.MethodOptions.verify(message.options); + var error = $root.google.protobuf.MethodOptions.verify(message.options, long + 1); if (error) return "options." + error; } @@ -60475,9 +63003,13 @@ * @param {Object.} object Plain object * @returns {google.protobuf.MethodDescriptorProto} MethodDescriptorProto */ - MethodDescriptorProto.fromObject = function fromObject(object) { + MethodDescriptorProto.fromObject = function fromObject(object, long) { if (object instanceof $root.google.protobuf.MethodDescriptorProto) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.protobuf.MethodDescriptorProto(); if (object.name != null) message.name = String(object.name); @@ -60488,7 +63020,7 @@ if (object.options != null) { if (typeof object.options !== "object") throw TypeError(".google.protobuf.MethodDescriptorProto.options: object expected"); - message.options = $root.google.protobuf.MethodOptions.fromObject(object.options); + message.options = $root.google.protobuf.MethodOptions.fromObject(object.options, long + 1); } if (object.clientStreaming != null) message.clientStreaming = Boolean(object.clientStreaming); @@ -60605,7 +63137,7 @@ this[".google.api.resourceDefinition"] = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -60882,9 +63414,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - FileOptions.decode = function decode(reader, length, error) { + FileOptions.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FileOptions(); while (reader.pos < end) { var tag = reader.uint32(); @@ -60968,23 +63504,23 @@ break; } case 50: { - message.features = $root.google.protobuf.FeatureSet.decode(reader, reader.uint32()); + message.features = $root.google.protobuf.FeatureSet.decode(reader, reader.uint32(), undefined, long + 1); break; } case 999: { if (!(message.uninterpretedOption && message.uninterpretedOption.length)) message.uninterpretedOption = []; - message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); + message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32(), undefined, long + 1)); break; } case 1053: { if (!(message[".google.api.resourceDefinition"] && message[".google.api.resourceDefinition"].length)) message[".google.api.resourceDefinition"] = []; - message[".google.api.resourceDefinition"].push($root.google.api.ResourceDescriptor.decode(reader, reader.uint32())); + message[".google.api.resourceDefinition"].push($root.google.api.ResourceDescriptor.decode(reader, reader.uint32(), undefined, long + 1)); break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -61015,9 +63551,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - FileOptions.verify = function verify(message) { + FileOptions.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.javaPackage != null && message.hasOwnProperty("javaPackage")) if (!$util.isString(message.javaPackage)) return "javaPackage: string expected"; @@ -61082,7 +63622,7 @@ if (!$util.isString(message.rubyPackage)) return "rubyPackage: string expected"; if (message.features != null && message.hasOwnProperty("features")) { - var error = $root.google.protobuf.FeatureSet.verify(message.features); + var error = $root.google.protobuf.FeatureSet.verify(message.features, long + 1); if (error) return "features." + error; } @@ -61090,7 +63630,7 @@ if (!Array.isArray(message.uninterpretedOption)) return "uninterpretedOption: array expected"; for (var i = 0; i < message.uninterpretedOption.length; ++i) { - var error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpretedOption[i]); + var error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpretedOption[i], long + 1); if (error) return "uninterpretedOption." + error; } @@ -61099,7 +63639,7 @@ if (!Array.isArray(message[".google.api.resourceDefinition"])) return ".google.api.resourceDefinition: array expected"; for (var i = 0; i < message[".google.api.resourceDefinition"].length; ++i) { - var error = $root.google.api.ResourceDescriptor.verify(message[".google.api.resourceDefinition"][i]); + var error = $root.google.api.ResourceDescriptor.verify(message[".google.api.resourceDefinition"][i], long + 1); if (error) return ".google.api.resourceDefinition." + error; } @@ -61115,9 +63655,13 @@ * @param {Object.} object Plain object * @returns {google.protobuf.FileOptions} FileOptions */ - FileOptions.fromObject = function fromObject(object) { + FileOptions.fromObject = function fromObject(object, long) { if (object instanceof $root.google.protobuf.FileOptions) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.protobuf.FileOptions(); if (object.javaPackage != null) message.javaPackage = String(object.javaPackage); @@ -61178,7 +63722,7 @@ if (object.features != null) { if (typeof object.features !== "object") throw TypeError(".google.protobuf.FileOptions.features: object expected"); - message.features = $root.google.protobuf.FeatureSet.fromObject(object.features); + message.features = $root.google.protobuf.FeatureSet.fromObject(object.features, long + 1); } if (object.uninterpretedOption) { if (!Array.isArray(object.uninterpretedOption)) @@ -61187,7 +63731,7 @@ for (var i = 0; i < object.uninterpretedOption.length; ++i) { if (typeof object.uninterpretedOption[i] !== "object") throw TypeError(".google.protobuf.FileOptions.uninterpretedOption: object expected"); - message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i]); + message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i], long + 1); } } if (object[".google.api.resourceDefinition"]) { @@ -61197,7 +63741,7 @@ for (var i = 0; i < object[".google.api.resourceDefinition"].length; ++i) { if (typeof object[".google.api.resourceDefinition"][i] !== "object") throw TypeError(".google.protobuf.FileOptions..google.api.resourceDefinition: object expected"); - message[".google.api.resourceDefinition"][i] = $root.google.api.ResourceDescriptor.fromObject(object[".google.api.resourceDefinition"][i]); + message[".google.api.resourceDefinition"][i] = $root.google.api.ResourceDescriptor.fromObject(object[".google.api.resourceDefinition"][i], long + 1); } } return message; @@ -61368,7 +63912,7 @@ this.uninterpretedOption = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -61504,9 +64048,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - MessageOptions.decode = function decode(reader, length, error) { + MessageOptions.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.MessageOptions(); while (reader.pos < end) { var tag = reader.uint32(); @@ -61534,21 +64082,21 @@ break; } case 12: { - message.features = $root.google.protobuf.FeatureSet.decode(reader, reader.uint32()); + message.features = $root.google.protobuf.FeatureSet.decode(reader, reader.uint32(), undefined, long + 1); break; } case 999: { if (!(message.uninterpretedOption && message.uninterpretedOption.length)) message.uninterpretedOption = []; - message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); + message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32(), undefined, long + 1)); break; } case 1053: { - message[".google.api.resource"] = $root.google.api.ResourceDescriptor.decode(reader, reader.uint32()); + message[".google.api.resource"] = $root.google.api.ResourceDescriptor.decode(reader, reader.uint32(), undefined, long + 1); break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -61579,9 +64127,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - MessageOptions.verify = function verify(message) { + MessageOptions.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.messageSetWireFormat != null && message.hasOwnProperty("messageSetWireFormat")) if (typeof message.messageSetWireFormat !== "boolean") return "messageSetWireFormat: boolean expected"; @@ -61598,7 +64150,7 @@ if (typeof message.deprecatedLegacyJsonFieldConflicts !== "boolean") return "deprecatedLegacyJsonFieldConflicts: boolean expected"; if (message.features != null && message.hasOwnProperty("features")) { - var error = $root.google.protobuf.FeatureSet.verify(message.features); + var error = $root.google.protobuf.FeatureSet.verify(message.features, long + 1); if (error) return "features." + error; } @@ -61606,13 +64158,13 @@ if (!Array.isArray(message.uninterpretedOption)) return "uninterpretedOption: array expected"; for (var i = 0; i < message.uninterpretedOption.length; ++i) { - var error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpretedOption[i]); + var error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpretedOption[i], long + 1); if (error) return "uninterpretedOption." + error; } } if (message[".google.api.resource"] != null && message.hasOwnProperty(".google.api.resource")) { - var error = $root.google.api.ResourceDescriptor.verify(message[".google.api.resource"]); + var error = $root.google.api.ResourceDescriptor.verify(message[".google.api.resource"], long + 1); if (error) return ".google.api.resource." + error; } @@ -61627,9 +64179,13 @@ * @param {Object.} object Plain object * @returns {google.protobuf.MessageOptions} MessageOptions */ - MessageOptions.fromObject = function fromObject(object) { + MessageOptions.fromObject = function fromObject(object, long) { if (object instanceof $root.google.protobuf.MessageOptions) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.protobuf.MessageOptions(); if (object.messageSetWireFormat != null) message.messageSetWireFormat = Boolean(object.messageSetWireFormat); @@ -61644,7 +64200,7 @@ if (object.features != null) { if (typeof object.features !== "object") throw TypeError(".google.protobuf.MessageOptions.features: object expected"); - message.features = $root.google.protobuf.FeatureSet.fromObject(object.features); + message.features = $root.google.protobuf.FeatureSet.fromObject(object.features, long + 1); } if (object.uninterpretedOption) { if (!Array.isArray(object.uninterpretedOption)) @@ -61653,13 +64209,13 @@ for (var i = 0; i < object.uninterpretedOption.length; ++i) { if (typeof object.uninterpretedOption[i] !== "object") throw TypeError(".google.protobuf.MessageOptions.uninterpretedOption: object expected"); - message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i]); + message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i], long + 1); } } if (object[".google.api.resource"] != null) { if (typeof object[".google.api.resource"] !== "object") throw TypeError(".google.protobuf.MessageOptions..google.api.resource: object expected"); - message[".google.api.resource"] = $root.google.api.ResourceDescriptor.fromObject(object[".google.api.resource"]); + message[".google.api.resource"] = $root.google.api.ResourceDescriptor.fromObject(object[".google.api.resource"], long + 1); } return message; }; @@ -61779,7 +64335,7 @@ this[".google.api.fieldBehavior"] = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -62008,9 +64564,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - FieldOptions.decode = function decode(reader, length, error) { + FieldOptions.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FieldOptions(); while (reader.pos < end) { var tag = reader.uint32(); @@ -62067,21 +64627,21 @@ case 20: { if (!(message.editionDefaults && message.editionDefaults.length)) message.editionDefaults = []; - message.editionDefaults.push($root.google.protobuf.FieldOptions.EditionDefault.decode(reader, reader.uint32())); + message.editionDefaults.push($root.google.protobuf.FieldOptions.EditionDefault.decode(reader, reader.uint32(), undefined, long + 1)); break; } case 21: { - message.features = $root.google.protobuf.FeatureSet.decode(reader, reader.uint32()); + message.features = $root.google.protobuf.FeatureSet.decode(reader, reader.uint32(), undefined, long + 1); break; } case 22: { - message.featureSupport = $root.google.protobuf.FieldOptions.FeatureSupport.decode(reader, reader.uint32()); + message.featureSupport = $root.google.protobuf.FieldOptions.FeatureSupport.decode(reader, reader.uint32(), undefined, long + 1); break; } case 999: { if (!(message.uninterpretedOption && message.uninterpretedOption.length)) message.uninterpretedOption = []; - message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); + message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32(), undefined, long + 1)); break; } case 1052: { @@ -62096,15 +64656,15 @@ break; } case 1055: { - message[".google.api.resourceReference"] = $root.google.api.ResourceReference.decode(reader, reader.uint32()); + message[".google.api.resourceReference"] = $root.google.api.ResourceReference.decode(reader, reader.uint32(), undefined, long + 1); break; } case 291403980: { - message[".google.api.fieldInfo"] = $root.google.api.FieldInfo.decode(reader, reader.uint32()); + message[".google.api.fieldInfo"] = $root.google.api.FieldInfo.decode(reader, reader.uint32(), undefined, long + 1); break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -62135,9 +64695,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - FieldOptions.verify = function verify(message) { + FieldOptions.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.ctype != null && message.hasOwnProperty("ctype")) switch (message.ctype) { default: @@ -62207,18 +64771,18 @@ if (!Array.isArray(message.editionDefaults)) return "editionDefaults: array expected"; for (var i = 0; i < message.editionDefaults.length; ++i) { - var error = $root.google.protobuf.FieldOptions.EditionDefault.verify(message.editionDefaults[i]); + var error = $root.google.protobuf.FieldOptions.EditionDefault.verify(message.editionDefaults[i], long + 1); if (error) return "editionDefaults." + error; } } if (message.features != null && message.hasOwnProperty("features")) { - var error = $root.google.protobuf.FeatureSet.verify(message.features); + var error = $root.google.protobuf.FeatureSet.verify(message.features, long + 1); if (error) return "features." + error; } if (message.featureSupport != null && message.hasOwnProperty("featureSupport")) { - var error = $root.google.protobuf.FieldOptions.FeatureSupport.verify(message.featureSupport); + var error = $root.google.protobuf.FieldOptions.FeatureSupport.verify(message.featureSupport, long + 1); if (error) return "featureSupport." + error; } @@ -62226,7 +64790,7 @@ if (!Array.isArray(message.uninterpretedOption)) return "uninterpretedOption: array expected"; for (var i = 0; i < message.uninterpretedOption.length; ++i) { - var error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpretedOption[i]); + var error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpretedOption[i], long + 1); if (error) return "uninterpretedOption." + error; } @@ -62251,12 +64815,12 @@ } } if (message[".google.api.resourceReference"] != null && message.hasOwnProperty(".google.api.resourceReference")) { - var error = $root.google.api.ResourceReference.verify(message[".google.api.resourceReference"]); + var error = $root.google.api.ResourceReference.verify(message[".google.api.resourceReference"], long + 1); if (error) return ".google.api.resourceReference." + error; } if (message[".google.api.fieldInfo"] != null && message.hasOwnProperty(".google.api.fieldInfo")) { - var error = $root.google.api.FieldInfo.verify(message[".google.api.fieldInfo"]); + var error = $root.google.api.FieldInfo.verify(message[".google.api.fieldInfo"], long + 1); if (error) return ".google.api.fieldInfo." + error; } @@ -62271,9 +64835,13 @@ * @param {Object.} object Plain object * @returns {google.protobuf.FieldOptions} FieldOptions */ - FieldOptions.fromObject = function fromObject(object) { + FieldOptions.fromObject = function fromObject(object, long) { if (object instanceof $root.google.protobuf.FieldOptions) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.protobuf.FieldOptions(); switch (object.ctype) { default: @@ -62407,18 +64975,18 @@ for (var i = 0; i < object.editionDefaults.length; ++i) { if (typeof object.editionDefaults[i] !== "object") throw TypeError(".google.protobuf.FieldOptions.editionDefaults: object expected"); - message.editionDefaults[i] = $root.google.protobuf.FieldOptions.EditionDefault.fromObject(object.editionDefaults[i]); + message.editionDefaults[i] = $root.google.protobuf.FieldOptions.EditionDefault.fromObject(object.editionDefaults[i], long + 1); } } if (object.features != null) { if (typeof object.features !== "object") throw TypeError(".google.protobuf.FieldOptions.features: object expected"); - message.features = $root.google.protobuf.FeatureSet.fromObject(object.features); + message.features = $root.google.protobuf.FeatureSet.fromObject(object.features, long + 1); } if (object.featureSupport != null) { if (typeof object.featureSupport !== "object") throw TypeError(".google.protobuf.FieldOptions.featureSupport: object expected"); - message.featureSupport = $root.google.protobuf.FieldOptions.FeatureSupport.fromObject(object.featureSupport); + message.featureSupport = $root.google.protobuf.FieldOptions.FeatureSupport.fromObject(object.featureSupport, long + 1); } if (object.uninterpretedOption) { if (!Array.isArray(object.uninterpretedOption)) @@ -62427,7 +64995,7 @@ for (var i = 0; i < object.uninterpretedOption.length; ++i) { if (typeof object.uninterpretedOption[i] !== "object") throw TypeError(".google.protobuf.FieldOptions.uninterpretedOption: object expected"); - message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i]); + message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i], long + 1); } } if (object[".google.api.fieldBehavior"]) { @@ -62482,12 +65050,12 @@ if (object[".google.api.resourceReference"] != null) { if (typeof object[".google.api.resourceReference"] !== "object") throw TypeError(".google.protobuf.FieldOptions..google.api.resourceReference: object expected"); - message[".google.api.resourceReference"] = $root.google.api.ResourceReference.fromObject(object[".google.api.resourceReference"]); + message[".google.api.resourceReference"] = $root.google.api.ResourceReference.fromObject(object[".google.api.resourceReference"], long + 1); } if (object[".google.api.fieldInfo"] != null) { if (typeof object[".google.api.fieldInfo"] !== "object") throw TypeError(".google.protobuf.FieldOptions..google.api.fieldInfo: object expected"); - message[".google.api.fieldInfo"] = $root.google.api.FieldInfo.fromObject(object[".google.api.fieldInfo"]); + message[".google.api.fieldInfo"] = $root.google.api.FieldInfo.fromObject(object[".google.api.fieldInfo"], long + 1); } return message; }; @@ -62700,7 +65268,7 @@ function EditionDefault(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -62775,9 +65343,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - EditionDefault.decode = function decode(reader, length, error) { + EditionDefault.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FieldOptions.EditionDefault(); while (reader.pos < end) { var tag = reader.uint32(); @@ -62793,7 +65365,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -62824,9 +65396,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - EditionDefault.verify = function verify(message) { + EditionDefault.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.edition != null && message.hasOwnProperty("edition")) switch (message.edition) { default: @@ -62859,9 +65435,13 @@ * @param {Object.} object Plain object * @returns {google.protobuf.FieldOptions.EditionDefault} EditionDefault */ - EditionDefault.fromObject = function fromObject(object) { + EditionDefault.fromObject = function fromObject(object, long) { if (object instanceof $root.google.protobuf.FieldOptions.EditionDefault) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.protobuf.FieldOptions.EditionDefault(); switch (object.edition) { default: @@ -63000,7 +65580,7 @@ function FeatureSupport(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -63095,9 +65675,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - FeatureSupport.decode = function decode(reader, length, error) { + FeatureSupport.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FieldOptions.FeatureSupport(); while (reader.pos < end) { var tag = reader.uint32(); @@ -63121,7 +65705,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -63152,9 +65736,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - FeatureSupport.verify = function verify(message) { + FeatureSupport.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.editionIntroduced != null && message.hasOwnProperty("editionIntroduced")) switch (message.editionIntroduced) { default: @@ -63223,9 +65811,13 @@ * @param {Object.} object Plain object * @returns {google.protobuf.FieldOptions.FeatureSupport} FeatureSupport */ - FeatureSupport.fromObject = function fromObject(object) { + FeatureSupport.fromObject = function fromObject(object, long) { if (object instanceof $root.google.protobuf.FieldOptions.FeatureSupport) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.protobuf.FieldOptions.FeatureSupport(); switch (object.editionIntroduced) { default: @@ -63484,7 +66076,7 @@ this.uninterpretedOption = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -63560,9 +66152,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - OneofOptions.decode = function decode(reader, length, error) { + OneofOptions.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.OneofOptions(); while (reader.pos < end) { var tag = reader.uint32(); @@ -63570,17 +66166,17 @@ break; switch (tag >>> 3) { case 1: { - message.features = $root.google.protobuf.FeatureSet.decode(reader, reader.uint32()); + message.features = $root.google.protobuf.FeatureSet.decode(reader, reader.uint32(), undefined, long + 1); break; } case 999: { if (!(message.uninterpretedOption && message.uninterpretedOption.length)) message.uninterpretedOption = []; - message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); + message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32(), undefined, long + 1)); break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -63611,11 +66207,15 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - OneofOptions.verify = function verify(message) { + OneofOptions.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.features != null && message.hasOwnProperty("features")) { - var error = $root.google.protobuf.FeatureSet.verify(message.features); + var error = $root.google.protobuf.FeatureSet.verify(message.features, long + 1); if (error) return "features." + error; } @@ -63623,7 +66223,7 @@ if (!Array.isArray(message.uninterpretedOption)) return "uninterpretedOption: array expected"; for (var i = 0; i < message.uninterpretedOption.length; ++i) { - var error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpretedOption[i]); + var error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpretedOption[i], long + 1); if (error) return "uninterpretedOption." + error; } @@ -63639,14 +66239,18 @@ * @param {Object.} object Plain object * @returns {google.protobuf.OneofOptions} OneofOptions */ - OneofOptions.fromObject = function fromObject(object) { + OneofOptions.fromObject = function fromObject(object, long) { if (object instanceof $root.google.protobuf.OneofOptions) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.protobuf.OneofOptions(); if (object.features != null) { if (typeof object.features !== "object") throw TypeError(".google.protobuf.OneofOptions.features: object expected"); - message.features = $root.google.protobuf.FeatureSet.fromObject(object.features); + message.features = $root.google.protobuf.FeatureSet.fromObject(object.features, long + 1); } if (object.uninterpretedOption) { if (!Array.isArray(object.uninterpretedOption)) @@ -63655,7 +66259,7 @@ for (var i = 0; i < object.uninterpretedOption.length; ++i) { if (typeof object.uninterpretedOption[i] !== "object") throw TypeError(".google.protobuf.OneofOptions.uninterpretedOption: object expected"); - message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i]); + message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i], long + 1); } } return message; @@ -63742,7 +66346,7 @@ this.uninterpretedOption = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -63848,9 +66452,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - EnumOptions.decode = function decode(reader, length, error) { + EnumOptions.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.EnumOptions(); while (reader.pos < end) { var tag = reader.uint32(); @@ -63870,17 +66478,17 @@ break; } case 7: { - message.features = $root.google.protobuf.FeatureSet.decode(reader, reader.uint32()); + message.features = $root.google.protobuf.FeatureSet.decode(reader, reader.uint32(), undefined, long + 1); break; } case 999: { if (!(message.uninterpretedOption && message.uninterpretedOption.length)) message.uninterpretedOption = []; - message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); + message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32(), undefined, long + 1)); break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -63911,9 +66519,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - EnumOptions.verify = function verify(message) { + EnumOptions.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.allowAlias != null && message.hasOwnProperty("allowAlias")) if (typeof message.allowAlias !== "boolean") return "allowAlias: boolean expected"; @@ -63924,7 +66536,7 @@ if (typeof message.deprecatedLegacyJsonFieldConflicts !== "boolean") return "deprecatedLegacyJsonFieldConflicts: boolean expected"; if (message.features != null && message.hasOwnProperty("features")) { - var error = $root.google.protobuf.FeatureSet.verify(message.features); + var error = $root.google.protobuf.FeatureSet.verify(message.features, long + 1); if (error) return "features." + error; } @@ -63932,7 +66544,7 @@ if (!Array.isArray(message.uninterpretedOption)) return "uninterpretedOption: array expected"; for (var i = 0; i < message.uninterpretedOption.length; ++i) { - var error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpretedOption[i]); + var error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpretedOption[i], long + 1); if (error) return "uninterpretedOption." + error; } @@ -63948,9 +66560,13 @@ * @param {Object.} object Plain object * @returns {google.protobuf.EnumOptions} EnumOptions */ - EnumOptions.fromObject = function fromObject(object) { + EnumOptions.fromObject = function fromObject(object, long) { if (object instanceof $root.google.protobuf.EnumOptions) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.protobuf.EnumOptions(); if (object.allowAlias != null) message.allowAlias = Boolean(object.allowAlias); @@ -63961,7 +66577,7 @@ if (object.features != null) { if (typeof object.features !== "object") throw TypeError(".google.protobuf.EnumOptions.features: object expected"); - message.features = $root.google.protobuf.FeatureSet.fromObject(object.features); + message.features = $root.google.protobuf.FeatureSet.fromObject(object.features, long + 1); } if (object.uninterpretedOption) { if (!Array.isArray(object.uninterpretedOption)) @@ -63970,7 +66586,7 @@ for (var i = 0; i < object.uninterpretedOption.length; ++i) { if (typeof object.uninterpretedOption[i] !== "object") throw TypeError(".google.protobuf.EnumOptions.uninterpretedOption: object expected"); - message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i]); + message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i], long + 1); } } return message; @@ -64067,7 +66683,7 @@ this.uninterpretedOption = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -64173,9 +66789,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - EnumValueOptions.decode = function decode(reader, length, error) { + EnumValueOptions.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.EnumValueOptions(); while (reader.pos < end) { var tag = reader.uint32(); @@ -64187,7 +66807,7 @@ break; } case 2: { - message.features = $root.google.protobuf.FeatureSet.decode(reader, reader.uint32()); + message.features = $root.google.protobuf.FeatureSet.decode(reader, reader.uint32(), undefined, long + 1); break; } case 3: { @@ -64195,17 +66815,17 @@ break; } case 4: { - message.featureSupport = $root.google.protobuf.FieldOptions.FeatureSupport.decode(reader, reader.uint32()); + message.featureSupport = $root.google.protobuf.FieldOptions.FeatureSupport.decode(reader, reader.uint32(), undefined, long + 1); break; } case 999: { if (!(message.uninterpretedOption && message.uninterpretedOption.length)) message.uninterpretedOption = []; - message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); + message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32(), undefined, long + 1)); break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -64236,14 +66856,18 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - EnumValueOptions.verify = function verify(message) { + EnumValueOptions.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.deprecated != null && message.hasOwnProperty("deprecated")) if (typeof message.deprecated !== "boolean") return "deprecated: boolean expected"; if (message.features != null && message.hasOwnProperty("features")) { - var error = $root.google.protobuf.FeatureSet.verify(message.features); + var error = $root.google.protobuf.FeatureSet.verify(message.features, long + 1); if (error) return "features." + error; } @@ -64251,7 +66875,7 @@ if (typeof message.debugRedact !== "boolean") return "debugRedact: boolean expected"; if (message.featureSupport != null && message.hasOwnProperty("featureSupport")) { - var error = $root.google.protobuf.FieldOptions.FeatureSupport.verify(message.featureSupport); + var error = $root.google.protobuf.FieldOptions.FeatureSupport.verify(message.featureSupport, long + 1); if (error) return "featureSupport." + error; } @@ -64259,7 +66883,7 @@ if (!Array.isArray(message.uninterpretedOption)) return "uninterpretedOption: array expected"; for (var i = 0; i < message.uninterpretedOption.length; ++i) { - var error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpretedOption[i]); + var error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpretedOption[i], long + 1); if (error) return "uninterpretedOption." + error; } @@ -64275,23 +66899,27 @@ * @param {Object.} object Plain object * @returns {google.protobuf.EnumValueOptions} EnumValueOptions */ - EnumValueOptions.fromObject = function fromObject(object) { + EnumValueOptions.fromObject = function fromObject(object, long) { if (object instanceof $root.google.protobuf.EnumValueOptions) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.protobuf.EnumValueOptions(); if (object.deprecated != null) message.deprecated = Boolean(object.deprecated); if (object.features != null) { if (typeof object.features !== "object") throw TypeError(".google.protobuf.EnumValueOptions.features: object expected"); - message.features = $root.google.protobuf.FeatureSet.fromObject(object.features); + message.features = $root.google.protobuf.FeatureSet.fromObject(object.features, long + 1); } if (object.debugRedact != null) message.debugRedact = Boolean(object.debugRedact); if (object.featureSupport != null) { if (typeof object.featureSupport !== "object") throw TypeError(".google.protobuf.EnumValueOptions.featureSupport: object expected"); - message.featureSupport = $root.google.protobuf.FieldOptions.FeatureSupport.fromObject(object.featureSupport); + message.featureSupport = $root.google.protobuf.FieldOptions.FeatureSupport.fromObject(object.featureSupport, long + 1); } if (object.uninterpretedOption) { if (!Array.isArray(object.uninterpretedOption)) @@ -64300,7 +66928,7 @@ for (var i = 0; i < object.uninterpretedOption.length; ++i) { if (typeof object.uninterpretedOption[i] !== "object") throw TypeError(".google.protobuf.EnumValueOptions.uninterpretedOption: object expected"); - message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i]); + message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i], long + 1); } } return message; @@ -64398,7 +67026,7 @@ this.uninterpretedOption = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -64514,9 +67142,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ServiceOptions.decode = function decode(reader, length, error) { + ServiceOptions.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.ServiceOptions(); while (reader.pos < end) { var tag = reader.uint32(); @@ -64524,7 +67156,7 @@ break; switch (tag >>> 3) { case 34: { - message.features = $root.google.protobuf.FeatureSet.decode(reader, reader.uint32()); + message.features = $root.google.protobuf.FeatureSet.decode(reader, reader.uint32(), undefined, long + 1); break; } case 33: { @@ -64534,7 +67166,7 @@ case 999: { if (!(message.uninterpretedOption && message.uninterpretedOption.length)) message.uninterpretedOption = []; - message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); + message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32(), undefined, long + 1)); break; } case 1049: { @@ -64550,7 +67182,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -64581,11 +67213,15 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ServiceOptions.verify = function verify(message) { + ServiceOptions.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.features != null && message.hasOwnProperty("features")) { - var error = $root.google.protobuf.FeatureSet.verify(message.features); + var error = $root.google.protobuf.FeatureSet.verify(message.features, long + 1); if (error) return "features." + error; } @@ -64596,7 +67232,7 @@ if (!Array.isArray(message.uninterpretedOption)) return "uninterpretedOption: array expected"; for (var i = 0; i < message.uninterpretedOption.length; ++i) { - var error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpretedOption[i]); + var error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpretedOption[i], long + 1); if (error) return "uninterpretedOption." + error; } @@ -64621,14 +67257,18 @@ * @param {Object.} object Plain object * @returns {google.protobuf.ServiceOptions} ServiceOptions */ - ServiceOptions.fromObject = function fromObject(object) { + ServiceOptions.fromObject = function fromObject(object, long) { if (object instanceof $root.google.protobuf.ServiceOptions) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.protobuf.ServiceOptions(); if (object.features != null) { if (typeof object.features !== "object") throw TypeError(".google.protobuf.ServiceOptions.features: object expected"); - message.features = $root.google.protobuf.FeatureSet.fromObject(object.features); + message.features = $root.google.protobuf.FeatureSet.fromObject(object.features, long + 1); } if (object.deprecated != null) message.deprecated = Boolean(object.deprecated); @@ -64639,7 +67279,7 @@ for (var i = 0; i < object.uninterpretedOption.length; ++i) { if (typeof object.uninterpretedOption[i] !== "object") throw TypeError(".google.protobuf.ServiceOptions.uninterpretedOption: object expected"); - message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i]); + message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i], long + 1); } } if (object[".google.api.defaultHost"] != null) @@ -64747,7 +67387,7 @@ this[".google.api.methodSignature"] = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -64864,9 +67504,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - MethodOptions.decode = function decode(reader, length, error) { + MethodOptions.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.MethodOptions(); while (reader.pos < end) { var tag = reader.uint32(); @@ -64882,17 +67526,17 @@ break; } case 35: { - message.features = $root.google.protobuf.FeatureSet.decode(reader, reader.uint32()); + message.features = $root.google.protobuf.FeatureSet.decode(reader, reader.uint32(), undefined, long + 1); break; } case 999: { if (!(message.uninterpretedOption && message.uninterpretedOption.length)) message.uninterpretedOption = []; - message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); + message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32(), undefined, long + 1)); break; } case 72295728: { - message[".google.api.http"] = $root.google.api.HttpRule.decode(reader, reader.uint32()); + message[".google.api.http"] = $root.google.api.HttpRule.decode(reader, reader.uint32(), undefined, long + 1); break; } case 1051: { @@ -64902,7 +67546,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -64933,9 +67577,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - MethodOptions.verify = function verify(message) { + MethodOptions.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.deprecated != null && message.hasOwnProperty("deprecated")) if (typeof message.deprecated !== "boolean") return "deprecated: boolean expected"; @@ -64949,7 +67597,7 @@ break; } if (message.features != null && message.hasOwnProperty("features")) { - var error = $root.google.protobuf.FeatureSet.verify(message.features); + var error = $root.google.protobuf.FeatureSet.verify(message.features, long + 1); if (error) return "features." + error; } @@ -64957,13 +67605,13 @@ if (!Array.isArray(message.uninterpretedOption)) return "uninterpretedOption: array expected"; for (var i = 0; i < message.uninterpretedOption.length; ++i) { - var error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpretedOption[i]); + var error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpretedOption[i], long + 1); if (error) return "uninterpretedOption." + error; } } if (message[".google.api.http"] != null && message.hasOwnProperty(".google.api.http")) { - var error = $root.google.api.HttpRule.verify(message[".google.api.http"]); + var error = $root.google.api.HttpRule.verify(message[".google.api.http"], long + 1); if (error) return ".google.api.http." + error; } @@ -64985,9 +67633,13 @@ * @param {Object.} object Plain object * @returns {google.protobuf.MethodOptions} MethodOptions */ - MethodOptions.fromObject = function fromObject(object) { + MethodOptions.fromObject = function fromObject(object, long) { if (object instanceof $root.google.protobuf.MethodOptions) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.protobuf.MethodOptions(); if (object.deprecated != null) message.deprecated = Boolean(object.deprecated); @@ -65014,7 +67666,7 @@ if (object.features != null) { if (typeof object.features !== "object") throw TypeError(".google.protobuf.MethodOptions.features: object expected"); - message.features = $root.google.protobuf.FeatureSet.fromObject(object.features); + message.features = $root.google.protobuf.FeatureSet.fromObject(object.features, long + 1); } if (object.uninterpretedOption) { if (!Array.isArray(object.uninterpretedOption)) @@ -65023,13 +67675,13 @@ for (var i = 0; i < object.uninterpretedOption.length; ++i) { if (typeof object.uninterpretedOption[i] !== "object") throw TypeError(".google.protobuf.MethodOptions.uninterpretedOption: object expected"); - message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i]); + message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i], long + 1); } } if (object[".google.api.http"] != null) { if (typeof object[".google.api.http"] !== "object") throw TypeError(".google.protobuf.MethodOptions..google.api.http: object expected"); - message[".google.api.http"] = $root.google.api.HttpRule.fromObject(object[".google.api.http"]); + message[".google.api.http"] = $root.google.api.HttpRule.fromObject(object[".google.api.http"], long + 1); } if (object[".google.api.methodSignature"]) { if (!Array.isArray(object[".google.api.methodSignature"])) @@ -65157,7 +67809,7 @@ this.name = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -65283,9 +67935,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - UninterpretedOption.decode = function decode(reader, length, error) { + UninterpretedOption.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.UninterpretedOption(); while (reader.pos < end) { var tag = reader.uint32(); @@ -65295,7 +67951,7 @@ case 2: { if (!(message.name && message.name.length)) message.name = []; - message.name.push($root.google.protobuf.UninterpretedOption.NamePart.decode(reader, reader.uint32())); + message.name.push($root.google.protobuf.UninterpretedOption.NamePart.decode(reader, reader.uint32(), undefined, long + 1)); break; } case 3: { @@ -65323,7 +67979,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -65354,14 +68010,18 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - UninterpretedOption.verify = function verify(message) { + UninterpretedOption.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.name != null && message.hasOwnProperty("name")) { if (!Array.isArray(message.name)) return "name: array expected"; for (var i = 0; i < message.name.length; ++i) { - var error = $root.google.protobuf.UninterpretedOption.NamePart.verify(message.name[i]); + var error = $root.google.protobuf.UninterpretedOption.NamePart.verify(message.name[i], long + 1); if (error) return "name." + error; } @@ -65395,9 +68055,13 @@ * @param {Object.} object Plain object * @returns {google.protobuf.UninterpretedOption} UninterpretedOption */ - UninterpretedOption.fromObject = function fromObject(object) { + UninterpretedOption.fromObject = function fromObject(object, long) { if (object instanceof $root.google.protobuf.UninterpretedOption) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.protobuf.UninterpretedOption(); if (object.name) { if (!Array.isArray(object.name)) @@ -65406,7 +68070,7 @@ for (var i = 0; i < object.name.length; ++i) { if (typeof object.name[i] !== "object") throw TypeError(".google.protobuf.UninterpretedOption.name: object expected"); - message.name[i] = $root.google.protobuf.UninterpretedOption.NamePart.fromObject(object.name[i]); + message.name[i] = $root.google.protobuf.UninterpretedOption.NamePart.fromObject(object.name[i], long + 1); } } if (object.identifierValue != null) @@ -65551,7 +68215,7 @@ function NamePart(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -65624,9 +68288,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - NamePart.decode = function decode(reader, length, error) { + NamePart.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.UninterpretedOption.NamePart(); while (reader.pos < end) { var tag = reader.uint32(); @@ -65642,7 +68310,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -65677,9 +68345,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - NamePart.verify = function verify(message) { + NamePart.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (!$util.isString(message.namePart)) return "namePart: string expected"; if (typeof message.isExtension !== "boolean") @@ -65695,9 +68367,13 @@ * @param {Object.} object Plain object * @returns {google.protobuf.UninterpretedOption.NamePart} NamePart */ - NamePart.fromObject = function fromObject(object) { + NamePart.fromObject = function fromObject(object, long) { if (object instanceof $root.google.protobuf.UninterpretedOption.NamePart) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.protobuf.UninterpretedOption.NamePart(); if (object.namePart != null) message.namePart = String(object.namePart); @@ -65789,7 +68465,7 @@ function FeatureSet(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -65924,9 +68600,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - FeatureSet.decode = function decode(reader, length, error) { + FeatureSet.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FeatureSet(); while (reader.pos < end) { var tag = reader.uint32(); @@ -65966,7 +68646,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -65997,9 +68677,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - FeatureSet.verify = function verify(message) { + FeatureSet.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.fieldPresence != null && message.hasOwnProperty("fieldPresence")) switch (message.fieldPresence) { default: @@ -66086,9 +68770,13 @@ * @param {Object.} object Plain object * @returns {google.protobuf.FeatureSet} FeatureSet */ - FeatureSet.fromObject = function fromObject(object) { + FeatureSet.fromObject = function fromObject(object, long) { if (object instanceof $root.google.protobuf.FeatureSet) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.protobuf.FeatureSet(); switch (object.fieldPresence) { default: @@ -66466,7 +69154,7 @@ function VisibilityFeature(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -66521,9 +69209,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - VisibilityFeature.decode = function decode(reader, length, error) { + VisibilityFeature.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FeatureSet.VisibilityFeature(); while (reader.pos < end) { var tag = reader.uint32(); @@ -66531,7 +69223,7 @@ break; switch (tag >>> 3) { default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -66562,9 +69254,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - VisibilityFeature.verify = function verify(message) { + VisibilityFeature.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; return null; }; @@ -66576,9 +69272,13 @@ * @param {Object.} object Plain object * @returns {google.protobuf.FeatureSet.VisibilityFeature} VisibilityFeature */ - VisibilityFeature.fromObject = function fromObject(object) { + VisibilityFeature.fromObject = function fromObject(object, long) { if (object instanceof $root.google.protobuf.FeatureSet.VisibilityFeature) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); return new $root.google.protobuf.FeatureSet.VisibilityFeature(); }; @@ -66670,7 +69370,7 @@ this.defaults = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -66756,9 +69456,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - FeatureSetDefaults.decode = function decode(reader, length, error) { + FeatureSetDefaults.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FeatureSetDefaults(); while (reader.pos < end) { var tag = reader.uint32(); @@ -66768,7 +69472,7 @@ case 1: { if (!(message.defaults && message.defaults.length)) message.defaults = []; - message.defaults.push($root.google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.decode(reader, reader.uint32())); + message.defaults.push($root.google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.decode(reader, reader.uint32(), undefined, long + 1)); break; } case 4: { @@ -66780,7 +69484,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -66811,14 +69515,18 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - FeatureSetDefaults.verify = function verify(message) { + FeatureSetDefaults.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.defaults != null && message.hasOwnProperty("defaults")) { if (!Array.isArray(message.defaults)) return "defaults: array expected"; for (var i = 0; i < message.defaults.length; ++i) { - var error = $root.google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.verify(message.defaults[i]); + var error = $root.google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.verify(message.defaults[i], long + 1); if (error) return "defaults." + error; } @@ -66870,9 +69578,13 @@ * @param {Object.} object Plain object * @returns {google.protobuf.FeatureSetDefaults} FeatureSetDefaults */ - FeatureSetDefaults.fromObject = function fromObject(object) { + FeatureSetDefaults.fromObject = function fromObject(object, long) { if (object instanceof $root.google.protobuf.FeatureSetDefaults) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.protobuf.FeatureSetDefaults(); if (object.defaults) { if (!Array.isArray(object.defaults)) @@ -66881,7 +69593,7 @@ for (var i = 0; i < object.defaults.length; ++i) { if (typeof object.defaults[i] !== "object") throw TypeError(".google.protobuf.FeatureSetDefaults.defaults: object expected"); - message.defaults[i] = $root.google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.fromObject(object.defaults[i]); + message.defaults[i] = $root.google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.fromObject(object.defaults[i], long + 1); } } switch (object.minimumEdition) { @@ -67078,7 +69790,7 @@ function FeatureSetEditionDefault(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -67163,9 +69875,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - FeatureSetEditionDefault.decode = function decode(reader, length, error) { + FeatureSetEditionDefault.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault(); while (reader.pos < end) { var tag = reader.uint32(); @@ -67177,15 +69893,15 @@ break; } case 4: { - message.overridableFeatures = $root.google.protobuf.FeatureSet.decode(reader, reader.uint32()); + message.overridableFeatures = $root.google.protobuf.FeatureSet.decode(reader, reader.uint32(), undefined, long + 1); break; } case 5: { - message.fixedFeatures = $root.google.protobuf.FeatureSet.decode(reader, reader.uint32()); + message.fixedFeatures = $root.google.protobuf.FeatureSet.decode(reader, reader.uint32(), undefined, long + 1); break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -67216,9 +69932,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - FeatureSetEditionDefault.verify = function verify(message) { + FeatureSetEditionDefault.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.edition != null && message.hasOwnProperty("edition")) switch (message.edition) { default: @@ -67238,12 +69958,12 @@ break; } if (message.overridableFeatures != null && message.hasOwnProperty("overridableFeatures")) { - var error = $root.google.protobuf.FeatureSet.verify(message.overridableFeatures); + var error = $root.google.protobuf.FeatureSet.verify(message.overridableFeatures, long + 1); if (error) return "overridableFeatures." + error; } if (message.fixedFeatures != null && message.hasOwnProperty("fixedFeatures")) { - var error = $root.google.protobuf.FeatureSet.verify(message.fixedFeatures); + var error = $root.google.protobuf.FeatureSet.verify(message.fixedFeatures, long + 1); if (error) return "fixedFeatures." + error; } @@ -67258,9 +69978,13 @@ * @param {Object.} object Plain object * @returns {google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault} FeatureSetEditionDefault */ - FeatureSetEditionDefault.fromObject = function fromObject(object) { + FeatureSetEditionDefault.fromObject = function fromObject(object, long) { if (object instanceof $root.google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault(); switch (object.edition) { default: @@ -67321,12 +70045,12 @@ if (object.overridableFeatures != null) { if (typeof object.overridableFeatures !== "object") throw TypeError(".google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.overridableFeatures: object expected"); - message.overridableFeatures = $root.google.protobuf.FeatureSet.fromObject(object.overridableFeatures); + message.overridableFeatures = $root.google.protobuf.FeatureSet.fromObject(object.overridableFeatures, long + 1); } if (object.fixedFeatures != null) { if (typeof object.fixedFeatures !== "object") throw TypeError(".google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.fixedFeatures: object expected"); - message.fixedFeatures = $root.google.protobuf.FeatureSet.fromObject(object.fixedFeatures); + message.fixedFeatures = $root.google.protobuf.FeatureSet.fromObject(object.fixedFeatures, long + 1); } return message; }; @@ -67411,7 +70135,7 @@ this.location = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -67477,9 +70201,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - SourceCodeInfo.decode = function decode(reader, length, error) { + SourceCodeInfo.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.SourceCodeInfo(); while (reader.pos < end) { var tag = reader.uint32(); @@ -67489,11 +70217,11 @@ case 1: { if (!(message.location && message.location.length)) message.location = []; - message.location.push($root.google.protobuf.SourceCodeInfo.Location.decode(reader, reader.uint32())); + message.location.push($root.google.protobuf.SourceCodeInfo.Location.decode(reader, reader.uint32(), undefined, long + 1)); break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -67524,14 +70252,18 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - SourceCodeInfo.verify = function verify(message) { + SourceCodeInfo.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.location != null && message.hasOwnProperty("location")) { if (!Array.isArray(message.location)) return "location: array expected"; for (var i = 0; i < message.location.length; ++i) { - var error = $root.google.protobuf.SourceCodeInfo.Location.verify(message.location[i]); + var error = $root.google.protobuf.SourceCodeInfo.Location.verify(message.location[i], long + 1); if (error) return "location." + error; } @@ -67547,9 +70279,13 @@ * @param {Object.} object Plain object * @returns {google.protobuf.SourceCodeInfo} SourceCodeInfo */ - SourceCodeInfo.fromObject = function fromObject(object) { + SourceCodeInfo.fromObject = function fromObject(object, long) { if (object instanceof $root.google.protobuf.SourceCodeInfo) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.protobuf.SourceCodeInfo(); if (object.location) { if (!Array.isArray(object.location)) @@ -67558,7 +70294,7 @@ for (var i = 0; i < object.location.length; ++i) { if (typeof object.location[i] !== "object") throw TypeError(".google.protobuf.SourceCodeInfo.location: object expected"); - message.location[i] = $root.google.protobuf.SourceCodeInfo.Location.fromObject(object.location[i]); + message.location[i] = $root.google.protobuf.SourceCodeInfo.Location.fromObject(object.location[i], long + 1); } } return message; @@ -67640,7 +70376,7 @@ this.leadingDetachedComments = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -67754,9 +70490,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Location.decode = function decode(reader, length, error) { + Location.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.SourceCodeInfo.Location(); while (reader.pos < end) { var tag = reader.uint32(); @@ -67800,7 +70540,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -67831,9 +70571,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Location.verify = function verify(message) { + Location.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.path != null && message.hasOwnProperty("path")) { if (!Array.isArray(message.path)) return "path: array expected"; @@ -67872,9 +70616,13 @@ * @param {Object.} object Plain object * @returns {google.protobuf.SourceCodeInfo.Location} Location */ - Location.fromObject = function fromObject(object) { + Location.fromObject = function fromObject(object, long) { if (object instanceof $root.google.protobuf.SourceCodeInfo.Location) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.protobuf.SourceCodeInfo.Location(); if (object.path) { if (!Array.isArray(object.path)) @@ -68001,7 +70749,7 @@ this.annotation = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -68067,9 +70815,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GeneratedCodeInfo.decode = function decode(reader, length, error) { + GeneratedCodeInfo.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.GeneratedCodeInfo(); while (reader.pos < end) { var tag = reader.uint32(); @@ -68079,11 +70831,11 @@ case 1: { if (!(message.annotation && message.annotation.length)) message.annotation = []; - message.annotation.push($root.google.protobuf.GeneratedCodeInfo.Annotation.decode(reader, reader.uint32())); + message.annotation.push($root.google.protobuf.GeneratedCodeInfo.Annotation.decode(reader, reader.uint32(), undefined, long + 1)); break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -68114,14 +70866,18 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GeneratedCodeInfo.verify = function verify(message) { + GeneratedCodeInfo.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.annotation != null && message.hasOwnProperty("annotation")) { if (!Array.isArray(message.annotation)) return "annotation: array expected"; for (var i = 0; i < message.annotation.length; ++i) { - var error = $root.google.protobuf.GeneratedCodeInfo.Annotation.verify(message.annotation[i]); + var error = $root.google.protobuf.GeneratedCodeInfo.Annotation.verify(message.annotation[i], long + 1); if (error) return "annotation." + error; } @@ -68137,9 +70893,13 @@ * @param {Object.} object Plain object * @returns {google.protobuf.GeneratedCodeInfo} GeneratedCodeInfo */ - GeneratedCodeInfo.fromObject = function fromObject(object) { + GeneratedCodeInfo.fromObject = function fromObject(object, long) { if (object instanceof $root.google.protobuf.GeneratedCodeInfo) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.protobuf.GeneratedCodeInfo(); if (object.annotation) { if (!Array.isArray(object.annotation)) @@ -68148,7 +70908,7 @@ for (var i = 0; i < object.annotation.length; ++i) { if (typeof object.annotation[i] !== "object") throw TypeError(".google.protobuf.GeneratedCodeInfo.annotation: object expected"); - message.annotation[i] = $root.google.protobuf.GeneratedCodeInfo.Annotation.fromObject(object.annotation[i]); + message.annotation[i] = $root.google.protobuf.GeneratedCodeInfo.Annotation.fromObject(object.annotation[i], long + 1); } } return message; @@ -68228,7 +70988,7 @@ this.path = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -68337,9 +71097,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Annotation.decode = function decode(reader, length, error) { + Annotation.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.GeneratedCodeInfo.Annotation(); while (reader.pos < end) { var tag = reader.uint32(); @@ -68374,7 +71138,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -68405,9 +71169,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Annotation.verify = function verify(message) { + Annotation.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.path != null && message.hasOwnProperty("path")) { if (!Array.isArray(message.path)) return "path: array expected"; @@ -68444,9 +71212,13 @@ * @param {Object.} object Plain object * @returns {google.protobuf.GeneratedCodeInfo.Annotation} Annotation */ - Annotation.fromObject = function fromObject(object) { + Annotation.fromObject = function fromObject(object, long) { if (object instanceof $root.google.protobuf.GeneratedCodeInfo.Annotation) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.protobuf.GeneratedCodeInfo.Annotation(); if (object.path) { if (!Array.isArray(object.path)) @@ -68606,7 +71378,7 @@ function Any(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -68681,9 +71453,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Any.decode = function decode(reader, length, error) { + Any.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.Any(); while (reader.pos < end) { var tag = reader.uint32(); @@ -68699,7 +71475,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -68730,9 +71506,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Any.verify = function verify(message) { + Any.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.type_url != null && message.hasOwnProperty("type_url")) if (!$util.isString(message.type_url)) return "type_url: string expected"; @@ -68750,9 +71530,13 @@ * @param {Object.} object Plain object * @returns {google.protobuf.Any} Any */ - Any.fromObject = function fromObject(object) { + Any.fromObject = function fromObject(object, long) { if (object instanceof $root.google.protobuf.Any) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.protobuf.Any(); if (object.type_url != null) message.type_url = String(object.type_url); @@ -68844,7 +71628,7 @@ function Timestamp(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -68919,9 +71703,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Timestamp.decode = function decode(reader, length, error) { + Timestamp.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.Timestamp(); while (reader.pos < end) { var tag = reader.uint32(); @@ -68937,7 +71725,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -68968,9 +71756,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Timestamp.verify = function verify(message) { + Timestamp.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.seconds != null && message.hasOwnProperty("seconds")) if (!$util.isInteger(message.seconds) && !(message.seconds && $util.isInteger(message.seconds.low) && $util.isInteger(message.seconds.high))) return "seconds: integer|Long expected"; @@ -68988,9 +71780,13 @@ * @param {Object.} object Plain object * @returns {google.protobuf.Timestamp} Timestamp */ - Timestamp.fromObject = function fromObject(object) { + Timestamp.fromObject = function fromObject(object, long) { if (object instanceof $root.google.protobuf.Timestamp) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.protobuf.Timestamp(); if (object.seconds != null) if ($util.Long) @@ -69087,7 +71883,7 @@ function Duration(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -69162,9 +71958,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Duration.decode = function decode(reader, length, error) { + Duration.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.Duration(); while (reader.pos < end) { var tag = reader.uint32(); @@ -69180,7 +71980,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -69211,9 +72011,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Duration.verify = function verify(message) { + Duration.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.seconds != null && message.hasOwnProperty("seconds")) if (!$util.isInteger(message.seconds) && !(message.seconds && $util.isInteger(message.seconds.low) && $util.isInteger(message.seconds.high))) return "seconds: integer|Long expected"; @@ -69231,9 +72035,13 @@ * @param {Object.} object Plain object * @returns {google.protobuf.Duration} Duration */ - Duration.fromObject = function fromObject(object) { + Duration.fromObject = function fromObject(object, long) { if (object instanceof $root.google.protobuf.Duration) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.protobuf.Duration(); if (object.seconds != null) if ($util.Long) @@ -69329,7 +72137,7 @@ function DoubleValue(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -69394,9 +72202,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - DoubleValue.decode = function decode(reader, length, error) { + DoubleValue.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.DoubleValue(); while (reader.pos < end) { var tag = reader.uint32(); @@ -69408,7 +72220,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -69439,9 +72251,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - DoubleValue.verify = function verify(message) { + DoubleValue.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.value != null && message.hasOwnProperty("value")) if (typeof message.value !== "number") return "value: number expected"; @@ -69456,9 +72272,13 @@ * @param {Object.} object Plain object * @returns {google.protobuf.DoubleValue} DoubleValue */ - DoubleValue.fromObject = function fromObject(object) { + DoubleValue.fromObject = function fromObject(object, long) { if (object instanceof $root.google.protobuf.DoubleValue) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.protobuf.DoubleValue(); if (object.value != null) message.value = Number(object.value); @@ -69534,7 +72354,7 @@ function FloatValue(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -69599,9 +72419,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - FloatValue.decode = function decode(reader, length, error) { + FloatValue.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FloatValue(); while (reader.pos < end) { var tag = reader.uint32(); @@ -69613,7 +72437,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -69644,9 +72468,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - FloatValue.verify = function verify(message) { + FloatValue.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.value != null && message.hasOwnProperty("value")) if (typeof message.value !== "number") return "value: number expected"; @@ -69661,9 +72489,13 @@ * @param {Object.} object Plain object * @returns {google.protobuf.FloatValue} FloatValue */ - FloatValue.fromObject = function fromObject(object) { + FloatValue.fromObject = function fromObject(object, long) { if (object instanceof $root.google.protobuf.FloatValue) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.protobuf.FloatValue(); if (object.value != null) message.value = Number(object.value); @@ -69739,7 +72571,7 @@ function Int64Value(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -69804,9 +72636,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Int64Value.decode = function decode(reader, length, error) { + Int64Value.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.Int64Value(); while (reader.pos < end) { var tag = reader.uint32(); @@ -69818,7 +72654,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -69849,9 +72685,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Int64Value.verify = function verify(message) { + Int64Value.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.value != null && message.hasOwnProperty("value")) if (!$util.isInteger(message.value) && !(message.value && $util.isInteger(message.value.low) && $util.isInteger(message.value.high))) return "value: integer|Long expected"; @@ -69866,9 +72706,13 @@ * @param {Object.} object Plain object * @returns {google.protobuf.Int64Value} Int64Value */ - Int64Value.fromObject = function fromObject(object) { + Int64Value.fromObject = function fromObject(object, long) { if (object instanceof $root.google.protobuf.Int64Value) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.protobuf.Int64Value(); if (object.value != null) if ($util.Long) @@ -69958,7 +72802,7 @@ function UInt64Value(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -70023,9 +72867,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - UInt64Value.decode = function decode(reader, length, error) { + UInt64Value.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.UInt64Value(); while (reader.pos < end) { var tag = reader.uint32(); @@ -70037,7 +72885,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -70068,9 +72916,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - UInt64Value.verify = function verify(message) { + UInt64Value.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.value != null && message.hasOwnProperty("value")) if (!$util.isInteger(message.value) && !(message.value && $util.isInteger(message.value.low) && $util.isInteger(message.value.high))) return "value: integer|Long expected"; @@ -70085,9 +72937,13 @@ * @param {Object.} object Plain object * @returns {google.protobuf.UInt64Value} UInt64Value */ - UInt64Value.fromObject = function fromObject(object) { + UInt64Value.fromObject = function fromObject(object, long) { if (object instanceof $root.google.protobuf.UInt64Value) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.protobuf.UInt64Value(); if (object.value != null) if ($util.Long) @@ -70177,7 +73033,7 @@ function Int32Value(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -70242,9 +73098,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Int32Value.decode = function decode(reader, length, error) { + Int32Value.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.Int32Value(); while (reader.pos < end) { var tag = reader.uint32(); @@ -70256,7 +73116,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -70287,9 +73147,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Int32Value.verify = function verify(message) { + Int32Value.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.value != null && message.hasOwnProperty("value")) if (!$util.isInteger(message.value)) return "value: integer expected"; @@ -70304,9 +73168,13 @@ * @param {Object.} object Plain object * @returns {google.protobuf.Int32Value} Int32Value */ - Int32Value.fromObject = function fromObject(object) { + Int32Value.fromObject = function fromObject(object, long) { if (object instanceof $root.google.protobuf.Int32Value) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.protobuf.Int32Value(); if (object.value != null) message.value = object.value | 0; @@ -70382,7 +73250,7 @@ function UInt32Value(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -70447,9 +73315,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - UInt32Value.decode = function decode(reader, length, error) { + UInt32Value.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.UInt32Value(); while (reader.pos < end) { var tag = reader.uint32(); @@ -70461,7 +73333,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -70492,9 +73364,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - UInt32Value.verify = function verify(message) { + UInt32Value.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.value != null && message.hasOwnProperty("value")) if (!$util.isInteger(message.value)) return "value: integer expected"; @@ -70509,9 +73385,13 @@ * @param {Object.} object Plain object * @returns {google.protobuf.UInt32Value} UInt32Value */ - UInt32Value.fromObject = function fromObject(object) { + UInt32Value.fromObject = function fromObject(object, long) { if (object instanceof $root.google.protobuf.UInt32Value) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.protobuf.UInt32Value(); if (object.value != null) message.value = object.value >>> 0; @@ -70587,7 +73467,7 @@ function BoolValue(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -70652,9 +73532,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - BoolValue.decode = function decode(reader, length, error) { + BoolValue.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.BoolValue(); while (reader.pos < end) { var tag = reader.uint32(); @@ -70666,7 +73550,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -70697,9 +73581,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - BoolValue.verify = function verify(message) { + BoolValue.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.value != null && message.hasOwnProperty("value")) if (typeof message.value !== "boolean") return "value: boolean expected"; @@ -70714,9 +73602,13 @@ * @param {Object.} object Plain object * @returns {google.protobuf.BoolValue} BoolValue */ - BoolValue.fromObject = function fromObject(object) { + BoolValue.fromObject = function fromObject(object, long) { if (object instanceof $root.google.protobuf.BoolValue) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.protobuf.BoolValue(); if (object.value != null) message.value = Boolean(object.value); @@ -70792,7 +73684,7 @@ function StringValue(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -70857,9 +73749,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - StringValue.decode = function decode(reader, length, error) { + StringValue.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.StringValue(); while (reader.pos < end) { var tag = reader.uint32(); @@ -70871,7 +73767,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -70902,9 +73798,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - StringValue.verify = function verify(message) { + StringValue.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.value != null && message.hasOwnProperty("value")) if (!$util.isString(message.value)) return "value: string expected"; @@ -70919,9 +73819,13 @@ * @param {Object.} object Plain object * @returns {google.protobuf.StringValue} StringValue */ - StringValue.fromObject = function fromObject(object) { + StringValue.fromObject = function fromObject(object, long) { if (object instanceof $root.google.protobuf.StringValue) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.protobuf.StringValue(); if (object.value != null) message.value = String(object.value); @@ -70997,7 +73901,7 @@ function BytesValue(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -71062,9 +73966,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - BytesValue.decode = function decode(reader, length, error) { + BytesValue.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.BytesValue(); while (reader.pos < end) { var tag = reader.uint32(); @@ -71076,7 +73984,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -71107,9 +74015,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - BytesValue.verify = function verify(message) { + BytesValue.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.value != null && message.hasOwnProperty("value")) if (!(message.value && typeof message.value.length === "number" || $util.isString(message.value))) return "value: buffer expected"; @@ -71124,9 +74036,13 @@ * @param {Object.} object Plain object * @returns {google.protobuf.BytesValue} BytesValue */ - BytesValue.fromObject = function fromObject(object) { + BytesValue.fromObject = function fromObject(object, long) { if (object instanceof $root.google.protobuf.BytesValue) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.protobuf.BytesValue(); if (object.value != null) if (typeof object.value === "string") @@ -71210,7 +74126,7 @@ function Empty(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -71265,9 +74181,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Empty.decode = function decode(reader, length, error) { + Empty.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.Empty(); while (reader.pos < end) { var tag = reader.uint32(); @@ -71275,7 +74195,7 @@ break; switch (tag >>> 3) { default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -71306,9 +74226,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Empty.verify = function verify(message) { + Empty.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; return null; }; @@ -71320,9 +74244,13 @@ * @param {Object.} object Plain object * @returns {google.protobuf.Empty} Empty */ - Empty.fromObject = function fromObject(object) { + Empty.fromObject = function fromObject(object, long) { if (object instanceof $root.google.protobuf.Empty) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); return new $root.google.protobuf.Empty(); }; @@ -71389,7 +74317,7 @@ this.paths = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -71455,9 +74383,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - FieldMask.decode = function decode(reader, length, error) { + FieldMask.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FieldMask(); while (reader.pos < end) { var tag = reader.uint32(); @@ -71471,7 +74403,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -71502,9 +74434,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - FieldMask.verify = function verify(message) { + FieldMask.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.paths != null && message.hasOwnProperty("paths")) { if (!Array.isArray(message.paths)) return "paths: array expected"; @@ -71523,9 +74459,13 @@ * @param {Object.} object Plain object * @returns {google.protobuf.FieldMask} FieldMask */ - FieldMask.fromObject = function fromObject(object) { + FieldMask.fromObject = function fromObject(object, long) { if (object instanceof $root.google.protobuf.FieldMask) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.protobuf.FieldMask(); if (object.paths) { if (!Array.isArray(object.paths)) @@ -71610,7 +74550,7 @@ this.fields = {}; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -71678,9 +74618,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Struct.decode = function decode(reader, length, error) { + Struct.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.Struct(), key, value; while (reader.pos < end) { var tag = reader.uint32(); @@ -71700,18 +74644,20 @@ key = reader.string(); break; case 2: - value = $root.google.protobuf.Value.decode(reader, reader.uint32()); + value = $root.google.protobuf.Value.decode(reader, reader.uint32(), undefined, long + 1); break; default: - reader.skipType(tag2 & 7); + reader.skipType(tag2 & 7, long); break; } } + if (key === "__proto__") + $util.makeProp(message.fields, key); message.fields[key] = value; break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -71742,15 +74688,19 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Struct.verify = function verify(message) { + Struct.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.fields != null && message.hasOwnProperty("fields")) { if (!$util.isObject(message.fields)) return "fields: object expected"; var key = Object.keys(message.fields); for (var i = 0; i < key.length; ++i) { - var error = $root.google.protobuf.Value.verify(message.fields[key[i]]); + var error = $root.google.protobuf.Value.verify(message.fields[key[i]], long + 1); if (error) return "fields." + error; } @@ -71766,18 +74716,24 @@ * @param {Object.} object Plain object * @returns {google.protobuf.Struct} Struct */ - Struct.fromObject = function fromObject(object) { + Struct.fromObject = function fromObject(object, long) { if (object instanceof $root.google.protobuf.Struct) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.protobuf.Struct(); if (object.fields) { if (typeof object.fields !== "object") throw TypeError(".google.protobuf.Struct.fields: object expected"); message.fields = {}; for (var keys = Object.keys(object.fields), i = 0; i < keys.length; ++i) { + if (keys[i] === "__proto__") + $util.makeProp(message.fields, keys[i]); if (typeof object.fields[keys[i]] !== "object") throw TypeError(".google.protobuf.Struct.fields: object expected"); - message.fields[keys[i]] = $root.google.protobuf.Value.fromObject(object.fields[keys[i]]); + message.fields[keys[i]] = $root.google.protobuf.Value.fromObject(object.fields[keys[i]], long + 1); } } return message; @@ -71801,8 +74757,11 @@ var keys2; if (message.fields && (keys2 = Object.keys(message.fields)).length) { object.fields = {}; - for (var j = 0; j < keys2.length; ++j) + for (var j = 0; j < keys2.length; ++j) { + if (keys2[j] === "__proto__") + $util.makeProp(object.fields, keys2[j]); object.fields[keys2[j]] = $root.google.protobuf.Value.toObject(message.fields[keys2[j]], options); + } } return object; }; @@ -71861,7 +74820,7 @@ function Value(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -71990,9 +74949,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Value.decode = function decode(reader, length, error) { + Value.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.Value(); while (reader.pos < end) { var tag = reader.uint32(); @@ -72016,15 +74979,15 @@ break; } case 5: { - message.structValue = $root.google.protobuf.Struct.decode(reader, reader.uint32()); + message.structValue = $root.google.protobuf.Struct.decode(reader, reader.uint32(), undefined, long + 1); break; } case 6: { - message.listValue = $root.google.protobuf.ListValue.decode(reader, reader.uint32()); + message.listValue = $root.google.protobuf.ListValue.decode(reader, reader.uint32(), undefined, long + 1); break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -72055,9 +75018,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Value.verify = function verify(message) { + Value.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; var properties = {}; if (message.nullValue != null && message.hasOwnProperty("nullValue")) { properties.kind = 1; @@ -72094,7 +75061,7 @@ return "kind: multiple values"; properties.kind = 1; { - var error = $root.google.protobuf.Struct.verify(message.structValue); + var error = $root.google.protobuf.Struct.verify(message.structValue, long + 1); if (error) return "structValue." + error; } @@ -72104,7 +75071,7 @@ return "kind: multiple values"; properties.kind = 1; { - var error = $root.google.protobuf.ListValue.verify(message.listValue); + var error = $root.google.protobuf.ListValue.verify(message.listValue, long + 1); if (error) return "listValue." + error; } @@ -72120,9 +75087,13 @@ * @param {Object.} object Plain object * @returns {google.protobuf.Value} Value */ - Value.fromObject = function fromObject(object) { + Value.fromObject = function fromObject(object, long) { if (object instanceof $root.google.protobuf.Value) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.protobuf.Value(); switch (object.nullValue) { default: @@ -72145,12 +75116,12 @@ if (object.structValue != null) { if (typeof object.structValue !== "object") throw TypeError(".google.protobuf.Value.structValue: object expected"); - message.structValue = $root.google.protobuf.Struct.fromObject(object.structValue); + message.structValue = $root.google.protobuf.Struct.fromObject(object.structValue, long + 1); } if (object.listValue != null) { if (typeof object.listValue !== "object") throw TypeError(".google.protobuf.Value.listValue: object expected"); - message.listValue = $root.google.protobuf.ListValue.fromObject(object.listValue); + message.listValue = $root.google.protobuf.ListValue.fromObject(object.listValue, long + 1); } return message; }; @@ -72263,7 +75234,7 @@ this.values = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -72329,9 +75300,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ListValue.decode = function decode(reader, length, error) { + ListValue.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.ListValue(); while (reader.pos < end) { var tag = reader.uint32(); @@ -72341,11 +75316,11 @@ case 1: { if (!(message.values && message.values.length)) message.values = []; - message.values.push($root.google.protobuf.Value.decode(reader, reader.uint32())); + message.values.push($root.google.protobuf.Value.decode(reader, reader.uint32(), undefined, long + 1)); break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -72376,14 +75351,18 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ListValue.verify = function verify(message) { + ListValue.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.values != null && message.hasOwnProperty("values")) { if (!Array.isArray(message.values)) return "values: array expected"; for (var i = 0; i < message.values.length; ++i) { - var error = $root.google.protobuf.Value.verify(message.values[i]); + var error = $root.google.protobuf.Value.verify(message.values[i], long + 1); if (error) return "values." + error; } @@ -72399,9 +75378,13 @@ * @param {Object.} object Plain object * @returns {google.protobuf.ListValue} ListValue */ - ListValue.fromObject = function fromObject(object) { + ListValue.fromObject = function fromObject(object, long) { if (object instanceof $root.google.protobuf.ListValue) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.protobuf.ListValue(); if (object.values) { if (!Array.isArray(object.values)) @@ -72410,7 +75393,7 @@ for (var i = 0; i < object.values.length; ++i) { if (typeof object.values[i] !== "object") throw TypeError(".google.protobuf.ListValue.values: object expected"); - message.values[i] = $root.google.protobuf.Value.fromObject(object.values[i]); + message.values[i] = $root.google.protobuf.Value.fromObject(object.values[i], long + 1); } } return message; @@ -72503,7 +75486,7 @@ this.details = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -72589,9 +75572,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Status.decode = function decode(reader, length, error) { + Status.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.rpc.Status(); while (reader.pos < end) { var tag = reader.uint32(); @@ -72609,11 +75596,11 @@ case 3: { if (!(message.details && message.details.length)) message.details = []; - message.details.push($root.google.protobuf.Any.decode(reader, reader.uint32())); + message.details.push($root.google.protobuf.Any.decode(reader, reader.uint32(), undefined, long + 1)); break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -72644,9 +75631,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Status.verify = function verify(message) { + Status.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.code != null && message.hasOwnProperty("code")) if (!$util.isInteger(message.code)) return "code: integer expected"; @@ -72657,7 +75648,7 @@ if (!Array.isArray(message.details)) return "details: array expected"; for (var i = 0; i < message.details.length; ++i) { - var error = $root.google.protobuf.Any.verify(message.details[i]); + var error = $root.google.protobuf.Any.verify(message.details[i], long + 1); if (error) return "details." + error; } @@ -72673,9 +75664,13 @@ * @param {Object.} object Plain object * @returns {google.rpc.Status} Status */ - Status.fromObject = function fromObject(object) { + Status.fromObject = function fromObject(object, long) { if (object instanceof $root.google.rpc.Status) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.rpc.Status(); if (object.code != null) message.code = object.code | 0; @@ -72688,7 +75683,7 @@ for (var i = 0; i < object.details.length; ++i) { if (typeof object.details[i] !== "object") throw TypeError(".google.rpc.Status.details: object expected"); - message.details[i] = $root.google.protobuf.Any.fromObject(object.details[i]); + message.details[i] = $root.google.protobuf.Any.fromObject(object.details[i], long + 1); } } return message; @@ -72789,7 +75784,7 @@ function TimeOfDay(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) + if (properties[keys[i]] != null && keys[i] !== "__proto__") this[keys[i]] = properties[keys[i]]; } @@ -72884,9 +75879,13 @@ * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - TimeOfDay.decode = function decode(reader, length, error) { + TimeOfDay.decode = function decode(reader, length, error, long) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); + if (long === undefined) + long = 0; + if (long > $Reader.recursionLimit) + throw Error("maximum nesting depth exceeded"); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.type.TimeOfDay(); while (reader.pos < end) { var tag = reader.uint32(); @@ -72910,7 +75909,7 @@ break; } default: - reader.skipType(tag & 7); + reader.skipType(tag & 7, long); break; } } @@ -72941,9 +75940,13 @@ * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - TimeOfDay.verify = function verify(message) { + TimeOfDay.verify = function verify(message, long) { if (typeof message !== "object" || message === null) return "object expected"; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + return "maximum nesting depth exceeded"; if (message.hours != null && message.hasOwnProperty("hours")) if (!$util.isInteger(message.hours)) return "hours: integer expected"; @@ -72967,9 +75970,13 @@ * @param {Object.} object Plain object * @returns {google.type.TimeOfDay} TimeOfDay */ - TimeOfDay.fromObject = function fromObject(object) { + TimeOfDay.fromObject = function fromObject(object, long) { if (object instanceof $root.google.type.TimeOfDay) return object; + if (long === undefined) + long = 0; + if (long > $util.recursionLimit) + throw Error("maximum nesting depth exceeded"); var message = new $root.google.type.TimeOfDay(); if (object.hours != null) message.hours = object.hours | 0; diff --git a/packages/google-cloud-monitoring/protos/protos.json b/packages/google-cloud-monitoring/protos/protos.json index 3966e9f8a508..735ff9b4a0ed 100644 --- a/packages/google-cloud-monitoring/protos/protos.json +++ b/packages/google-cloud-monitoring/protos/protos.json @@ -5813,7 +5813,14 @@ "type": "ServiceOptions", "id": 3 } - } + }, + "reserved": [ + [ + 4, + 4 + ], + "stream" + ] }, "MethodDescriptorProto": { "edition": "proto2", diff --git a/packages/google-cloud-monitoring/src/v3/alert_policy_service_client.ts b/packages/google-cloud-monitoring/src/v3/alert_policy_service_client.ts index 14c8f571f2c8..f26d0a645a61 100644 --- a/packages/google-cloud-monitoring/src/v3/alert_policy_service_client.ts +++ b/packages/google-cloud-monitoring/src/v3/alert_policy_service_client.ts @@ -18,11 +18,18 @@ /* global window */ import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} from 'google-gax'; -import {Transform} from 'stream'; +import type { + Callback, + CallOptions, + Descriptors, + ClientOptions, + PaginationCallback, + GaxCall, +} from 'google-gax'; +import { Transform } from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; +import { loggingUtils as logging, decodeAnyProtosInArray } from 'google-gax'; /** * Client JSON configuration object, loaded from @@ -52,7 +59,7 @@ export class AlertPolicyServiceClient { 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('monitoring'); @@ -65,9 +72,9 @@ export class AlertPolicyServiceClient { batching: {}, }; warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - alertPolicyServiceStub?: Promise<{[name: string]: Function}>; + innerApiCalls: { [name: string]: Function }; + pathTemplates: { [name: string]: gax.PathTemplate }; + alertPolicyServiceStub?: Promise<{ [name: string]: Function }>; /** * Construct an instance of AlertPolicyServiceClient. @@ -108,21 +115,42 @@ export class AlertPolicyServiceClient { * const client = new AlertPolicyServiceClient({fallback: true}, gax); * ``` */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + constructor( + opts?: ClientOptions, + gaxInstance?: typeof gax | typeof gax.fallback, + ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof AlertPolicyServiceClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.', + ); } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; + const universeDomainEnvVar = + typeof process === 'object' && typeof process.env === 'object' + ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] + : undefined; + this._universeDomain = + opts?.universeDomain ?? + opts?.universe_domain ?? + universeDomainEnvVar ?? + 'googleapis.com'; this._servicePath = 'monitoring.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + const servicePath = + opts?.servicePath || opts?.apiEndpoint || this._servicePath; + this._providedCustomServicePath = !!( + opts?.servicePath || opts?.apiEndpoint + ); const port = opts?.port || staticMembers.port; const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts); // Request numeric enum values if REST transport is used. opts.numericEnums = true; @@ -147,7 +175,7 @@ export class AlertPolicyServiceClient { this._opts = opts; // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set useJWTAccessWithScope on the auth object. this.auth.useJWTAccessWithScope = true; @@ -161,10 +189,7 @@ export class AlertPolicyServiceClient { } // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; if (typeof process === 'object' && 'versions' in process) { clientHeader.push(`gl-node/${process.versions.node}`); } else { @@ -186,82 +211,89 @@ export class AlertPolicyServiceClient { // Create useful helper objects for these. this.pathTemplates = { folderAlertPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/alertPolicies/{alert_policy}' + 'folders/{folder}/alertPolicies/{alert_policy}', ), folderAlertPolicyConditionPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/alertPolicies/{alert_policy}/conditions/{condition}' + 'folders/{folder}/alertPolicies/{alert_policy}/conditions/{condition}', ), folderChannelDescriptorPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/notificationChannelDescriptors/{channel_descriptor}' + 'folders/{folder}/notificationChannelDescriptors/{channel_descriptor}', ), folderGroupPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/groups/{group}' + 'folders/{folder}/groups/{group}', ), folderNotificationChannelPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/notificationChannels/{notification_channel}' + 'folders/{folder}/notificationChannels/{notification_channel}', ), folderServicePathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/services/{service}' - ), - folderServiceServiceLevelObjectivePathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/services/{service}/serviceLevelObjectives/{service_level_objective}' + 'folders/{folder}/services/{service}', ), + folderServiceServiceLevelObjectivePathTemplate: + new this._gaxModule.PathTemplate( + 'folders/{folder}/services/{service}/serviceLevelObjectives/{service_level_objective}', + ), folderUptimeCheckConfigPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/uptimeCheckConfigs/{uptime_check_config}' + 'folders/{folder}/uptimeCheckConfigs/{uptime_check_config}', ), organizationAlertPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/alertPolicies/{alert_policy}' - ), - organizationAlertPolicyConditionPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/alertPolicies/{alert_policy}/conditions/{condition}' - ), - organizationChannelDescriptorPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/notificationChannelDescriptors/{channel_descriptor}' + 'organizations/{organization}/alertPolicies/{alert_policy}', ), + organizationAlertPolicyConditionPathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/alertPolicies/{alert_policy}/conditions/{condition}', + ), + organizationChannelDescriptorPathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/notificationChannelDescriptors/{channel_descriptor}', + ), organizationGroupPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/groups/{group}' - ), - organizationNotificationChannelPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/notificationChannels/{notification_channel}' + 'organizations/{organization}/groups/{group}', ), + organizationNotificationChannelPathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/notificationChannels/{notification_channel}', + ), organizationServicePathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/services/{service}' - ), - organizationServiceServiceLevelObjectivePathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/services/{service}/serviceLevelObjectives/{service_level_objective}' - ), - organizationUptimeCheckConfigPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/uptimeCheckConfigs/{uptime_check_config}' + 'organizations/{organization}/services/{service}', ), + organizationServiceServiceLevelObjectivePathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/services/{service}/serviceLevelObjectives/{service_level_objective}', + ), + organizationUptimeCheckConfigPathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/uptimeCheckConfigs/{uptime_check_config}', + ), projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}' + 'projects/{project}', ), projectAlertPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/alertPolicies/{alert_policy}' + 'projects/{project}/alertPolicies/{alert_policy}', ), projectAlertPolicyConditionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/alertPolicies/{alert_policy}/conditions/{condition}' + 'projects/{project}/alertPolicies/{alert_policy}/conditions/{condition}', ), projectChannelDescriptorPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/notificationChannelDescriptors/{channel_descriptor}' + 'projects/{project}/notificationChannelDescriptors/{channel_descriptor}', ), projectGroupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/groups/{group}' + 'projects/{project}/groups/{group}', ), projectNotificationChannelPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/notificationChannels/{notification_channel}' + 'projects/{project}/notificationChannels/{notification_channel}', ), projectServicePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/services/{service}' - ), - projectServiceServiceLevelObjectivePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/services/{service}/serviceLevelObjectives/{service_level_objective}' + 'projects/{project}/services/{service}', ), + projectServiceServiceLevelObjectivePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/services/{service}/serviceLevelObjectives/{service_level_objective}', + ), projectUptimeCheckConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/uptimeCheckConfigs/{uptime_check_config}' + 'projects/{project}/uptimeCheckConfigs/{uptime_check_config}', ), snoozePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/snoozes/{snooze}' + 'projects/{project}/snoozes/{snooze}', ), }; @@ -269,14 +301,20 @@ export class AlertPolicyServiceClient { // (e.g. 50 results at a time, with tokens to get subsequent // pages). Denote the keys used for pagination and results. this.descriptors.page = { - listAlertPolicies: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'alertPolicies') + listAlertPolicies: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'alertPolicies', + ), }; // Put together the default options sent with requests. this._defaults = this._gaxGrpc.constructSettings( - 'google.monitoring.v3.AlertPolicyService', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + 'google.monitoring.v3.AlertPolicyService', + gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, + { 'x-goog-api-client': clientHeader.join(' ') }, + ); // Set up a dictionary of "inner API calls"; the core implementation // of calling the API is handled in `google-gax`, with this code @@ -307,37 +345,46 @@ export class AlertPolicyServiceClient { // Put together the "service stub" for // google.monitoring.v3.AlertPolicyService. this.alertPolicyServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.monitoring.v3.AlertPolicyService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.monitoring.v3.AlertPolicyService', + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any (this._protos as any).google.monitoring.v3.AlertPolicyService, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; + this._opts, + this._providedCustomServicePath, + ) as Promise<{ [method: string]: Function }>; // Iterate over each of the methods that the service provides // and create an API call method for each. - const alertPolicyServiceStubMethods = - ['listAlertPolicies', 'getAlertPolicy', 'createAlertPolicy', 'deleteAlertPolicy', 'updateAlertPolicy']; + const alertPolicyServiceStubMethods = [ + 'listAlertPolicies', + 'getAlertPolicy', + 'createAlertPolicy', + 'deleteAlertPolicy', + 'updateAlertPolicy', + ]; for (const methodName of alertPolicyServiceStubMethods) { const callPromise = this.alertPolicyServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { + (stub) => + (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error | null | undefined) => () => { throw err; - }); + }, + ); - const descriptor = - this.descriptors.page[methodName] || - undefined; + const descriptor = this.descriptors.page[methodName] || undefined; const apiCall = this._gaxModule.createApiCall( callPromise, this._defaults[methodName], descriptor, - this._opts.fallback + this._opts.fallback, ); this.innerApiCalls[methodName] = apiCall; @@ -352,8 +399,14 @@ export class AlertPolicyServiceClient { * @returns {string} The DNS address for this service. */ static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); } return 'monitoring.googleapis.com'; } @@ -364,8 +417,14 @@ export class AlertPolicyServiceClient { * @returns {string} The DNS address for this service. */ static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); } return 'monitoring.googleapis.com'; } @@ -399,7 +458,7 @@ export class AlertPolicyServiceClient { return [ 'https://www.googleapis.com/auth/cloud-platform', 'https://www.googleapis.com/auth/monitoring', - 'https://www.googleapis.com/auth/monitoring.read' + 'https://www.googleapis.com/auth/monitoring.read', ]; } @@ -409,8 +468,9 @@ export class AlertPolicyServiceClient { * Return the project ID used by this class. * @returns {Promise} A promise that resolves to string containing the project ID. */ - getProjectId(callback?: Callback): - Promise|void { + getProjectId( + callback?: Callback, + ): Promise | void { if (callback) { this.auth.getProjectId(callback); return; @@ -421,552 +481,703 @@ export class AlertPolicyServiceClient { // ------------------- // -- Service calls -- // ------------------- -/** - * Gets a single alerting policy. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The alerting policy to retrieve. The format is: - * - * projects/[PROJECT_ID_OR_NUMBER]/alertPolicies/[ALERT_POLICY_ID] - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.monitoring.v3.AlertPolicy|AlertPolicy}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v3/alert_policy_service.get_alert_policy.js - * region_tag:monitoring_v3_generated_AlertPolicyService_GetAlertPolicy_async - */ + /** + * Gets a single alerting policy. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The alerting policy to retrieve. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER]/alertPolicies/[ALERT_POLICY_ID] + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.monitoring.v3.AlertPolicy|AlertPolicy}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v3/alert_policy_service.get_alert_policy.js + * region_tag:monitoring_v3_generated_AlertPolicyService_GetAlertPolicy_async + */ getAlertPolicy( - request?: protos.google.monitoring.v3.IGetAlertPolicyRequest, - options?: CallOptions): - Promise<[ - protos.google.monitoring.v3.IAlertPolicy, - protos.google.monitoring.v3.IGetAlertPolicyRequest|undefined, {}|undefined - ]>; + request?: protos.google.monitoring.v3.IGetAlertPolicyRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.monitoring.v3.IAlertPolicy, + protos.google.monitoring.v3.IGetAlertPolicyRequest | undefined, + {} | undefined, + ] + >; getAlertPolicy( - request: protos.google.monitoring.v3.IGetAlertPolicyRequest, - options: CallOptions, - callback: Callback< - protos.google.monitoring.v3.IAlertPolicy, - protos.google.monitoring.v3.IGetAlertPolicyRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.monitoring.v3.IGetAlertPolicyRequest, + options: CallOptions, + callback: Callback< + protos.google.monitoring.v3.IAlertPolicy, + protos.google.monitoring.v3.IGetAlertPolicyRequest | null | undefined, + {} | null | undefined + >, + ): void; getAlertPolicy( - request: protos.google.monitoring.v3.IGetAlertPolicyRequest, - callback: Callback< - protos.google.monitoring.v3.IAlertPolicy, - protos.google.monitoring.v3.IGetAlertPolicyRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.monitoring.v3.IGetAlertPolicyRequest, + callback: Callback< + protos.google.monitoring.v3.IAlertPolicy, + protos.google.monitoring.v3.IGetAlertPolicyRequest | null | undefined, + {} | null | undefined + >, + ): void; getAlertPolicy( - request?: protos.google.monitoring.v3.IGetAlertPolicyRequest, - optionsOrCallback?: CallOptions|Callback< + request?: protos.google.monitoring.v3.IGetAlertPolicyRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.monitoring.v3.IAlertPolicy, - protos.google.monitoring.v3.IGetAlertPolicyRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.monitoring.v3.IAlertPolicy, - protos.google.monitoring.v3.IGetAlertPolicyRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.monitoring.v3.IAlertPolicy, - protos.google.monitoring.v3.IGetAlertPolicyRequest|undefined, {}|undefined - ]>|void { + protos.google.monitoring.v3.IGetAlertPolicyRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.monitoring.v3.IAlertPolicy, + protos.google.monitoring.v3.IGetAlertPolicyRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.monitoring.v3.IAlertPolicy, + protos.google.monitoring.v3.IGetAlertPolicyRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('getAlertPolicy request %j', request); - const wrappedCallback: Callback< - protos.google.monitoring.v3.IAlertPolicy, - protos.google.monitoring.v3.IGetAlertPolicyRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.monitoring.v3.IAlertPolicy, + protos.google.monitoring.v3.IGetAlertPolicyRequest | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('getAlertPolicy response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.getAlertPolicy(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.monitoring.v3.IAlertPolicy, - protos.google.monitoring.v3.IGetAlertPolicyRequest|undefined, - {}|undefined - ]) => { - this._log.info('getAlertPolicy 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); + return this.innerApiCalls + .getAlertPolicy(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.monitoring.v3.IAlertPolicy, + protos.google.monitoring.v3.IGetAlertPolicyRequest | undefined, + {} | undefined, + ]) => { + this._log.info('getAlertPolicy 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 alerting policy. - * - * Design your application to single-thread API calls that modify the state of - * alerting policies in a single project. This includes calls to - * CreateAlertPolicy, DeleteAlertPolicy and UpdateAlertPolicy. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The - * [project](https://cloud.google.com/monitoring/api/v3#project_name) in which - * to create the alerting policy. The format is: - * - * projects/[PROJECT_ID_OR_NUMBER] - * - * Note that this field names the parent container in which the alerting - * policy will be written, not the name of the created policy. |name| must be - * a host project of a Metrics Scope, otherwise INVALID_ARGUMENT error will - * return. The alerting policy that is returned will have a name that contains - * a normalized representation of this name as a prefix but adds a suffix of - * the form `/alertPolicies/[ALERT_POLICY_ID]`, identifying the policy in the - * container. - * @param {google.monitoring.v3.AlertPolicy} request.alertPolicy - * Required. The requested alerting policy. You should omit the `name` field - * in this policy. The name will be returned in the new policy, including a - * new `[ALERT_POLICY_ID]` value. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.monitoring.v3.AlertPolicy|AlertPolicy}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v3/alert_policy_service.create_alert_policy.js - * region_tag:monitoring_v3_generated_AlertPolicyService_CreateAlertPolicy_async - */ + /** + * Creates a new alerting policy. + * + * Design your application to single-thread API calls that modify the state of + * alerting policies in a single project. This includes calls to + * CreateAlertPolicy, DeleteAlertPolicy and UpdateAlertPolicy. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The + * [project](https://cloud.google.com/monitoring/api/v3#project_name) in which + * to create the alerting policy. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER] + * + * Note that this field names the parent container in which the alerting + * policy will be written, not the name of the created policy. |name| must be + * a host project of a Metrics Scope, otherwise INVALID_ARGUMENT error will + * return. The alerting policy that is returned will have a name that contains + * a normalized representation of this name as a prefix but adds a suffix of + * the form `/alertPolicies/[ALERT_POLICY_ID]`, identifying the policy in the + * container. + * @param {google.monitoring.v3.AlertPolicy} request.alertPolicy + * Required. The requested alerting policy. You should omit the `name` field + * in this policy. The name will be returned in the new policy, including a + * new `[ALERT_POLICY_ID]` value. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.monitoring.v3.AlertPolicy|AlertPolicy}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v3/alert_policy_service.create_alert_policy.js + * region_tag:monitoring_v3_generated_AlertPolicyService_CreateAlertPolicy_async + */ createAlertPolicy( - request?: protos.google.monitoring.v3.ICreateAlertPolicyRequest, - options?: CallOptions): - Promise<[ - protos.google.monitoring.v3.IAlertPolicy, - protos.google.monitoring.v3.ICreateAlertPolicyRequest|undefined, {}|undefined - ]>; + request?: protos.google.monitoring.v3.ICreateAlertPolicyRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.monitoring.v3.IAlertPolicy, + protos.google.monitoring.v3.ICreateAlertPolicyRequest | undefined, + {} | undefined, + ] + >; createAlertPolicy( - request: protos.google.monitoring.v3.ICreateAlertPolicyRequest, - options: CallOptions, - callback: Callback< - protos.google.monitoring.v3.IAlertPolicy, - protos.google.monitoring.v3.ICreateAlertPolicyRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.monitoring.v3.ICreateAlertPolicyRequest, + options: CallOptions, + callback: Callback< + protos.google.monitoring.v3.IAlertPolicy, + protos.google.monitoring.v3.ICreateAlertPolicyRequest | null | undefined, + {} | null | undefined + >, + ): void; createAlertPolicy( - request: protos.google.monitoring.v3.ICreateAlertPolicyRequest, - callback: Callback< - protos.google.monitoring.v3.IAlertPolicy, - protos.google.monitoring.v3.ICreateAlertPolicyRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.monitoring.v3.ICreateAlertPolicyRequest, + callback: Callback< + protos.google.monitoring.v3.IAlertPolicy, + protos.google.monitoring.v3.ICreateAlertPolicyRequest | null | undefined, + {} | null | undefined + >, + ): void; createAlertPolicy( - request?: protos.google.monitoring.v3.ICreateAlertPolicyRequest, - optionsOrCallback?: CallOptions|Callback< + request?: protos.google.monitoring.v3.ICreateAlertPolicyRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.monitoring.v3.IAlertPolicy, - protos.google.monitoring.v3.ICreateAlertPolicyRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.monitoring.v3.IAlertPolicy, - protos.google.monitoring.v3.ICreateAlertPolicyRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.monitoring.v3.IAlertPolicy, - protos.google.monitoring.v3.ICreateAlertPolicyRequest|undefined, {}|undefined - ]>|void { + | protos.google.monitoring.v3.ICreateAlertPolicyRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.monitoring.v3.IAlertPolicy, + protos.google.monitoring.v3.ICreateAlertPolicyRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.monitoring.v3.IAlertPolicy, + protos.google.monitoring.v3.ICreateAlertPolicyRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('createAlertPolicy request %j', request); - const wrappedCallback: Callback< - protos.google.monitoring.v3.IAlertPolicy, - protos.google.monitoring.v3.ICreateAlertPolicyRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.monitoring.v3.IAlertPolicy, + | protos.google.monitoring.v3.ICreateAlertPolicyRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('createAlertPolicy response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.createAlertPolicy(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.monitoring.v3.IAlertPolicy, - protos.google.monitoring.v3.ICreateAlertPolicyRequest|undefined, - {}|undefined - ]) => { - this._log.info('createAlertPolicy 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); + return this.innerApiCalls + .createAlertPolicy(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.monitoring.v3.IAlertPolicy, + protos.google.monitoring.v3.ICreateAlertPolicyRequest | undefined, + {} | undefined, + ]) => { + this._log.info('createAlertPolicy 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 alerting policy. - * - * Design your application to single-thread API calls that modify the state of - * alerting policies in a single project. This includes calls to - * CreateAlertPolicy, DeleteAlertPolicy and UpdateAlertPolicy. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The alerting policy to delete. The format is: - * - * projects/[PROJECT_ID_OR_NUMBER]/alertPolicies/[ALERT_POLICY_ID] - * - * For more information, see {@link protos.google.monitoring.v3.AlertPolicy|AlertPolicy}. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v3/alert_policy_service.delete_alert_policy.js - * region_tag:monitoring_v3_generated_AlertPolicyService_DeleteAlertPolicy_async - */ + /** + * Deletes an alerting policy. + * + * Design your application to single-thread API calls that modify the state of + * alerting policies in a single project. This includes calls to + * CreateAlertPolicy, DeleteAlertPolicy and UpdateAlertPolicy. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The alerting policy to delete. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER]/alertPolicies/[ALERT_POLICY_ID] + * + * For more information, see {@link protos.google.monitoring.v3.AlertPolicy|AlertPolicy}. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.protobuf.Empty|Empty}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v3/alert_policy_service.delete_alert_policy.js + * region_tag:monitoring_v3_generated_AlertPolicyService_DeleteAlertPolicy_async + */ deleteAlertPolicy( - request?: protos.google.monitoring.v3.IDeleteAlertPolicyRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteAlertPolicyRequest|undefined, {}|undefined - ]>; + request?: protos.google.monitoring.v3.IDeleteAlertPolicyRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.protobuf.IEmpty, + protos.google.monitoring.v3.IDeleteAlertPolicyRequest | undefined, + {} | undefined, + ] + >; deleteAlertPolicy( - request: protos.google.monitoring.v3.IDeleteAlertPolicyRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteAlertPolicyRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.monitoring.v3.IDeleteAlertPolicyRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.monitoring.v3.IDeleteAlertPolicyRequest | null | undefined, + {} | null | undefined + >, + ): void; deleteAlertPolicy( - request: protos.google.monitoring.v3.IDeleteAlertPolicyRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteAlertPolicyRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.monitoring.v3.IDeleteAlertPolicyRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.monitoring.v3.IDeleteAlertPolicyRequest | null | undefined, + {} | null | undefined + >, + ): void; deleteAlertPolicy( - request?: protos.google.monitoring.v3.IDeleteAlertPolicyRequest, - optionsOrCallback?: CallOptions|Callback< + request?: protos.google.monitoring.v3.IDeleteAlertPolicyRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteAlertPolicyRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteAlertPolicyRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteAlertPolicyRequest|undefined, {}|undefined - ]>|void { + | protos.google.monitoring.v3.IDeleteAlertPolicyRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.monitoring.v3.IDeleteAlertPolicyRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.protobuf.IEmpty, + protos.google.monitoring.v3.IDeleteAlertPolicyRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('deleteAlertPolicy request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteAlertPolicyRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.protobuf.IEmpty, + | protos.google.monitoring.v3.IDeleteAlertPolicyRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('deleteAlertPolicy response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.deleteAlertPolicy(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteAlertPolicyRequest|undefined, - {}|undefined - ]) => { - this._log.info('deleteAlertPolicy 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); + return this.innerApiCalls + .deleteAlertPolicy(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.protobuf.IEmpty, + protos.google.monitoring.v3.IDeleteAlertPolicyRequest | undefined, + {} | undefined, + ]) => { + this._log.info('deleteAlertPolicy 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 an alerting policy. You can either replace the entire policy with - * a new one or replace only certain fields in the current alerting policy by - * specifying the fields to be updated via `updateMask`. Returns the - * updated alerting policy. - * - * Design your application to single-thread API calls that modify the state of - * alerting policies in a single project. This includes calls to - * CreateAlertPolicy, DeleteAlertPolicy and UpdateAlertPolicy. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.FieldMask} [request.updateMask] - * Optional. A list of alerting policy field names. If this field is not - * empty, each listed field in the existing alerting policy is set to the - * value of the corresponding field in the supplied policy (`alert_policy`), - * or to the field's default value if the field is not in the supplied - * alerting policy. Fields not listed retain their previous value. - * - * Examples of valid field masks include `display_name`, `documentation`, - * `documentation.content`, `documentation.mime_type`, `user_labels`, - * `user_label.nameofkey`, `enabled`, `conditions`, `combiner`, etc. - * - * If this field is empty, then the supplied alerting policy replaces the - * existing policy. It is the same as deleting the existing policy and - * adding the supplied policy, except for the following: - * - * + The new policy will have the same `[ALERT_POLICY_ID]` as the former - * policy. This gives you continuity with the former policy in your - * notifications and incidents. - * + Conditions in the new policy will keep their former `[CONDITION_ID]` if - * the supplied condition includes the `name` field with that - * `[CONDITION_ID]`. If the supplied condition omits the `name` field, - * then a new `[CONDITION_ID]` is created. - * @param {google.monitoring.v3.AlertPolicy} request.alertPolicy - * Required. The updated alerting policy or the updated values for the - * fields listed in `update_mask`. - * If `update_mask` is not empty, any fields in this policy that are - * not in `update_mask` are ignored. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.monitoring.v3.AlertPolicy|AlertPolicy}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v3/alert_policy_service.update_alert_policy.js - * region_tag:monitoring_v3_generated_AlertPolicyService_UpdateAlertPolicy_async - */ + /** + * Updates an alerting policy. You can either replace the entire policy with + * a new one or replace only certain fields in the current alerting policy by + * specifying the fields to be updated via `updateMask`. Returns the + * updated alerting policy. + * + * Design your application to single-thread API calls that modify the state of + * alerting policies in a single project. This includes calls to + * CreateAlertPolicy, DeleteAlertPolicy and UpdateAlertPolicy. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.protobuf.FieldMask} [request.updateMask] + * Optional. A list of alerting policy field names. If this field is not + * empty, each listed field in the existing alerting policy is set to the + * value of the corresponding field in the supplied policy (`alert_policy`), + * or to the field's default value if the field is not in the supplied + * alerting policy. Fields not listed retain their previous value. + * + * Examples of valid field masks include `display_name`, `documentation`, + * `documentation.content`, `documentation.mime_type`, `user_labels`, + * `user_label.nameofkey`, `enabled`, `conditions`, `combiner`, etc. + * + * If this field is empty, then the supplied alerting policy replaces the + * existing policy. It is the same as deleting the existing policy and + * adding the supplied policy, except for the following: + * + * + The new policy will have the same `[ALERT_POLICY_ID]` as the former + * policy. This gives you continuity with the former policy in your + * notifications and incidents. + * + Conditions in the new policy will keep their former `[CONDITION_ID]` if + * the supplied condition includes the `name` field with that + * `[CONDITION_ID]`. If the supplied condition omits the `name` field, + * then a new `[CONDITION_ID]` is created. + * @param {google.monitoring.v3.AlertPolicy} request.alertPolicy + * Required. The updated alerting policy or the updated values for the + * fields listed in `update_mask`. + * If `update_mask` is not empty, any fields in this policy that are + * not in `update_mask` are ignored. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.monitoring.v3.AlertPolicy|AlertPolicy}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v3/alert_policy_service.update_alert_policy.js + * region_tag:monitoring_v3_generated_AlertPolicyService_UpdateAlertPolicy_async + */ updateAlertPolicy( - request?: protos.google.monitoring.v3.IUpdateAlertPolicyRequest, - options?: CallOptions): - Promise<[ - protos.google.monitoring.v3.IAlertPolicy, - protos.google.monitoring.v3.IUpdateAlertPolicyRequest|undefined, {}|undefined - ]>; + request?: protos.google.monitoring.v3.IUpdateAlertPolicyRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.monitoring.v3.IAlertPolicy, + protos.google.monitoring.v3.IUpdateAlertPolicyRequest | undefined, + {} | undefined, + ] + >; updateAlertPolicy( - request: protos.google.monitoring.v3.IUpdateAlertPolicyRequest, - options: CallOptions, - callback: Callback< - protos.google.monitoring.v3.IAlertPolicy, - protos.google.monitoring.v3.IUpdateAlertPolicyRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.monitoring.v3.IUpdateAlertPolicyRequest, + options: CallOptions, + callback: Callback< + protos.google.monitoring.v3.IAlertPolicy, + protos.google.monitoring.v3.IUpdateAlertPolicyRequest | null | undefined, + {} | null | undefined + >, + ): void; updateAlertPolicy( - request: protos.google.monitoring.v3.IUpdateAlertPolicyRequest, - callback: Callback< - protos.google.monitoring.v3.IAlertPolicy, - protos.google.monitoring.v3.IUpdateAlertPolicyRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.monitoring.v3.IUpdateAlertPolicyRequest, + callback: Callback< + protos.google.monitoring.v3.IAlertPolicy, + protos.google.monitoring.v3.IUpdateAlertPolicyRequest | null | undefined, + {} | null | undefined + >, + ): void; updateAlertPolicy( - request?: protos.google.monitoring.v3.IUpdateAlertPolicyRequest, - optionsOrCallback?: CallOptions|Callback< + request?: protos.google.monitoring.v3.IUpdateAlertPolicyRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.monitoring.v3.IAlertPolicy, - protos.google.monitoring.v3.IUpdateAlertPolicyRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.monitoring.v3.IAlertPolicy, - protos.google.monitoring.v3.IUpdateAlertPolicyRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.monitoring.v3.IAlertPolicy, - protos.google.monitoring.v3.IUpdateAlertPolicyRequest|undefined, {}|undefined - ]>|void { + | protos.google.monitoring.v3.IUpdateAlertPolicyRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.monitoring.v3.IAlertPolicy, + protos.google.monitoring.v3.IUpdateAlertPolicyRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.monitoring.v3.IAlertPolicy, + protos.google.monitoring.v3.IUpdateAlertPolicyRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'alert_policy.name': request.alertPolicy!.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + 'alert_policy.name': request.alertPolicy!.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('updateAlertPolicy request %j', request); - const wrappedCallback: Callback< - protos.google.monitoring.v3.IAlertPolicy, - protos.google.monitoring.v3.IUpdateAlertPolicyRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.monitoring.v3.IAlertPolicy, + | protos.google.monitoring.v3.IUpdateAlertPolicyRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('updateAlertPolicy response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.updateAlertPolicy(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.monitoring.v3.IAlertPolicy, - protos.google.monitoring.v3.IUpdateAlertPolicyRequest|undefined, - {}|undefined - ]) => { - this._log.info('updateAlertPolicy 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); + return this.innerApiCalls + .updateAlertPolicy(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.monitoring.v3.IAlertPolicy, + protos.google.monitoring.v3.IUpdateAlertPolicyRequest | undefined, + {} | undefined, + ]) => { + this._log.info('updateAlertPolicy 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; }); } - /** - * Lists the existing alerting policies for the workspace. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The - * [project](https://cloud.google.com/monitoring/api/v3#project_name) whose - * alert policies are to be listed. The format is: - * - * projects/[PROJECT_ID_OR_NUMBER] - * - * Note that this field names the parent container in which the alerting - * policies to be listed are stored. To retrieve a single alerting policy - * by name, use the - * {@link protos.google.monitoring.v3.AlertPolicyService.GetAlertPolicy|GetAlertPolicy} - * operation, instead. - * @param {string} [request.filter] - * Optional. If provided, this field specifies the criteria that must be met - * by alert policies to be included in the response. - * - * For more details, see [sorting and - * filtering](https://cloud.google.com/monitoring/api/v3/sorting-and-filtering). - * @param {string} [request.orderBy] - * Optional. A comma-separated list of fields by which to sort the result. - * Supports the same set of field references as the `filter` field. Entries - * can be prefixed with a minus sign to sort by the field in descending order. - * - * For more details, see [sorting and - * filtering](https://cloud.google.com/monitoring/api/v3/sorting-and-filtering). - * @param {number} [request.pageSize] - * Optional. The maximum number of results to return in a single response. - * @param {string} [request.pageToken] - * Optional. If this field is not empty then it must contain the - * `nextPageToken` value returned by a previous call to this method. Using - * this field causes the method to return more results from the previous - * method call. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of {@link protos.google.monitoring.v3.AlertPolicy|AlertPolicy}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listAlertPoliciesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Lists the existing alerting policies for the workspace. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The + * [project](https://cloud.google.com/monitoring/api/v3#project_name) whose + * alert policies are to be listed. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER] + * + * Note that this field names the parent container in which the alerting + * policies to be listed are stored. To retrieve a single alerting policy + * by name, use the + * {@link protos.google.monitoring.v3.AlertPolicyService.GetAlertPolicy|GetAlertPolicy} + * operation, instead. + * @param {string} [request.filter] + * Optional. If provided, this field specifies the criteria that must be met + * by alert policies to be included in the response. + * + * For more details, see [sorting and + * filtering](https://cloud.google.com/monitoring/api/v3/sorting-and-filtering). + * @param {string} [request.orderBy] + * Optional. A comma-separated list of fields by which to sort the result. + * Supports the same set of field references as the `filter` field. Entries + * can be prefixed with a minus sign to sort by the field in descending order. + * + * For more details, see [sorting and + * filtering](https://cloud.google.com/monitoring/api/v3/sorting-and-filtering). + * @param {number} [request.pageSize] + * Optional. The maximum number of results to return in a single response. + * @param {string} [request.pageToken] + * Optional. If this field is not empty then it must contain the + * `nextPageToken` value returned by a previous call to this method. Using + * this field causes the method to return more results from the previous + * method call. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of {@link protos.google.monitoring.v3.AlertPolicy|AlertPolicy}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listAlertPoliciesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listAlertPolicies( - request?: protos.google.monitoring.v3.IListAlertPoliciesRequest, - options?: CallOptions): - Promise<[ - protos.google.monitoring.v3.IAlertPolicy[], - protos.google.monitoring.v3.IListAlertPoliciesRequest|null, - protos.google.monitoring.v3.IListAlertPoliciesResponse - ]>; + request?: protos.google.monitoring.v3.IListAlertPoliciesRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.monitoring.v3.IAlertPolicy[], + protos.google.monitoring.v3.IListAlertPoliciesRequest | null, + protos.google.monitoring.v3.IListAlertPoliciesResponse, + ] + >; listAlertPolicies( - request: protos.google.monitoring.v3.IListAlertPoliciesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.monitoring.v3.IListAlertPoliciesRequest, - protos.google.monitoring.v3.IListAlertPoliciesResponse|null|undefined, - protos.google.monitoring.v3.IAlertPolicy>): void; + request: protos.google.monitoring.v3.IListAlertPoliciesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.monitoring.v3.IListAlertPoliciesRequest, + protos.google.monitoring.v3.IListAlertPoliciesResponse | null | undefined, + protos.google.monitoring.v3.IAlertPolicy + >, + ): void; listAlertPolicies( - request: protos.google.monitoring.v3.IListAlertPoliciesRequest, - callback: PaginationCallback< - protos.google.monitoring.v3.IListAlertPoliciesRequest, - protos.google.monitoring.v3.IListAlertPoliciesResponse|null|undefined, - protos.google.monitoring.v3.IAlertPolicy>): void; + request: protos.google.monitoring.v3.IListAlertPoliciesRequest, + callback: PaginationCallback< + protos.google.monitoring.v3.IListAlertPoliciesRequest, + protos.google.monitoring.v3.IListAlertPoliciesResponse | null | undefined, + protos.google.monitoring.v3.IAlertPolicy + >, + ): void; listAlertPolicies( - request?: protos.google.monitoring.v3.IListAlertPoliciesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.monitoring.v3.IListAlertPoliciesRequest, - protos.google.monitoring.v3.IListAlertPoliciesResponse|null|undefined, - protos.google.monitoring.v3.IAlertPolicy>, - callback?: PaginationCallback< + request?: protos.google.monitoring.v3.IListAlertPoliciesRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.monitoring.v3.IListAlertPoliciesRequest, - protos.google.monitoring.v3.IListAlertPoliciesResponse|null|undefined, - protos.google.monitoring.v3.IAlertPolicy>): - Promise<[ - protos.google.monitoring.v3.IAlertPolicy[], - protos.google.monitoring.v3.IListAlertPoliciesRequest|null, - protos.google.monitoring.v3.IListAlertPoliciesResponse - ]>|void { + | protos.google.monitoring.v3.IListAlertPoliciesResponse + | null + | undefined, + protos.google.monitoring.v3.IAlertPolicy + >, + callback?: PaginationCallback< + protos.google.monitoring.v3.IListAlertPoliciesRequest, + protos.google.monitoring.v3.IListAlertPoliciesResponse | null | undefined, + protos.google.monitoring.v3.IAlertPolicy + >, + ): Promise< + [ + protos.google.monitoring.v3.IAlertPolicy[], + protos.google.monitoring.v3.IListAlertPoliciesRequest | null, + protos.google.monitoring.v3.IListAlertPoliciesResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.monitoring.v3.IListAlertPoliciesRequest, - protos.google.monitoring.v3.IListAlertPoliciesResponse|null|undefined, - protos.google.monitoring.v3.IAlertPolicy>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.monitoring.v3.IListAlertPoliciesRequest, + | protos.google.monitoring.v3.IListAlertPoliciesResponse + | null + | undefined, + protos.google.monitoring.v3.IAlertPolicy + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('listAlertPolicies values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -975,158 +1186,162 @@ export class AlertPolicyServiceClient { this._log.info('listAlertPolicies request %j', request); return this.innerApiCalls .listAlertPolicies(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.monitoring.v3.IAlertPolicy[], - protos.google.monitoring.v3.IListAlertPoliciesRequest|null, - protos.google.monitoring.v3.IListAlertPoliciesResponse - ]) => { - this._log.info('listAlertPolicies values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.monitoring.v3.IAlertPolicy[], + protos.google.monitoring.v3.IListAlertPoliciesRequest | null, + protos.google.monitoring.v3.IListAlertPoliciesResponse, + ]) => { + this._log.info('listAlertPolicies values %j', response); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listAlertPolicies`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The - * [project](https://cloud.google.com/monitoring/api/v3#project_name) whose - * alert policies are to be listed. The format is: - * - * projects/[PROJECT_ID_OR_NUMBER] - * - * Note that this field names the parent container in which the alerting - * policies to be listed are stored. To retrieve a single alerting policy - * by name, use the - * {@link protos.google.monitoring.v3.AlertPolicyService.GetAlertPolicy|GetAlertPolicy} - * operation, instead. - * @param {string} [request.filter] - * Optional. If provided, this field specifies the criteria that must be met - * by alert policies to be included in the response. - * - * For more details, see [sorting and - * filtering](https://cloud.google.com/monitoring/api/v3/sorting-and-filtering). - * @param {string} [request.orderBy] - * Optional. A comma-separated list of fields by which to sort the result. - * Supports the same set of field references as the `filter` field. Entries - * can be prefixed with a minus sign to sort by the field in descending order. - * - * For more details, see [sorting and - * filtering](https://cloud.google.com/monitoring/api/v3/sorting-and-filtering). - * @param {number} [request.pageSize] - * Optional. The maximum number of results to return in a single response. - * @param {string} [request.pageToken] - * Optional. If this field is not empty then it must contain the - * `nextPageToken` value returned by a previous call to this method. Using - * this field causes the method to return more results from the previous - * method call. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.monitoring.v3.AlertPolicy|AlertPolicy} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listAlertPoliciesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Equivalent to `listAlertPolicies`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The + * [project](https://cloud.google.com/monitoring/api/v3#project_name) whose + * alert policies are to be listed. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER] + * + * Note that this field names the parent container in which the alerting + * policies to be listed are stored. To retrieve a single alerting policy + * by name, use the + * {@link protos.google.monitoring.v3.AlertPolicyService.GetAlertPolicy|GetAlertPolicy} + * operation, instead. + * @param {string} [request.filter] + * Optional. If provided, this field specifies the criteria that must be met + * by alert policies to be included in the response. + * + * For more details, see [sorting and + * filtering](https://cloud.google.com/monitoring/api/v3/sorting-and-filtering). + * @param {string} [request.orderBy] + * Optional. A comma-separated list of fields by which to sort the result. + * Supports the same set of field references as the `filter` field. Entries + * can be prefixed with a minus sign to sort by the field in descending order. + * + * For more details, see [sorting and + * filtering](https://cloud.google.com/monitoring/api/v3/sorting-and-filtering). + * @param {number} [request.pageSize] + * Optional. The maximum number of results to return in a single response. + * @param {string} [request.pageToken] + * Optional. If this field is not empty then it must contain the + * `nextPageToken` value returned by a previous call to this method. Using + * this field causes the method to return more results from the previous + * method call. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.monitoring.v3.AlertPolicy|AlertPolicy} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listAlertPoliciesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listAlertPoliciesStream( - request?: protos.google.monitoring.v3.IListAlertPoliciesRequest, - options?: CallOptions): - Transform{ + request?: protos.google.monitoring.v3.IListAlertPoliciesRequest, + options?: CallOptions, + ): Transform { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); const defaultCallSettings = this._defaults['listAlertPolicies']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listAlertPolicies stream %j', request); return this.descriptors.page.listAlertPolicies.createStream( this.innerApiCalls.listAlertPolicies as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `listAlertPolicies`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The - * [project](https://cloud.google.com/monitoring/api/v3#project_name) whose - * alert policies are to be listed. The format is: - * - * projects/[PROJECT_ID_OR_NUMBER] - * - * Note that this field names the parent container in which the alerting - * policies to be listed are stored. To retrieve a single alerting policy - * by name, use the - * {@link protos.google.monitoring.v3.AlertPolicyService.GetAlertPolicy|GetAlertPolicy} - * operation, instead. - * @param {string} [request.filter] - * Optional. If provided, this field specifies the criteria that must be met - * by alert policies to be included in the response. - * - * For more details, see [sorting and - * filtering](https://cloud.google.com/monitoring/api/v3/sorting-and-filtering). - * @param {string} [request.orderBy] - * Optional. A comma-separated list of fields by which to sort the result. - * Supports the same set of field references as the `filter` field. Entries - * can be prefixed with a minus sign to sort by the field in descending order. - * - * For more details, see [sorting and - * filtering](https://cloud.google.com/monitoring/api/v3/sorting-and-filtering). - * @param {number} [request.pageSize] - * Optional. The maximum number of results to return in a single response. - * @param {string} [request.pageToken] - * Optional. If this field is not empty then it must contain the - * `nextPageToken` value returned by a previous call to this method. Using - * this field causes the method to return more results from the previous - * method call. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.monitoring.v3.AlertPolicy|AlertPolicy}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v3/alert_policy_service.list_alert_policies.js - * region_tag:monitoring_v3_generated_AlertPolicyService_ListAlertPolicies_async - */ + /** + * Equivalent to `listAlertPolicies`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The + * [project](https://cloud.google.com/monitoring/api/v3#project_name) whose + * alert policies are to be listed. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER] + * + * Note that this field names the parent container in which the alerting + * policies to be listed are stored. To retrieve a single alerting policy + * by name, use the + * {@link protos.google.monitoring.v3.AlertPolicyService.GetAlertPolicy|GetAlertPolicy} + * operation, instead. + * @param {string} [request.filter] + * Optional. If provided, this field specifies the criteria that must be met + * by alert policies to be included in the response. + * + * For more details, see [sorting and + * filtering](https://cloud.google.com/monitoring/api/v3/sorting-and-filtering). + * @param {string} [request.orderBy] + * Optional. A comma-separated list of fields by which to sort the result. + * Supports the same set of field references as the `filter` field. Entries + * can be prefixed with a minus sign to sort by the field in descending order. + * + * For more details, see [sorting and + * filtering](https://cloud.google.com/monitoring/api/v3/sorting-and-filtering). + * @param {number} [request.pageSize] + * Optional. The maximum number of results to return in a single response. + * @param {string} [request.pageToken] + * Optional. If this field is not empty then it must contain the + * `nextPageToken` value returned by a previous call to this method. Using + * this field causes the method to return more results from the previous + * method call. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.monitoring.v3.AlertPolicy|AlertPolicy}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v3/alert_policy_service.list_alert_policies.js + * region_tag:monitoring_v3_generated_AlertPolicyService_ListAlertPolicies_async + */ listAlertPoliciesAsync( - request?: protos.google.monitoring.v3.IListAlertPoliciesRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.monitoring.v3.IListAlertPoliciesRequest, + options?: CallOptions, + ): AsyncIterable { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); const defaultCallSettings = this._defaults['listAlertPolicies']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listAlertPolicies iterate %j', request); return this.descriptors.page.listAlertPolicies.asyncIterate( this.innerApiCalls['listAlertPolicies'] as GaxCall, request as {}, - callSettings + callSettings, ) as AsyncIterable; } // -------------------- @@ -1140,7 +1355,7 @@ export class AlertPolicyServiceClient { * @param {string} alert_policy * @returns {string} Resource name string. */ - folderAlertPolicyPath(folder:string,alertPolicy:string) { + folderAlertPolicyPath(folder: string, alertPolicy: string) { return this.pathTemplates.folderAlertPolicyPathTemplate.render({ folder: folder, alert_policy: alertPolicy, @@ -1155,7 +1370,9 @@ export class AlertPolicyServiceClient { * @returns {string} A string representing the folder. */ matchFolderFromFolderAlertPolicyName(folderAlertPolicyName: string) { - return this.pathTemplates.folderAlertPolicyPathTemplate.match(folderAlertPolicyName).folder; + return this.pathTemplates.folderAlertPolicyPathTemplate.match( + folderAlertPolicyName, + ).folder; } /** @@ -1166,7 +1383,9 @@ export class AlertPolicyServiceClient { * @returns {string} A string representing the alert_policy. */ matchAlertPolicyFromFolderAlertPolicyName(folderAlertPolicyName: string) { - return this.pathTemplates.folderAlertPolicyPathTemplate.match(folderAlertPolicyName).alert_policy; + return this.pathTemplates.folderAlertPolicyPathTemplate.match( + folderAlertPolicyName, + ).alert_policy; } /** @@ -1177,7 +1396,11 @@ export class AlertPolicyServiceClient { * @param {string} condition * @returns {string} Resource name string. */ - folderAlertPolicyConditionPath(folder:string,alertPolicy:string,condition:string) { + folderAlertPolicyConditionPath( + folder: string, + alertPolicy: string, + condition: string, + ) { return this.pathTemplates.folderAlertPolicyConditionPathTemplate.render({ folder: folder, alert_policy: alertPolicy, @@ -1192,8 +1415,12 @@ export class AlertPolicyServiceClient { * A fully-qualified path representing folder_alert_policy_condition resource. * @returns {string} A string representing the folder. */ - matchFolderFromFolderAlertPolicyConditionName(folderAlertPolicyConditionName: string) { - return this.pathTemplates.folderAlertPolicyConditionPathTemplate.match(folderAlertPolicyConditionName).folder; + matchFolderFromFolderAlertPolicyConditionName( + folderAlertPolicyConditionName: string, + ) { + return this.pathTemplates.folderAlertPolicyConditionPathTemplate.match( + folderAlertPolicyConditionName, + ).folder; } /** @@ -1203,8 +1430,12 @@ export class AlertPolicyServiceClient { * A fully-qualified path representing folder_alert_policy_condition resource. * @returns {string} A string representing the alert_policy. */ - matchAlertPolicyFromFolderAlertPolicyConditionName(folderAlertPolicyConditionName: string) { - return this.pathTemplates.folderAlertPolicyConditionPathTemplate.match(folderAlertPolicyConditionName).alert_policy; + matchAlertPolicyFromFolderAlertPolicyConditionName( + folderAlertPolicyConditionName: string, + ) { + return this.pathTemplates.folderAlertPolicyConditionPathTemplate.match( + folderAlertPolicyConditionName, + ).alert_policy; } /** @@ -1214,8 +1445,12 @@ export class AlertPolicyServiceClient { * A fully-qualified path representing folder_alert_policy_condition resource. * @returns {string} A string representing the condition. */ - matchConditionFromFolderAlertPolicyConditionName(folderAlertPolicyConditionName: string) { - return this.pathTemplates.folderAlertPolicyConditionPathTemplate.match(folderAlertPolicyConditionName).condition; + matchConditionFromFolderAlertPolicyConditionName( + folderAlertPolicyConditionName: string, + ) { + return this.pathTemplates.folderAlertPolicyConditionPathTemplate.match( + folderAlertPolicyConditionName, + ).condition; } /** @@ -1225,7 +1460,7 @@ export class AlertPolicyServiceClient { * @param {string} channel_descriptor * @returns {string} Resource name string. */ - folderChannelDescriptorPath(folder:string,channelDescriptor:string) { + folderChannelDescriptorPath(folder: string, channelDescriptor: string) { return this.pathTemplates.folderChannelDescriptorPathTemplate.render({ folder: folder, channel_descriptor: channelDescriptor, @@ -1239,8 +1474,12 @@ export class AlertPolicyServiceClient { * A fully-qualified path representing folder_channel_descriptor resource. * @returns {string} A string representing the folder. */ - matchFolderFromFolderChannelDescriptorName(folderChannelDescriptorName: string) { - return this.pathTemplates.folderChannelDescriptorPathTemplate.match(folderChannelDescriptorName).folder; + matchFolderFromFolderChannelDescriptorName( + folderChannelDescriptorName: string, + ) { + return this.pathTemplates.folderChannelDescriptorPathTemplate.match( + folderChannelDescriptorName, + ).folder; } /** @@ -1250,8 +1489,12 @@ export class AlertPolicyServiceClient { * A fully-qualified path representing folder_channel_descriptor resource. * @returns {string} A string representing the channel_descriptor. */ - matchChannelDescriptorFromFolderChannelDescriptorName(folderChannelDescriptorName: string) { - return this.pathTemplates.folderChannelDescriptorPathTemplate.match(folderChannelDescriptorName).channel_descriptor; + matchChannelDescriptorFromFolderChannelDescriptorName( + folderChannelDescriptorName: string, + ) { + return this.pathTemplates.folderChannelDescriptorPathTemplate.match( + folderChannelDescriptorName, + ).channel_descriptor; } /** @@ -1261,7 +1504,7 @@ export class AlertPolicyServiceClient { * @param {string} group * @returns {string} Resource name string. */ - folderGroupPath(folder:string,group:string) { + folderGroupPath(folder: string, group: string) { return this.pathTemplates.folderGroupPathTemplate.render({ folder: folder, group: group, @@ -1276,7 +1519,8 @@ export class AlertPolicyServiceClient { * @returns {string} A string representing the folder. */ matchFolderFromFolderGroupName(folderGroupName: string) { - return this.pathTemplates.folderGroupPathTemplate.match(folderGroupName).folder; + return this.pathTemplates.folderGroupPathTemplate.match(folderGroupName) + .folder; } /** @@ -1287,7 +1531,8 @@ export class AlertPolicyServiceClient { * @returns {string} A string representing the group. */ matchGroupFromFolderGroupName(folderGroupName: string) { - return this.pathTemplates.folderGroupPathTemplate.match(folderGroupName).group; + return this.pathTemplates.folderGroupPathTemplate.match(folderGroupName) + .group; } /** @@ -1297,7 +1542,7 @@ export class AlertPolicyServiceClient { * @param {string} notification_channel * @returns {string} Resource name string. */ - folderNotificationChannelPath(folder:string,notificationChannel:string) { + folderNotificationChannelPath(folder: string, notificationChannel: string) { return this.pathTemplates.folderNotificationChannelPathTemplate.render({ folder: folder, notification_channel: notificationChannel, @@ -1311,8 +1556,12 @@ export class AlertPolicyServiceClient { * A fully-qualified path representing folder_notification_channel resource. * @returns {string} A string representing the folder. */ - matchFolderFromFolderNotificationChannelName(folderNotificationChannelName: string) { - return this.pathTemplates.folderNotificationChannelPathTemplate.match(folderNotificationChannelName).folder; + matchFolderFromFolderNotificationChannelName( + folderNotificationChannelName: string, + ) { + return this.pathTemplates.folderNotificationChannelPathTemplate.match( + folderNotificationChannelName, + ).folder; } /** @@ -1322,8 +1571,12 @@ export class AlertPolicyServiceClient { * A fully-qualified path representing folder_notification_channel resource. * @returns {string} A string representing the notification_channel. */ - matchNotificationChannelFromFolderNotificationChannelName(folderNotificationChannelName: string) { - return this.pathTemplates.folderNotificationChannelPathTemplate.match(folderNotificationChannelName).notification_channel; + matchNotificationChannelFromFolderNotificationChannelName( + folderNotificationChannelName: string, + ) { + return this.pathTemplates.folderNotificationChannelPathTemplate.match( + folderNotificationChannelName, + ).notification_channel; } /** @@ -1333,7 +1586,7 @@ export class AlertPolicyServiceClient { * @param {string} service * @returns {string} Resource name string. */ - folderServicePath(folder:string,service:string) { + folderServicePath(folder: string, service: string) { return this.pathTemplates.folderServicePathTemplate.render({ folder: folder, service: service, @@ -1348,7 +1601,8 @@ export class AlertPolicyServiceClient { * @returns {string} A string representing the folder. */ matchFolderFromFolderServiceName(folderServiceName: string) { - return this.pathTemplates.folderServicePathTemplate.match(folderServiceName).folder; + return this.pathTemplates.folderServicePathTemplate.match(folderServiceName) + .folder; } /** @@ -1359,7 +1613,8 @@ export class AlertPolicyServiceClient { * @returns {string} A string representing the service. */ matchServiceFromFolderServiceName(folderServiceName: string) { - return this.pathTemplates.folderServicePathTemplate.match(folderServiceName).service; + return this.pathTemplates.folderServicePathTemplate.match(folderServiceName) + .service; } /** @@ -1370,12 +1625,18 @@ export class AlertPolicyServiceClient { * @param {string} service_level_objective * @returns {string} Resource name string. */ - folderServiceServiceLevelObjectivePath(folder:string,service:string,serviceLevelObjective:string) { - return this.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.render({ - folder: folder, - service: service, - service_level_objective: serviceLevelObjective, - }); + folderServiceServiceLevelObjectivePath( + folder: string, + service: string, + serviceLevelObjective: string, + ) { + return this.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.render( + { + folder: folder, + service: service, + service_level_objective: serviceLevelObjective, + }, + ); } /** @@ -1385,8 +1646,12 @@ export class AlertPolicyServiceClient { * A fully-qualified path representing folder_service_service_level_objective resource. * @returns {string} A string representing the folder. */ - matchFolderFromFolderServiceServiceLevelObjectiveName(folderServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match(folderServiceServiceLevelObjectiveName).folder; + matchFolderFromFolderServiceServiceLevelObjectiveName( + folderServiceServiceLevelObjectiveName: string, + ) { + return this.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match( + folderServiceServiceLevelObjectiveName, + ).folder; } /** @@ -1396,8 +1661,12 @@ export class AlertPolicyServiceClient { * A fully-qualified path representing folder_service_service_level_objective resource. * @returns {string} A string representing the service. */ - matchServiceFromFolderServiceServiceLevelObjectiveName(folderServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match(folderServiceServiceLevelObjectiveName).service; + matchServiceFromFolderServiceServiceLevelObjectiveName( + folderServiceServiceLevelObjectiveName: string, + ) { + return this.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match( + folderServiceServiceLevelObjectiveName, + ).service; } /** @@ -1407,8 +1676,12 @@ export class AlertPolicyServiceClient { * A fully-qualified path representing folder_service_service_level_objective resource. * @returns {string} A string representing the service_level_objective. */ - matchServiceLevelObjectiveFromFolderServiceServiceLevelObjectiveName(folderServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match(folderServiceServiceLevelObjectiveName).service_level_objective; + matchServiceLevelObjectiveFromFolderServiceServiceLevelObjectiveName( + folderServiceServiceLevelObjectiveName: string, + ) { + return this.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match( + folderServiceServiceLevelObjectiveName, + ).service_level_objective; } /** @@ -1418,7 +1691,7 @@ export class AlertPolicyServiceClient { * @param {string} uptime_check_config * @returns {string} Resource name string. */ - folderUptimeCheckConfigPath(folder:string,uptimeCheckConfig:string) { + folderUptimeCheckConfigPath(folder: string, uptimeCheckConfig: string) { return this.pathTemplates.folderUptimeCheckConfigPathTemplate.render({ folder: folder, uptime_check_config: uptimeCheckConfig, @@ -1432,8 +1705,12 @@ export class AlertPolicyServiceClient { * A fully-qualified path representing folder_uptime_check_config resource. * @returns {string} A string representing the folder. */ - matchFolderFromFolderUptimeCheckConfigName(folderUptimeCheckConfigName: string) { - return this.pathTemplates.folderUptimeCheckConfigPathTemplate.match(folderUptimeCheckConfigName).folder; + matchFolderFromFolderUptimeCheckConfigName( + folderUptimeCheckConfigName: string, + ) { + return this.pathTemplates.folderUptimeCheckConfigPathTemplate.match( + folderUptimeCheckConfigName, + ).folder; } /** @@ -1443,8 +1720,12 @@ export class AlertPolicyServiceClient { * A fully-qualified path representing folder_uptime_check_config resource. * @returns {string} A string representing the uptime_check_config. */ - matchUptimeCheckConfigFromFolderUptimeCheckConfigName(folderUptimeCheckConfigName: string) { - return this.pathTemplates.folderUptimeCheckConfigPathTemplate.match(folderUptimeCheckConfigName).uptime_check_config; + matchUptimeCheckConfigFromFolderUptimeCheckConfigName( + folderUptimeCheckConfigName: string, + ) { + return this.pathTemplates.folderUptimeCheckConfigPathTemplate.match( + folderUptimeCheckConfigName, + ).uptime_check_config; } /** @@ -1454,7 +1735,7 @@ export class AlertPolicyServiceClient { * @param {string} alert_policy * @returns {string} Resource name string. */ - organizationAlertPolicyPath(organization:string,alertPolicy:string) { + organizationAlertPolicyPath(organization: string, alertPolicy: string) { return this.pathTemplates.organizationAlertPolicyPathTemplate.render({ organization: organization, alert_policy: alertPolicy, @@ -1468,8 +1749,12 @@ export class AlertPolicyServiceClient { * A fully-qualified path representing organization_alert_policy resource. * @returns {string} A string representing the organization. */ - matchOrganizationFromOrganizationAlertPolicyName(organizationAlertPolicyName: string) { - return this.pathTemplates.organizationAlertPolicyPathTemplate.match(organizationAlertPolicyName).organization; + matchOrganizationFromOrganizationAlertPolicyName( + organizationAlertPolicyName: string, + ) { + return this.pathTemplates.organizationAlertPolicyPathTemplate.match( + organizationAlertPolicyName, + ).organization; } /** @@ -1479,8 +1764,12 @@ export class AlertPolicyServiceClient { * A fully-qualified path representing organization_alert_policy resource. * @returns {string} A string representing the alert_policy. */ - matchAlertPolicyFromOrganizationAlertPolicyName(organizationAlertPolicyName: string) { - return this.pathTemplates.organizationAlertPolicyPathTemplate.match(organizationAlertPolicyName).alert_policy; + matchAlertPolicyFromOrganizationAlertPolicyName( + organizationAlertPolicyName: string, + ) { + return this.pathTemplates.organizationAlertPolicyPathTemplate.match( + organizationAlertPolicyName, + ).alert_policy; } /** @@ -1491,12 +1780,18 @@ export class AlertPolicyServiceClient { * @param {string} condition * @returns {string} Resource name string. */ - organizationAlertPolicyConditionPath(organization:string,alertPolicy:string,condition:string) { - return this.pathTemplates.organizationAlertPolicyConditionPathTemplate.render({ - organization: organization, - alert_policy: alertPolicy, - condition: condition, - }); + organizationAlertPolicyConditionPath( + organization: string, + alertPolicy: string, + condition: string, + ) { + return this.pathTemplates.organizationAlertPolicyConditionPathTemplate.render( + { + organization: organization, + alert_policy: alertPolicy, + condition: condition, + }, + ); } /** @@ -1506,8 +1801,12 @@ export class AlertPolicyServiceClient { * A fully-qualified path representing organization_alert_policy_condition resource. * @returns {string} A string representing the organization. */ - matchOrganizationFromOrganizationAlertPolicyConditionName(organizationAlertPolicyConditionName: string) { - return this.pathTemplates.organizationAlertPolicyConditionPathTemplate.match(organizationAlertPolicyConditionName).organization; + matchOrganizationFromOrganizationAlertPolicyConditionName( + organizationAlertPolicyConditionName: string, + ) { + return this.pathTemplates.organizationAlertPolicyConditionPathTemplate.match( + organizationAlertPolicyConditionName, + ).organization; } /** @@ -1517,8 +1816,12 @@ export class AlertPolicyServiceClient { * A fully-qualified path representing organization_alert_policy_condition resource. * @returns {string} A string representing the alert_policy. */ - matchAlertPolicyFromOrganizationAlertPolicyConditionName(organizationAlertPolicyConditionName: string) { - return this.pathTemplates.organizationAlertPolicyConditionPathTemplate.match(organizationAlertPolicyConditionName).alert_policy; + matchAlertPolicyFromOrganizationAlertPolicyConditionName( + organizationAlertPolicyConditionName: string, + ) { + return this.pathTemplates.organizationAlertPolicyConditionPathTemplate.match( + organizationAlertPolicyConditionName, + ).alert_policy; } /** @@ -1528,8 +1831,12 @@ export class AlertPolicyServiceClient { * A fully-qualified path representing organization_alert_policy_condition resource. * @returns {string} A string representing the condition. */ - matchConditionFromOrganizationAlertPolicyConditionName(organizationAlertPolicyConditionName: string) { - return this.pathTemplates.organizationAlertPolicyConditionPathTemplate.match(organizationAlertPolicyConditionName).condition; + matchConditionFromOrganizationAlertPolicyConditionName( + organizationAlertPolicyConditionName: string, + ) { + return this.pathTemplates.organizationAlertPolicyConditionPathTemplate.match( + organizationAlertPolicyConditionName, + ).condition; } /** @@ -1539,7 +1846,10 @@ export class AlertPolicyServiceClient { * @param {string} channel_descriptor * @returns {string} Resource name string. */ - organizationChannelDescriptorPath(organization:string,channelDescriptor:string) { + organizationChannelDescriptorPath( + organization: string, + channelDescriptor: string, + ) { return this.pathTemplates.organizationChannelDescriptorPathTemplate.render({ organization: organization, channel_descriptor: channelDescriptor, @@ -1553,8 +1863,12 @@ export class AlertPolicyServiceClient { * A fully-qualified path representing organization_channel_descriptor resource. * @returns {string} A string representing the organization. */ - matchOrganizationFromOrganizationChannelDescriptorName(organizationChannelDescriptorName: string) { - return this.pathTemplates.organizationChannelDescriptorPathTemplate.match(organizationChannelDescriptorName).organization; + matchOrganizationFromOrganizationChannelDescriptorName( + organizationChannelDescriptorName: string, + ) { + return this.pathTemplates.organizationChannelDescriptorPathTemplate.match( + organizationChannelDescriptorName, + ).organization; } /** @@ -1564,8 +1878,12 @@ export class AlertPolicyServiceClient { * A fully-qualified path representing organization_channel_descriptor resource. * @returns {string} A string representing the channel_descriptor. */ - matchChannelDescriptorFromOrganizationChannelDescriptorName(organizationChannelDescriptorName: string) { - return this.pathTemplates.organizationChannelDescriptorPathTemplate.match(organizationChannelDescriptorName).channel_descriptor; + matchChannelDescriptorFromOrganizationChannelDescriptorName( + organizationChannelDescriptorName: string, + ) { + return this.pathTemplates.organizationChannelDescriptorPathTemplate.match( + organizationChannelDescriptorName, + ).channel_descriptor; } /** @@ -1575,7 +1893,7 @@ export class AlertPolicyServiceClient { * @param {string} group * @returns {string} Resource name string. */ - organizationGroupPath(organization:string,group:string) { + organizationGroupPath(organization: string, group: string) { return this.pathTemplates.organizationGroupPathTemplate.render({ organization: organization, group: group, @@ -1590,7 +1908,9 @@ export class AlertPolicyServiceClient { * @returns {string} A string representing the organization. */ matchOrganizationFromOrganizationGroupName(organizationGroupName: string) { - return this.pathTemplates.organizationGroupPathTemplate.match(organizationGroupName).organization; + return this.pathTemplates.organizationGroupPathTemplate.match( + organizationGroupName, + ).organization; } /** @@ -1601,7 +1921,9 @@ export class AlertPolicyServiceClient { * @returns {string} A string representing the group. */ matchGroupFromOrganizationGroupName(organizationGroupName: string) { - return this.pathTemplates.organizationGroupPathTemplate.match(organizationGroupName).group; + return this.pathTemplates.organizationGroupPathTemplate.match( + organizationGroupName, + ).group; } /** @@ -1611,11 +1933,16 @@ export class AlertPolicyServiceClient { * @param {string} notification_channel * @returns {string} Resource name string. */ - organizationNotificationChannelPath(organization:string,notificationChannel:string) { - return this.pathTemplates.organizationNotificationChannelPathTemplate.render({ - organization: organization, - notification_channel: notificationChannel, - }); + organizationNotificationChannelPath( + organization: string, + notificationChannel: string, + ) { + return this.pathTemplates.organizationNotificationChannelPathTemplate.render( + { + organization: organization, + notification_channel: notificationChannel, + }, + ); } /** @@ -1625,8 +1952,12 @@ export class AlertPolicyServiceClient { * A fully-qualified path representing organization_notification_channel resource. * @returns {string} A string representing the organization. */ - matchOrganizationFromOrganizationNotificationChannelName(organizationNotificationChannelName: string) { - return this.pathTemplates.organizationNotificationChannelPathTemplate.match(organizationNotificationChannelName).organization; + matchOrganizationFromOrganizationNotificationChannelName( + organizationNotificationChannelName: string, + ) { + return this.pathTemplates.organizationNotificationChannelPathTemplate.match( + organizationNotificationChannelName, + ).organization; } /** @@ -1636,8 +1967,12 @@ export class AlertPolicyServiceClient { * A fully-qualified path representing organization_notification_channel resource. * @returns {string} A string representing the notification_channel. */ - matchNotificationChannelFromOrganizationNotificationChannelName(organizationNotificationChannelName: string) { - return this.pathTemplates.organizationNotificationChannelPathTemplate.match(organizationNotificationChannelName).notification_channel; + matchNotificationChannelFromOrganizationNotificationChannelName( + organizationNotificationChannelName: string, + ) { + return this.pathTemplates.organizationNotificationChannelPathTemplate.match( + organizationNotificationChannelName, + ).notification_channel; } /** @@ -1647,7 +1982,7 @@ export class AlertPolicyServiceClient { * @param {string} service * @returns {string} Resource name string. */ - organizationServicePath(organization:string,service:string) { + organizationServicePath(organization: string, service: string) { return this.pathTemplates.organizationServicePathTemplate.render({ organization: organization, service: service, @@ -1661,8 +1996,12 @@ export class AlertPolicyServiceClient { * A fully-qualified path representing organization_service resource. * @returns {string} A string representing the organization. */ - matchOrganizationFromOrganizationServiceName(organizationServiceName: string) { - return this.pathTemplates.organizationServicePathTemplate.match(organizationServiceName).organization; + matchOrganizationFromOrganizationServiceName( + organizationServiceName: string, + ) { + return this.pathTemplates.organizationServicePathTemplate.match( + organizationServiceName, + ).organization; } /** @@ -1673,7 +2012,9 @@ export class AlertPolicyServiceClient { * @returns {string} A string representing the service. */ matchServiceFromOrganizationServiceName(organizationServiceName: string) { - return this.pathTemplates.organizationServicePathTemplate.match(organizationServiceName).service; + return this.pathTemplates.organizationServicePathTemplate.match( + organizationServiceName, + ).service; } /** @@ -1684,12 +2025,18 @@ export class AlertPolicyServiceClient { * @param {string} service_level_objective * @returns {string} Resource name string. */ - organizationServiceServiceLevelObjectivePath(organization:string,service:string,serviceLevelObjective:string) { - return this.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.render({ - organization: organization, - service: service, - service_level_objective: serviceLevelObjective, - }); + organizationServiceServiceLevelObjectivePath( + organization: string, + service: string, + serviceLevelObjective: string, + ) { + return this.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.render( + { + organization: organization, + service: service, + service_level_objective: serviceLevelObjective, + }, + ); } /** @@ -1699,8 +2046,12 @@ export class AlertPolicyServiceClient { * A fully-qualified path representing organization_service_service_level_objective resource. * @returns {string} A string representing the organization. */ - matchOrganizationFromOrganizationServiceServiceLevelObjectiveName(organizationServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match(organizationServiceServiceLevelObjectiveName).organization; + matchOrganizationFromOrganizationServiceServiceLevelObjectiveName( + organizationServiceServiceLevelObjectiveName: string, + ) { + return this.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match( + organizationServiceServiceLevelObjectiveName, + ).organization; } /** @@ -1710,8 +2061,12 @@ export class AlertPolicyServiceClient { * A fully-qualified path representing organization_service_service_level_objective resource. * @returns {string} A string representing the service. */ - matchServiceFromOrganizationServiceServiceLevelObjectiveName(organizationServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match(organizationServiceServiceLevelObjectiveName).service; + matchServiceFromOrganizationServiceServiceLevelObjectiveName( + organizationServiceServiceLevelObjectiveName: string, + ) { + return this.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match( + organizationServiceServiceLevelObjectiveName, + ).service; } /** @@ -1721,8 +2076,12 @@ export class AlertPolicyServiceClient { * A fully-qualified path representing organization_service_service_level_objective resource. * @returns {string} A string representing the service_level_objective. */ - matchServiceLevelObjectiveFromOrganizationServiceServiceLevelObjectiveName(organizationServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match(organizationServiceServiceLevelObjectiveName).service_level_objective; + matchServiceLevelObjectiveFromOrganizationServiceServiceLevelObjectiveName( + organizationServiceServiceLevelObjectiveName: string, + ) { + return this.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match( + organizationServiceServiceLevelObjectiveName, + ).service_level_objective; } /** @@ -1732,7 +2091,10 @@ export class AlertPolicyServiceClient { * @param {string} uptime_check_config * @returns {string} Resource name string. */ - organizationUptimeCheckConfigPath(organization:string,uptimeCheckConfig:string) { + organizationUptimeCheckConfigPath( + organization: string, + uptimeCheckConfig: string, + ) { return this.pathTemplates.organizationUptimeCheckConfigPathTemplate.render({ organization: organization, uptime_check_config: uptimeCheckConfig, @@ -1746,8 +2108,12 @@ export class AlertPolicyServiceClient { * A fully-qualified path representing organization_uptime_check_config resource. * @returns {string} A string representing the organization. */ - matchOrganizationFromOrganizationUptimeCheckConfigName(organizationUptimeCheckConfigName: string) { - return this.pathTemplates.organizationUptimeCheckConfigPathTemplate.match(organizationUptimeCheckConfigName).organization; + matchOrganizationFromOrganizationUptimeCheckConfigName( + organizationUptimeCheckConfigName: string, + ) { + return this.pathTemplates.organizationUptimeCheckConfigPathTemplate.match( + organizationUptimeCheckConfigName, + ).organization; } /** @@ -1757,8 +2123,12 @@ export class AlertPolicyServiceClient { * A fully-qualified path representing organization_uptime_check_config resource. * @returns {string} A string representing the uptime_check_config. */ - matchUptimeCheckConfigFromOrganizationUptimeCheckConfigName(organizationUptimeCheckConfigName: string) { - return this.pathTemplates.organizationUptimeCheckConfigPathTemplate.match(organizationUptimeCheckConfigName).uptime_check_config; + matchUptimeCheckConfigFromOrganizationUptimeCheckConfigName( + organizationUptimeCheckConfigName: string, + ) { + return this.pathTemplates.organizationUptimeCheckConfigPathTemplate.match( + organizationUptimeCheckConfigName, + ).uptime_check_config; } /** @@ -1767,7 +2137,7 @@ export class AlertPolicyServiceClient { * @param {string} project * @returns {string} Resource name string. */ - projectPath(project:string) { + projectPath(project: string) { return this.pathTemplates.projectPathTemplate.render({ project: project, }); @@ -1791,7 +2161,7 @@ export class AlertPolicyServiceClient { * @param {string} alert_policy * @returns {string} Resource name string. */ - projectAlertPolicyPath(project:string,alertPolicy:string) { + projectAlertPolicyPath(project: string, alertPolicy: string) { return this.pathTemplates.projectAlertPolicyPathTemplate.render({ project: project, alert_policy: alertPolicy, @@ -1806,7 +2176,9 @@ export class AlertPolicyServiceClient { * @returns {string} A string representing the project. */ matchProjectFromProjectAlertPolicyName(projectAlertPolicyName: string) { - return this.pathTemplates.projectAlertPolicyPathTemplate.match(projectAlertPolicyName).project; + return this.pathTemplates.projectAlertPolicyPathTemplate.match( + projectAlertPolicyName, + ).project; } /** @@ -1817,7 +2189,9 @@ export class AlertPolicyServiceClient { * @returns {string} A string representing the alert_policy. */ matchAlertPolicyFromProjectAlertPolicyName(projectAlertPolicyName: string) { - return this.pathTemplates.projectAlertPolicyPathTemplate.match(projectAlertPolicyName).alert_policy; + return this.pathTemplates.projectAlertPolicyPathTemplate.match( + projectAlertPolicyName, + ).alert_policy; } /** @@ -1828,7 +2202,11 @@ export class AlertPolicyServiceClient { * @param {string} condition * @returns {string} Resource name string. */ - projectAlertPolicyConditionPath(project:string,alertPolicy:string,condition:string) { + projectAlertPolicyConditionPath( + project: string, + alertPolicy: string, + condition: string, + ) { return this.pathTemplates.projectAlertPolicyConditionPathTemplate.render({ project: project, alert_policy: alertPolicy, @@ -1843,8 +2221,12 @@ export class AlertPolicyServiceClient { * A fully-qualified path representing project_alert_policy_condition resource. * @returns {string} A string representing the project. */ - matchProjectFromProjectAlertPolicyConditionName(projectAlertPolicyConditionName: string) { - return this.pathTemplates.projectAlertPolicyConditionPathTemplate.match(projectAlertPolicyConditionName).project; + matchProjectFromProjectAlertPolicyConditionName( + projectAlertPolicyConditionName: string, + ) { + return this.pathTemplates.projectAlertPolicyConditionPathTemplate.match( + projectAlertPolicyConditionName, + ).project; } /** @@ -1854,8 +2236,12 @@ export class AlertPolicyServiceClient { * A fully-qualified path representing project_alert_policy_condition resource. * @returns {string} A string representing the alert_policy. */ - matchAlertPolicyFromProjectAlertPolicyConditionName(projectAlertPolicyConditionName: string) { - return this.pathTemplates.projectAlertPolicyConditionPathTemplate.match(projectAlertPolicyConditionName).alert_policy; + matchAlertPolicyFromProjectAlertPolicyConditionName( + projectAlertPolicyConditionName: string, + ) { + return this.pathTemplates.projectAlertPolicyConditionPathTemplate.match( + projectAlertPolicyConditionName, + ).alert_policy; } /** @@ -1865,8 +2251,12 @@ export class AlertPolicyServiceClient { * A fully-qualified path representing project_alert_policy_condition resource. * @returns {string} A string representing the condition. */ - matchConditionFromProjectAlertPolicyConditionName(projectAlertPolicyConditionName: string) { - return this.pathTemplates.projectAlertPolicyConditionPathTemplate.match(projectAlertPolicyConditionName).condition; + matchConditionFromProjectAlertPolicyConditionName( + projectAlertPolicyConditionName: string, + ) { + return this.pathTemplates.projectAlertPolicyConditionPathTemplate.match( + projectAlertPolicyConditionName, + ).condition; } /** @@ -1876,7 +2266,7 @@ export class AlertPolicyServiceClient { * @param {string} channel_descriptor * @returns {string} Resource name string. */ - projectChannelDescriptorPath(project:string,channelDescriptor:string) { + projectChannelDescriptorPath(project: string, channelDescriptor: string) { return this.pathTemplates.projectChannelDescriptorPathTemplate.render({ project: project, channel_descriptor: channelDescriptor, @@ -1890,8 +2280,12 @@ export class AlertPolicyServiceClient { * A fully-qualified path representing project_channel_descriptor resource. * @returns {string} A string representing the project. */ - matchProjectFromProjectChannelDescriptorName(projectChannelDescriptorName: string) { - return this.pathTemplates.projectChannelDescriptorPathTemplate.match(projectChannelDescriptorName).project; + matchProjectFromProjectChannelDescriptorName( + projectChannelDescriptorName: string, + ) { + return this.pathTemplates.projectChannelDescriptorPathTemplate.match( + projectChannelDescriptorName, + ).project; } /** @@ -1901,8 +2295,12 @@ export class AlertPolicyServiceClient { * A fully-qualified path representing project_channel_descriptor resource. * @returns {string} A string representing the channel_descriptor. */ - matchChannelDescriptorFromProjectChannelDescriptorName(projectChannelDescriptorName: string) { - return this.pathTemplates.projectChannelDescriptorPathTemplate.match(projectChannelDescriptorName).channel_descriptor; + matchChannelDescriptorFromProjectChannelDescriptorName( + projectChannelDescriptorName: string, + ) { + return this.pathTemplates.projectChannelDescriptorPathTemplate.match( + projectChannelDescriptorName, + ).channel_descriptor; } /** @@ -1912,7 +2310,7 @@ export class AlertPolicyServiceClient { * @param {string} group * @returns {string} Resource name string. */ - projectGroupPath(project:string,group:string) { + projectGroupPath(project: string, group: string) { return this.pathTemplates.projectGroupPathTemplate.render({ project: project, group: group, @@ -1927,7 +2325,8 @@ export class AlertPolicyServiceClient { * @returns {string} A string representing the project. */ matchProjectFromProjectGroupName(projectGroupName: string) { - return this.pathTemplates.projectGroupPathTemplate.match(projectGroupName).project; + return this.pathTemplates.projectGroupPathTemplate.match(projectGroupName) + .project; } /** @@ -1938,7 +2337,8 @@ export class AlertPolicyServiceClient { * @returns {string} A string representing the group. */ matchGroupFromProjectGroupName(projectGroupName: string) { - return this.pathTemplates.projectGroupPathTemplate.match(projectGroupName).group; + return this.pathTemplates.projectGroupPathTemplate.match(projectGroupName) + .group; } /** @@ -1948,7 +2348,7 @@ export class AlertPolicyServiceClient { * @param {string} notification_channel * @returns {string} Resource name string. */ - projectNotificationChannelPath(project:string,notificationChannel:string) { + projectNotificationChannelPath(project: string, notificationChannel: string) { return this.pathTemplates.projectNotificationChannelPathTemplate.render({ project: project, notification_channel: notificationChannel, @@ -1962,8 +2362,12 @@ export class AlertPolicyServiceClient { * A fully-qualified path representing project_notification_channel resource. * @returns {string} A string representing the project. */ - matchProjectFromProjectNotificationChannelName(projectNotificationChannelName: string) { - return this.pathTemplates.projectNotificationChannelPathTemplate.match(projectNotificationChannelName).project; + matchProjectFromProjectNotificationChannelName( + projectNotificationChannelName: string, + ) { + return this.pathTemplates.projectNotificationChannelPathTemplate.match( + projectNotificationChannelName, + ).project; } /** @@ -1973,8 +2377,12 @@ export class AlertPolicyServiceClient { * A fully-qualified path representing project_notification_channel resource. * @returns {string} A string representing the notification_channel. */ - matchNotificationChannelFromProjectNotificationChannelName(projectNotificationChannelName: string) { - return this.pathTemplates.projectNotificationChannelPathTemplate.match(projectNotificationChannelName).notification_channel; + matchNotificationChannelFromProjectNotificationChannelName( + projectNotificationChannelName: string, + ) { + return this.pathTemplates.projectNotificationChannelPathTemplate.match( + projectNotificationChannelName, + ).notification_channel; } /** @@ -1984,7 +2392,7 @@ export class AlertPolicyServiceClient { * @param {string} service * @returns {string} Resource name string. */ - projectServicePath(project:string,service:string) { + projectServicePath(project: string, service: string) { return this.pathTemplates.projectServicePathTemplate.render({ project: project, service: service, @@ -1999,7 +2407,9 @@ export class AlertPolicyServiceClient { * @returns {string} A string representing the project. */ matchProjectFromProjectServiceName(projectServiceName: string) { - return this.pathTemplates.projectServicePathTemplate.match(projectServiceName).project; + return this.pathTemplates.projectServicePathTemplate.match( + projectServiceName, + ).project; } /** @@ -2010,7 +2420,9 @@ export class AlertPolicyServiceClient { * @returns {string} A string representing the service. */ matchServiceFromProjectServiceName(projectServiceName: string) { - return this.pathTemplates.projectServicePathTemplate.match(projectServiceName).service; + return this.pathTemplates.projectServicePathTemplate.match( + projectServiceName, + ).service; } /** @@ -2021,12 +2433,18 @@ export class AlertPolicyServiceClient { * @param {string} service_level_objective * @returns {string} Resource name string. */ - projectServiceServiceLevelObjectivePath(project:string,service:string,serviceLevelObjective:string) { - return this.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.render({ - project: project, - service: service, - service_level_objective: serviceLevelObjective, - }); + projectServiceServiceLevelObjectivePath( + project: string, + service: string, + serviceLevelObjective: string, + ) { + return this.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.render( + { + project: project, + service: service, + service_level_objective: serviceLevelObjective, + }, + ); } /** @@ -2036,8 +2454,12 @@ export class AlertPolicyServiceClient { * A fully-qualified path representing project_service_service_level_objective resource. * @returns {string} A string representing the project. */ - matchProjectFromProjectServiceServiceLevelObjectiveName(projectServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match(projectServiceServiceLevelObjectiveName).project; + matchProjectFromProjectServiceServiceLevelObjectiveName( + projectServiceServiceLevelObjectiveName: string, + ) { + return this.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match( + projectServiceServiceLevelObjectiveName, + ).project; } /** @@ -2047,8 +2469,12 @@ export class AlertPolicyServiceClient { * A fully-qualified path representing project_service_service_level_objective resource. * @returns {string} A string representing the service. */ - matchServiceFromProjectServiceServiceLevelObjectiveName(projectServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match(projectServiceServiceLevelObjectiveName).service; + matchServiceFromProjectServiceServiceLevelObjectiveName( + projectServiceServiceLevelObjectiveName: string, + ) { + return this.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match( + projectServiceServiceLevelObjectiveName, + ).service; } /** @@ -2058,8 +2484,12 @@ export class AlertPolicyServiceClient { * A fully-qualified path representing project_service_service_level_objective resource. * @returns {string} A string representing the service_level_objective. */ - matchServiceLevelObjectiveFromProjectServiceServiceLevelObjectiveName(projectServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match(projectServiceServiceLevelObjectiveName).service_level_objective; + matchServiceLevelObjectiveFromProjectServiceServiceLevelObjectiveName( + projectServiceServiceLevelObjectiveName: string, + ) { + return this.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match( + projectServiceServiceLevelObjectiveName, + ).service_level_objective; } /** @@ -2069,7 +2499,7 @@ export class AlertPolicyServiceClient { * @param {string} uptime_check_config * @returns {string} Resource name string. */ - projectUptimeCheckConfigPath(project:string,uptimeCheckConfig:string) { + projectUptimeCheckConfigPath(project: string, uptimeCheckConfig: string) { return this.pathTemplates.projectUptimeCheckConfigPathTemplate.render({ project: project, uptime_check_config: uptimeCheckConfig, @@ -2083,8 +2513,12 @@ export class AlertPolicyServiceClient { * A fully-qualified path representing project_uptime_check_config resource. * @returns {string} A string representing the project. */ - matchProjectFromProjectUptimeCheckConfigName(projectUptimeCheckConfigName: string) { - return this.pathTemplates.projectUptimeCheckConfigPathTemplate.match(projectUptimeCheckConfigName).project; + matchProjectFromProjectUptimeCheckConfigName( + projectUptimeCheckConfigName: string, + ) { + return this.pathTemplates.projectUptimeCheckConfigPathTemplate.match( + projectUptimeCheckConfigName, + ).project; } /** @@ -2094,8 +2528,12 @@ export class AlertPolicyServiceClient { * A fully-qualified path representing project_uptime_check_config resource. * @returns {string} A string representing the uptime_check_config. */ - matchUptimeCheckConfigFromProjectUptimeCheckConfigName(projectUptimeCheckConfigName: string) { - return this.pathTemplates.projectUptimeCheckConfigPathTemplate.match(projectUptimeCheckConfigName).uptime_check_config; + matchUptimeCheckConfigFromProjectUptimeCheckConfigName( + projectUptimeCheckConfigName: string, + ) { + return this.pathTemplates.projectUptimeCheckConfigPathTemplate.match( + projectUptimeCheckConfigName, + ).uptime_check_config; } /** @@ -2105,7 +2543,7 @@ export class AlertPolicyServiceClient { * @param {string} snooze * @returns {string} Resource name string. */ - snoozePath(project:string,snooze:string) { + snoozePath(project: string, snooze: string) { return this.pathTemplates.snoozePathTemplate.render({ project: project, snooze: snooze, @@ -2142,7 +2580,7 @@ export class AlertPolicyServiceClient { */ close(): Promise { if (this.alertPolicyServiceStub && !this._terminated) { - return this.alertPolicyServiceStub.then(stub => { + return this.alertPolicyServiceStub.then((stub) => { this._log.info('ending gRPC channel'); this._terminated = true; stub.close(); @@ -2150,4 +2588,4 @@ export class AlertPolicyServiceClient { } return Promise.resolve(); } -} \ No newline at end of file +} diff --git a/packages/google-cloud-monitoring/src/v3/group_service_client.ts b/packages/google-cloud-monitoring/src/v3/group_service_client.ts index 621e68cb6ae1..1343875bc45b 100644 --- a/packages/google-cloud-monitoring/src/v3/group_service_client.ts +++ b/packages/google-cloud-monitoring/src/v3/group_service_client.ts @@ -18,11 +18,18 @@ /* global window */ import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} from 'google-gax'; -import {Transform} from 'stream'; +import type { + Callback, + CallOptions, + Descriptors, + ClientOptions, + PaginationCallback, + GaxCall, +} from 'google-gax'; +import { Transform } from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; +import { loggingUtils as logging, decodeAnyProtosInArray } from 'google-gax'; /** * Client JSON configuration object, loaded from @@ -55,7 +62,7 @@ export class GroupServiceClient { 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('monitoring'); @@ -68,9 +75,9 @@ export class GroupServiceClient { batching: {}, }; warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - groupServiceStub?: Promise<{[name: string]: Function}>; + innerApiCalls: { [name: string]: Function }; + pathTemplates: { [name: string]: gax.PathTemplate }; + groupServiceStub?: Promise<{ [name: string]: Function }>; /** * Construct an instance of GroupServiceClient. @@ -111,21 +118,42 @@ export class GroupServiceClient { * const client = new GroupServiceClient({fallback: true}, gax); * ``` */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + constructor( + opts?: ClientOptions, + gaxInstance?: typeof gax | typeof gax.fallback, + ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof GroupServiceClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.', + ); } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; + const universeDomainEnvVar = + typeof process === 'object' && typeof process.env === 'object' + ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] + : undefined; + this._universeDomain = + opts?.universeDomain ?? + opts?.universe_domain ?? + universeDomainEnvVar ?? + 'googleapis.com'; this._servicePath = 'monitoring.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + const servicePath = + opts?.servicePath || opts?.apiEndpoint || this._servicePath; + this._providedCustomServicePath = !!( + opts?.servicePath || opts?.apiEndpoint + ); const port = opts?.port || staticMembers.port; const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts); // Request numeric enum values if REST transport is used. opts.numericEnums = true; @@ -150,7 +178,7 @@ export class GroupServiceClient { this._opts = opts; // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set useJWTAccessWithScope on the auth object. this.auth.useJWTAccessWithScope = true; @@ -164,10 +192,7 @@ export class GroupServiceClient { } // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; if (typeof process === 'object' && 'versions' in process) { clientHeader.push(`gl-node/${process.versions.node}`); } else { @@ -189,82 +214,89 @@ export class GroupServiceClient { // Create useful helper objects for these. this.pathTemplates = { folderAlertPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/alertPolicies/{alert_policy}' + 'folders/{folder}/alertPolicies/{alert_policy}', ), folderAlertPolicyConditionPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/alertPolicies/{alert_policy}/conditions/{condition}' + 'folders/{folder}/alertPolicies/{alert_policy}/conditions/{condition}', ), folderChannelDescriptorPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/notificationChannelDescriptors/{channel_descriptor}' + 'folders/{folder}/notificationChannelDescriptors/{channel_descriptor}', ), folderGroupPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/groups/{group}' + 'folders/{folder}/groups/{group}', ), folderNotificationChannelPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/notificationChannels/{notification_channel}' + 'folders/{folder}/notificationChannels/{notification_channel}', ), folderServicePathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/services/{service}' - ), - folderServiceServiceLevelObjectivePathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/services/{service}/serviceLevelObjectives/{service_level_objective}' + 'folders/{folder}/services/{service}', ), + folderServiceServiceLevelObjectivePathTemplate: + new this._gaxModule.PathTemplate( + 'folders/{folder}/services/{service}/serviceLevelObjectives/{service_level_objective}', + ), folderUptimeCheckConfigPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/uptimeCheckConfigs/{uptime_check_config}' + 'folders/{folder}/uptimeCheckConfigs/{uptime_check_config}', ), organizationAlertPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/alertPolicies/{alert_policy}' - ), - organizationAlertPolicyConditionPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/alertPolicies/{alert_policy}/conditions/{condition}' - ), - organizationChannelDescriptorPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/notificationChannelDescriptors/{channel_descriptor}' + 'organizations/{organization}/alertPolicies/{alert_policy}', ), + organizationAlertPolicyConditionPathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/alertPolicies/{alert_policy}/conditions/{condition}', + ), + organizationChannelDescriptorPathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/notificationChannelDescriptors/{channel_descriptor}', + ), organizationGroupPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/groups/{group}' - ), - organizationNotificationChannelPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/notificationChannels/{notification_channel}' + 'organizations/{organization}/groups/{group}', ), + organizationNotificationChannelPathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/notificationChannels/{notification_channel}', + ), organizationServicePathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/services/{service}' - ), - organizationServiceServiceLevelObjectivePathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/services/{service}/serviceLevelObjectives/{service_level_objective}' - ), - organizationUptimeCheckConfigPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/uptimeCheckConfigs/{uptime_check_config}' + 'organizations/{organization}/services/{service}', ), + organizationServiceServiceLevelObjectivePathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/services/{service}/serviceLevelObjectives/{service_level_objective}', + ), + organizationUptimeCheckConfigPathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/uptimeCheckConfigs/{uptime_check_config}', + ), projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}' + 'projects/{project}', ), projectAlertPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/alertPolicies/{alert_policy}' + 'projects/{project}/alertPolicies/{alert_policy}', ), projectAlertPolicyConditionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/alertPolicies/{alert_policy}/conditions/{condition}' + 'projects/{project}/alertPolicies/{alert_policy}/conditions/{condition}', ), projectChannelDescriptorPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/notificationChannelDescriptors/{channel_descriptor}' + 'projects/{project}/notificationChannelDescriptors/{channel_descriptor}', ), projectGroupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/groups/{group}' + 'projects/{project}/groups/{group}', ), projectNotificationChannelPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/notificationChannels/{notification_channel}' + 'projects/{project}/notificationChannels/{notification_channel}', ), projectServicePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/services/{service}' - ), - projectServiceServiceLevelObjectivePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/services/{service}/serviceLevelObjectives/{service_level_objective}' + 'projects/{project}/services/{service}', ), + projectServiceServiceLevelObjectivePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/services/{service}/serviceLevelObjectives/{service_level_objective}', + ), projectUptimeCheckConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/uptimeCheckConfigs/{uptime_check_config}' + 'projects/{project}/uptimeCheckConfigs/{uptime_check_config}', ), snoozePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/snoozes/{snooze}' + 'projects/{project}/snoozes/{snooze}', ), }; @@ -272,16 +304,25 @@ export class GroupServiceClient { // (e.g. 50 results at a time, with tokens to get subsequent // pages). Denote the keys used for pagination and results. this.descriptors.page = { - listGroups: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'group'), - listGroupMembers: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'members') + listGroups: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'group', + ), + listGroupMembers: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'members', + ), }; // Put together the default options sent with requests. this._defaults = this._gaxGrpc.constructSettings( - 'google.monitoring.v3.GroupService', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + 'google.monitoring.v3.GroupService', + gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, + { 'x-goog-api-client': clientHeader.join(' ') }, + ); // Set up a dictionary of "inner API calls"; the core implementation // of calling the API is handled in `google-gax`, with this code @@ -312,37 +353,47 @@ export class GroupServiceClient { // Put together the "service stub" for // google.monitoring.v3.GroupService. this.groupServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.monitoring.v3.GroupService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.monitoring.v3.GroupService', + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any (this._protos as any).google.monitoring.v3.GroupService, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; + this._opts, + this._providedCustomServicePath, + ) as Promise<{ [method: string]: Function }>; // Iterate over each of the methods that the service provides // and create an API call method for each. - const groupServiceStubMethods = - ['listGroups', 'getGroup', 'createGroup', 'updateGroup', 'deleteGroup', 'listGroupMembers']; + const groupServiceStubMethods = [ + 'listGroups', + 'getGroup', + 'createGroup', + 'updateGroup', + 'deleteGroup', + 'listGroupMembers', + ]; for (const methodName of groupServiceStubMethods) { const callPromise = this.groupServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { + (stub) => + (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error | null | undefined) => () => { throw err; - }); + }, + ); - const descriptor = - this.descriptors.page[methodName] || - undefined; + const descriptor = this.descriptors.page[methodName] || undefined; const apiCall = this._gaxModule.createApiCall( callPromise, this._defaults[methodName], descriptor, - this._opts.fallback + this._opts.fallback, ); this.innerApiCalls[methodName] = apiCall; @@ -357,8 +408,14 @@ export class GroupServiceClient { * @returns {string} The DNS address for this service. */ static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); } return 'monitoring.googleapis.com'; } @@ -369,8 +426,14 @@ export class GroupServiceClient { * @returns {string} The DNS address for this service. */ static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); } return 'monitoring.googleapis.com'; } @@ -404,7 +467,7 @@ export class GroupServiceClient { return [ 'https://www.googleapis.com/auth/cloud-platform', 'https://www.googleapis.com/auth/monitoring', - 'https://www.googleapis.com/auth/monitoring.read' + 'https://www.googleapis.com/auth/monitoring.read', ]; } @@ -414,8 +477,9 @@ export class GroupServiceClient { * Return the project ID used by this class. * @returns {Promise} A promise that resolves to string containing the project ID. */ - getProjectId(callback?: Callback): - Promise|void { + getProjectId( + callback?: Callback, + ): Promise | void { if (callback) { this.auth.getProjectId(callback); return; @@ -426,516 +490,651 @@ export class GroupServiceClient { // ------------------- // -- Service calls -- // ------------------- -/** - * Gets a single group. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The group to retrieve. The format is: - * - * projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID] - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.monitoring.v3.Group|Group}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v3/group_service.get_group.js - * region_tag:monitoring_v3_generated_GroupService_GetGroup_async - */ + /** + * Gets a single group. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The group to retrieve. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID] + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.monitoring.v3.Group|Group}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v3/group_service.get_group.js + * region_tag:monitoring_v3_generated_GroupService_GetGroup_async + */ getGroup( - request?: protos.google.monitoring.v3.IGetGroupRequest, - options?: CallOptions): - Promise<[ - protos.google.monitoring.v3.IGroup, - protos.google.monitoring.v3.IGetGroupRequest|undefined, {}|undefined - ]>; + request?: protos.google.monitoring.v3.IGetGroupRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.monitoring.v3.IGroup, + protos.google.monitoring.v3.IGetGroupRequest | undefined, + {} | undefined, + ] + >; getGroup( - request: protos.google.monitoring.v3.IGetGroupRequest, - options: CallOptions, - callback: Callback< - protos.google.monitoring.v3.IGroup, - protos.google.monitoring.v3.IGetGroupRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.monitoring.v3.IGetGroupRequest, + options: CallOptions, + callback: Callback< + protos.google.monitoring.v3.IGroup, + protos.google.monitoring.v3.IGetGroupRequest | null | undefined, + {} | null | undefined + >, + ): void; getGroup( - request: protos.google.monitoring.v3.IGetGroupRequest, - callback: Callback< - protos.google.monitoring.v3.IGroup, - protos.google.monitoring.v3.IGetGroupRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.monitoring.v3.IGetGroupRequest, + callback: Callback< + protos.google.monitoring.v3.IGroup, + protos.google.monitoring.v3.IGetGroupRequest | null | undefined, + {} | null | undefined + >, + ): void; getGroup( - request?: protos.google.monitoring.v3.IGetGroupRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.monitoring.v3.IGroup, - protos.google.monitoring.v3.IGetGroupRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.monitoring.v3.IGetGroupRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.monitoring.v3.IGroup, - protos.google.monitoring.v3.IGetGroupRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.monitoring.v3.IGroup, - protos.google.monitoring.v3.IGetGroupRequest|undefined, {}|undefined - ]>|void { + protos.google.monitoring.v3.IGetGroupRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.monitoring.v3.IGroup, + protos.google.monitoring.v3.IGetGroupRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.monitoring.v3.IGroup, + protos.google.monitoring.v3.IGetGroupRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('getGroup request %j', request); - const wrappedCallback: Callback< - protos.google.monitoring.v3.IGroup, - protos.google.monitoring.v3.IGetGroupRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.monitoring.v3.IGroup, + protos.google.monitoring.v3.IGetGroupRequest | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('getGroup response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.getGroup(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.monitoring.v3.IGroup, - protos.google.monitoring.v3.IGetGroupRequest|undefined, - {}|undefined - ]) => { - this._log.info('getGroup 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); + return this.innerApiCalls + .getGroup(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.monitoring.v3.IGroup, + protos.google.monitoring.v3.IGetGroupRequest | undefined, + {} | undefined, + ]) => { + this._log.info('getGroup 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 group. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The - * [project](https://cloud.google.com/monitoring/api/v3#project_name) in which - * to create the group. The format is: - * - * projects/[PROJECT_ID_OR_NUMBER] - * @param {google.monitoring.v3.Group} request.group - * Required. A group definition. It is an error to define the `name` field - * because the system assigns the name. - * @param {boolean} request.validateOnly - * If true, validate this request but do not create the group. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.monitoring.v3.Group|Group}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v3/group_service.create_group.js - * region_tag:monitoring_v3_generated_GroupService_CreateGroup_async - */ + /** + * Creates a new group. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The + * [project](https://cloud.google.com/monitoring/api/v3#project_name) in which + * to create the group. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER] + * @param {google.monitoring.v3.Group} request.group + * Required. A group definition. It is an error to define the `name` field + * because the system assigns the name. + * @param {boolean} request.validateOnly + * If true, validate this request but do not create the group. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.monitoring.v3.Group|Group}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v3/group_service.create_group.js + * region_tag:monitoring_v3_generated_GroupService_CreateGroup_async + */ createGroup( - request?: protos.google.monitoring.v3.ICreateGroupRequest, - options?: CallOptions): - Promise<[ - protos.google.monitoring.v3.IGroup, - protos.google.monitoring.v3.ICreateGroupRequest|undefined, {}|undefined - ]>; + request?: protos.google.monitoring.v3.ICreateGroupRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.monitoring.v3.IGroup, + protos.google.monitoring.v3.ICreateGroupRequest | undefined, + {} | undefined, + ] + >; createGroup( - request: protos.google.monitoring.v3.ICreateGroupRequest, - options: CallOptions, - callback: Callback< - protos.google.monitoring.v3.IGroup, - protos.google.monitoring.v3.ICreateGroupRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.monitoring.v3.ICreateGroupRequest, + options: CallOptions, + callback: Callback< + protos.google.monitoring.v3.IGroup, + protos.google.monitoring.v3.ICreateGroupRequest | null | undefined, + {} | null | undefined + >, + ): void; createGroup( - request: protos.google.monitoring.v3.ICreateGroupRequest, - callback: Callback< - protos.google.monitoring.v3.IGroup, - protos.google.monitoring.v3.ICreateGroupRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.monitoring.v3.ICreateGroupRequest, + callback: Callback< + protos.google.monitoring.v3.IGroup, + protos.google.monitoring.v3.ICreateGroupRequest | null | undefined, + {} | null | undefined + >, + ): void; createGroup( - request?: protos.google.monitoring.v3.ICreateGroupRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.monitoring.v3.IGroup, - protos.google.monitoring.v3.ICreateGroupRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.monitoring.v3.ICreateGroupRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.monitoring.v3.IGroup, - protos.google.monitoring.v3.ICreateGroupRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.monitoring.v3.IGroup, - protos.google.monitoring.v3.ICreateGroupRequest|undefined, {}|undefined - ]>|void { + protos.google.monitoring.v3.ICreateGroupRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.monitoring.v3.IGroup, + protos.google.monitoring.v3.ICreateGroupRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.monitoring.v3.IGroup, + protos.google.monitoring.v3.ICreateGroupRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('createGroup request %j', request); - const wrappedCallback: Callback< - protos.google.monitoring.v3.IGroup, - protos.google.monitoring.v3.ICreateGroupRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.monitoring.v3.IGroup, + protos.google.monitoring.v3.ICreateGroupRequest | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('createGroup response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.createGroup(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.monitoring.v3.IGroup, - protos.google.monitoring.v3.ICreateGroupRequest|undefined, - {}|undefined - ]) => { - this._log.info('createGroup 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); + return this.innerApiCalls + .createGroup(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.monitoring.v3.IGroup, + protos.google.monitoring.v3.ICreateGroupRequest | undefined, + {} | undefined, + ]) => { + this._log.info('createGroup 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 an existing group. - * You can change any group attributes except `name`. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.monitoring.v3.Group} request.group - * Required. The new definition of the group. All fields of the existing - * group, excepting `name`, are replaced with the corresponding fields of this - * group. - * @param {boolean} request.validateOnly - * If true, validate this request but do not update the existing group. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.monitoring.v3.Group|Group}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v3/group_service.update_group.js - * region_tag:monitoring_v3_generated_GroupService_UpdateGroup_async - */ + /** + * Updates an existing group. + * You can change any group attributes except `name`. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.monitoring.v3.Group} request.group + * Required. The new definition of the group. All fields of the existing + * group, excepting `name`, are replaced with the corresponding fields of this + * group. + * @param {boolean} request.validateOnly + * If true, validate this request but do not update the existing group. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.monitoring.v3.Group|Group}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v3/group_service.update_group.js + * region_tag:monitoring_v3_generated_GroupService_UpdateGroup_async + */ updateGroup( - request?: protos.google.monitoring.v3.IUpdateGroupRequest, - options?: CallOptions): - Promise<[ - protos.google.monitoring.v3.IGroup, - protos.google.monitoring.v3.IUpdateGroupRequest|undefined, {}|undefined - ]>; + request?: protos.google.monitoring.v3.IUpdateGroupRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.monitoring.v3.IGroup, + protos.google.monitoring.v3.IUpdateGroupRequest | undefined, + {} | undefined, + ] + >; updateGroup( - request: protos.google.monitoring.v3.IUpdateGroupRequest, - options: CallOptions, - callback: Callback< - protos.google.monitoring.v3.IGroup, - protos.google.monitoring.v3.IUpdateGroupRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.monitoring.v3.IUpdateGroupRequest, + options: CallOptions, + callback: Callback< + protos.google.monitoring.v3.IGroup, + protos.google.monitoring.v3.IUpdateGroupRequest | null | undefined, + {} | null | undefined + >, + ): void; updateGroup( - request: protos.google.monitoring.v3.IUpdateGroupRequest, - callback: Callback< - protos.google.monitoring.v3.IGroup, - protos.google.monitoring.v3.IUpdateGroupRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.monitoring.v3.IUpdateGroupRequest, + callback: Callback< + protos.google.monitoring.v3.IGroup, + protos.google.monitoring.v3.IUpdateGroupRequest | null | undefined, + {} | null | undefined + >, + ): void; updateGroup( - request?: protos.google.monitoring.v3.IUpdateGroupRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.monitoring.v3.IGroup, - protos.google.monitoring.v3.IUpdateGroupRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.monitoring.v3.IUpdateGroupRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.monitoring.v3.IGroup, - protos.google.monitoring.v3.IUpdateGroupRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.monitoring.v3.IGroup, - protos.google.monitoring.v3.IUpdateGroupRequest|undefined, {}|undefined - ]>|void { + protos.google.monitoring.v3.IUpdateGroupRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.monitoring.v3.IGroup, + protos.google.monitoring.v3.IUpdateGroupRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.monitoring.v3.IGroup, + protos.google.monitoring.v3.IUpdateGroupRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'group.name': request.group!.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + 'group.name': request.group!.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('updateGroup request %j', request); - const wrappedCallback: Callback< - protos.google.monitoring.v3.IGroup, - protos.google.monitoring.v3.IUpdateGroupRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.monitoring.v3.IGroup, + protos.google.monitoring.v3.IUpdateGroupRequest | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('updateGroup response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.updateGroup(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.monitoring.v3.IGroup, - protos.google.monitoring.v3.IUpdateGroupRequest|undefined, - {}|undefined - ]) => { - this._log.info('updateGroup 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); + return this.innerApiCalls + .updateGroup(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.monitoring.v3.IGroup, + protos.google.monitoring.v3.IUpdateGroupRequest | undefined, + {} | undefined, + ]) => { + this._log.info('updateGroup 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 existing group. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The group to delete. The format is: - * - * projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID] - * @param {boolean} request.recursive - * If this field is true, then the request means to delete a group with all - * its descendants. Otherwise, the request means to delete a group only when - * it has no descendants. The default value is false. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v3/group_service.delete_group.js - * region_tag:monitoring_v3_generated_GroupService_DeleteGroup_async - */ + /** + * Deletes an existing group. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The group to delete. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID] + * @param {boolean} request.recursive + * If this field is true, then the request means to delete a group with all + * its descendants. Otherwise, the request means to delete a group only when + * it has no descendants. The default value is false. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.protobuf.Empty|Empty}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v3/group_service.delete_group.js + * region_tag:monitoring_v3_generated_GroupService_DeleteGroup_async + */ deleteGroup( - request?: protos.google.monitoring.v3.IDeleteGroupRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteGroupRequest|undefined, {}|undefined - ]>; + request?: protos.google.monitoring.v3.IDeleteGroupRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.protobuf.IEmpty, + protos.google.monitoring.v3.IDeleteGroupRequest | undefined, + {} | undefined, + ] + >; deleteGroup( - request: protos.google.monitoring.v3.IDeleteGroupRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteGroupRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.monitoring.v3.IDeleteGroupRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.monitoring.v3.IDeleteGroupRequest | null | undefined, + {} | null | undefined + >, + ): void; deleteGroup( - request: protos.google.monitoring.v3.IDeleteGroupRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteGroupRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.monitoring.v3.IDeleteGroupRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.monitoring.v3.IDeleteGroupRequest | null | undefined, + {} | null | undefined + >, + ): void; deleteGroup( - request?: protos.google.monitoring.v3.IDeleteGroupRequest, - optionsOrCallback?: CallOptions|Callback< + request?: protos.google.monitoring.v3.IDeleteGroupRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteGroupRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteGroupRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteGroupRequest|undefined, {}|undefined - ]>|void { + protos.google.monitoring.v3.IDeleteGroupRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.monitoring.v3.IDeleteGroupRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.protobuf.IEmpty, + protos.google.monitoring.v3.IDeleteGroupRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('deleteGroup request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteGroupRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.protobuf.IEmpty, + protos.google.monitoring.v3.IDeleteGroupRequest | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('deleteGroup response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.deleteGroup(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteGroupRequest|undefined, - {}|undefined - ]) => { - this._log.info('deleteGroup 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); + return this.innerApiCalls + .deleteGroup(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.protobuf.IEmpty, + protos.google.monitoring.v3.IDeleteGroupRequest | undefined, + {} | undefined, + ]) => { + this._log.info('deleteGroup 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; }); } - /** - * Lists the existing groups. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The - * [project](https://cloud.google.com/monitoring/api/v3#project_name) whose - * groups are to be listed. The format is: - * - * projects/[PROJECT_ID_OR_NUMBER] - * @param {string} request.childrenOfGroup - * A group name. The format is: - * - * projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID] - * - * Returns groups whose `parent_name` field contains the group - * name. If no groups have this parent, the results are empty. - * @param {string} request.ancestorsOfGroup - * A group name. The format is: - * - * projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID] - * - * Returns groups that are ancestors of the specified group. - * The groups are returned in order, starting with the immediate parent and - * ending with the most distant ancestor. If the specified group has no - * immediate parent, the results are empty. - * @param {string} request.descendantsOfGroup - * A group name. The format is: - * - * projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID] - * - * Returns the descendants of the specified group. This is a superset of - * the results returned by the `children_of_group` filter, and includes - * children-of-children, and so forth. - * @param {number} request.pageSize - * A positive number that is the maximum number of results to return. - * @param {string} request.pageToken - * If this field is not empty then it must contain the `next_page_token` value - * returned by a previous call to this method. Using this field causes the - * method to return additional results from the previous method call. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of {@link protos.google.monitoring.v3.Group|Group}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listGroupsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Lists the existing groups. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The + * [project](https://cloud.google.com/monitoring/api/v3#project_name) whose + * groups are to be listed. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER] + * @param {string} request.childrenOfGroup + * A group name. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID] + * + * Returns groups whose `parent_name` field contains the group + * name. If no groups have this parent, the results are empty. + * @param {string} request.ancestorsOfGroup + * A group name. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID] + * + * Returns groups that are ancestors of the specified group. + * The groups are returned in order, starting with the immediate parent and + * ending with the most distant ancestor. If the specified group has no + * immediate parent, the results are empty. + * @param {string} request.descendantsOfGroup + * A group name. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID] + * + * Returns the descendants of the specified group. This is a superset of + * the results returned by the `children_of_group` filter, and includes + * children-of-children, and so forth. + * @param {number} request.pageSize + * A positive number that is the maximum number of results to return. + * @param {string} request.pageToken + * If this field is not empty then it must contain the `next_page_token` value + * returned by a previous call to this method. Using this field causes the + * method to return additional results from the previous method call. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of {@link protos.google.monitoring.v3.Group|Group}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listGroupsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listGroups( - request?: protos.google.monitoring.v3.IListGroupsRequest, - options?: CallOptions): - Promise<[ - protos.google.monitoring.v3.IGroup[], - protos.google.monitoring.v3.IListGroupsRequest|null, - protos.google.monitoring.v3.IListGroupsResponse - ]>; + request?: protos.google.monitoring.v3.IListGroupsRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.monitoring.v3.IGroup[], + protos.google.monitoring.v3.IListGroupsRequest | null, + protos.google.monitoring.v3.IListGroupsResponse, + ] + >; listGroups( - request: protos.google.monitoring.v3.IListGroupsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.monitoring.v3.IListGroupsRequest, - protos.google.monitoring.v3.IListGroupsResponse|null|undefined, - protos.google.monitoring.v3.IGroup>): void; + request: protos.google.monitoring.v3.IListGroupsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.monitoring.v3.IListGroupsRequest, + protos.google.monitoring.v3.IListGroupsResponse | null | undefined, + protos.google.monitoring.v3.IGroup + >, + ): void; listGroups( - request: protos.google.monitoring.v3.IListGroupsRequest, - callback: PaginationCallback< - protos.google.monitoring.v3.IListGroupsRequest, - protos.google.monitoring.v3.IListGroupsResponse|null|undefined, - protos.google.monitoring.v3.IGroup>): void; + request: protos.google.monitoring.v3.IListGroupsRequest, + callback: PaginationCallback< + protos.google.monitoring.v3.IListGroupsRequest, + protos.google.monitoring.v3.IListGroupsResponse | null | undefined, + protos.google.monitoring.v3.IGroup + >, + ): void; listGroups( - request?: protos.google.monitoring.v3.IListGroupsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.monitoring.v3.IListGroupsRequest, - protos.google.monitoring.v3.IListGroupsResponse|null|undefined, - protos.google.monitoring.v3.IGroup>, - callback?: PaginationCallback< + request?: protos.google.monitoring.v3.IListGroupsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.monitoring.v3.IListGroupsRequest, - protos.google.monitoring.v3.IListGroupsResponse|null|undefined, - protos.google.monitoring.v3.IGroup>): - Promise<[ - protos.google.monitoring.v3.IGroup[], - protos.google.monitoring.v3.IListGroupsRequest|null, - protos.google.monitoring.v3.IListGroupsResponse - ]>|void { + protos.google.monitoring.v3.IListGroupsResponse | null | undefined, + protos.google.monitoring.v3.IGroup + >, + callback?: PaginationCallback< + protos.google.monitoring.v3.IListGroupsRequest, + protos.google.monitoring.v3.IListGroupsResponse | null | undefined, + protos.google.monitoring.v3.IGroup + >, + ): Promise< + [ + protos.google.monitoring.v3.IGroup[], + protos.google.monitoring.v3.IListGroupsRequest | null, + protos.google.monitoring.v3.IListGroupsResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.monitoring.v3.IListGroupsRequest, - protos.google.monitoring.v3.IListGroupsResponse|null|undefined, - protos.google.monitoring.v3.IGroup>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.monitoring.v3.IListGroupsRequest, + protos.google.monitoring.v3.IListGroupsResponse | null | undefined, + protos.google.monitoring.v3.IGroup + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('listGroups values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -944,267 +1143,290 @@ export class GroupServiceClient { this._log.info('listGroups request %j', request); return this.innerApiCalls .listGroups(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.monitoring.v3.IGroup[], - protos.google.monitoring.v3.IListGroupsRequest|null, - protos.google.monitoring.v3.IListGroupsResponse - ]) => { - this._log.info('listGroups values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.monitoring.v3.IGroup[], + protos.google.monitoring.v3.IListGroupsRequest | null, + protos.google.monitoring.v3.IListGroupsResponse, + ]) => { + this._log.info('listGroups values %j', response); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listGroups`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The - * [project](https://cloud.google.com/monitoring/api/v3#project_name) whose - * groups are to be listed. The format is: - * - * projects/[PROJECT_ID_OR_NUMBER] - * @param {string} request.childrenOfGroup - * A group name. The format is: - * - * projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID] - * - * Returns groups whose `parent_name` field contains the group - * name. If no groups have this parent, the results are empty. - * @param {string} request.ancestorsOfGroup - * A group name. The format is: - * - * projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID] - * - * Returns groups that are ancestors of the specified group. - * The groups are returned in order, starting with the immediate parent and - * ending with the most distant ancestor. If the specified group has no - * immediate parent, the results are empty. - * @param {string} request.descendantsOfGroup - * A group name. The format is: - * - * projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID] - * - * Returns the descendants of the specified group. This is a superset of - * the results returned by the `children_of_group` filter, and includes - * children-of-children, and so forth. - * @param {number} request.pageSize - * A positive number that is the maximum number of results to return. - * @param {string} request.pageToken - * If this field is not empty then it must contain the `next_page_token` value - * returned by a previous call to this method. Using this field causes the - * method to return additional results from the previous method call. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.monitoring.v3.Group|Group} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listGroupsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Equivalent to `listGroups`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The + * [project](https://cloud.google.com/monitoring/api/v3#project_name) whose + * groups are to be listed. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER] + * @param {string} request.childrenOfGroup + * A group name. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID] + * + * Returns groups whose `parent_name` field contains the group + * name. If no groups have this parent, the results are empty. + * @param {string} request.ancestorsOfGroup + * A group name. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID] + * + * Returns groups that are ancestors of the specified group. + * The groups are returned in order, starting with the immediate parent and + * ending with the most distant ancestor. If the specified group has no + * immediate parent, the results are empty. + * @param {string} request.descendantsOfGroup + * A group name. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID] + * + * Returns the descendants of the specified group. This is a superset of + * the results returned by the `children_of_group` filter, and includes + * children-of-children, and so forth. + * @param {number} request.pageSize + * A positive number that is the maximum number of results to return. + * @param {string} request.pageToken + * If this field is not empty then it must contain the `next_page_token` value + * returned by a previous call to this method. Using this field causes the + * method to return additional results from the previous method call. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.monitoring.v3.Group|Group} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listGroupsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listGroupsStream( - request?: protos.google.monitoring.v3.IListGroupsRequest, - options?: CallOptions): - Transform{ + request?: protos.google.monitoring.v3.IListGroupsRequest, + options?: CallOptions, + ): Transform { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); const defaultCallSettings = this._defaults['listGroups']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listGroups stream %j', request); return this.descriptors.page.listGroups.createStream( this.innerApiCalls.listGroups as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `listGroups`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The - * [project](https://cloud.google.com/monitoring/api/v3#project_name) whose - * groups are to be listed. The format is: - * - * projects/[PROJECT_ID_OR_NUMBER] - * @param {string} request.childrenOfGroup - * A group name. The format is: - * - * projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID] - * - * Returns groups whose `parent_name` field contains the group - * name. If no groups have this parent, the results are empty. - * @param {string} request.ancestorsOfGroup - * A group name. The format is: - * - * projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID] - * - * Returns groups that are ancestors of the specified group. - * The groups are returned in order, starting with the immediate parent and - * ending with the most distant ancestor. If the specified group has no - * immediate parent, the results are empty. - * @param {string} request.descendantsOfGroup - * A group name. The format is: - * - * projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID] - * - * Returns the descendants of the specified group. This is a superset of - * the results returned by the `children_of_group` filter, and includes - * children-of-children, and so forth. - * @param {number} request.pageSize - * A positive number that is the maximum number of results to return. - * @param {string} request.pageToken - * If this field is not empty then it must contain the `next_page_token` value - * returned by a previous call to this method. Using this field causes the - * method to return additional results from the previous method call. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.monitoring.v3.Group|Group}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v3/group_service.list_groups.js - * region_tag:monitoring_v3_generated_GroupService_ListGroups_async - */ + /** + * Equivalent to `listGroups`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The + * [project](https://cloud.google.com/monitoring/api/v3#project_name) whose + * groups are to be listed. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER] + * @param {string} request.childrenOfGroup + * A group name. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID] + * + * Returns groups whose `parent_name` field contains the group + * name. If no groups have this parent, the results are empty. + * @param {string} request.ancestorsOfGroup + * A group name. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID] + * + * Returns groups that are ancestors of the specified group. + * The groups are returned in order, starting with the immediate parent and + * ending with the most distant ancestor. If the specified group has no + * immediate parent, the results are empty. + * @param {string} request.descendantsOfGroup + * A group name. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID] + * + * Returns the descendants of the specified group. This is a superset of + * the results returned by the `children_of_group` filter, and includes + * children-of-children, and so forth. + * @param {number} request.pageSize + * A positive number that is the maximum number of results to return. + * @param {string} request.pageToken + * If this field is not empty then it must contain the `next_page_token` value + * returned by a previous call to this method. Using this field causes the + * method to return additional results from the previous method call. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.monitoring.v3.Group|Group}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v3/group_service.list_groups.js + * region_tag:monitoring_v3_generated_GroupService_ListGroups_async + */ listGroupsAsync( - request?: protos.google.monitoring.v3.IListGroupsRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.monitoring.v3.IListGroupsRequest, + options?: CallOptions, + ): AsyncIterable { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); const defaultCallSettings = this._defaults['listGroups']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listGroups iterate %j', request); return this.descriptors.page.listGroups.asyncIterate( this.innerApiCalls['listGroups'] as GaxCall, request as {}, - callSettings + callSettings, ) as AsyncIterable; } - /** - * Lists the monitored resources that are members of a group. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The group whose members are listed. The format is: - * - * projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID] - * @param {number} request.pageSize - * A positive number that is the maximum number of results to return. - * @param {string} request.pageToken - * If this field is not empty then it must contain the `next_page_token` value - * returned by a previous call to this method. Using this field causes the - * method to return additional results from the previous method call. - * @param {string} request.filter - * An optional [list - * filter](https://cloud.google.com/monitoring/api/learn_more#filtering) - * describing the members to be returned. The filter may reference the type, - * labels, and metadata of monitored resources that comprise the group. For - * example, to return only resources representing Compute Engine VM instances, - * use this filter: - * - * `resource.type = "gce_instance"` - * @param {google.monitoring.v3.TimeInterval} request.interval - * An optional time interval for which results should be returned. Only - * members that were part of the group during the specified interval are - * included in the response. If no interval is provided then the group - * membership over the last minute is returned. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of {@link protos.google.api.MonitoredResource|MonitoredResource}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listGroupMembersAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Lists the monitored resources that are members of a group. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The group whose members are listed. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID] + * @param {number} request.pageSize + * A positive number that is the maximum number of results to return. + * @param {string} request.pageToken + * If this field is not empty then it must contain the `next_page_token` value + * returned by a previous call to this method. Using this field causes the + * method to return additional results from the previous method call. + * @param {string} request.filter + * An optional [list + * filter](https://cloud.google.com/monitoring/api/learn_more#filtering) + * describing the members to be returned. The filter may reference the type, + * labels, and metadata of monitored resources that comprise the group. For + * example, to return only resources representing Compute Engine VM instances, + * use this filter: + * + * `resource.type = "gce_instance"` + * @param {google.monitoring.v3.TimeInterval} request.interval + * An optional time interval for which results should be returned. Only + * members that were part of the group during the specified interval are + * included in the response. If no interval is provided then the group + * membership over the last minute is returned. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of {@link protos.google.api.MonitoredResource|MonitoredResource}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listGroupMembersAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listGroupMembers( - request?: protos.google.monitoring.v3.IListGroupMembersRequest, - options?: CallOptions): - Promise<[ - protos.google.api.IMonitoredResource[], - protos.google.monitoring.v3.IListGroupMembersRequest|null, - protos.google.monitoring.v3.IListGroupMembersResponse - ]>; + request?: protos.google.monitoring.v3.IListGroupMembersRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.api.IMonitoredResource[], + protos.google.monitoring.v3.IListGroupMembersRequest | null, + protos.google.monitoring.v3.IListGroupMembersResponse, + ] + >; listGroupMembers( - request: protos.google.monitoring.v3.IListGroupMembersRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.monitoring.v3.IListGroupMembersRequest, - protos.google.monitoring.v3.IListGroupMembersResponse|null|undefined, - protos.google.api.IMonitoredResource>): void; + request: protos.google.monitoring.v3.IListGroupMembersRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.monitoring.v3.IListGroupMembersRequest, + protos.google.monitoring.v3.IListGroupMembersResponse | null | undefined, + protos.google.api.IMonitoredResource + >, + ): void; listGroupMembers( - request: protos.google.monitoring.v3.IListGroupMembersRequest, - callback: PaginationCallback< - protos.google.monitoring.v3.IListGroupMembersRequest, - protos.google.monitoring.v3.IListGroupMembersResponse|null|undefined, - protos.google.api.IMonitoredResource>): void; + request: protos.google.monitoring.v3.IListGroupMembersRequest, + callback: PaginationCallback< + protos.google.monitoring.v3.IListGroupMembersRequest, + protos.google.monitoring.v3.IListGroupMembersResponse | null | undefined, + protos.google.api.IMonitoredResource + >, + ): void; listGroupMembers( - request?: protos.google.monitoring.v3.IListGroupMembersRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.monitoring.v3.IListGroupMembersRequest, - protos.google.monitoring.v3.IListGroupMembersResponse|null|undefined, - protos.google.api.IMonitoredResource>, - callback?: PaginationCallback< + request?: protos.google.monitoring.v3.IListGroupMembersRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.monitoring.v3.IListGroupMembersRequest, - protos.google.monitoring.v3.IListGroupMembersResponse|null|undefined, - protos.google.api.IMonitoredResource>): - Promise<[ - protos.google.api.IMonitoredResource[], - protos.google.monitoring.v3.IListGroupMembersRequest|null, - protos.google.monitoring.v3.IListGroupMembersResponse - ]>|void { + | protos.google.monitoring.v3.IListGroupMembersResponse + | null + | undefined, + protos.google.api.IMonitoredResource + >, + callback?: PaginationCallback< + protos.google.monitoring.v3.IListGroupMembersRequest, + protos.google.monitoring.v3.IListGroupMembersResponse | null | undefined, + protos.google.api.IMonitoredResource + >, + ): Promise< + [ + protos.google.api.IMonitoredResource[], + protos.google.monitoring.v3.IListGroupMembersRequest | null, + protos.google.monitoring.v3.IListGroupMembersResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.monitoring.v3.IListGroupMembersRequest, - protos.google.monitoring.v3.IListGroupMembersResponse|null|undefined, - protos.google.api.IMonitoredResource>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.monitoring.v3.IListGroupMembersRequest, + | protos.google.monitoring.v3.IListGroupMembersResponse + | null + | undefined, + protos.google.api.IMonitoredResource + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('listGroupMembers values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -1213,142 +1435,146 @@ export class GroupServiceClient { this._log.info('listGroupMembers request %j', request); return this.innerApiCalls .listGroupMembers(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.api.IMonitoredResource[], - protos.google.monitoring.v3.IListGroupMembersRequest|null, - protos.google.monitoring.v3.IListGroupMembersResponse - ]) => { - this._log.info('listGroupMembers values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.api.IMonitoredResource[], + protos.google.monitoring.v3.IListGroupMembersRequest | null, + protos.google.monitoring.v3.IListGroupMembersResponse, + ]) => { + this._log.info('listGroupMembers values %j', response); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listGroupMembers`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The group whose members are listed. The format is: - * - * projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID] - * @param {number} request.pageSize - * A positive number that is the maximum number of results to return. - * @param {string} request.pageToken - * If this field is not empty then it must contain the `next_page_token` value - * returned by a previous call to this method. Using this field causes the - * method to return additional results from the previous method call. - * @param {string} request.filter - * An optional [list - * filter](https://cloud.google.com/monitoring/api/learn_more#filtering) - * describing the members to be returned. The filter may reference the type, - * labels, and metadata of monitored resources that comprise the group. For - * example, to return only resources representing Compute Engine VM instances, - * use this filter: - * - * `resource.type = "gce_instance"` - * @param {google.monitoring.v3.TimeInterval} request.interval - * An optional time interval for which results should be returned. Only - * members that were part of the group during the specified interval are - * included in the response. If no interval is provided then the group - * membership over the last minute is returned. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.api.MonitoredResource|MonitoredResource} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listGroupMembersAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Equivalent to `listGroupMembers`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The group whose members are listed. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID] + * @param {number} request.pageSize + * A positive number that is the maximum number of results to return. + * @param {string} request.pageToken + * If this field is not empty then it must contain the `next_page_token` value + * returned by a previous call to this method. Using this field causes the + * method to return additional results from the previous method call. + * @param {string} request.filter + * An optional [list + * filter](https://cloud.google.com/monitoring/api/learn_more#filtering) + * describing the members to be returned. The filter may reference the type, + * labels, and metadata of monitored resources that comprise the group. For + * example, to return only resources representing Compute Engine VM instances, + * use this filter: + * + * `resource.type = "gce_instance"` + * @param {google.monitoring.v3.TimeInterval} request.interval + * An optional time interval for which results should be returned. Only + * members that were part of the group during the specified interval are + * included in the response. If no interval is provided then the group + * membership over the last minute is returned. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.api.MonitoredResource|MonitoredResource} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listGroupMembersAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listGroupMembersStream( - request?: protos.google.monitoring.v3.IListGroupMembersRequest, - options?: CallOptions): - Transform{ + request?: protos.google.monitoring.v3.IListGroupMembersRequest, + options?: CallOptions, + ): Transform { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); const defaultCallSettings = this._defaults['listGroupMembers']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listGroupMembers stream %j', request); return this.descriptors.page.listGroupMembers.createStream( this.innerApiCalls.listGroupMembers as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `listGroupMembers`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The group whose members are listed. The format is: - * - * projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID] - * @param {number} request.pageSize - * A positive number that is the maximum number of results to return. - * @param {string} request.pageToken - * If this field is not empty then it must contain the `next_page_token` value - * returned by a previous call to this method. Using this field causes the - * method to return additional results from the previous method call. - * @param {string} request.filter - * An optional [list - * filter](https://cloud.google.com/monitoring/api/learn_more#filtering) - * describing the members to be returned. The filter may reference the type, - * labels, and metadata of monitored resources that comprise the group. For - * example, to return only resources representing Compute Engine VM instances, - * use this filter: - * - * `resource.type = "gce_instance"` - * @param {google.monitoring.v3.TimeInterval} request.interval - * An optional time interval for which results should be returned. Only - * members that were part of the group during the specified interval are - * included in the response. If no interval is provided then the group - * membership over the last minute is returned. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.api.MonitoredResource|MonitoredResource}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v3/group_service.list_group_members.js - * region_tag:monitoring_v3_generated_GroupService_ListGroupMembers_async - */ + /** + * Equivalent to `listGroupMembers`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The group whose members are listed. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID] + * @param {number} request.pageSize + * A positive number that is the maximum number of results to return. + * @param {string} request.pageToken + * If this field is not empty then it must contain the `next_page_token` value + * returned by a previous call to this method. Using this field causes the + * method to return additional results from the previous method call. + * @param {string} request.filter + * An optional [list + * filter](https://cloud.google.com/monitoring/api/learn_more#filtering) + * describing the members to be returned. The filter may reference the type, + * labels, and metadata of monitored resources that comprise the group. For + * example, to return only resources representing Compute Engine VM instances, + * use this filter: + * + * `resource.type = "gce_instance"` + * @param {google.monitoring.v3.TimeInterval} request.interval + * An optional time interval for which results should be returned. Only + * members that were part of the group during the specified interval are + * included in the response. If no interval is provided then the group + * membership over the last minute is returned. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.api.MonitoredResource|MonitoredResource}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v3/group_service.list_group_members.js + * region_tag:monitoring_v3_generated_GroupService_ListGroupMembers_async + */ listGroupMembersAsync( - request?: protos.google.monitoring.v3.IListGroupMembersRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.monitoring.v3.IListGroupMembersRequest, + options?: CallOptions, + ): AsyncIterable { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); const defaultCallSettings = this._defaults['listGroupMembers']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listGroupMembers iterate %j', request); return this.descriptors.page.listGroupMembers.asyncIterate( this.innerApiCalls['listGroupMembers'] as GaxCall, request as {}, - callSettings + callSettings, ) as AsyncIterable; } // -------------------- @@ -1362,7 +1588,7 @@ export class GroupServiceClient { * @param {string} alert_policy * @returns {string} Resource name string. */ - folderAlertPolicyPath(folder:string,alertPolicy:string) { + folderAlertPolicyPath(folder: string, alertPolicy: string) { return this.pathTemplates.folderAlertPolicyPathTemplate.render({ folder: folder, alert_policy: alertPolicy, @@ -1377,7 +1603,9 @@ export class GroupServiceClient { * @returns {string} A string representing the folder. */ matchFolderFromFolderAlertPolicyName(folderAlertPolicyName: string) { - return this.pathTemplates.folderAlertPolicyPathTemplate.match(folderAlertPolicyName).folder; + return this.pathTemplates.folderAlertPolicyPathTemplate.match( + folderAlertPolicyName, + ).folder; } /** @@ -1388,7 +1616,9 @@ export class GroupServiceClient { * @returns {string} A string representing the alert_policy. */ matchAlertPolicyFromFolderAlertPolicyName(folderAlertPolicyName: string) { - return this.pathTemplates.folderAlertPolicyPathTemplate.match(folderAlertPolicyName).alert_policy; + return this.pathTemplates.folderAlertPolicyPathTemplate.match( + folderAlertPolicyName, + ).alert_policy; } /** @@ -1399,7 +1629,11 @@ export class GroupServiceClient { * @param {string} condition * @returns {string} Resource name string. */ - folderAlertPolicyConditionPath(folder:string,alertPolicy:string,condition:string) { + folderAlertPolicyConditionPath( + folder: string, + alertPolicy: string, + condition: string, + ) { return this.pathTemplates.folderAlertPolicyConditionPathTemplate.render({ folder: folder, alert_policy: alertPolicy, @@ -1414,8 +1648,12 @@ export class GroupServiceClient { * A fully-qualified path representing folder_alert_policy_condition resource. * @returns {string} A string representing the folder. */ - matchFolderFromFolderAlertPolicyConditionName(folderAlertPolicyConditionName: string) { - return this.pathTemplates.folderAlertPolicyConditionPathTemplate.match(folderAlertPolicyConditionName).folder; + matchFolderFromFolderAlertPolicyConditionName( + folderAlertPolicyConditionName: string, + ) { + return this.pathTemplates.folderAlertPolicyConditionPathTemplate.match( + folderAlertPolicyConditionName, + ).folder; } /** @@ -1425,8 +1663,12 @@ export class GroupServiceClient { * A fully-qualified path representing folder_alert_policy_condition resource. * @returns {string} A string representing the alert_policy. */ - matchAlertPolicyFromFolderAlertPolicyConditionName(folderAlertPolicyConditionName: string) { - return this.pathTemplates.folderAlertPolicyConditionPathTemplate.match(folderAlertPolicyConditionName).alert_policy; + matchAlertPolicyFromFolderAlertPolicyConditionName( + folderAlertPolicyConditionName: string, + ) { + return this.pathTemplates.folderAlertPolicyConditionPathTemplate.match( + folderAlertPolicyConditionName, + ).alert_policy; } /** @@ -1436,8 +1678,12 @@ export class GroupServiceClient { * A fully-qualified path representing folder_alert_policy_condition resource. * @returns {string} A string representing the condition. */ - matchConditionFromFolderAlertPolicyConditionName(folderAlertPolicyConditionName: string) { - return this.pathTemplates.folderAlertPolicyConditionPathTemplate.match(folderAlertPolicyConditionName).condition; + matchConditionFromFolderAlertPolicyConditionName( + folderAlertPolicyConditionName: string, + ) { + return this.pathTemplates.folderAlertPolicyConditionPathTemplate.match( + folderAlertPolicyConditionName, + ).condition; } /** @@ -1447,7 +1693,7 @@ export class GroupServiceClient { * @param {string} channel_descriptor * @returns {string} Resource name string. */ - folderChannelDescriptorPath(folder:string,channelDescriptor:string) { + folderChannelDescriptorPath(folder: string, channelDescriptor: string) { return this.pathTemplates.folderChannelDescriptorPathTemplate.render({ folder: folder, channel_descriptor: channelDescriptor, @@ -1461,8 +1707,12 @@ export class GroupServiceClient { * A fully-qualified path representing folder_channel_descriptor resource. * @returns {string} A string representing the folder. */ - matchFolderFromFolderChannelDescriptorName(folderChannelDescriptorName: string) { - return this.pathTemplates.folderChannelDescriptorPathTemplate.match(folderChannelDescriptorName).folder; + matchFolderFromFolderChannelDescriptorName( + folderChannelDescriptorName: string, + ) { + return this.pathTemplates.folderChannelDescriptorPathTemplate.match( + folderChannelDescriptorName, + ).folder; } /** @@ -1472,8 +1722,12 @@ export class GroupServiceClient { * A fully-qualified path representing folder_channel_descriptor resource. * @returns {string} A string representing the channel_descriptor. */ - matchChannelDescriptorFromFolderChannelDescriptorName(folderChannelDescriptorName: string) { - return this.pathTemplates.folderChannelDescriptorPathTemplate.match(folderChannelDescriptorName).channel_descriptor; + matchChannelDescriptorFromFolderChannelDescriptorName( + folderChannelDescriptorName: string, + ) { + return this.pathTemplates.folderChannelDescriptorPathTemplate.match( + folderChannelDescriptorName, + ).channel_descriptor; } /** @@ -1483,7 +1737,7 @@ export class GroupServiceClient { * @param {string} group * @returns {string} Resource name string. */ - folderGroupPath(folder:string,group:string) { + folderGroupPath(folder: string, group: string) { return this.pathTemplates.folderGroupPathTemplate.render({ folder: folder, group: group, @@ -1498,7 +1752,8 @@ export class GroupServiceClient { * @returns {string} A string representing the folder. */ matchFolderFromFolderGroupName(folderGroupName: string) { - return this.pathTemplates.folderGroupPathTemplate.match(folderGroupName).folder; + return this.pathTemplates.folderGroupPathTemplate.match(folderGroupName) + .folder; } /** @@ -1509,7 +1764,8 @@ export class GroupServiceClient { * @returns {string} A string representing the group. */ matchGroupFromFolderGroupName(folderGroupName: string) { - return this.pathTemplates.folderGroupPathTemplate.match(folderGroupName).group; + return this.pathTemplates.folderGroupPathTemplate.match(folderGroupName) + .group; } /** @@ -1519,7 +1775,7 @@ export class GroupServiceClient { * @param {string} notification_channel * @returns {string} Resource name string. */ - folderNotificationChannelPath(folder:string,notificationChannel:string) { + folderNotificationChannelPath(folder: string, notificationChannel: string) { return this.pathTemplates.folderNotificationChannelPathTemplate.render({ folder: folder, notification_channel: notificationChannel, @@ -1533,8 +1789,12 @@ export class GroupServiceClient { * A fully-qualified path representing folder_notification_channel resource. * @returns {string} A string representing the folder. */ - matchFolderFromFolderNotificationChannelName(folderNotificationChannelName: string) { - return this.pathTemplates.folderNotificationChannelPathTemplate.match(folderNotificationChannelName).folder; + matchFolderFromFolderNotificationChannelName( + folderNotificationChannelName: string, + ) { + return this.pathTemplates.folderNotificationChannelPathTemplate.match( + folderNotificationChannelName, + ).folder; } /** @@ -1544,8 +1804,12 @@ export class GroupServiceClient { * A fully-qualified path representing folder_notification_channel resource. * @returns {string} A string representing the notification_channel. */ - matchNotificationChannelFromFolderNotificationChannelName(folderNotificationChannelName: string) { - return this.pathTemplates.folderNotificationChannelPathTemplate.match(folderNotificationChannelName).notification_channel; + matchNotificationChannelFromFolderNotificationChannelName( + folderNotificationChannelName: string, + ) { + return this.pathTemplates.folderNotificationChannelPathTemplate.match( + folderNotificationChannelName, + ).notification_channel; } /** @@ -1555,7 +1819,7 @@ export class GroupServiceClient { * @param {string} service * @returns {string} Resource name string. */ - folderServicePath(folder:string,service:string) { + folderServicePath(folder: string, service: string) { return this.pathTemplates.folderServicePathTemplate.render({ folder: folder, service: service, @@ -1570,7 +1834,8 @@ export class GroupServiceClient { * @returns {string} A string representing the folder. */ matchFolderFromFolderServiceName(folderServiceName: string) { - return this.pathTemplates.folderServicePathTemplate.match(folderServiceName).folder; + return this.pathTemplates.folderServicePathTemplate.match(folderServiceName) + .folder; } /** @@ -1581,7 +1846,8 @@ export class GroupServiceClient { * @returns {string} A string representing the service. */ matchServiceFromFolderServiceName(folderServiceName: string) { - return this.pathTemplates.folderServicePathTemplate.match(folderServiceName).service; + return this.pathTemplates.folderServicePathTemplate.match(folderServiceName) + .service; } /** @@ -1592,12 +1858,18 @@ export class GroupServiceClient { * @param {string} service_level_objective * @returns {string} Resource name string. */ - folderServiceServiceLevelObjectivePath(folder:string,service:string,serviceLevelObjective:string) { - return this.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.render({ - folder: folder, - service: service, - service_level_objective: serviceLevelObjective, - }); + folderServiceServiceLevelObjectivePath( + folder: string, + service: string, + serviceLevelObjective: string, + ) { + return this.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.render( + { + folder: folder, + service: service, + service_level_objective: serviceLevelObjective, + }, + ); } /** @@ -1607,8 +1879,12 @@ export class GroupServiceClient { * A fully-qualified path representing folder_service_service_level_objective resource. * @returns {string} A string representing the folder. */ - matchFolderFromFolderServiceServiceLevelObjectiveName(folderServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match(folderServiceServiceLevelObjectiveName).folder; + matchFolderFromFolderServiceServiceLevelObjectiveName( + folderServiceServiceLevelObjectiveName: string, + ) { + return this.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match( + folderServiceServiceLevelObjectiveName, + ).folder; } /** @@ -1618,8 +1894,12 @@ export class GroupServiceClient { * A fully-qualified path representing folder_service_service_level_objective resource. * @returns {string} A string representing the service. */ - matchServiceFromFolderServiceServiceLevelObjectiveName(folderServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match(folderServiceServiceLevelObjectiveName).service; + matchServiceFromFolderServiceServiceLevelObjectiveName( + folderServiceServiceLevelObjectiveName: string, + ) { + return this.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match( + folderServiceServiceLevelObjectiveName, + ).service; } /** @@ -1629,8 +1909,12 @@ export class GroupServiceClient { * A fully-qualified path representing folder_service_service_level_objective resource. * @returns {string} A string representing the service_level_objective. */ - matchServiceLevelObjectiveFromFolderServiceServiceLevelObjectiveName(folderServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match(folderServiceServiceLevelObjectiveName).service_level_objective; + matchServiceLevelObjectiveFromFolderServiceServiceLevelObjectiveName( + folderServiceServiceLevelObjectiveName: string, + ) { + return this.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match( + folderServiceServiceLevelObjectiveName, + ).service_level_objective; } /** @@ -1640,7 +1924,7 @@ export class GroupServiceClient { * @param {string} uptime_check_config * @returns {string} Resource name string. */ - folderUptimeCheckConfigPath(folder:string,uptimeCheckConfig:string) { + folderUptimeCheckConfigPath(folder: string, uptimeCheckConfig: string) { return this.pathTemplates.folderUptimeCheckConfigPathTemplate.render({ folder: folder, uptime_check_config: uptimeCheckConfig, @@ -1654,8 +1938,12 @@ export class GroupServiceClient { * A fully-qualified path representing folder_uptime_check_config resource. * @returns {string} A string representing the folder. */ - matchFolderFromFolderUptimeCheckConfigName(folderUptimeCheckConfigName: string) { - return this.pathTemplates.folderUptimeCheckConfigPathTemplate.match(folderUptimeCheckConfigName).folder; + matchFolderFromFolderUptimeCheckConfigName( + folderUptimeCheckConfigName: string, + ) { + return this.pathTemplates.folderUptimeCheckConfigPathTemplate.match( + folderUptimeCheckConfigName, + ).folder; } /** @@ -1665,8 +1953,12 @@ export class GroupServiceClient { * A fully-qualified path representing folder_uptime_check_config resource. * @returns {string} A string representing the uptime_check_config. */ - matchUptimeCheckConfigFromFolderUptimeCheckConfigName(folderUptimeCheckConfigName: string) { - return this.pathTemplates.folderUptimeCheckConfigPathTemplate.match(folderUptimeCheckConfigName).uptime_check_config; + matchUptimeCheckConfigFromFolderUptimeCheckConfigName( + folderUptimeCheckConfigName: string, + ) { + return this.pathTemplates.folderUptimeCheckConfigPathTemplate.match( + folderUptimeCheckConfigName, + ).uptime_check_config; } /** @@ -1676,7 +1968,7 @@ export class GroupServiceClient { * @param {string} alert_policy * @returns {string} Resource name string. */ - organizationAlertPolicyPath(organization:string,alertPolicy:string) { + organizationAlertPolicyPath(organization: string, alertPolicy: string) { return this.pathTemplates.organizationAlertPolicyPathTemplate.render({ organization: organization, alert_policy: alertPolicy, @@ -1690,8 +1982,12 @@ export class GroupServiceClient { * A fully-qualified path representing organization_alert_policy resource. * @returns {string} A string representing the organization. */ - matchOrganizationFromOrganizationAlertPolicyName(organizationAlertPolicyName: string) { - return this.pathTemplates.organizationAlertPolicyPathTemplate.match(organizationAlertPolicyName).organization; + matchOrganizationFromOrganizationAlertPolicyName( + organizationAlertPolicyName: string, + ) { + return this.pathTemplates.organizationAlertPolicyPathTemplate.match( + organizationAlertPolicyName, + ).organization; } /** @@ -1701,8 +1997,12 @@ export class GroupServiceClient { * A fully-qualified path representing organization_alert_policy resource. * @returns {string} A string representing the alert_policy. */ - matchAlertPolicyFromOrganizationAlertPolicyName(organizationAlertPolicyName: string) { - return this.pathTemplates.organizationAlertPolicyPathTemplate.match(organizationAlertPolicyName).alert_policy; + matchAlertPolicyFromOrganizationAlertPolicyName( + organizationAlertPolicyName: string, + ) { + return this.pathTemplates.organizationAlertPolicyPathTemplate.match( + organizationAlertPolicyName, + ).alert_policy; } /** @@ -1713,12 +2013,18 @@ export class GroupServiceClient { * @param {string} condition * @returns {string} Resource name string. */ - organizationAlertPolicyConditionPath(organization:string,alertPolicy:string,condition:string) { - return this.pathTemplates.organizationAlertPolicyConditionPathTemplate.render({ - organization: organization, - alert_policy: alertPolicy, - condition: condition, - }); + organizationAlertPolicyConditionPath( + organization: string, + alertPolicy: string, + condition: string, + ) { + return this.pathTemplates.organizationAlertPolicyConditionPathTemplate.render( + { + organization: organization, + alert_policy: alertPolicy, + condition: condition, + }, + ); } /** @@ -1728,8 +2034,12 @@ export class GroupServiceClient { * A fully-qualified path representing organization_alert_policy_condition resource. * @returns {string} A string representing the organization. */ - matchOrganizationFromOrganizationAlertPolicyConditionName(organizationAlertPolicyConditionName: string) { - return this.pathTemplates.organizationAlertPolicyConditionPathTemplate.match(organizationAlertPolicyConditionName).organization; + matchOrganizationFromOrganizationAlertPolicyConditionName( + organizationAlertPolicyConditionName: string, + ) { + return this.pathTemplates.organizationAlertPolicyConditionPathTemplate.match( + organizationAlertPolicyConditionName, + ).organization; } /** @@ -1739,8 +2049,12 @@ export class GroupServiceClient { * A fully-qualified path representing organization_alert_policy_condition resource. * @returns {string} A string representing the alert_policy. */ - matchAlertPolicyFromOrganizationAlertPolicyConditionName(organizationAlertPolicyConditionName: string) { - return this.pathTemplates.organizationAlertPolicyConditionPathTemplate.match(organizationAlertPolicyConditionName).alert_policy; + matchAlertPolicyFromOrganizationAlertPolicyConditionName( + organizationAlertPolicyConditionName: string, + ) { + return this.pathTemplates.organizationAlertPolicyConditionPathTemplate.match( + organizationAlertPolicyConditionName, + ).alert_policy; } /** @@ -1750,8 +2064,12 @@ export class GroupServiceClient { * A fully-qualified path representing organization_alert_policy_condition resource. * @returns {string} A string representing the condition. */ - matchConditionFromOrganizationAlertPolicyConditionName(organizationAlertPolicyConditionName: string) { - return this.pathTemplates.organizationAlertPolicyConditionPathTemplate.match(organizationAlertPolicyConditionName).condition; + matchConditionFromOrganizationAlertPolicyConditionName( + organizationAlertPolicyConditionName: string, + ) { + return this.pathTemplates.organizationAlertPolicyConditionPathTemplate.match( + organizationAlertPolicyConditionName, + ).condition; } /** @@ -1761,7 +2079,10 @@ export class GroupServiceClient { * @param {string} channel_descriptor * @returns {string} Resource name string. */ - organizationChannelDescriptorPath(organization:string,channelDescriptor:string) { + organizationChannelDescriptorPath( + organization: string, + channelDescriptor: string, + ) { return this.pathTemplates.organizationChannelDescriptorPathTemplate.render({ organization: organization, channel_descriptor: channelDescriptor, @@ -1775,8 +2096,12 @@ export class GroupServiceClient { * A fully-qualified path representing organization_channel_descriptor resource. * @returns {string} A string representing the organization. */ - matchOrganizationFromOrganizationChannelDescriptorName(organizationChannelDescriptorName: string) { - return this.pathTemplates.organizationChannelDescriptorPathTemplate.match(organizationChannelDescriptorName).organization; + matchOrganizationFromOrganizationChannelDescriptorName( + organizationChannelDescriptorName: string, + ) { + return this.pathTemplates.organizationChannelDescriptorPathTemplate.match( + organizationChannelDescriptorName, + ).organization; } /** @@ -1786,8 +2111,12 @@ export class GroupServiceClient { * A fully-qualified path representing organization_channel_descriptor resource. * @returns {string} A string representing the channel_descriptor. */ - matchChannelDescriptorFromOrganizationChannelDescriptorName(organizationChannelDescriptorName: string) { - return this.pathTemplates.organizationChannelDescriptorPathTemplate.match(organizationChannelDescriptorName).channel_descriptor; + matchChannelDescriptorFromOrganizationChannelDescriptorName( + organizationChannelDescriptorName: string, + ) { + return this.pathTemplates.organizationChannelDescriptorPathTemplate.match( + organizationChannelDescriptorName, + ).channel_descriptor; } /** @@ -1797,7 +2126,7 @@ export class GroupServiceClient { * @param {string} group * @returns {string} Resource name string. */ - organizationGroupPath(organization:string,group:string) { + organizationGroupPath(organization: string, group: string) { return this.pathTemplates.organizationGroupPathTemplate.render({ organization: organization, group: group, @@ -1812,7 +2141,9 @@ export class GroupServiceClient { * @returns {string} A string representing the organization. */ matchOrganizationFromOrganizationGroupName(organizationGroupName: string) { - return this.pathTemplates.organizationGroupPathTemplate.match(organizationGroupName).organization; + return this.pathTemplates.organizationGroupPathTemplate.match( + organizationGroupName, + ).organization; } /** @@ -1823,7 +2154,9 @@ export class GroupServiceClient { * @returns {string} A string representing the group. */ matchGroupFromOrganizationGroupName(organizationGroupName: string) { - return this.pathTemplates.organizationGroupPathTemplate.match(organizationGroupName).group; + return this.pathTemplates.organizationGroupPathTemplate.match( + organizationGroupName, + ).group; } /** @@ -1833,11 +2166,16 @@ export class GroupServiceClient { * @param {string} notification_channel * @returns {string} Resource name string. */ - organizationNotificationChannelPath(organization:string,notificationChannel:string) { - return this.pathTemplates.organizationNotificationChannelPathTemplate.render({ - organization: organization, - notification_channel: notificationChannel, - }); + organizationNotificationChannelPath( + organization: string, + notificationChannel: string, + ) { + return this.pathTemplates.organizationNotificationChannelPathTemplate.render( + { + organization: organization, + notification_channel: notificationChannel, + }, + ); } /** @@ -1847,8 +2185,12 @@ export class GroupServiceClient { * A fully-qualified path representing organization_notification_channel resource. * @returns {string} A string representing the organization. */ - matchOrganizationFromOrganizationNotificationChannelName(organizationNotificationChannelName: string) { - return this.pathTemplates.organizationNotificationChannelPathTemplate.match(organizationNotificationChannelName).organization; + matchOrganizationFromOrganizationNotificationChannelName( + organizationNotificationChannelName: string, + ) { + return this.pathTemplates.organizationNotificationChannelPathTemplate.match( + organizationNotificationChannelName, + ).organization; } /** @@ -1858,8 +2200,12 @@ export class GroupServiceClient { * A fully-qualified path representing organization_notification_channel resource. * @returns {string} A string representing the notification_channel. */ - matchNotificationChannelFromOrganizationNotificationChannelName(organizationNotificationChannelName: string) { - return this.pathTemplates.organizationNotificationChannelPathTemplate.match(organizationNotificationChannelName).notification_channel; + matchNotificationChannelFromOrganizationNotificationChannelName( + organizationNotificationChannelName: string, + ) { + return this.pathTemplates.organizationNotificationChannelPathTemplate.match( + organizationNotificationChannelName, + ).notification_channel; } /** @@ -1869,7 +2215,7 @@ export class GroupServiceClient { * @param {string} service * @returns {string} Resource name string. */ - organizationServicePath(organization:string,service:string) { + organizationServicePath(organization: string, service: string) { return this.pathTemplates.organizationServicePathTemplate.render({ organization: organization, service: service, @@ -1883,8 +2229,12 @@ export class GroupServiceClient { * A fully-qualified path representing organization_service resource. * @returns {string} A string representing the organization. */ - matchOrganizationFromOrganizationServiceName(organizationServiceName: string) { - return this.pathTemplates.organizationServicePathTemplate.match(organizationServiceName).organization; + matchOrganizationFromOrganizationServiceName( + organizationServiceName: string, + ) { + return this.pathTemplates.organizationServicePathTemplate.match( + organizationServiceName, + ).organization; } /** @@ -1895,7 +2245,9 @@ export class GroupServiceClient { * @returns {string} A string representing the service. */ matchServiceFromOrganizationServiceName(organizationServiceName: string) { - return this.pathTemplates.organizationServicePathTemplate.match(organizationServiceName).service; + return this.pathTemplates.organizationServicePathTemplate.match( + organizationServiceName, + ).service; } /** @@ -1906,12 +2258,18 @@ export class GroupServiceClient { * @param {string} service_level_objective * @returns {string} Resource name string. */ - organizationServiceServiceLevelObjectivePath(organization:string,service:string,serviceLevelObjective:string) { - return this.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.render({ - organization: organization, - service: service, - service_level_objective: serviceLevelObjective, - }); + organizationServiceServiceLevelObjectivePath( + organization: string, + service: string, + serviceLevelObjective: string, + ) { + return this.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.render( + { + organization: organization, + service: service, + service_level_objective: serviceLevelObjective, + }, + ); } /** @@ -1921,8 +2279,12 @@ export class GroupServiceClient { * A fully-qualified path representing organization_service_service_level_objective resource. * @returns {string} A string representing the organization. */ - matchOrganizationFromOrganizationServiceServiceLevelObjectiveName(organizationServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match(organizationServiceServiceLevelObjectiveName).organization; + matchOrganizationFromOrganizationServiceServiceLevelObjectiveName( + organizationServiceServiceLevelObjectiveName: string, + ) { + return this.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match( + organizationServiceServiceLevelObjectiveName, + ).organization; } /** @@ -1932,8 +2294,12 @@ export class GroupServiceClient { * A fully-qualified path representing organization_service_service_level_objective resource. * @returns {string} A string representing the service. */ - matchServiceFromOrganizationServiceServiceLevelObjectiveName(organizationServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match(organizationServiceServiceLevelObjectiveName).service; + matchServiceFromOrganizationServiceServiceLevelObjectiveName( + organizationServiceServiceLevelObjectiveName: string, + ) { + return this.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match( + organizationServiceServiceLevelObjectiveName, + ).service; } /** @@ -1943,8 +2309,12 @@ export class GroupServiceClient { * A fully-qualified path representing organization_service_service_level_objective resource. * @returns {string} A string representing the service_level_objective. */ - matchServiceLevelObjectiveFromOrganizationServiceServiceLevelObjectiveName(organizationServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match(organizationServiceServiceLevelObjectiveName).service_level_objective; + matchServiceLevelObjectiveFromOrganizationServiceServiceLevelObjectiveName( + organizationServiceServiceLevelObjectiveName: string, + ) { + return this.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match( + organizationServiceServiceLevelObjectiveName, + ).service_level_objective; } /** @@ -1954,7 +2324,10 @@ export class GroupServiceClient { * @param {string} uptime_check_config * @returns {string} Resource name string. */ - organizationUptimeCheckConfigPath(organization:string,uptimeCheckConfig:string) { + organizationUptimeCheckConfigPath( + organization: string, + uptimeCheckConfig: string, + ) { return this.pathTemplates.organizationUptimeCheckConfigPathTemplate.render({ organization: organization, uptime_check_config: uptimeCheckConfig, @@ -1968,8 +2341,12 @@ export class GroupServiceClient { * A fully-qualified path representing organization_uptime_check_config resource. * @returns {string} A string representing the organization. */ - matchOrganizationFromOrganizationUptimeCheckConfigName(organizationUptimeCheckConfigName: string) { - return this.pathTemplates.organizationUptimeCheckConfigPathTemplate.match(organizationUptimeCheckConfigName).organization; + matchOrganizationFromOrganizationUptimeCheckConfigName( + organizationUptimeCheckConfigName: string, + ) { + return this.pathTemplates.organizationUptimeCheckConfigPathTemplate.match( + organizationUptimeCheckConfigName, + ).organization; } /** @@ -1979,8 +2356,12 @@ export class GroupServiceClient { * A fully-qualified path representing organization_uptime_check_config resource. * @returns {string} A string representing the uptime_check_config. */ - matchUptimeCheckConfigFromOrganizationUptimeCheckConfigName(organizationUptimeCheckConfigName: string) { - return this.pathTemplates.organizationUptimeCheckConfigPathTemplate.match(organizationUptimeCheckConfigName).uptime_check_config; + matchUptimeCheckConfigFromOrganizationUptimeCheckConfigName( + organizationUptimeCheckConfigName: string, + ) { + return this.pathTemplates.organizationUptimeCheckConfigPathTemplate.match( + organizationUptimeCheckConfigName, + ).uptime_check_config; } /** @@ -1989,7 +2370,7 @@ export class GroupServiceClient { * @param {string} project * @returns {string} Resource name string. */ - projectPath(project:string) { + projectPath(project: string) { return this.pathTemplates.projectPathTemplate.render({ project: project, }); @@ -2013,7 +2394,7 @@ export class GroupServiceClient { * @param {string} alert_policy * @returns {string} Resource name string. */ - projectAlertPolicyPath(project:string,alertPolicy:string) { + projectAlertPolicyPath(project: string, alertPolicy: string) { return this.pathTemplates.projectAlertPolicyPathTemplate.render({ project: project, alert_policy: alertPolicy, @@ -2028,7 +2409,9 @@ export class GroupServiceClient { * @returns {string} A string representing the project. */ matchProjectFromProjectAlertPolicyName(projectAlertPolicyName: string) { - return this.pathTemplates.projectAlertPolicyPathTemplate.match(projectAlertPolicyName).project; + return this.pathTemplates.projectAlertPolicyPathTemplate.match( + projectAlertPolicyName, + ).project; } /** @@ -2039,7 +2422,9 @@ export class GroupServiceClient { * @returns {string} A string representing the alert_policy. */ matchAlertPolicyFromProjectAlertPolicyName(projectAlertPolicyName: string) { - return this.pathTemplates.projectAlertPolicyPathTemplate.match(projectAlertPolicyName).alert_policy; + return this.pathTemplates.projectAlertPolicyPathTemplate.match( + projectAlertPolicyName, + ).alert_policy; } /** @@ -2050,7 +2435,11 @@ export class GroupServiceClient { * @param {string} condition * @returns {string} Resource name string. */ - projectAlertPolicyConditionPath(project:string,alertPolicy:string,condition:string) { + projectAlertPolicyConditionPath( + project: string, + alertPolicy: string, + condition: string, + ) { return this.pathTemplates.projectAlertPolicyConditionPathTemplate.render({ project: project, alert_policy: alertPolicy, @@ -2065,8 +2454,12 @@ export class GroupServiceClient { * A fully-qualified path representing project_alert_policy_condition resource. * @returns {string} A string representing the project. */ - matchProjectFromProjectAlertPolicyConditionName(projectAlertPolicyConditionName: string) { - return this.pathTemplates.projectAlertPolicyConditionPathTemplate.match(projectAlertPolicyConditionName).project; + matchProjectFromProjectAlertPolicyConditionName( + projectAlertPolicyConditionName: string, + ) { + return this.pathTemplates.projectAlertPolicyConditionPathTemplate.match( + projectAlertPolicyConditionName, + ).project; } /** @@ -2076,8 +2469,12 @@ export class GroupServiceClient { * A fully-qualified path representing project_alert_policy_condition resource. * @returns {string} A string representing the alert_policy. */ - matchAlertPolicyFromProjectAlertPolicyConditionName(projectAlertPolicyConditionName: string) { - return this.pathTemplates.projectAlertPolicyConditionPathTemplate.match(projectAlertPolicyConditionName).alert_policy; + matchAlertPolicyFromProjectAlertPolicyConditionName( + projectAlertPolicyConditionName: string, + ) { + return this.pathTemplates.projectAlertPolicyConditionPathTemplate.match( + projectAlertPolicyConditionName, + ).alert_policy; } /** @@ -2087,8 +2484,12 @@ export class GroupServiceClient { * A fully-qualified path representing project_alert_policy_condition resource. * @returns {string} A string representing the condition. */ - matchConditionFromProjectAlertPolicyConditionName(projectAlertPolicyConditionName: string) { - return this.pathTemplates.projectAlertPolicyConditionPathTemplate.match(projectAlertPolicyConditionName).condition; + matchConditionFromProjectAlertPolicyConditionName( + projectAlertPolicyConditionName: string, + ) { + return this.pathTemplates.projectAlertPolicyConditionPathTemplate.match( + projectAlertPolicyConditionName, + ).condition; } /** @@ -2098,7 +2499,7 @@ export class GroupServiceClient { * @param {string} channel_descriptor * @returns {string} Resource name string. */ - projectChannelDescriptorPath(project:string,channelDescriptor:string) { + projectChannelDescriptorPath(project: string, channelDescriptor: string) { return this.pathTemplates.projectChannelDescriptorPathTemplate.render({ project: project, channel_descriptor: channelDescriptor, @@ -2112,8 +2513,12 @@ export class GroupServiceClient { * A fully-qualified path representing project_channel_descriptor resource. * @returns {string} A string representing the project. */ - matchProjectFromProjectChannelDescriptorName(projectChannelDescriptorName: string) { - return this.pathTemplates.projectChannelDescriptorPathTemplate.match(projectChannelDescriptorName).project; + matchProjectFromProjectChannelDescriptorName( + projectChannelDescriptorName: string, + ) { + return this.pathTemplates.projectChannelDescriptorPathTemplate.match( + projectChannelDescriptorName, + ).project; } /** @@ -2123,8 +2528,12 @@ export class GroupServiceClient { * A fully-qualified path representing project_channel_descriptor resource. * @returns {string} A string representing the channel_descriptor. */ - matchChannelDescriptorFromProjectChannelDescriptorName(projectChannelDescriptorName: string) { - return this.pathTemplates.projectChannelDescriptorPathTemplate.match(projectChannelDescriptorName).channel_descriptor; + matchChannelDescriptorFromProjectChannelDescriptorName( + projectChannelDescriptorName: string, + ) { + return this.pathTemplates.projectChannelDescriptorPathTemplate.match( + projectChannelDescriptorName, + ).channel_descriptor; } /** @@ -2134,7 +2543,7 @@ export class GroupServiceClient { * @param {string} group * @returns {string} Resource name string. */ - projectGroupPath(project:string,group:string) { + projectGroupPath(project: string, group: string) { return this.pathTemplates.projectGroupPathTemplate.render({ project: project, group: group, @@ -2149,7 +2558,8 @@ export class GroupServiceClient { * @returns {string} A string representing the project. */ matchProjectFromProjectGroupName(projectGroupName: string) { - return this.pathTemplates.projectGroupPathTemplate.match(projectGroupName).project; + return this.pathTemplates.projectGroupPathTemplate.match(projectGroupName) + .project; } /** @@ -2160,7 +2570,8 @@ export class GroupServiceClient { * @returns {string} A string representing the group. */ matchGroupFromProjectGroupName(projectGroupName: string) { - return this.pathTemplates.projectGroupPathTemplate.match(projectGroupName).group; + return this.pathTemplates.projectGroupPathTemplate.match(projectGroupName) + .group; } /** @@ -2170,7 +2581,7 @@ export class GroupServiceClient { * @param {string} notification_channel * @returns {string} Resource name string. */ - projectNotificationChannelPath(project:string,notificationChannel:string) { + projectNotificationChannelPath(project: string, notificationChannel: string) { return this.pathTemplates.projectNotificationChannelPathTemplate.render({ project: project, notification_channel: notificationChannel, @@ -2184,8 +2595,12 @@ export class GroupServiceClient { * A fully-qualified path representing project_notification_channel resource. * @returns {string} A string representing the project. */ - matchProjectFromProjectNotificationChannelName(projectNotificationChannelName: string) { - return this.pathTemplates.projectNotificationChannelPathTemplate.match(projectNotificationChannelName).project; + matchProjectFromProjectNotificationChannelName( + projectNotificationChannelName: string, + ) { + return this.pathTemplates.projectNotificationChannelPathTemplate.match( + projectNotificationChannelName, + ).project; } /** @@ -2195,8 +2610,12 @@ export class GroupServiceClient { * A fully-qualified path representing project_notification_channel resource. * @returns {string} A string representing the notification_channel. */ - matchNotificationChannelFromProjectNotificationChannelName(projectNotificationChannelName: string) { - return this.pathTemplates.projectNotificationChannelPathTemplate.match(projectNotificationChannelName).notification_channel; + matchNotificationChannelFromProjectNotificationChannelName( + projectNotificationChannelName: string, + ) { + return this.pathTemplates.projectNotificationChannelPathTemplate.match( + projectNotificationChannelName, + ).notification_channel; } /** @@ -2206,7 +2625,7 @@ export class GroupServiceClient { * @param {string} service * @returns {string} Resource name string. */ - projectServicePath(project:string,service:string) { + projectServicePath(project: string, service: string) { return this.pathTemplates.projectServicePathTemplate.render({ project: project, service: service, @@ -2221,7 +2640,9 @@ export class GroupServiceClient { * @returns {string} A string representing the project. */ matchProjectFromProjectServiceName(projectServiceName: string) { - return this.pathTemplates.projectServicePathTemplate.match(projectServiceName).project; + return this.pathTemplates.projectServicePathTemplate.match( + projectServiceName, + ).project; } /** @@ -2232,7 +2653,9 @@ export class GroupServiceClient { * @returns {string} A string representing the service. */ matchServiceFromProjectServiceName(projectServiceName: string) { - return this.pathTemplates.projectServicePathTemplate.match(projectServiceName).service; + return this.pathTemplates.projectServicePathTemplate.match( + projectServiceName, + ).service; } /** @@ -2243,12 +2666,18 @@ export class GroupServiceClient { * @param {string} service_level_objective * @returns {string} Resource name string. */ - projectServiceServiceLevelObjectivePath(project:string,service:string,serviceLevelObjective:string) { - return this.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.render({ - project: project, - service: service, - service_level_objective: serviceLevelObjective, - }); + projectServiceServiceLevelObjectivePath( + project: string, + service: string, + serviceLevelObjective: string, + ) { + return this.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.render( + { + project: project, + service: service, + service_level_objective: serviceLevelObjective, + }, + ); } /** @@ -2258,8 +2687,12 @@ export class GroupServiceClient { * A fully-qualified path representing project_service_service_level_objective resource. * @returns {string} A string representing the project. */ - matchProjectFromProjectServiceServiceLevelObjectiveName(projectServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match(projectServiceServiceLevelObjectiveName).project; + matchProjectFromProjectServiceServiceLevelObjectiveName( + projectServiceServiceLevelObjectiveName: string, + ) { + return this.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match( + projectServiceServiceLevelObjectiveName, + ).project; } /** @@ -2269,8 +2702,12 @@ export class GroupServiceClient { * A fully-qualified path representing project_service_service_level_objective resource. * @returns {string} A string representing the service. */ - matchServiceFromProjectServiceServiceLevelObjectiveName(projectServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match(projectServiceServiceLevelObjectiveName).service; + matchServiceFromProjectServiceServiceLevelObjectiveName( + projectServiceServiceLevelObjectiveName: string, + ) { + return this.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match( + projectServiceServiceLevelObjectiveName, + ).service; } /** @@ -2280,8 +2717,12 @@ export class GroupServiceClient { * A fully-qualified path representing project_service_service_level_objective resource. * @returns {string} A string representing the service_level_objective. */ - matchServiceLevelObjectiveFromProjectServiceServiceLevelObjectiveName(projectServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match(projectServiceServiceLevelObjectiveName).service_level_objective; + matchServiceLevelObjectiveFromProjectServiceServiceLevelObjectiveName( + projectServiceServiceLevelObjectiveName: string, + ) { + return this.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match( + projectServiceServiceLevelObjectiveName, + ).service_level_objective; } /** @@ -2291,7 +2732,7 @@ export class GroupServiceClient { * @param {string} uptime_check_config * @returns {string} Resource name string. */ - projectUptimeCheckConfigPath(project:string,uptimeCheckConfig:string) { + projectUptimeCheckConfigPath(project: string, uptimeCheckConfig: string) { return this.pathTemplates.projectUptimeCheckConfigPathTemplate.render({ project: project, uptime_check_config: uptimeCheckConfig, @@ -2305,8 +2746,12 @@ export class GroupServiceClient { * A fully-qualified path representing project_uptime_check_config resource. * @returns {string} A string representing the project. */ - matchProjectFromProjectUptimeCheckConfigName(projectUptimeCheckConfigName: string) { - return this.pathTemplates.projectUptimeCheckConfigPathTemplate.match(projectUptimeCheckConfigName).project; + matchProjectFromProjectUptimeCheckConfigName( + projectUptimeCheckConfigName: string, + ) { + return this.pathTemplates.projectUptimeCheckConfigPathTemplate.match( + projectUptimeCheckConfigName, + ).project; } /** @@ -2316,8 +2761,12 @@ export class GroupServiceClient { * A fully-qualified path representing project_uptime_check_config resource. * @returns {string} A string representing the uptime_check_config. */ - matchUptimeCheckConfigFromProjectUptimeCheckConfigName(projectUptimeCheckConfigName: string) { - return this.pathTemplates.projectUptimeCheckConfigPathTemplate.match(projectUptimeCheckConfigName).uptime_check_config; + matchUptimeCheckConfigFromProjectUptimeCheckConfigName( + projectUptimeCheckConfigName: string, + ) { + return this.pathTemplates.projectUptimeCheckConfigPathTemplate.match( + projectUptimeCheckConfigName, + ).uptime_check_config; } /** @@ -2327,7 +2776,7 @@ export class GroupServiceClient { * @param {string} snooze * @returns {string} Resource name string. */ - snoozePath(project:string,snooze:string) { + snoozePath(project: string, snooze: string) { return this.pathTemplates.snoozePathTemplate.render({ project: project, snooze: snooze, @@ -2364,7 +2813,7 @@ export class GroupServiceClient { */ close(): Promise { if (this.groupServiceStub && !this._terminated) { - return this.groupServiceStub.then(stub => { + return this.groupServiceStub.then((stub) => { this._log.info('ending gRPC channel'); this._terminated = true; stub.close(); @@ -2372,4 +2821,4 @@ export class GroupServiceClient { } return Promise.resolve(); } -} \ No newline at end of file +} diff --git a/packages/google-cloud-monitoring/src/v3/index.ts b/packages/google-cloud-monitoring/src/v3/index.ts index 9d2d1992d845..27910af8fafa 100644 --- a/packages/google-cloud-monitoring/src/v3/index.ts +++ b/packages/google-cloud-monitoring/src/v3/index.ts @@ -16,11 +16,11 @@ // ** https://github.com/googleapis/gapic-generator-typescript ** // ** All changes to this file may be overwritten. ** -export {AlertPolicyServiceClient} from './alert_policy_service_client'; -export {GroupServiceClient} from './group_service_client'; -export {MetricServiceClient} from './metric_service_client'; -export {NotificationChannelServiceClient} from './notification_channel_service_client'; -export {QueryServiceClient} from './query_service_client'; -export {ServiceMonitoringServiceClient} from './service_monitoring_service_client'; -export {SnoozeServiceClient} from './snooze_service_client'; -export {UptimeCheckServiceClient} from './uptime_check_service_client'; +export { AlertPolicyServiceClient } from './alert_policy_service_client'; +export { GroupServiceClient } from './group_service_client'; +export { MetricServiceClient } from './metric_service_client'; +export { NotificationChannelServiceClient } from './notification_channel_service_client'; +export { QueryServiceClient } from './query_service_client'; +export { ServiceMonitoringServiceClient } from './service_monitoring_service_client'; +export { SnoozeServiceClient } from './snooze_service_client'; +export { UptimeCheckServiceClient } from './uptime_check_service_client'; diff --git a/packages/google-cloud-monitoring/src/v3/metric_service_client.ts b/packages/google-cloud-monitoring/src/v3/metric_service_client.ts index 69e49e64afc7..439da4ab8acb 100644 --- a/packages/google-cloud-monitoring/src/v3/metric_service_client.ts +++ b/packages/google-cloud-monitoring/src/v3/metric_service_client.ts @@ -18,11 +18,18 @@ /* global window */ import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} from 'google-gax'; -import {Transform} from 'stream'; +import type { + Callback, + CallOptions, + Descriptors, + ClientOptions, + PaginationCallback, + GaxCall, +} from 'google-gax'; +import { Transform } from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; +import { loggingUtils as logging, decodeAnyProtosInArray } from 'google-gax'; /** * Client JSON configuration object, loaded from @@ -45,7 +52,7 @@ export class MetricServiceClient { 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('monitoring'); @@ -58,9 +65,9 @@ export class MetricServiceClient { batching: {}, }; warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - metricServiceStub?: Promise<{[name: string]: Function}>; + innerApiCalls: { [name: string]: Function }; + pathTemplates: { [name: string]: gax.PathTemplate }; + metricServiceStub?: Promise<{ [name: string]: Function }>; /** * Construct an instance of MetricServiceClient. @@ -101,21 +108,42 @@ export class MetricServiceClient { * const client = new MetricServiceClient({fallback: true}, gax); * ``` */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + constructor( + opts?: ClientOptions, + gaxInstance?: typeof gax | typeof gax.fallback, + ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof MetricServiceClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.', + ); } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; + const universeDomainEnvVar = + typeof process === 'object' && typeof process.env === 'object' + ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] + : undefined; + this._universeDomain = + opts?.universeDomain ?? + opts?.universe_domain ?? + universeDomainEnvVar ?? + 'googleapis.com'; this._servicePath = 'monitoring.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + const servicePath = + opts?.servicePath || opts?.apiEndpoint || this._servicePath; + this._providedCustomServicePath = !!( + opts?.servicePath || opts?.apiEndpoint + ); const port = opts?.port || staticMembers.port; const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts); // Request numeric enum values if REST transport is used. opts.numericEnums = true; @@ -140,7 +168,7 @@ export class MetricServiceClient { this._opts = opts; // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set useJWTAccessWithScope on the auth object. this.auth.useJWTAccessWithScope = true; @@ -154,10 +182,7 @@ export class MetricServiceClient { } // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; if (typeof process === 'object' && 'versions' in process) { clientHeader.push(`gl-node/${process.versions.node}`); } else { @@ -179,103 +204,114 @@ export class MetricServiceClient { // Create useful helper objects for these. this.pathTemplates = { folderAlertPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/alertPolicies/{alert_policy}' + 'folders/{folder}/alertPolicies/{alert_policy}', ), folderAlertPolicyConditionPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/alertPolicies/{alert_policy}/conditions/{condition}' + 'folders/{folder}/alertPolicies/{alert_policy}/conditions/{condition}', ), folderChannelDescriptorPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/notificationChannelDescriptors/{channel_descriptor}' + 'folders/{folder}/notificationChannelDescriptors/{channel_descriptor}', ), folderGroupPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/groups/{group}' + 'folders/{folder}/groups/{group}', ), folderMetricDescriptorPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/metricDescriptors/{metric_descriptor=**}' - ), - folderMonitoredResourceDescriptorPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/monitoredResourceDescriptors/{monitored_resource_descriptor}' + 'folders/{folder}/metricDescriptors/{metric_descriptor=**}', ), + folderMonitoredResourceDescriptorPathTemplate: + new this._gaxModule.PathTemplate( + 'folders/{folder}/monitoredResourceDescriptors/{monitored_resource_descriptor}', + ), folderNotificationChannelPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/notificationChannels/{notification_channel}' + 'folders/{folder}/notificationChannels/{notification_channel}', ), folderServicePathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/services/{service}' - ), - folderServiceServiceLevelObjectivePathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/services/{service}/serviceLevelObjectives/{service_level_objective}' + 'folders/{folder}/services/{service}', ), + folderServiceServiceLevelObjectivePathTemplate: + new this._gaxModule.PathTemplate( + 'folders/{folder}/services/{service}/serviceLevelObjectives/{service_level_objective}', + ), folderUptimeCheckConfigPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/uptimeCheckConfigs/{uptime_check_config}' + 'folders/{folder}/uptimeCheckConfigs/{uptime_check_config}', ), organizationAlertPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/alertPolicies/{alert_policy}' - ), - organizationAlertPolicyConditionPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/alertPolicies/{alert_policy}/conditions/{condition}' - ), - organizationChannelDescriptorPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/notificationChannelDescriptors/{channel_descriptor}' + 'organizations/{organization}/alertPolicies/{alert_policy}', ), + organizationAlertPolicyConditionPathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/alertPolicies/{alert_policy}/conditions/{condition}', + ), + organizationChannelDescriptorPathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/notificationChannelDescriptors/{channel_descriptor}', + ), organizationGroupPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/groups/{group}' - ), - organizationMetricDescriptorPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/metricDescriptors/{metric_descriptor=**}' - ), - organizationMonitoredResourceDescriptorPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/monitoredResourceDescriptors/{monitored_resource_descriptor}' - ), - organizationNotificationChannelPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/notificationChannels/{notification_channel}' + 'organizations/{organization}/groups/{group}', ), + organizationMetricDescriptorPathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/metricDescriptors/{metric_descriptor=**}', + ), + organizationMonitoredResourceDescriptorPathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/monitoredResourceDescriptors/{monitored_resource_descriptor}', + ), + organizationNotificationChannelPathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/notificationChannels/{notification_channel}', + ), organizationServicePathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/services/{service}' - ), - organizationServiceServiceLevelObjectivePathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/services/{service}/serviceLevelObjectives/{service_level_objective}' - ), - organizationUptimeCheckConfigPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/uptimeCheckConfigs/{uptime_check_config}' + 'organizations/{organization}/services/{service}', ), + organizationServiceServiceLevelObjectivePathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/services/{service}/serviceLevelObjectives/{service_level_objective}', + ), + organizationUptimeCheckConfigPathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/uptimeCheckConfigs/{uptime_check_config}', + ), projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}' + 'projects/{project}', ), projectAlertPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/alertPolicies/{alert_policy}' + 'projects/{project}/alertPolicies/{alert_policy}', ), projectAlertPolicyConditionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/alertPolicies/{alert_policy}/conditions/{condition}' + 'projects/{project}/alertPolicies/{alert_policy}/conditions/{condition}', ), projectChannelDescriptorPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/notificationChannelDescriptors/{channel_descriptor}' + 'projects/{project}/notificationChannelDescriptors/{channel_descriptor}', ), projectGroupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/groups/{group}' + 'projects/{project}/groups/{group}', ), projectMetricDescriptorPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/metricDescriptors/{metric_descriptor=**}' - ), - projectMonitoredResourceDescriptorPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/monitoredResourceDescriptors/{monitored_resource_descriptor}' + 'projects/{project}/metricDescriptors/{metric_descriptor=**}', ), + projectMonitoredResourceDescriptorPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/monitoredResourceDescriptors/{monitored_resource_descriptor}', + ), projectNotificationChannelPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/notificationChannels/{notification_channel}' + 'projects/{project}/notificationChannels/{notification_channel}', ), projectServicePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/services/{service}' - ), - projectServiceServiceLevelObjectivePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/services/{service}/serviceLevelObjectives/{service_level_objective}' + 'projects/{project}/services/{service}', ), + projectServiceServiceLevelObjectivePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/services/{service}/serviceLevelObjectives/{service_level_objective}', + ), projectTimeSeriesPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/timeSeries/{time_series}' + 'projects/{project}/timeSeries/{time_series}', ), projectUptimeCheckConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/uptimeCheckConfigs/{uptime_check_config}' + 'projects/{project}/uptimeCheckConfigs/{uptime_check_config}', ), snoozePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/snoozes/{snooze}' + 'projects/{project}/snoozes/{snooze}', ), }; @@ -283,18 +319,30 @@ export class MetricServiceClient { // (e.g. 50 results at a time, with tokens to get subsequent // pages). Denote the keys used for pagination and results. this.descriptors.page = { - listMonitoredResourceDescriptors: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'resourceDescriptors'), - listMetricDescriptors: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'metricDescriptors'), - listTimeSeries: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'timeSeries') + listMonitoredResourceDescriptors: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'resourceDescriptors', + ), + listMetricDescriptors: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'metricDescriptors', + ), + listTimeSeries: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'timeSeries', + ), }; // Put together the default options sent with requests. this._defaults = this._gaxGrpc.constructSettings( - 'google.monitoring.v3.MetricService', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + 'google.monitoring.v3.MetricService', + gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, + { 'x-goog-api-client': clientHeader.join(' ') }, + ); // Set up a dictionary of "inner API calls"; the core implementation // of calling the API is handled in `google-gax`, with this code @@ -325,37 +373,50 @@ export class MetricServiceClient { // Put together the "service stub" for // google.monitoring.v3.MetricService. this.metricServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.monitoring.v3.MetricService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.monitoring.v3.MetricService', + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any (this._protos as any).google.monitoring.v3.MetricService, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; + this._opts, + this._providedCustomServicePath, + ) as Promise<{ [method: string]: Function }>; // Iterate over each of the methods that the service provides // and create an API call method for each. - const metricServiceStubMethods = - ['listMonitoredResourceDescriptors', 'getMonitoredResourceDescriptor', 'listMetricDescriptors', 'getMetricDescriptor', 'createMetricDescriptor', 'deleteMetricDescriptor', 'listTimeSeries', 'createTimeSeries', 'createServiceTimeSeries']; + const metricServiceStubMethods = [ + 'listMonitoredResourceDescriptors', + 'getMonitoredResourceDescriptor', + 'listMetricDescriptors', + 'getMetricDescriptor', + 'createMetricDescriptor', + 'deleteMetricDescriptor', + 'listTimeSeries', + 'createTimeSeries', + 'createServiceTimeSeries', + ]; for (const methodName of metricServiceStubMethods) { const callPromise = this.metricServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { + (stub) => + (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error | null | undefined) => () => { throw err; - }); + }, + ); - const descriptor = - this.descriptors.page[methodName] || - undefined; + const descriptor = this.descriptors.page[methodName] || undefined; const apiCall = this._gaxModule.createApiCall( callPromise, this._defaults[methodName], descriptor, - this._opts.fallback + this._opts.fallback, ); this.innerApiCalls[methodName] = apiCall; @@ -370,8 +431,14 @@ export class MetricServiceClient { * @returns {string} The DNS address for this service. */ static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); } return 'monitoring.googleapis.com'; } @@ -382,8 +449,14 @@ export class MetricServiceClient { * @returns {string} The DNS address for this service. */ static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); } return 'monitoring.googleapis.com'; } @@ -418,7 +491,7 @@ export class MetricServiceClient { 'https://www.googleapis.com/auth/cloud-platform', 'https://www.googleapis.com/auth/monitoring', 'https://www.googleapis.com/auth/monitoring.read', - 'https://www.googleapis.com/auth/monitoring.write' + 'https://www.googleapis.com/auth/monitoring.write', ]; } @@ -428,8 +501,9 @@ export class MetricServiceClient { * Return the project ID used by this class. * @returns {Promise} A promise that resolves to string containing the project ID. */ - getProjectId(callback?: Callback): - Promise|void { + getProjectId( + callback?: Callback, + ): Promise | void { if (callback) { this.auth.getProjectId(callback); return; @@ -440,734 +514,1008 @@ export class MetricServiceClient { // ------------------- // -- Service calls -- // ------------------- -/** - * Gets a single monitored resource descriptor. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The monitored resource descriptor to get. The format is: - * - * projects/[PROJECT_ID_OR_NUMBER]/monitoredResourceDescriptors/[RESOURCE_TYPE] - * - * The `[RESOURCE_TYPE]` is a predefined type, such as - * `cloudsql_database`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.api.MonitoredResourceDescriptor|MonitoredResourceDescriptor}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v3/metric_service.get_monitored_resource_descriptor.js - * region_tag:monitoring_v3_generated_MetricService_GetMonitoredResourceDescriptor_async - */ + /** + * Gets a single monitored resource descriptor. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The monitored resource descriptor to get. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER]/monitoredResourceDescriptors/[RESOURCE_TYPE] + * + * The `[RESOURCE_TYPE]` is a predefined type, such as + * `cloudsql_database`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.api.MonitoredResourceDescriptor|MonitoredResourceDescriptor}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v3/metric_service.get_monitored_resource_descriptor.js + * region_tag:monitoring_v3_generated_MetricService_GetMonitoredResourceDescriptor_async + */ getMonitoredResourceDescriptor( - request?: protos.google.monitoring.v3.IGetMonitoredResourceDescriptorRequest, - options?: CallOptions): - Promise<[ - protos.google.api.IMonitoredResourceDescriptor, - protos.google.monitoring.v3.IGetMonitoredResourceDescriptorRequest|undefined, {}|undefined - ]>; + request?: protos.google.monitoring.v3.IGetMonitoredResourceDescriptorRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.api.IMonitoredResourceDescriptor, + ( + | protos.google.monitoring.v3.IGetMonitoredResourceDescriptorRequest + | undefined + ), + {} | undefined, + ] + >; getMonitoredResourceDescriptor( - request: protos.google.monitoring.v3.IGetMonitoredResourceDescriptorRequest, - options: CallOptions, - callback: Callback< - protos.google.api.IMonitoredResourceDescriptor, - protos.google.monitoring.v3.IGetMonitoredResourceDescriptorRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.monitoring.v3.IGetMonitoredResourceDescriptorRequest, + options: CallOptions, + callback: Callback< + protos.google.api.IMonitoredResourceDescriptor, + | protos.google.monitoring.v3.IGetMonitoredResourceDescriptorRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getMonitoredResourceDescriptor( - request: protos.google.monitoring.v3.IGetMonitoredResourceDescriptorRequest, - callback: Callback< - protos.google.api.IMonitoredResourceDescriptor, - protos.google.monitoring.v3.IGetMonitoredResourceDescriptorRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.monitoring.v3.IGetMonitoredResourceDescriptorRequest, + callback: Callback< + protos.google.api.IMonitoredResourceDescriptor, + | protos.google.monitoring.v3.IGetMonitoredResourceDescriptorRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getMonitoredResourceDescriptor( - request?: protos.google.monitoring.v3.IGetMonitoredResourceDescriptorRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.api.IMonitoredResourceDescriptor, - protos.google.monitoring.v3.IGetMonitoredResourceDescriptorRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.monitoring.v3.IGetMonitoredResourceDescriptorRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.api.IMonitoredResourceDescriptor, - protos.google.monitoring.v3.IGetMonitoredResourceDescriptorRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.api.IMonitoredResourceDescriptor, - protos.google.monitoring.v3.IGetMonitoredResourceDescriptorRequest|undefined, {}|undefined - ]>|void { + | protos.google.monitoring.v3.IGetMonitoredResourceDescriptorRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.api.IMonitoredResourceDescriptor, + | protos.google.monitoring.v3.IGetMonitoredResourceDescriptorRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.api.IMonitoredResourceDescriptor, + ( + | protos.google.monitoring.v3.IGetMonitoredResourceDescriptorRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('getMonitoredResourceDescriptor request %j', request); - const wrappedCallback: Callback< - protos.google.api.IMonitoredResourceDescriptor, - protos.google.monitoring.v3.IGetMonitoredResourceDescriptorRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.api.IMonitoredResourceDescriptor, + | protos.google.monitoring.v3.IGetMonitoredResourceDescriptorRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { - this._log.info('getMonitoredResourceDescriptor response %j', response); + this._log.info( + 'getMonitoredResourceDescriptor response %j', + response, + ); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.getMonitoredResourceDescriptor(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.api.IMonitoredResourceDescriptor, - protos.google.monitoring.v3.IGetMonitoredResourceDescriptorRequest|undefined, - {}|undefined - ]) => { - this._log.info('getMonitoredResourceDescriptor 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); + return this.innerApiCalls + .getMonitoredResourceDescriptor(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.api.IMonitoredResourceDescriptor, + ( + | protos.google.monitoring.v3.IGetMonitoredResourceDescriptorRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info( + 'getMonitoredResourceDescriptor 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 single metric descriptor. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The metric descriptor on which to execute the request. The format - * is: - * - * projects/[PROJECT_ID_OR_NUMBER]/metricDescriptors/[METRIC_ID] - * - * An example value of `[METRIC_ID]` is - * `"compute.googleapis.com/instance/disk/read_bytes_count"`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.api.MetricDescriptor|MetricDescriptor}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v3/metric_service.get_metric_descriptor.js - * region_tag:monitoring_v3_generated_MetricService_GetMetricDescriptor_async - */ + /** + * Gets a single metric descriptor. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The metric descriptor on which to execute the request. The format + * is: + * + * projects/[PROJECT_ID_OR_NUMBER]/metricDescriptors/[METRIC_ID] + * + * An example value of `[METRIC_ID]` is + * `"compute.googleapis.com/instance/disk/read_bytes_count"`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.api.MetricDescriptor|MetricDescriptor}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v3/metric_service.get_metric_descriptor.js + * region_tag:monitoring_v3_generated_MetricService_GetMetricDescriptor_async + */ getMetricDescriptor( - request?: protos.google.monitoring.v3.IGetMetricDescriptorRequest, - options?: CallOptions): - Promise<[ - protos.google.api.IMetricDescriptor, - protos.google.monitoring.v3.IGetMetricDescriptorRequest|undefined, {}|undefined - ]>; + request?: protos.google.monitoring.v3.IGetMetricDescriptorRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.api.IMetricDescriptor, + protos.google.monitoring.v3.IGetMetricDescriptorRequest | undefined, + {} | undefined, + ] + >; getMetricDescriptor( - request: protos.google.monitoring.v3.IGetMetricDescriptorRequest, - options: CallOptions, - callback: Callback< - protos.google.api.IMetricDescriptor, - protos.google.monitoring.v3.IGetMetricDescriptorRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.monitoring.v3.IGetMetricDescriptorRequest, + options: CallOptions, + callback: Callback< + protos.google.api.IMetricDescriptor, + | protos.google.monitoring.v3.IGetMetricDescriptorRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getMetricDescriptor( - request: protos.google.monitoring.v3.IGetMetricDescriptorRequest, - callback: Callback< - protos.google.api.IMetricDescriptor, - protos.google.monitoring.v3.IGetMetricDescriptorRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.monitoring.v3.IGetMetricDescriptorRequest, + callback: Callback< + protos.google.api.IMetricDescriptor, + | protos.google.monitoring.v3.IGetMetricDescriptorRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getMetricDescriptor( - request?: protos.google.monitoring.v3.IGetMetricDescriptorRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.api.IMetricDescriptor, - protos.google.monitoring.v3.IGetMetricDescriptorRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.monitoring.v3.IGetMetricDescriptorRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.api.IMetricDescriptor, - protos.google.monitoring.v3.IGetMetricDescriptorRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.api.IMetricDescriptor, - protos.google.monitoring.v3.IGetMetricDescriptorRequest|undefined, {}|undefined - ]>|void { + | protos.google.monitoring.v3.IGetMetricDescriptorRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.api.IMetricDescriptor, + | protos.google.monitoring.v3.IGetMetricDescriptorRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.api.IMetricDescriptor, + protos.google.monitoring.v3.IGetMetricDescriptorRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('getMetricDescriptor request %j', request); - const wrappedCallback: Callback< - protos.google.api.IMetricDescriptor, - protos.google.monitoring.v3.IGetMetricDescriptorRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.api.IMetricDescriptor, + | protos.google.monitoring.v3.IGetMetricDescriptorRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('getMetricDescriptor response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.getMetricDescriptor(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.api.IMetricDescriptor, - protos.google.monitoring.v3.IGetMetricDescriptorRequest|undefined, - {}|undefined - ]) => { - this._log.info('getMetricDescriptor 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); + return this.innerApiCalls + .getMetricDescriptor(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.api.IMetricDescriptor, + protos.google.monitoring.v3.IGetMetricDescriptorRequest | undefined, + {} | undefined, + ]) => { + this._log.info('getMetricDescriptor 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 metric descriptor. - * The creation is executed asynchronously. - * User-created metric descriptors define - * [custom metrics](https://cloud.google.com/monitoring/custom-metrics). - * The metric descriptor is updated if it already exists, - * except that metric labels are never removed. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The - * [project](https://cloud.google.com/monitoring/api/v3#project_name) on which - * to execute the request. The format is: - * 4 - * projects/[PROJECT_ID_OR_NUMBER] - * @param {google.api.MetricDescriptor} request.metricDescriptor - * Required. The new [custom - * metric](https://cloud.google.com/monitoring/custom-metrics) descriptor. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.api.MetricDescriptor|MetricDescriptor}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v3/metric_service.create_metric_descriptor.js - * region_tag:monitoring_v3_generated_MetricService_CreateMetricDescriptor_async - */ + /** + * Creates a new metric descriptor. + * The creation is executed asynchronously. + * User-created metric descriptors define + * [custom metrics](https://cloud.google.com/monitoring/custom-metrics). + * The metric descriptor is updated if it already exists, + * except that metric labels are never removed. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The + * [project](https://cloud.google.com/monitoring/api/v3#project_name) on which + * to execute the request. The format is: + * 4 + * projects/[PROJECT_ID_OR_NUMBER] + * @param {google.api.MetricDescriptor} request.metricDescriptor + * Required. The new [custom + * metric](https://cloud.google.com/monitoring/custom-metrics) descriptor. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.api.MetricDescriptor|MetricDescriptor}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v3/metric_service.create_metric_descriptor.js + * region_tag:monitoring_v3_generated_MetricService_CreateMetricDescriptor_async + */ createMetricDescriptor( - request?: protos.google.monitoring.v3.ICreateMetricDescriptorRequest, - options?: CallOptions): - Promise<[ - protos.google.api.IMetricDescriptor, - protos.google.monitoring.v3.ICreateMetricDescriptorRequest|undefined, {}|undefined - ]>; + request?: protos.google.monitoring.v3.ICreateMetricDescriptorRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.api.IMetricDescriptor, + protos.google.monitoring.v3.ICreateMetricDescriptorRequest | undefined, + {} | undefined, + ] + >; createMetricDescriptor( - request: protos.google.monitoring.v3.ICreateMetricDescriptorRequest, - options: CallOptions, - callback: Callback< - protos.google.api.IMetricDescriptor, - protos.google.monitoring.v3.ICreateMetricDescriptorRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.monitoring.v3.ICreateMetricDescriptorRequest, + options: CallOptions, + callback: Callback< + protos.google.api.IMetricDescriptor, + | protos.google.monitoring.v3.ICreateMetricDescriptorRequest + | null + | undefined, + {} | null | undefined + >, + ): void; createMetricDescriptor( - request: protos.google.monitoring.v3.ICreateMetricDescriptorRequest, - callback: Callback< - protos.google.api.IMetricDescriptor, - protos.google.monitoring.v3.ICreateMetricDescriptorRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.monitoring.v3.ICreateMetricDescriptorRequest, + callback: Callback< + protos.google.api.IMetricDescriptor, + | protos.google.monitoring.v3.ICreateMetricDescriptorRequest + | null + | undefined, + {} | null | undefined + >, + ): void; createMetricDescriptor( - request?: protos.google.monitoring.v3.ICreateMetricDescriptorRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.api.IMetricDescriptor, - protos.google.monitoring.v3.ICreateMetricDescriptorRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.monitoring.v3.ICreateMetricDescriptorRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.api.IMetricDescriptor, - protos.google.monitoring.v3.ICreateMetricDescriptorRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.api.IMetricDescriptor, - protos.google.monitoring.v3.ICreateMetricDescriptorRequest|undefined, {}|undefined - ]>|void { + | protos.google.monitoring.v3.ICreateMetricDescriptorRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.api.IMetricDescriptor, + | protos.google.monitoring.v3.ICreateMetricDescriptorRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.api.IMetricDescriptor, + protos.google.monitoring.v3.ICreateMetricDescriptorRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('createMetricDescriptor request %j', request); - const wrappedCallback: Callback< - protos.google.api.IMetricDescriptor, - protos.google.monitoring.v3.ICreateMetricDescriptorRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.api.IMetricDescriptor, + | protos.google.monitoring.v3.ICreateMetricDescriptorRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('createMetricDescriptor response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.createMetricDescriptor(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.api.IMetricDescriptor, - protos.google.monitoring.v3.ICreateMetricDescriptorRequest|undefined, - {}|undefined - ]) => { - this._log.info('createMetricDescriptor 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); + return this.innerApiCalls + .createMetricDescriptor(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.api.IMetricDescriptor, + ( + | protos.google.monitoring.v3.ICreateMetricDescriptorRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('createMetricDescriptor 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 metric descriptor. Only user-created - * [custom metrics](https://cloud.google.com/monitoring/custom-metrics) can be - * deleted. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The metric descriptor on which to execute the request. The format - * is: - * - * projects/[PROJECT_ID_OR_NUMBER]/metricDescriptors/[METRIC_ID] - * - * An example of `[METRIC_ID]` is: - * `"custom.googleapis.com/my_test_metric"`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v3/metric_service.delete_metric_descriptor.js - * region_tag:monitoring_v3_generated_MetricService_DeleteMetricDescriptor_async - */ + /** + * Deletes a metric descriptor. Only user-created + * [custom metrics](https://cloud.google.com/monitoring/custom-metrics) can be + * deleted. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The metric descriptor on which to execute the request. The format + * is: + * + * projects/[PROJECT_ID_OR_NUMBER]/metricDescriptors/[METRIC_ID] + * + * An example of `[METRIC_ID]` is: + * `"custom.googleapis.com/my_test_metric"`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.protobuf.Empty|Empty}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v3/metric_service.delete_metric_descriptor.js + * region_tag:monitoring_v3_generated_MetricService_DeleteMetricDescriptor_async + */ deleteMetricDescriptor( - request?: protos.google.monitoring.v3.IDeleteMetricDescriptorRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteMetricDescriptorRequest|undefined, {}|undefined - ]>; + request?: protos.google.monitoring.v3.IDeleteMetricDescriptorRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.protobuf.IEmpty, + protos.google.monitoring.v3.IDeleteMetricDescriptorRequest | undefined, + {} | undefined, + ] + >; deleteMetricDescriptor( - request: protos.google.monitoring.v3.IDeleteMetricDescriptorRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteMetricDescriptorRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.monitoring.v3.IDeleteMetricDescriptorRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + | protos.google.monitoring.v3.IDeleteMetricDescriptorRequest + | null + | undefined, + {} | null | undefined + >, + ): void; deleteMetricDescriptor( - request: protos.google.monitoring.v3.IDeleteMetricDescriptorRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteMetricDescriptorRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.monitoring.v3.IDeleteMetricDescriptorRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + | protos.google.monitoring.v3.IDeleteMetricDescriptorRequest + | null + | undefined, + {} | null | undefined + >, + ): void; deleteMetricDescriptor( - request?: protos.google.monitoring.v3.IDeleteMetricDescriptorRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteMetricDescriptorRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.monitoring.v3.IDeleteMetricDescriptorRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteMetricDescriptorRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteMetricDescriptorRequest|undefined, {}|undefined - ]>|void { + | protos.google.monitoring.v3.IDeleteMetricDescriptorRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.IEmpty, + | protos.google.monitoring.v3.IDeleteMetricDescriptorRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.protobuf.IEmpty, + protos.google.monitoring.v3.IDeleteMetricDescriptorRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('deleteMetricDescriptor request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteMetricDescriptorRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.protobuf.IEmpty, + | protos.google.monitoring.v3.IDeleteMetricDescriptorRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('deleteMetricDescriptor response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.deleteMetricDescriptor(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteMetricDescriptorRequest|undefined, - {}|undefined - ]) => { - this._log.info('deleteMetricDescriptor 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); + return this.innerApiCalls + .deleteMetricDescriptor(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.protobuf.IEmpty, + ( + | protos.google.monitoring.v3.IDeleteMetricDescriptorRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('deleteMetricDescriptor 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 adds data to one or more time series. - * The response is empty if all time series in the request were written. - * If any time series could not be written, a corresponding failure message is - * included in the error response. - * This method does not support - * [resource locations constraint of an organization - * policy](https://cloud.google.com/resource-manager/docs/organization-policy/defining-locations#setting_the_organization_policy). - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The - * [project](https://cloud.google.com/monitoring/api/v3#project_name) on which - * to execute the request. The format is: - * - * projects/[PROJECT_ID_OR_NUMBER] - * @param {number[]} request.timeSeries - * Required. The new data to be added to a list of time series. - * Adds at most one data point to each of several time series. The new data - * point must be more recent than any other point in its time series. Each - * `TimeSeries` value must fully specify a unique time series by supplying - * all label values for the metric and the monitored resource. - * - * The maximum number of `TimeSeries` objects per `Create` request is 200. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v3/metric_service.create_time_series.js - * region_tag:monitoring_v3_generated_MetricService_CreateTimeSeries_async - */ + /** + * Creates or adds data to one or more time series. + * The response is empty if all time series in the request were written. + * If any time series could not be written, a corresponding failure message is + * included in the error response. + * This method does not support + * [resource locations constraint of an organization + * policy](https://cloud.google.com/resource-manager/docs/organization-policy/defining-locations#setting_the_organization_policy). + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The + * [project](https://cloud.google.com/monitoring/api/v3#project_name) on which + * to execute the request. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER] + * @param {number[]} request.timeSeries + * Required. The new data to be added to a list of time series. + * Adds at most one data point to each of several time series. The new data + * point must be more recent than any other point in its time series. Each + * `TimeSeries` value must fully specify a unique time series by supplying + * all label values for the metric and the monitored resource. + * + * The maximum number of `TimeSeries` objects per `Create` request is 200. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.protobuf.Empty|Empty}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v3/metric_service.create_time_series.js + * region_tag:monitoring_v3_generated_MetricService_CreateTimeSeries_async + */ createTimeSeries( - request?: protos.google.monitoring.v3.ICreateTimeSeriesRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.ICreateTimeSeriesRequest|undefined, {}|undefined - ]>; + request?: protos.google.monitoring.v3.ICreateTimeSeriesRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.protobuf.IEmpty, + protos.google.monitoring.v3.ICreateTimeSeriesRequest | undefined, + {} | undefined, + ] + >; createTimeSeries( - request: protos.google.monitoring.v3.ICreateTimeSeriesRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.ICreateTimeSeriesRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.monitoring.v3.ICreateTimeSeriesRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.monitoring.v3.ICreateTimeSeriesRequest | null | undefined, + {} | null | undefined + >, + ): void; createTimeSeries( - request: protos.google.monitoring.v3.ICreateTimeSeriesRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.ICreateTimeSeriesRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.monitoring.v3.ICreateTimeSeriesRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.monitoring.v3.ICreateTimeSeriesRequest | null | undefined, + {} | null | undefined + >, + ): void; createTimeSeries( - request?: protos.google.monitoring.v3.ICreateTimeSeriesRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.ICreateTimeSeriesRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.monitoring.v3.ICreateTimeSeriesRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.ICreateTimeSeriesRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.ICreateTimeSeriesRequest|undefined, {}|undefined - ]>|void { + | protos.google.monitoring.v3.ICreateTimeSeriesRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.monitoring.v3.ICreateTimeSeriesRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.protobuf.IEmpty, + protos.google.monitoring.v3.ICreateTimeSeriesRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('createTimeSeries request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.ICreateTimeSeriesRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.protobuf.IEmpty, + | protos.google.monitoring.v3.ICreateTimeSeriesRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('createTimeSeries response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.createTimeSeries(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.ICreateTimeSeriesRequest|undefined, - {}|undefined - ]) => { - this._log.info('createTimeSeries 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); + return this.innerApiCalls + .createTimeSeries(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.protobuf.IEmpty, + protos.google.monitoring.v3.ICreateTimeSeriesRequest | undefined, + {} | undefined, + ]) => { + this._log.info('createTimeSeries 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 adds data to one or more service time series. A service time - * series is a time series for a metric from a Google Cloud service. The - * response is empty if all time series in the request were written. If any - * time series could not be written, a corresponding failure message is - * included in the error response. This endpoint rejects writes to - * user-defined metrics. - * This method is only for use by Google Cloud services. Use - * {@link protos.google.monitoring.v3.MetricService.CreateTimeSeries|projects.timeSeries.create} - * instead. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The - * [project](https://cloud.google.com/monitoring/api/v3#project_name) on which - * to execute the request. The format is: - * - * projects/[PROJECT_ID_OR_NUMBER] - * @param {number[]} request.timeSeries - * Required. The new data to be added to a list of time series. - * Adds at most one data point to each of several time series. The new data - * point must be more recent than any other point in its time series. Each - * `TimeSeries` value must fully specify a unique time series by supplying - * all label values for the metric and the monitored resource. - * - * The maximum number of `TimeSeries` objects per `Create` request is 200. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v3/metric_service.create_service_time_series.js - * region_tag:monitoring_v3_generated_MetricService_CreateServiceTimeSeries_async - */ + /** + * Creates or adds data to one or more service time series. A service time + * series is a time series for a metric from a Google Cloud service. The + * response is empty if all time series in the request were written. If any + * time series could not be written, a corresponding failure message is + * included in the error response. This endpoint rejects writes to + * user-defined metrics. + * This method is only for use by Google Cloud services. Use + * {@link protos.google.monitoring.v3.MetricService.CreateTimeSeries|projects.timeSeries.create} + * instead. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The + * [project](https://cloud.google.com/monitoring/api/v3#project_name) on which + * to execute the request. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER] + * @param {number[]} request.timeSeries + * Required. The new data to be added to a list of time series. + * Adds at most one data point to each of several time series. The new data + * point must be more recent than any other point in its time series. Each + * `TimeSeries` value must fully specify a unique time series by supplying + * all label values for the metric and the monitored resource. + * + * The maximum number of `TimeSeries` objects per `Create` request is 200. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.protobuf.Empty|Empty}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v3/metric_service.create_service_time_series.js + * region_tag:monitoring_v3_generated_MetricService_CreateServiceTimeSeries_async + */ createServiceTimeSeries( - request?: protos.google.monitoring.v3.ICreateTimeSeriesRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.ICreateTimeSeriesRequest|undefined, {}|undefined - ]>; + request?: protos.google.monitoring.v3.ICreateTimeSeriesRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.protobuf.IEmpty, + protos.google.monitoring.v3.ICreateTimeSeriesRequest | undefined, + {} | undefined, + ] + >; createServiceTimeSeries( - request: protos.google.monitoring.v3.ICreateTimeSeriesRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.ICreateTimeSeriesRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.monitoring.v3.ICreateTimeSeriesRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.monitoring.v3.ICreateTimeSeriesRequest | null | undefined, + {} | null | undefined + >, + ): void; createServiceTimeSeries( - request: protos.google.monitoring.v3.ICreateTimeSeriesRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.ICreateTimeSeriesRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.monitoring.v3.ICreateTimeSeriesRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.monitoring.v3.ICreateTimeSeriesRequest | null | undefined, + {} | null | undefined + >, + ): void; createServiceTimeSeries( - request?: protos.google.monitoring.v3.ICreateTimeSeriesRequest, - optionsOrCallback?: CallOptions|Callback< + request?: protos.google.monitoring.v3.ICreateTimeSeriesRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.ICreateTimeSeriesRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.ICreateTimeSeriesRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.ICreateTimeSeriesRequest|undefined, {}|undefined - ]>|void { + | protos.google.monitoring.v3.ICreateTimeSeriesRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.monitoring.v3.ICreateTimeSeriesRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.protobuf.IEmpty, + protos.google.monitoring.v3.ICreateTimeSeriesRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('createServiceTimeSeries request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.ICreateTimeSeriesRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.protobuf.IEmpty, + | protos.google.monitoring.v3.ICreateTimeSeriesRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('createServiceTimeSeries response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.createServiceTimeSeries(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.ICreateTimeSeriesRequest|undefined, - {}|undefined - ]) => { - this._log.info('createServiceTimeSeries 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); + return this.innerApiCalls + .createServiceTimeSeries(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.protobuf.IEmpty, + protos.google.monitoring.v3.ICreateTimeSeriesRequest | undefined, + {} | undefined, + ]) => { + this._log.info('createServiceTimeSeries 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; }); } - /** - * Lists monitored resource descriptors that match a filter. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The - * [project](https://cloud.google.com/monitoring/api/v3#project_name) on which - * to execute the request. The format is: - * - * projects/[PROJECT_ID_OR_NUMBER] - * @param {string} request.filter - * An optional [filter](https://cloud.google.com/monitoring/api/v3/filters) - * describing the descriptors to be returned. The filter can reference the - * descriptor's type and labels. For example, the following filter returns - * only Google Compute Engine descriptors that have an `id` label: - * - * resource.type = starts_with("gce_") AND resource.label:id - * @param {number} request.pageSize - * A positive number that is the maximum number of results to return. - * @param {string} request.pageToken - * If this field is not empty then it must contain the `nextPageToken` value - * returned by a previous call to this method. Using this field causes the - * method to return additional results from the previous method call. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of {@link protos.google.api.MonitoredResourceDescriptor|MonitoredResourceDescriptor}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listMonitoredResourceDescriptorsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Lists monitored resource descriptors that match a filter. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The + * [project](https://cloud.google.com/monitoring/api/v3#project_name) on which + * to execute the request. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER] + * @param {string} request.filter + * An optional [filter](https://cloud.google.com/monitoring/api/v3/filters) + * describing the descriptors to be returned. The filter can reference the + * descriptor's type and labels. For example, the following filter returns + * only Google Compute Engine descriptors that have an `id` label: + * + * resource.type = starts_with("gce_") AND resource.label:id + * @param {number} request.pageSize + * A positive number that is the maximum number of results to return. + * @param {string} request.pageToken + * If this field is not empty then it must contain the `nextPageToken` value + * returned by a previous call to this method. Using this field causes the + * method to return additional results from the previous method call. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of {@link protos.google.api.MonitoredResourceDescriptor|MonitoredResourceDescriptor}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listMonitoredResourceDescriptorsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listMonitoredResourceDescriptors( - request?: protos.google.monitoring.v3.IListMonitoredResourceDescriptorsRequest, - options?: CallOptions): - Promise<[ - protos.google.api.IMonitoredResourceDescriptor[], - protos.google.monitoring.v3.IListMonitoredResourceDescriptorsRequest|null, - protos.google.monitoring.v3.IListMonitoredResourceDescriptorsResponse - ]>; + request?: protos.google.monitoring.v3.IListMonitoredResourceDescriptorsRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.api.IMonitoredResourceDescriptor[], + protos.google.monitoring.v3.IListMonitoredResourceDescriptorsRequest | null, + protos.google.monitoring.v3.IListMonitoredResourceDescriptorsResponse, + ] + >; listMonitoredResourceDescriptors( - request: protos.google.monitoring.v3.IListMonitoredResourceDescriptorsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.monitoring.v3.IListMonitoredResourceDescriptorsRequest, - protos.google.monitoring.v3.IListMonitoredResourceDescriptorsResponse|null|undefined, - protos.google.api.IMonitoredResourceDescriptor>): void; + request: protos.google.monitoring.v3.IListMonitoredResourceDescriptorsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.monitoring.v3.IListMonitoredResourceDescriptorsRequest, + | protos.google.monitoring.v3.IListMonitoredResourceDescriptorsResponse + | null + | undefined, + protos.google.api.IMonitoredResourceDescriptor + >, + ): void; listMonitoredResourceDescriptors( - request: protos.google.monitoring.v3.IListMonitoredResourceDescriptorsRequest, - callback: PaginationCallback< - protos.google.monitoring.v3.IListMonitoredResourceDescriptorsRequest, - protos.google.monitoring.v3.IListMonitoredResourceDescriptorsResponse|null|undefined, - protos.google.api.IMonitoredResourceDescriptor>): void; + request: protos.google.monitoring.v3.IListMonitoredResourceDescriptorsRequest, + callback: PaginationCallback< + protos.google.monitoring.v3.IListMonitoredResourceDescriptorsRequest, + | protos.google.monitoring.v3.IListMonitoredResourceDescriptorsResponse + | null + | undefined, + protos.google.api.IMonitoredResourceDescriptor + >, + ): void; listMonitoredResourceDescriptors( - request?: protos.google.monitoring.v3.IListMonitoredResourceDescriptorsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.monitoring.v3.IListMonitoredResourceDescriptorsRequest, - protos.google.monitoring.v3.IListMonitoredResourceDescriptorsResponse|null|undefined, - protos.google.api.IMonitoredResourceDescriptor>, - callback?: PaginationCallback< + request?: protos.google.monitoring.v3.IListMonitoredResourceDescriptorsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.monitoring.v3.IListMonitoredResourceDescriptorsRequest, - protos.google.monitoring.v3.IListMonitoredResourceDescriptorsResponse|null|undefined, - protos.google.api.IMonitoredResourceDescriptor>): - Promise<[ - protos.google.api.IMonitoredResourceDescriptor[], - protos.google.monitoring.v3.IListMonitoredResourceDescriptorsRequest|null, - protos.google.monitoring.v3.IListMonitoredResourceDescriptorsResponse - ]>|void { + | protos.google.monitoring.v3.IListMonitoredResourceDescriptorsResponse + | null + | undefined, + protos.google.api.IMonitoredResourceDescriptor + >, + callback?: PaginationCallback< + protos.google.monitoring.v3.IListMonitoredResourceDescriptorsRequest, + | protos.google.monitoring.v3.IListMonitoredResourceDescriptorsResponse + | null + | undefined, + protos.google.api.IMonitoredResourceDescriptor + >, + ): Promise< + [ + protos.google.api.IMonitoredResourceDescriptor[], + protos.google.monitoring.v3.IListMonitoredResourceDescriptorsRequest | null, + protos.google.monitoring.v3.IListMonitoredResourceDescriptorsResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.monitoring.v3.IListMonitoredResourceDescriptorsRequest, - protos.google.monitoring.v3.IListMonitoredResourceDescriptorsResponse|null|undefined, - protos.google.api.IMonitoredResourceDescriptor>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.monitoring.v3.IListMonitoredResourceDescriptorsRequest, + | protos.google.monitoring.v3.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. @@ -1176,244 +1524,278 @@ export class MetricServiceClient { this._log.info('listMonitoredResourceDescriptors request %j', request); return this.innerApiCalls .listMonitoredResourceDescriptors(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.api.IMonitoredResourceDescriptor[], - protos.google.monitoring.v3.IListMonitoredResourceDescriptorsRequest|null, - protos.google.monitoring.v3.IListMonitoredResourceDescriptorsResponse - ]) => { - this._log.info('listMonitoredResourceDescriptors values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.api.IMonitoredResourceDescriptor[], + protos.google.monitoring.v3.IListMonitoredResourceDescriptorsRequest | null, + protos.google.monitoring.v3.IListMonitoredResourceDescriptorsResponse, + ]) => { + this._log.info( + 'listMonitoredResourceDescriptors values %j', + response, + ); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listMonitoredResourceDescriptors`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The - * [project](https://cloud.google.com/monitoring/api/v3#project_name) on which - * to execute the request. The format is: - * - * projects/[PROJECT_ID_OR_NUMBER] - * @param {string} request.filter - * An optional [filter](https://cloud.google.com/monitoring/api/v3/filters) - * describing the descriptors to be returned. The filter can reference the - * descriptor's type and labels. For example, the following filter returns - * only Google Compute Engine descriptors that have an `id` label: - * - * resource.type = starts_with("gce_") AND resource.label:id - * @param {number} request.pageSize - * A positive number that is the maximum number of results to return. - * @param {string} request.pageToken - * If this field is not empty then it must contain the `nextPageToken` value - * returned by a previous call to this method. Using this field causes the - * method to return additional results from the previous method call. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.api.MonitoredResourceDescriptor|MonitoredResourceDescriptor} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listMonitoredResourceDescriptorsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Equivalent to `listMonitoredResourceDescriptors`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The + * [project](https://cloud.google.com/monitoring/api/v3#project_name) on which + * to execute the request. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER] + * @param {string} request.filter + * An optional [filter](https://cloud.google.com/monitoring/api/v3/filters) + * describing the descriptors to be returned. The filter can reference the + * descriptor's type and labels. For example, the following filter returns + * only Google Compute Engine descriptors that have an `id` label: + * + * resource.type = starts_with("gce_") AND resource.label:id + * @param {number} request.pageSize + * A positive number that is the maximum number of results to return. + * @param {string} request.pageToken + * If this field is not empty then it must contain the `nextPageToken` value + * returned by a previous call to this method. Using this field causes the + * method to return additional results from the previous method call. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.api.MonitoredResourceDescriptor|MonitoredResourceDescriptor} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listMonitoredResourceDescriptorsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listMonitoredResourceDescriptorsStream( - request?: protos.google.monitoring.v3.IListMonitoredResourceDescriptorsRequest, - options?: CallOptions): - Transform{ + request?: protos.google.monitoring.v3.IListMonitoredResourceDescriptorsRequest, + options?: CallOptions, + ): Transform { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - const defaultCallSettings = this._defaults['listMonitoredResourceDescriptors']; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + const defaultCallSettings = + this._defaults['listMonitoredResourceDescriptors']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + 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, - callSettings + callSettings, ); } -/** - * Equivalent to `listMonitoredResourceDescriptors`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The - * [project](https://cloud.google.com/monitoring/api/v3#project_name) on which - * to execute the request. The format is: - * - * projects/[PROJECT_ID_OR_NUMBER] - * @param {string} request.filter - * An optional [filter](https://cloud.google.com/monitoring/api/v3/filters) - * describing the descriptors to be returned. The filter can reference the - * descriptor's type and labels. For example, the following filter returns - * only Google Compute Engine descriptors that have an `id` label: - * - * resource.type = starts_with("gce_") AND resource.label:id - * @param {number} request.pageSize - * A positive number that is the maximum number of results to return. - * @param {string} request.pageToken - * If this field is not empty then it must contain the `nextPageToken` value - * returned by a previous call to this method. Using this field causes the - * method to return additional results from the previous method call. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.api.MonitoredResourceDescriptor|MonitoredResourceDescriptor}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v3/metric_service.list_monitored_resource_descriptors.js - * region_tag:monitoring_v3_generated_MetricService_ListMonitoredResourceDescriptors_async - */ + /** + * Equivalent to `listMonitoredResourceDescriptors`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The + * [project](https://cloud.google.com/monitoring/api/v3#project_name) on which + * to execute the request. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER] + * @param {string} request.filter + * An optional [filter](https://cloud.google.com/monitoring/api/v3/filters) + * describing the descriptors to be returned. The filter can reference the + * descriptor's type and labels. For example, the following filter returns + * only Google Compute Engine descriptors that have an `id` label: + * + * resource.type = starts_with("gce_") AND resource.label:id + * @param {number} request.pageSize + * A positive number that is the maximum number of results to return. + * @param {string} request.pageToken + * If this field is not empty then it must contain the `nextPageToken` value + * returned by a previous call to this method. Using this field causes the + * method to return additional results from the previous method call. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.api.MonitoredResourceDescriptor|MonitoredResourceDescriptor}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v3/metric_service.list_monitored_resource_descriptors.js + * region_tag:monitoring_v3_generated_MetricService_ListMonitoredResourceDescriptors_async + */ listMonitoredResourceDescriptorsAsync( - request?: protos.google.monitoring.v3.IListMonitoredResourceDescriptorsRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.monitoring.v3.IListMonitoredResourceDescriptorsRequest, + options?: CallOptions, + ): AsyncIterable { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - const defaultCallSettings = this._defaults['listMonitoredResourceDescriptors']; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + const defaultCallSettings = + this._defaults['listMonitoredResourceDescriptors']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + 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 {}, - callSettings + callSettings, ) as AsyncIterable; } - /** - * Lists metric descriptors that match a filter. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The - * [project](https://cloud.google.com/monitoring/api/v3#project_name) on which - * to execute the request. The format is: - * - * projects/[PROJECT_ID_OR_NUMBER] - * @param {string} [request.filter] - * Optional. If this field is empty, all custom and - * system-defined metric descriptors are returned. - * Otherwise, the [filter](https://cloud.google.com/monitoring/api/v3/filters) - * specifies which metric descriptors are to be - * returned. For example, the following filter matches all - * [custom metrics](https://cloud.google.com/monitoring/custom-metrics): - * - * metric.type = starts_with("custom.googleapis.com/") - * @param {number} [request.pageSize] - * Optional. A positive number that is the maximum number of results to - * return. The default and maximum value is 10,000. If a page_size <= 0 or > - * 10,000 is submitted, will instead return a maximum of 10,000 results. - * @param {string} [request.pageToken] - * Optional. If this field is not empty then it must contain the - * `nextPageToken` value returned by a previous call to this method. Using - * this field causes the method to return additional results from the previous - * method call. - * @param {boolean} [request.activeOnly] - * Optional. If true, only metrics and monitored resource types that have - * recent data (within roughly 25 hours) will be included in the response. - * - If a metric descriptor enumerates monitored resource types, only the - * monitored resource types for which the metric type has recent data will - * be included in the returned metric descriptor, and if none of them have - * recent data, the metric descriptor will not be returned. - * - If a metric descriptor does not enumerate the compatible monitored - * resource types, it will be returned only if the metric type has recent - * data for some monitored resource type. The returned descriptor will not - * enumerate any monitored resource types. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of {@link protos.google.api.MetricDescriptor|MetricDescriptor}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listMetricDescriptorsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Lists metric descriptors that match a filter. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The + * [project](https://cloud.google.com/monitoring/api/v3#project_name) on which + * to execute the request. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER] + * @param {string} [request.filter] + * Optional. If this field is empty, all custom and + * system-defined metric descriptors are returned. + * Otherwise, the [filter](https://cloud.google.com/monitoring/api/v3/filters) + * specifies which metric descriptors are to be + * returned. For example, the following filter matches all + * [custom metrics](https://cloud.google.com/monitoring/custom-metrics): + * + * metric.type = starts_with("custom.googleapis.com/") + * @param {number} [request.pageSize] + * Optional. A positive number that is the maximum number of results to + * return. The default and maximum value is 10,000. If a page_size <= 0 or > + * 10,000 is submitted, will instead return a maximum of 10,000 results. + * @param {string} [request.pageToken] + * Optional. If this field is not empty then it must contain the + * `nextPageToken` value returned by a previous call to this method. Using + * this field causes the method to return additional results from the previous + * method call. + * @param {boolean} [request.activeOnly] + * Optional. If true, only metrics and monitored resource types that have + * recent data (within roughly 25 hours) will be included in the response. + * - If a metric descriptor enumerates monitored resource types, only the + * monitored resource types for which the metric type has recent data will + * be included in the returned metric descriptor, and if none of them have + * recent data, the metric descriptor will not be returned. + * - If a metric descriptor does not enumerate the compatible monitored + * resource types, it will be returned only if the metric type has recent + * data for some monitored resource type. The returned descriptor will not + * enumerate any monitored resource types. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of {@link protos.google.api.MetricDescriptor|MetricDescriptor}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listMetricDescriptorsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listMetricDescriptors( - request?: protos.google.monitoring.v3.IListMetricDescriptorsRequest, - options?: CallOptions): - Promise<[ - protos.google.api.IMetricDescriptor[], - protos.google.monitoring.v3.IListMetricDescriptorsRequest|null, - protos.google.monitoring.v3.IListMetricDescriptorsResponse - ]>; + request?: protos.google.monitoring.v3.IListMetricDescriptorsRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.api.IMetricDescriptor[], + protos.google.monitoring.v3.IListMetricDescriptorsRequest | null, + protos.google.monitoring.v3.IListMetricDescriptorsResponse, + ] + >; listMetricDescriptors( - request: protos.google.monitoring.v3.IListMetricDescriptorsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.monitoring.v3.IListMetricDescriptorsRequest, - protos.google.monitoring.v3.IListMetricDescriptorsResponse|null|undefined, - protos.google.api.IMetricDescriptor>): void; + request: protos.google.monitoring.v3.IListMetricDescriptorsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.monitoring.v3.IListMetricDescriptorsRequest, + | protos.google.monitoring.v3.IListMetricDescriptorsResponse + | null + | undefined, + protos.google.api.IMetricDescriptor + >, + ): void; listMetricDescriptors( - request: protos.google.monitoring.v3.IListMetricDescriptorsRequest, - callback: PaginationCallback< - protos.google.monitoring.v3.IListMetricDescriptorsRequest, - protos.google.monitoring.v3.IListMetricDescriptorsResponse|null|undefined, - protos.google.api.IMetricDescriptor>): void; + request: protos.google.monitoring.v3.IListMetricDescriptorsRequest, + callback: PaginationCallback< + protos.google.monitoring.v3.IListMetricDescriptorsRequest, + | protos.google.monitoring.v3.IListMetricDescriptorsResponse + | null + | undefined, + protos.google.api.IMetricDescriptor + >, + ): void; listMetricDescriptors( - request?: protos.google.monitoring.v3.IListMetricDescriptorsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.monitoring.v3.IListMetricDescriptorsRequest, - protos.google.monitoring.v3.IListMetricDescriptorsResponse|null|undefined, - protos.google.api.IMetricDescriptor>, - callback?: PaginationCallback< + request?: protos.google.monitoring.v3.IListMetricDescriptorsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.monitoring.v3.IListMetricDescriptorsRequest, - protos.google.monitoring.v3.IListMetricDescriptorsResponse|null|undefined, - protos.google.api.IMetricDescriptor>): - Promise<[ - protos.google.api.IMetricDescriptor[], - protos.google.monitoring.v3.IListMetricDescriptorsRequest|null, - protos.google.monitoring.v3.IListMetricDescriptorsResponse - ]>|void { + | protos.google.monitoring.v3.IListMetricDescriptorsResponse + | null + | undefined, + protos.google.api.IMetricDescriptor + >, + callback?: PaginationCallback< + protos.google.monitoring.v3.IListMetricDescriptorsRequest, + | protos.google.monitoring.v3.IListMetricDescriptorsResponse + | null + | undefined, + protos.google.api.IMetricDescriptor + >, + ): Promise< + [ + protos.google.api.IMetricDescriptor[], + protos.google.monitoring.v3.IListMetricDescriptorsRequest | null, + protos.google.monitoring.v3.IListMetricDescriptorsResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.monitoring.v3.IListMetricDescriptorsRequest, - protos.google.monitoring.v3.IListMetricDescriptorsResponse|null|undefined, - protos.google.api.IMetricDescriptor>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.monitoring.v3.IListMetricDescriptorsRequest, + | protos.google.monitoring.v3.IListMetricDescriptorsResponse + | null + | undefined, + protos.google.api.IMetricDescriptor + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('listMetricDescriptors values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -1422,286 +1804,309 @@ export class MetricServiceClient { this._log.info('listMetricDescriptors request %j', request); return this.innerApiCalls .listMetricDescriptors(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.api.IMetricDescriptor[], - protos.google.monitoring.v3.IListMetricDescriptorsRequest|null, - protos.google.monitoring.v3.IListMetricDescriptorsResponse - ]) => { - this._log.info('listMetricDescriptors values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.api.IMetricDescriptor[], + protos.google.monitoring.v3.IListMetricDescriptorsRequest | null, + protos.google.monitoring.v3.IListMetricDescriptorsResponse, + ]) => { + this._log.info('listMetricDescriptors values %j', response); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listMetricDescriptors`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The - * [project](https://cloud.google.com/monitoring/api/v3#project_name) on which - * to execute the request. The format is: - * - * projects/[PROJECT_ID_OR_NUMBER] - * @param {string} [request.filter] - * Optional. If this field is empty, all custom and - * system-defined metric descriptors are returned. - * Otherwise, the [filter](https://cloud.google.com/monitoring/api/v3/filters) - * specifies which metric descriptors are to be - * returned. For example, the following filter matches all - * [custom metrics](https://cloud.google.com/monitoring/custom-metrics): - * - * metric.type = starts_with("custom.googleapis.com/") - * @param {number} [request.pageSize] - * Optional. A positive number that is the maximum number of results to - * return. The default and maximum value is 10,000. If a page_size <= 0 or > - * 10,000 is submitted, will instead return a maximum of 10,000 results. - * @param {string} [request.pageToken] - * Optional. If this field is not empty then it must contain the - * `nextPageToken` value returned by a previous call to this method. Using - * this field causes the method to return additional results from the previous - * method call. - * @param {boolean} [request.activeOnly] - * Optional. If true, only metrics and monitored resource types that have - * recent data (within roughly 25 hours) will be included in the response. - * - If a metric descriptor enumerates monitored resource types, only the - * monitored resource types for which the metric type has recent data will - * be included in the returned metric descriptor, and if none of them have - * recent data, the metric descriptor will not be returned. - * - If a metric descriptor does not enumerate the compatible monitored - * resource types, it will be returned only if the metric type has recent - * data for some monitored resource type. The returned descriptor will not - * enumerate any monitored resource types. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.api.MetricDescriptor|MetricDescriptor} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listMetricDescriptorsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Equivalent to `listMetricDescriptors`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The + * [project](https://cloud.google.com/monitoring/api/v3#project_name) on which + * to execute the request. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER] + * @param {string} [request.filter] + * Optional. If this field is empty, all custom and + * system-defined metric descriptors are returned. + * Otherwise, the [filter](https://cloud.google.com/monitoring/api/v3/filters) + * specifies which metric descriptors are to be + * returned. For example, the following filter matches all + * [custom metrics](https://cloud.google.com/monitoring/custom-metrics): + * + * metric.type = starts_with("custom.googleapis.com/") + * @param {number} [request.pageSize] + * Optional. A positive number that is the maximum number of results to + * return. The default and maximum value is 10,000. If a page_size <= 0 or > + * 10,000 is submitted, will instead return a maximum of 10,000 results. + * @param {string} [request.pageToken] + * Optional. If this field is not empty then it must contain the + * `nextPageToken` value returned by a previous call to this method. Using + * this field causes the method to return additional results from the previous + * method call. + * @param {boolean} [request.activeOnly] + * Optional. If true, only metrics and monitored resource types that have + * recent data (within roughly 25 hours) will be included in the response. + * - If a metric descriptor enumerates monitored resource types, only the + * monitored resource types for which the metric type has recent data will + * be included in the returned metric descriptor, and if none of them have + * recent data, the metric descriptor will not be returned. + * - If a metric descriptor does not enumerate the compatible monitored + * resource types, it will be returned only if the metric type has recent + * data for some monitored resource type. The returned descriptor will not + * enumerate any monitored resource types. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.api.MetricDescriptor|MetricDescriptor} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listMetricDescriptorsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listMetricDescriptorsStream( - request?: protos.google.monitoring.v3.IListMetricDescriptorsRequest, - options?: CallOptions): - Transform{ + request?: protos.google.monitoring.v3.IListMetricDescriptorsRequest, + options?: CallOptions, + ): Transform { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); const defaultCallSettings = this._defaults['listMetricDescriptors']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listMetricDescriptors stream %j', request); return this.descriptors.page.listMetricDescriptors.createStream( this.innerApiCalls.listMetricDescriptors as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `listMetricDescriptors`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The - * [project](https://cloud.google.com/monitoring/api/v3#project_name) on which - * to execute the request. The format is: - * - * projects/[PROJECT_ID_OR_NUMBER] - * @param {string} [request.filter] - * Optional. If this field is empty, all custom and - * system-defined metric descriptors are returned. - * Otherwise, the [filter](https://cloud.google.com/monitoring/api/v3/filters) - * specifies which metric descriptors are to be - * returned. For example, the following filter matches all - * [custom metrics](https://cloud.google.com/monitoring/custom-metrics): - * - * metric.type = starts_with("custom.googleapis.com/") - * @param {number} [request.pageSize] - * Optional. A positive number that is the maximum number of results to - * return. The default and maximum value is 10,000. If a page_size <= 0 or > - * 10,000 is submitted, will instead return a maximum of 10,000 results. - * @param {string} [request.pageToken] - * Optional. If this field is not empty then it must contain the - * `nextPageToken` value returned by a previous call to this method. Using - * this field causes the method to return additional results from the previous - * method call. - * @param {boolean} [request.activeOnly] - * Optional. If true, only metrics and monitored resource types that have - * recent data (within roughly 25 hours) will be included in the response. - * - If a metric descriptor enumerates monitored resource types, only the - * monitored resource types for which the metric type has recent data will - * be included in the returned metric descriptor, and if none of them have - * recent data, the metric descriptor will not be returned. - * - If a metric descriptor does not enumerate the compatible monitored - * resource types, it will be returned only if the metric type has recent - * data for some monitored resource type. The returned descriptor will not - * enumerate any monitored resource types. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.api.MetricDescriptor|MetricDescriptor}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v3/metric_service.list_metric_descriptors.js - * region_tag:monitoring_v3_generated_MetricService_ListMetricDescriptors_async - */ + /** + * Equivalent to `listMetricDescriptors`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The + * [project](https://cloud.google.com/monitoring/api/v3#project_name) on which + * to execute the request. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER] + * @param {string} [request.filter] + * Optional. If this field is empty, all custom and + * system-defined metric descriptors are returned. + * Otherwise, the [filter](https://cloud.google.com/monitoring/api/v3/filters) + * specifies which metric descriptors are to be + * returned. For example, the following filter matches all + * [custom metrics](https://cloud.google.com/monitoring/custom-metrics): + * + * metric.type = starts_with("custom.googleapis.com/") + * @param {number} [request.pageSize] + * Optional. A positive number that is the maximum number of results to + * return. The default and maximum value is 10,000. If a page_size <= 0 or > + * 10,000 is submitted, will instead return a maximum of 10,000 results. + * @param {string} [request.pageToken] + * Optional. If this field is not empty then it must contain the + * `nextPageToken` value returned by a previous call to this method. Using + * this field causes the method to return additional results from the previous + * method call. + * @param {boolean} [request.activeOnly] + * Optional. If true, only metrics and monitored resource types that have + * recent data (within roughly 25 hours) will be included in the response. + * - If a metric descriptor enumerates monitored resource types, only the + * monitored resource types for which the metric type has recent data will + * be included in the returned metric descriptor, and if none of them have + * recent data, the metric descriptor will not be returned. + * - If a metric descriptor does not enumerate the compatible monitored + * resource types, it will be returned only if the metric type has recent + * data for some monitored resource type. The returned descriptor will not + * enumerate any monitored resource types. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.api.MetricDescriptor|MetricDescriptor}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v3/metric_service.list_metric_descriptors.js + * region_tag:monitoring_v3_generated_MetricService_ListMetricDescriptors_async + */ listMetricDescriptorsAsync( - request?: protos.google.monitoring.v3.IListMetricDescriptorsRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.monitoring.v3.IListMetricDescriptorsRequest, + options?: CallOptions, + ): AsyncIterable { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); const defaultCallSettings = this._defaults['listMetricDescriptors']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listMetricDescriptors iterate %j', request); return this.descriptors.page.listMetricDescriptors.asyncIterate( this.innerApiCalls['listMetricDescriptors'] as GaxCall, request as {}, - callSettings + callSettings, ) as AsyncIterable; } - /** - * Lists time series that match a filter. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The - * [project](https://cloud.google.com/monitoring/api/v3#project_name), - * organization or folder on which to execute the request. The format is: - * - * projects/[PROJECT_ID_OR_NUMBER] - * organizations/[ORGANIZATION_ID] - * folders/[FOLDER_ID] - * @param {string} request.filter - * Required. A [monitoring - * filter](https://cloud.google.com/monitoring/api/v3/filters) that specifies - * which time series should be returned. The filter must specify a single - * metric type, and can additionally specify metric labels and other - * information. For example: - * - * metric.type = "compute.googleapis.com/instance/cpu/usage_time" AND - * metric.labels.instance_name = "my-instance-name" - * @param {google.monitoring.v3.TimeInterval} request.interval - * Required. The time interval for which results should be returned. Only time - * series that contain data points in the specified interval are included in - * the response. - * @param {google.monitoring.v3.Aggregation} request.aggregation - * Specifies the alignment of data points in individual time series as - * well as how to combine the retrieved time series across specified labels. - * - * By default (if no `aggregation` is explicitly specified), the raw time - * series data is returned. - * @param {google.monitoring.v3.Aggregation} request.secondaryAggregation - * Apply a second aggregation after `aggregation` is applied. May only be - * specified if `aggregation` is specified. - * @param {string} request.orderBy - * Unsupported: must be left blank. The points in each time series are - * currently returned in reverse time order (most recent to oldest). - * @param {google.monitoring.v3.ListTimeSeriesRequest.TimeSeriesView} request.view - * Required. Specifies which information is returned about the time series. - * @param {number} request.pageSize - * A positive number that is the maximum number of results to return. If - * `page_size` is empty or more than 100,000 results, the effective - * `page_size` is 100,000 results. If `view` is set to `FULL`, this is the - * maximum number of `Points` returned. If `view` is set to `HEADERS`, this is - * the maximum number of `TimeSeries` returned. - * @param {string} request.pageToken - * If this field is not empty then it must contain the `nextPageToken` value - * returned by a previous call to this method. Using this field causes the - * method to return additional results from the previous method call. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of {@link protos.google.monitoring.v3.TimeSeries|TimeSeries}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listTimeSeriesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Lists time series that match a filter. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The + * [project](https://cloud.google.com/monitoring/api/v3#project_name), + * organization or folder on which to execute the request. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER] + * organizations/[ORGANIZATION_ID] + * folders/[FOLDER_ID] + * @param {string} request.filter + * Required. A [monitoring + * filter](https://cloud.google.com/monitoring/api/v3/filters) that specifies + * which time series should be returned. The filter must specify a single + * metric type, and can additionally specify metric labels and other + * information. For example: + * + * metric.type = "compute.googleapis.com/instance/cpu/usage_time" AND + * metric.labels.instance_name = "my-instance-name" + * @param {google.monitoring.v3.TimeInterval} request.interval + * Required. The time interval for which results should be returned. Only time + * series that contain data points in the specified interval are included in + * the response. + * @param {google.monitoring.v3.Aggregation} request.aggregation + * Specifies the alignment of data points in individual time series as + * well as how to combine the retrieved time series across specified labels. + * + * By default (if no `aggregation` is explicitly specified), the raw time + * series data is returned. + * @param {google.monitoring.v3.Aggregation} request.secondaryAggregation + * Apply a second aggregation after `aggregation` is applied. May only be + * specified if `aggregation` is specified. + * @param {string} request.orderBy + * Unsupported: must be left blank. The points in each time series are + * currently returned in reverse time order (most recent to oldest). + * @param {google.monitoring.v3.ListTimeSeriesRequest.TimeSeriesView} request.view + * Required. Specifies which information is returned about the time series. + * @param {number} request.pageSize + * A positive number that is the maximum number of results to return. If + * `page_size` is empty or more than 100,000 results, the effective + * `page_size` is 100,000 results. If `view` is set to `FULL`, this is the + * maximum number of `Points` returned. If `view` is set to `HEADERS`, this is + * the maximum number of `TimeSeries` returned. + * @param {string} request.pageToken + * If this field is not empty then it must contain the `nextPageToken` value + * returned by a previous call to this method. Using this field causes the + * method to return additional results from the previous method call. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of {@link protos.google.monitoring.v3.TimeSeries|TimeSeries}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listTimeSeriesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listTimeSeries( - request?: protos.google.monitoring.v3.IListTimeSeriesRequest, - options?: CallOptions): - Promise<[ - protos.google.monitoring.v3.ITimeSeries[], - protos.google.monitoring.v3.IListTimeSeriesRequest|null, - protos.google.monitoring.v3.IListTimeSeriesResponse - ]>; + request?: protos.google.monitoring.v3.IListTimeSeriesRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.monitoring.v3.ITimeSeries[], + protos.google.monitoring.v3.IListTimeSeriesRequest | null, + protos.google.monitoring.v3.IListTimeSeriesResponse, + ] + >; listTimeSeries( - request: protos.google.monitoring.v3.IListTimeSeriesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.monitoring.v3.IListTimeSeriesRequest, - protos.google.monitoring.v3.IListTimeSeriesResponse|null|undefined, - protos.google.monitoring.v3.ITimeSeries>): void; + request: protos.google.monitoring.v3.IListTimeSeriesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.monitoring.v3.IListTimeSeriesRequest, + protos.google.monitoring.v3.IListTimeSeriesResponse | null | undefined, + protos.google.monitoring.v3.ITimeSeries + >, + ): void; listTimeSeries( - request: protos.google.monitoring.v3.IListTimeSeriesRequest, - callback: PaginationCallback< - protos.google.monitoring.v3.IListTimeSeriesRequest, - protos.google.monitoring.v3.IListTimeSeriesResponse|null|undefined, - protos.google.monitoring.v3.ITimeSeries>): void; + request: protos.google.monitoring.v3.IListTimeSeriesRequest, + callback: PaginationCallback< + protos.google.monitoring.v3.IListTimeSeriesRequest, + protos.google.monitoring.v3.IListTimeSeriesResponse | null | undefined, + protos.google.monitoring.v3.ITimeSeries + >, + ): void; listTimeSeries( - request?: protos.google.monitoring.v3.IListTimeSeriesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.monitoring.v3.IListTimeSeriesRequest, - protos.google.monitoring.v3.IListTimeSeriesResponse|null|undefined, - protos.google.monitoring.v3.ITimeSeries>, - callback?: PaginationCallback< + request?: protos.google.monitoring.v3.IListTimeSeriesRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.monitoring.v3.IListTimeSeriesRequest, - protos.google.monitoring.v3.IListTimeSeriesResponse|null|undefined, - protos.google.monitoring.v3.ITimeSeries>): - Promise<[ - protos.google.monitoring.v3.ITimeSeries[], - protos.google.monitoring.v3.IListTimeSeriesRequest|null, - protos.google.monitoring.v3.IListTimeSeriesResponse - ]>|void { + | protos.google.monitoring.v3.IListTimeSeriesResponse + | null + | undefined, + protos.google.monitoring.v3.ITimeSeries + >, + callback?: PaginationCallback< + protos.google.monitoring.v3.IListTimeSeriesRequest, + protos.google.monitoring.v3.IListTimeSeriesResponse | null | undefined, + protos.google.monitoring.v3.ITimeSeries + >, + ): Promise< + [ + protos.google.monitoring.v3.ITimeSeries[], + protos.google.monitoring.v3.IListTimeSeriesRequest | null, + protos.google.monitoring.v3.IListTimeSeriesResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.monitoring.v3.IListTimeSeriesRequest, - protos.google.monitoring.v3.IListTimeSeriesResponse|null|undefined, - protos.google.monitoring.v3.ITimeSeries>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.monitoring.v3.IListTimeSeriesRequest, + | protos.google.monitoring.v3.IListTimeSeriesResponse + | null + | undefined, + protos.google.monitoring.v3.ITimeSeries + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('listTimeSeries values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -1710,184 +2115,188 @@ export class MetricServiceClient { this._log.info('listTimeSeries request %j', request); return this.innerApiCalls .listTimeSeries(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.monitoring.v3.ITimeSeries[], - protos.google.monitoring.v3.IListTimeSeriesRequest|null, - protos.google.monitoring.v3.IListTimeSeriesResponse - ]) => { - this._log.info('listTimeSeries values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.monitoring.v3.ITimeSeries[], + protos.google.monitoring.v3.IListTimeSeriesRequest | null, + protos.google.monitoring.v3.IListTimeSeriesResponse, + ]) => { + this._log.info('listTimeSeries values %j', response); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listTimeSeries`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The - * [project](https://cloud.google.com/monitoring/api/v3#project_name), - * organization or folder on which to execute the request. The format is: - * - * projects/[PROJECT_ID_OR_NUMBER] - * organizations/[ORGANIZATION_ID] - * folders/[FOLDER_ID] - * @param {string} request.filter - * Required. A [monitoring - * filter](https://cloud.google.com/monitoring/api/v3/filters) that specifies - * which time series should be returned. The filter must specify a single - * metric type, and can additionally specify metric labels and other - * information. For example: - * - * metric.type = "compute.googleapis.com/instance/cpu/usage_time" AND - * metric.labels.instance_name = "my-instance-name" - * @param {google.monitoring.v3.TimeInterval} request.interval - * Required. The time interval for which results should be returned. Only time - * series that contain data points in the specified interval are included in - * the response. - * @param {google.monitoring.v3.Aggregation} request.aggregation - * Specifies the alignment of data points in individual time series as - * well as how to combine the retrieved time series across specified labels. - * - * By default (if no `aggregation` is explicitly specified), the raw time - * series data is returned. - * @param {google.monitoring.v3.Aggregation} request.secondaryAggregation - * Apply a second aggregation after `aggregation` is applied. May only be - * specified if `aggregation` is specified. - * @param {string} request.orderBy - * Unsupported: must be left blank. The points in each time series are - * currently returned in reverse time order (most recent to oldest). - * @param {google.monitoring.v3.ListTimeSeriesRequest.TimeSeriesView} request.view - * Required. Specifies which information is returned about the time series. - * @param {number} request.pageSize - * A positive number that is the maximum number of results to return. If - * `page_size` is empty or more than 100,000 results, the effective - * `page_size` is 100,000 results. If `view` is set to `FULL`, this is the - * maximum number of `Points` returned. If `view` is set to `HEADERS`, this is - * the maximum number of `TimeSeries` returned. - * @param {string} request.pageToken - * If this field is not empty then it must contain the `nextPageToken` value - * returned by a previous call to this method. Using this field causes the - * method to return additional results from the previous method call. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.monitoring.v3.TimeSeries|TimeSeries} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listTimeSeriesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Equivalent to `listTimeSeries`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The + * [project](https://cloud.google.com/monitoring/api/v3#project_name), + * organization or folder on which to execute the request. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER] + * organizations/[ORGANIZATION_ID] + * folders/[FOLDER_ID] + * @param {string} request.filter + * Required. A [monitoring + * filter](https://cloud.google.com/monitoring/api/v3/filters) that specifies + * which time series should be returned. The filter must specify a single + * metric type, and can additionally specify metric labels and other + * information. For example: + * + * metric.type = "compute.googleapis.com/instance/cpu/usage_time" AND + * metric.labels.instance_name = "my-instance-name" + * @param {google.monitoring.v3.TimeInterval} request.interval + * Required. The time interval for which results should be returned. Only time + * series that contain data points in the specified interval are included in + * the response. + * @param {google.monitoring.v3.Aggregation} request.aggregation + * Specifies the alignment of data points in individual time series as + * well as how to combine the retrieved time series across specified labels. + * + * By default (if no `aggregation` is explicitly specified), the raw time + * series data is returned. + * @param {google.monitoring.v3.Aggregation} request.secondaryAggregation + * Apply a second aggregation after `aggregation` is applied. May only be + * specified if `aggregation` is specified. + * @param {string} request.orderBy + * Unsupported: must be left blank. The points in each time series are + * currently returned in reverse time order (most recent to oldest). + * @param {google.monitoring.v3.ListTimeSeriesRequest.TimeSeriesView} request.view + * Required. Specifies which information is returned about the time series. + * @param {number} request.pageSize + * A positive number that is the maximum number of results to return. If + * `page_size` is empty or more than 100,000 results, the effective + * `page_size` is 100,000 results. If `view` is set to `FULL`, this is the + * maximum number of `Points` returned. If `view` is set to `HEADERS`, this is + * the maximum number of `TimeSeries` returned. + * @param {string} request.pageToken + * If this field is not empty then it must contain the `nextPageToken` value + * returned by a previous call to this method. Using this field causes the + * method to return additional results from the previous method call. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.monitoring.v3.TimeSeries|TimeSeries} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listTimeSeriesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listTimeSeriesStream( - request?: protos.google.monitoring.v3.IListTimeSeriesRequest, - options?: CallOptions): - Transform{ + request?: protos.google.monitoring.v3.IListTimeSeriesRequest, + options?: CallOptions, + ): Transform { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); const defaultCallSettings = this._defaults['listTimeSeries']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listTimeSeries stream %j', request); return this.descriptors.page.listTimeSeries.createStream( this.innerApiCalls.listTimeSeries as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `listTimeSeries`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The - * [project](https://cloud.google.com/monitoring/api/v3#project_name), - * organization or folder on which to execute the request. The format is: - * - * projects/[PROJECT_ID_OR_NUMBER] - * organizations/[ORGANIZATION_ID] - * folders/[FOLDER_ID] - * @param {string} request.filter - * Required. A [monitoring - * filter](https://cloud.google.com/monitoring/api/v3/filters) that specifies - * which time series should be returned. The filter must specify a single - * metric type, and can additionally specify metric labels and other - * information. For example: - * - * metric.type = "compute.googleapis.com/instance/cpu/usage_time" AND - * metric.labels.instance_name = "my-instance-name" - * @param {google.monitoring.v3.TimeInterval} request.interval - * Required. The time interval for which results should be returned. Only time - * series that contain data points in the specified interval are included in - * the response. - * @param {google.monitoring.v3.Aggregation} request.aggregation - * Specifies the alignment of data points in individual time series as - * well as how to combine the retrieved time series across specified labels. - * - * By default (if no `aggregation` is explicitly specified), the raw time - * series data is returned. - * @param {google.monitoring.v3.Aggregation} request.secondaryAggregation - * Apply a second aggregation after `aggregation` is applied. May only be - * specified if `aggregation` is specified. - * @param {string} request.orderBy - * Unsupported: must be left blank. The points in each time series are - * currently returned in reverse time order (most recent to oldest). - * @param {google.monitoring.v3.ListTimeSeriesRequest.TimeSeriesView} request.view - * Required. Specifies which information is returned about the time series. - * @param {number} request.pageSize - * A positive number that is the maximum number of results to return. If - * `page_size` is empty or more than 100,000 results, the effective - * `page_size` is 100,000 results. If `view` is set to `FULL`, this is the - * maximum number of `Points` returned. If `view` is set to `HEADERS`, this is - * the maximum number of `TimeSeries` returned. - * @param {string} request.pageToken - * If this field is not empty then it must contain the `nextPageToken` value - * returned by a previous call to this method. Using this field causes the - * method to return additional results from the previous method call. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.monitoring.v3.TimeSeries|TimeSeries}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v3/metric_service.list_time_series.js - * region_tag:monitoring_v3_generated_MetricService_ListTimeSeries_async - */ + /** + * Equivalent to `listTimeSeries`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The + * [project](https://cloud.google.com/monitoring/api/v3#project_name), + * organization or folder on which to execute the request. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER] + * organizations/[ORGANIZATION_ID] + * folders/[FOLDER_ID] + * @param {string} request.filter + * Required. A [monitoring + * filter](https://cloud.google.com/monitoring/api/v3/filters) that specifies + * which time series should be returned. The filter must specify a single + * metric type, and can additionally specify metric labels and other + * information. For example: + * + * metric.type = "compute.googleapis.com/instance/cpu/usage_time" AND + * metric.labels.instance_name = "my-instance-name" + * @param {google.monitoring.v3.TimeInterval} request.interval + * Required. The time interval for which results should be returned. Only time + * series that contain data points in the specified interval are included in + * the response. + * @param {google.monitoring.v3.Aggregation} request.aggregation + * Specifies the alignment of data points in individual time series as + * well as how to combine the retrieved time series across specified labels. + * + * By default (if no `aggregation` is explicitly specified), the raw time + * series data is returned. + * @param {google.monitoring.v3.Aggregation} request.secondaryAggregation + * Apply a second aggregation after `aggregation` is applied. May only be + * specified if `aggregation` is specified. + * @param {string} request.orderBy + * Unsupported: must be left blank. The points in each time series are + * currently returned in reverse time order (most recent to oldest). + * @param {google.monitoring.v3.ListTimeSeriesRequest.TimeSeriesView} request.view + * Required. Specifies which information is returned about the time series. + * @param {number} request.pageSize + * A positive number that is the maximum number of results to return. If + * `page_size` is empty or more than 100,000 results, the effective + * `page_size` is 100,000 results. If `view` is set to `FULL`, this is the + * maximum number of `Points` returned. If `view` is set to `HEADERS`, this is + * the maximum number of `TimeSeries` returned. + * @param {string} request.pageToken + * If this field is not empty then it must contain the `nextPageToken` value + * returned by a previous call to this method. Using this field causes the + * method to return additional results from the previous method call. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.monitoring.v3.TimeSeries|TimeSeries}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v3/metric_service.list_time_series.js + * region_tag:monitoring_v3_generated_MetricService_ListTimeSeries_async + */ listTimeSeriesAsync( - request?: protos.google.monitoring.v3.IListTimeSeriesRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.monitoring.v3.IListTimeSeriesRequest, + options?: CallOptions, + ): AsyncIterable { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); const defaultCallSettings = this._defaults['listTimeSeries']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listTimeSeries iterate %j', request); return this.descriptors.page.listTimeSeries.asyncIterate( this.innerApiCalls['listTimeSeries'] as GaxCall, request as {}, - callSettings + callSettings, ) as AsyncIterable; } // -------------------- @@ -1901,7 +2310,7 @@ export class MetricServiceClient { * @param {string} alert_policy * @returns {string} Resource name string. */ - folderAlertPolicyPath(folder:string,alertPolicy:string) { + folderAlertPolicyPath(folder: string, alertPolicy: string) { return this.pathTemplates.folderAlertPolicyPathTemplate.render({ folder: folder, alert_policy: alertPolicy, @@ -1916,7 +2325,9 @@ export class MetricServiceClient { * @returns {string} A string representing the folder. */ matchFolderFromFolderAlertPolicyName(folderAlertPolicyName: string) { - return this.pathTemplates.folderAlertPolicyPathTemplate.match(folderAlertPolicyName).folder; + return this.pathTemplates.folderAlertPolicyPathTemplate.match( + folderAlertPolicyName, + ).folder; } /** @@ -1927,7 +2338,9 @@ export class MetricServiceClient { * @returns {string} A string representing the alert_policy. */ matchAlertPolicyFromFolderAlertPolicyName(folderAlertPolicyName: string) { - return this.pathTemplates.folderAlertPolicyPathTemplate.match(folderAlertPolicyName).alert_policy; + return this.pathTemplates.folderAlertPolicyPathTemplate.match( + folderAlertPolicyName, + ).alert_policy; } /** @@ -1938,7 +2351,11 @@ export class MetricServiceClient { * @param {string} condition * @returns {string} Resource name string. */ - folderAlertPolicyConditionPath(folder:string,alertPolicy:string,condition:string) { + folderAlertPolicyConditionPath( + folder: string, + alertPolicy: string, + condition: string, + ) { return this.pathTemplates.folderAlertPolicyConditionPathTemplate.render({ folder: folder, alert_policy: alertPolicy, @@ -1953,8 +2370,12 @@ export class MetricServiceClient { * A fully-qualified path representing folder_alert_policy_condition resource. * @returns {string} A string representing the folder. */ - matchFolderFromFolderAlertPolicyConditionName(folderAlertPolicyConditionName: string) { - return this.pathTemplates.folderAlertPolicyConditionPathTemplate.match(folderAlertPolicyConditionName).folder; + matchFolderFromFolderAlertPolicyConditionName( + folderAlertPolicyConditionName: string, + ) { + return this.pathTemplates.folderAlertPolicyConditionPathTemplate.match( + folderAlertPolicyConditionName, + ).folder; } /** @@ -1964,8 +2385,12 @@ export class MetricServiceClient { * A fully-qualified path representing folder_alert_policy_condition resource. * @returns {string} A string representing the alert_policy. */ - matchAlertPolicyFromFolderAlertPolicyConditionName(folderAlertPolicyConditionName: string) { - return this.pathTemplates.folderAlertPolicyConditionPathTemplate.match(folderAlertPolicyConditionName).alert_policy; + matchAlertPolicyFromFolderAlertPolicyConditionName( + folderAlertPolicyConditionName: string, + ) { + return this.pathTemplates.folderAlertPolicyConditionPathTemplate.match( + folderAlertPolicyConditionName, + ).alert_policy; } /** @@ -1975,8 +2400,12 @@ export class MetricServiceClient { * A fully-qualified path representing folder_alert_policy_condition resource. * @returns {string} A string representing the condition. */ - matchConditionFromFolderAlertPolicyConditionName(folderAlertPolicyConditionName: string) { - return this.pathTemplates.folderAlertPolicyConditionPathTemplate.match(folderAlertPolicyConditionName).condition; + matchConditionFromFolderAlertPolicyConditionName( + folderAlertPolicyConditionName: string, + ) { + return this.pathTemplates.folderAlertPolicyConditionPathTemplate.match( + folderAlertPolicyConditionName, + ).condition; } /** @@ -1986,7 +2415,7 @@ export class MetricServiceClient { * @param {string} channel_descriptor * @returns {string} Resource name string. */ - folderChannelDescriptorPath(folder:string,channelDescriptor:string) { + folderChannelDescriptorPath(folder: string, channelDescriptor: string) { return this.pathTemplates.folderChannelDescriptorPathTemplate.render({ folder: folder, channel_descriptor: channelDescriptor, @@ -2000,8 +2429,12 @@ export class MetricServiceClient { * A fully-qualified path representing folder_channel_descriptor resource. * @returns {string} A string representing the folder. */ - matchFolderFromFolderChannelDescriptorName(folderChannelDescriptorName: string) { - return this.pathTemplates.folderChannelDescriptorPathTemplate.match(folderChannelDescriptorName).folder; + matchFolderFromFolderChannelDescriptorName( + folderChannelDescriptorName: string, + ) { + return this.pathTemplates.folderChannelDescriptorPathTemplate.match( + folderChannelDescriptorName, + ).folder; } /** @@ -2011,8 +2444,12 @@ export class MetricServiceClient { * A fully-qualified path representing folder_channel_descriptor resource. * @returns {string} A string representing the channel_descriptor. */ - matchChannelDescriptorFromFolderChannelDescriptorName(folderChannelDescriptorName: string) { - return this.pathTemplates.folderChannelDescriptorPathTemplate.match(folderChannelDescriptorName).channel_descriptor; + matchChannelDescriptorFromFolderChannelDescriptorName( + folderChannelDescriptorName: string, + ) { + return this.pathTemplates.folderChannelDescriptorPathTemplate.match( + folderChannelDescriptorName, + ).channel_descriptor; } /** @@ -2022,7 +2459,7 @@ export class MetricServiceClient { * @param {string} group * @returns {string} Resource name string. */ - folderGroupPath(folder:string,group:string) { + folderGroupPath(folder: string, group: string) { return this.pathTemplates.folderGroupPathTemplate.render({ folder: folder, group: group, @@ -2037,7 +2474,8 @@ export class MetricServiceClient { * @returns {string} A string representing the folder. */ matchFolderFromFolderGroupName(folderGroupName: string) { - return this.pathTemplates.folderGroupPathTemplate.match(folderGroupName).folder; + return this.pathTemplates.folderGroupPathTemplate.match(folderGroupName) + .folder; } /** @@ -2048,7 +2486,8 @@ export class MetricServiceClient { * @returns {string} A string representing the group. */ matchGroupFromFolderGroupName(folderGroupName: string) { - return this.pathTemplates.folderGroupPathTemplate.match(folderGroupName).group; + return this.pathTemplates.folderGroupPathTemplate.match(folderGroupName) + .group; } /** @@ -2058,7 +2497,7 @@ export class MetricServiceClient { * @param {string} metric_descriptor * @returns {string} Resource name string. */ - folderMetricDescriptorPath(folder:string,metricDescriptor:string) { + folderMetricDescriptorPath(folder: string, metricDescriptor: string) { return this.pathTemplates.folderMetricDescriptorPathTemplate.render({ folder: folder, metric_descriptor: metricDescriptor, @@ -2072,8 +2511,12 @@ export class MetricServiceClient { * A fully-qualified path representing folder_metric_descriptor resource. * @returns {string} A string representing the folder. */ - matchFolderFromFolderMetricDescriptorName(folderMetricDescriptorName: string) { - return this.pathTemplates.folderMetricDescriptorPathTemplate.match(folderMetricDescriptorName).folder; + matchFolderFromFolderMetricDescriptorName( + folderMetricDescriptorName: string, + ) { + return this.pathTemplates.folderMetricDescriptorPathTemplate.match( + folderMetricDescriptorName, + ).folder; } /** @@ -2083,8 +2526,12 @@ export class MetricServiceClient { * A fully-qualified path representing folder_metric_descriptor resource. * @returns {string} A string representing the metric_descriptor. */ - matchMetricDescriptorFromFolderMetricDescriptorName(folderMetricDescriptorName: string) { - return this.pathTemplates.folderMetricDescriptorPathTemplate.match(folderMetricDescriptorName).metric_descriptor; + matchMetricDescriptorFromFolderMetricDescriptorName( + folderMetricDescriptorName: string, + ) { + return this.pathTemplates.folderMetricDescriptorPathTemplate.match( + folderMetricDescriptorName, + ).metric_descriptor; } /** @@ -2094,11 +2541,16 @@ export class MetricServiceClient { * @param {string} monitored_resource_descriptor * @returns {string} Resource name string. */ - folderMonitoredResourceDescriptorPath(folder:string,monitoredResourceDescriptor:string) { - return this.pathTemplates.folderMonitoredResourceDescriptorPathTemplate.render({ - folder: folder, - monitored_resource_descriptor: monitoredResourceDescriptor, - }); + folderMonitoredResourceDescriptorPath( + folder: string, + monitoredResourceDescriptor: string, + ) { + return this.pathTemplates.folderMonitoredResourceDescriptorPathTemplate.render( + { + folder: folder, + monitored_resource_descriptor: monitoredResourceDescriptor, + }, + ); } /** @@ -2108,8 +2560,12 @@ export class MetricServiceClient { * A fully-qualified path representing folder_monitored_resource_descriptor resource. * @returns {string} A string representing the folder. */ - matchFolderFromFolderMonitoredResourceDescriptorName(folderMonitoredResourceDescriptorName: string) { - return this.pathTemplates.folderMonitoredResourceDescriptorPathTemplate.match(folderMonitoredResourceDescriptorName).folder; + matchFolderFromFolderMonitoredResourceDescriptorName( + folderMonitoredResourceDescriptorName: string, + ) { + return this.pathTemplates.folderMonitoredResourceDescriptorPathTemplate.match( + folderMonitoredResourceDescriptorName, + ).folder; } /** @@ -2119,8 +2575,12 @@ export class MetricServiceClient { * A fully-qualified path representing folder_monitored_resource_descriptor resource. * @returns {string} A string representing the monitored_resource_descriptor. */ - matchMonitoredResourceDescriptorFromFolderMonitoredResourceDescriptorName(folderMonitoredResourceDescriptorName: string) { - return this.pathTemplates.folderMonitoredResourceDescriptorPathTemplate.match(folderMonitoredResourceDescriptorName).monitored_resource_descriptor; + matchMonitoredResourceDescriptorFromFolderMonitoredResourceDescriptorName( + folderMonitoredResourceDescriptorName: string, + ) { + return this.pathTemplates.folderMonitoredResourceDescriptorPathTemplate.match( + folderMonitoredResourceDescriptorName, + ).monitored_resource_descriptor; } /** @@ -2130,7 +2590,7 @@ export class MetricServiceClient { * @param {string} notification_channel * @returns {string} Resource name string. */ - folderNotificationChannelPath(folder:string,notificationChannel:string) { + folderNotificationChannelPath(folder: string, notificationChannel: string) { return this.pathTemplates.folderNotificationChannelPathTemplate.render({ folder: folder, notification_channel: notificationChannel, @@ -2144,8 +2604,12 @@ export class MetricServiceClient { * A fully-qualified path representing folder_notification_channel resource. * @returns {string} A string representing the folder. */ - matchFolderFromFolderNotificationChannelName(folderNotificationChannelName: string) { - return this.pathTemplates.folderNotificationChannelPathTemplate.match(folderNotificationChannelName).folder; + matchFolderFromFolderNotificationChannelName( + folderNotificationChannelName: string, + ) { + return this.pathTemplates.folderNotificationChannelPathTemplate.match( + folderNotificationChannelName, + ).folder; } /** @@ -2155,8 +2619,12 @@ export class MetricServiceClient { * A fully-qualified path representing folder_notification_channel resource. * @returns {string} A string representing the notification_channel. */ - matchNotificationChannelFromFolderNotificationChannelName(folderNotificationChannelName: string) { - return this.pathTemplates.folderNotificationChannelPathTemplate.match(folderNotificationChannelName).notification_channel; + matchNotificationChannelFromFolderNotificationChannelName( + folderNotificationChannelName: string, + ) { + return this.pathTemplates.folderNotificationChannelPathTemplate.match( + folderNotificationChannelName, + ).notification_channel; } /** @@ -2166,7 +2634,7 @@ export class MetricServiceClient { * @param {string} service * @returns {string} Resource name string. */ - folderServicePath(folder:string,service:string) { + folderServicePath(folder: string, service: string) { return this.pathTemplates.folderServicePathTemplate.render({ folder: folder, service: service, @@ -2181,7 +2649,8 @@ export class MetricServiceClient { * @returns {string} A string representing the folder. */ matchFolderFromFolderServiceName(folderServiceName: string) { - return this.pathTemplates.folderServicePathTemplate.match(folderServiceName).folder; + return this.pathTemplates.folderServicePathTemplate.match(folderServiceName) + .folder; } /** @@ -2192,7 +2661,8 @@ export class MetricServiceClient { * @returns {string} A string representing the service. */ matchServiceFromFolderServiceName(folderServiceName: string) { - return this.pathTemplates.folderServicePathTemplate.match(folderServiceName).service; + return this.pathTemplates.folderServicePathTemplate.match(folderServiceName) + .service; } /** @@ -2203,12 +2673,18 @@ export class MetricServiceClient { * @param {string} service_level_objective * @returns {string} Resource name string. */ - folderServiceServiceLevelObjectivePath(folder:string,service:string,serviceLevelObjective:string) { - return this.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.render({ - folder: folder, - service: service, - service_level_objective: serviceLevelObjective, - }); + folderServiceServiceLevelObjectivePath( + folder: string, + service: string, + serviceLevelObjective: string, + ) { + return this.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.render( + { + folder: folder, + service: service, + service_level_objective: serviceLevelObjective, + }, + ); } /** @@ -2218,8 +2694,12 @@ export class MetricServiceClient { * A fully-qualified path representing folder_service_service_level_objective resource. * @returns {string} A string representing the folder. */ - matchFolderFromFolderServiceServiceLevelObjectiveName(folderServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match(folderServiceServiceLevelObjectiveName).folder; + matchFolderFromFolderServiceServiceLevelObjectiveName( + folderServiceServiceLevelObjectiveName: string, + ) { + return this.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match( + folderServiceServiceLevelObjectiveName, + ).folder; } /** @@ -2229,8 +2709,12 @@ export class MetricServiceClient { * A fully-qualified path representing folder_service_service_level_objective resource. * @returns {string} A string representing the service. */ - matchServiceFromFolderServiceServiceLevelObjectiveName(folderServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match(folderServiceServiceLevelObjectiveName).service; + matchServiceFromFolderServiceServiceLevelObjectiveName( + folderServiceServiceLevelObjectiveName: string, + ) { + return this.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match( + folderServiceServiceLevelObjectiveName, + ).service; } /** @@ -2240,8 +2724,12 @@ export class MetricServiceClient { * A fully-qualified path representing folder_service_service_level_objective resource. * @returns {string} A string representing the service_level_objective. */ - matchServiceLevelObjectiveFromFolderServiceServiceLevelObjectiveName(folderServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match(folderServiceServiceLevelObjectiveName).service_level_objective; + matchServiceLevelObjectiveFromFolderServiceServiceLevelObjectiveName( + folderServiceServiceLevelObjectiveName: string, + ) { + return this.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match( + folderServiceServiceLevelObjectiveName, + ).service_level_objective; } /** @@ -2251,7 +2739,7 @@ export class MetricServiceClient { * @param {string} uptime_check_config * @returns {string} Resource name string. */ - folderUptimeCheckConfigPath(folder:string,uptimeCheckConfig:string) { + folderUptimeCheckConfigPath(folder: string, uptimeCheckConfig: string) { return this.pathTemplates.folderUptimeCheckConfigPathTemplate.render({ folder: folder, uptime_check_config: uptimeCheckConfig, @@ -2265,8 +2753,12 @@ export class MetricServiceClient { * A fully-qualified path representing folder_uptime_check_config resource. * @returns {string} A string representing the folder. */ - matchFolderFromFolderUptimeCheckConfigName(folderUptimeCheckConfigName: string) { - return this.pathTemplates.folderUptimeCheckConfigPathTemplate.match(folderUptimeCheckConfigName).folder; + matchFolderFromFolderUptimeCheckConfigName( + folderUptimeCheckConfigName: string, + ) { + return this.pathTemplates.folderUptimeCheckConfigPathTemplate.match( + folderUptimeCheckConfigName, + ).folder; } /** @@ -2276,8 +2768,12 @@ export class MetricServiceClient { * A fully-qualified path representing folder_uptime_check_config resource. * @returns {string} A string representing the uptime_check_config. */ - matchUptimeCheckConfigFromFolderUptimeCheckConfigName(folderUptimeCheckConfigName: string) { - return this.pathTemplates.folderUptimeCheckConfigPathTemplate.match(folderUptimeCheckConfigName).uptime_check_config; + matchUptimeCheckConfigFromFolderUptimeCheckConfigName( + folderUptimeCheckConfigName: string, + ) { + return this.pathTemplates.folderUptimeCheckConfigPathTemplate.match( + folderUptimeCheckConfigName, + ).uptime_check_config; } /** @@ -2287,7 +2783,7 @@ export class MetricServiceClient { * @param {string} alert_policy * @returns {string} Resource name string. */ - organizationAlertPolicyPath(organization:string,alertPolicy:string) { + organizationAlertPolicyPath(organization: string, alertPolicy: string) { return this.pathTemplates.organizationAlertPolicyPathTemplate.render({ organization: organization, alert_policy: alertPolicy, @@ -2301,8 +2797,12 @@ export class MetricServiceClient { * A fully-qualified path representing organization_alert_policy resource. * @returns {string} A string representing the organization. */ - matchOrganizationFromOrganizationAlertPolicyName(organizationAlertPolicyName: string) { - return this.pathTemplates.organizationAlertPolicyPathTemplate.match(organizationAlertPolicyName).organization; + matchOrganizationFromOrganizationAlertPolicyName( + organizationAlertPolicyName: string, + ) { + return this.pathTemplates.organizationAlertPolicyPathTemplate.match( + organizationAlertPolicyName, + ).organization; } /** @@ -2312,8 +2812,12 @@ export class MetricServiceClient { * A fully-qualified path representing organization_alert_policy resource. * @returns {string} A string representing the alert_policy. */ - matchAlertPolicyFromOrganizationAlertPolicyName(organizationAlertPolicyName: string) { - return this.pathTemplates.organizationAlertPolicyPathTemplate.match(organizationAlertPolicyName).alert_policy; + matchAlertPolicyFromOrganizationAlertPolicyName( + organizationAlertPolicyName: string, + ) { + return this.pathTemplates.organizationAlertPolicyPathTemplate.match( + organizationAlertPolicyName, + ).alert_policy; } /** @@ -2324,12 +2828,18 @@ export class MetricServiceClient { * @param {string} condition * @returns {string} Resource name string. */ - organizationAlertPolicyConditionPath(organization:string,alertPolicy:string,condition:string) { - return this.pathTemplates.organizationAlertPolicyConditionPathTemplate.render({ - organization: organization, - alert_policy: alertPolicy, - condition: condition, - }); + organizationAlertPolicyConditionPath( + organization: string, + alertPolicy: string, + condition: string, + ) { + return this.pathTemplates.organizationAlertPolicyConditionPathTemplate.render( + { + organization: organization, + alert_policy: alertPolicy, + condition: condition, + }, + ); } /** @@ -2339,8 +2849,12 @@ export class MetricServiceClient { * A fully-qualified path representing organization_alert_policy_condition resource. * @returns {string} A string representing the organization. */ - matchOrganizationFromOrganizationAlertPolicyConditionName(organizationAlertPolicyConditionName: string) { - return this.pathTemplates.organizationAlertPolicyConditionPathTemplate.match(organizationAlertPolicyConditionName).organization; + matchOrganizationFromOrganizationAlertPolicyConditionName( + organizationAlertPolicyConditionName: string, + ) { + return this.pathTemplates.organizationAlertPolicyConditionPathTemplate.match( + organizationAlertPolicyConditionName, + ).organization; } /** @@ -2350,8 +2864,12 @@ export class MetricServiceClient { * A fully-qualified path representing organization_alert_policy_condition resource. * @returns {string} A string representing the alert_policy. */ - matchAlertPolicyFromOrganizationAlertPolicyConditionName(organizationAlertPolicyConditionName: string) { - return this.pathTemplates.organizationAlertPolicyConditionPathTemplate.match(organizationAlertPolicyConditionName).alert_policy; + matchAlertPolicyFromOrganizationAlertPolicyConditionName( + organizationAlertPolicyConditionName: string, + ) { + return this.pathTemplates.organizationAlertPolicyConditionPathTemplate.match( + organizationAlertPolicyConditionName, + ).alert_policy; } /** @@ -2361,8 +2879,12 @@ export class MetricServiceClient { * A fully-qualified path representing organization_alert_policy_condition resource. * @returns {string} A string representing the condition. */ - matchConditionFromOrganizationAlertPolicyConditionName(organizationAlertPolicyConditionName: string) { - return this.pathTemplates.organizationAlertPolicyConditionPathTemplate.match(organizationAlertPolicyConditionName).condition; + matchConditionFromOrganizationAlertPolicyConditionName( + organizationAlertPolicyConditionName: string, + ) { + return this.pathTemplates.organizationAlertPolicyConditionPathTemplate.match( + organizationAlertPolicyConditionName, + ).condition; } /** @@ -2372,7 +2894,10 @@ export class MetricServiceClient { * @param {string} channel_descriptor * @returns {string} Resource name string. */ - organizationChannelDescriptorPath(organization:string,channelDescriptor:string) { + organizationChannelDescriptorPath( + organization: string, + channelDescriptor: string, + ) { return this.pathTemplates.organizationChannelDescriptorPathTemplate.render({ organization: organization, channel_descriptor: channelDescriptor, @@ -2386,8 +2911,12 @@ export class MetricServiceClient { * A fully-qualified path representing organization_channel_descriptor resource. * @returns {string} A string representing the organization. */ - matchOrganizationFromOrganizationChannelDescriptorName(organizationChannelDescriptorName: string) { - return this.pathTemplates.organizationChannelDescriptorPathTemplate.match(organizationChannelDescriptorName).organization; + matchOrganizationFromOrganizationChannelDescriptorName( + organizationChannelDescriptorName: string, + ) { + return this.pathTemplates.organizationChannelDescriptorPathTemplate.match( + organizationChannelDescriptorName, + ).organization; } /** @@ -2397,8 +2926,12 @@ export class MetricServiceClient { * A fully-qualified path representing organization_channel_descriptor resource. * @returns {string} A string representing the channel_descriptor. */ - matchChannelDescriptorFromOrganizationChannelDescriptorName(organizationChannelDescriptorName: string) { - return this.pathTemplates.organizationChannelDescriptorPathTemplate.match(organizationChannelDescriptorName).channel_descriptor; + matchChannelDescriptorFromOrganizationChannelDescriptorName( + organizationChannelDescriptorName: string, + ) { + return this.pathTemplates.organizationChannelDescriptorPathTemplate.match( + organizationChannelDescriptorName, + ).channel_descriptor; } /** @@ -2408,7 +2941,7 @@ export class MetricServiceClient { * @param {string} group * @returns {string} Resource name string. */ - organizationGroupPath(organization:string,group:string) { + organizationGroupPath(organization: string, group: string) { return this.pathTemplates.organizationGroupPathTemplate.render({ organization: organization, group: group, @@ -2423,7 +2956,9 @@ export class MetricServiceClient { * @returns {string} A string representing the organization. */ matchOrganizationFromOrganizationGroupName(organizationGroupName: string) { - return this.pathTemplates.organizationGroupPathTemplate.match(organizationGroupName).organization; + return this.pathTemplates.organizationGroupPathTemplate.match( + organizationGroupName, + ).organization; } /** @@ -2434,7 +2969,9 @@ export class MetricServiceClient { * @returns {string} A string representing the group. */ matchGroupFromOrganizationGroupName(organizationGroupName: string) { - return this.pathTemplates.organizationGroupPathTemplate.match(organizationGroupName).group; + return this.pathTemplates.organizationGroupPathTemplate.match( + organizationGroupName, + ).group; } /** @@ -2444,7 +2981,10 @@ export class MetricServiceClient { * @param {string} metric_descriptor * @returns {string} Resource name string. */ - organizationMetricDescriptorPath(organization:string,metricDescriptor:string) { + organizationMetricDescriptorPath( + organization: string, + metricDescriptor: string, + ) { return this.pathTemplates.organizationMetricDescriptorPathTemplate.render({ organization: organization, metric_descriptor: metricDescriptor, @@ -2458,8 +2998,12 @@ export class MetricServiceClient { * A fully-qualified path representing organization_metric_descriptor resource. * @returns {string} A string representing the organization. */ - matchOrganizationFromOrganizationMetricDescriptorName(organizationMetricDescriptorName: string) { - return this.pathTemplates.organizationMetricDescriptorPathTemplate.match(organizationMetricDescriptorName).organization; + matchOrganizationFromOrganizationMetricDescriptorName( + organizationMetricDescriptorName: string, + ) { + return this.pathTemplates.organizationMetricDescriptorPathTemplate.match( + organizationMetricDescriptorName, + ).organization; } /** @@ -2469,8 +3013,12 @@ export class MetricServiceClient { * A fully-qualified path representing organization_metric_descriptor resource. * @returns {string} A string representing the metric_descriptor. */ - matchMetricDescriptorFromOrganizationMetricDescriptorName(organizationMetricDescriptorName: string) { - return this.pathTemplates.organizationMetricDescriptorPathTemplate.match(organizationMetricDescriptorName).metric_descriptor; + matchMetricDescriptorFromOrganizationMetricDescriptorName( + organizationMetricDescriptorName: string, + ) { + return this.pathTemplates.organizationMetricDescriptorPathTemplate.match( + organizationMetricDescriptorName, + ).metric_descriptor; } /** @@ -2480,11 +3028,16 @@ export class MetricServiceClient { * @param {string} monitored_resource_descriptor * @returns {string} Resource name string. */ - organizationMonitoredResourceDescriptorPath(organization:string,monitoredResourceDescriptor:string) { - return this.pathTemplates.organizationMonitoredResourceDescriptorPathTemplate.render({ - organization: organization, - monitored_resource_descriptor: monitoredResourceDescriptor, - }); + organizationMonitoredResourceDescriptorPath( + organization: string, + monitoredResourceDescriptor: string, + ) { + return this.pathTemplates.organizationMonitoredResourceDescriptorPathTemplate.render( + { + organization: organization, + monitored_resource_descriptor: monitoredResourceDescriptor, + }, + ); } /** @@ -2494,8 +3047,12 @@ export class MetricServiceClient { * A fully-qualified path representing organization_monitored_resource_descriptor resource. * @returns {string} A string representing the organization. */ - matchOrganizationFromOrganizationMonitoredResourceDescriptorName(organizationMonitoredResourceDescriptorName: string) { - return this.pathTemplates.organizationMonitoredResourceDescriptorPathTemplate.match(organizationMonitoredResourceDescriptorName).organization; + matchOrganizationFromOrganizationMonitoredResourceDescriptorName( + organizationMonitoredResourceDescriptorName: string, + ) { + return this.pathTemplates.organizationMonitoredResourceDescriptorPathTemplate.match( + organizationMonitoredResourceDescriptorName, + ).organization; } /** @@ -2505,8 +3062,12 @@ export class MetricServiceClient { * A fully-qualified path representing organization_monitored_resource_descriptor resource. * @returns {string} A string representing the monitored_resource_descriptor. */ - matchMonitoredResourceDescriptorFromOrganizationMonitoredResourceDescriptorName(organizationMonitoredResourceDescriptorName: string) { - return this.pathTemplates.organizationMonitoredResourceDescriptorPathTemplate.match(organizationMonitoredResourceDescriptorName).monitored_resource_descriptor; + matchMonitoredResourceDescriptorFromOrganizationMonitoredResourceDescriptorName( + organizationMonitoredResourceDescriptorName: string, + ) { + return this.pathTemplates.organizationMonitoredResourceDescriptorPathTemplate.match( + organizationMonitoredResourceDescriptorName, + ).monitored_resource_descriptor; } /** @@ -2516,11 +3077,16 @@ export class MetricServiceClient { * @param {string} notification_channel * @returns {string} Resource name string. */ - organizationNotificationChannelPath(organization:string,notificationChannel:string) { - return this.pathTemplates.organizationNotificationChannelPathTemplate.render({ - organization: organization, - notification_channel: notificationChannel, - }); + organizationNotificationChannelPath( + organization: string, + notificationChannel: string, + ) { + return this.pathTemplates.organizationNotificationChannelPathTemplate.render( + { + organization: organization, + notification_channel: notificationChannel, + }, + ); } /** @@ -2530,8 +3096,12 @@ export class MetricServiceClient { * A fully-qualified path representing organization_notification_channel resource. * @returns {string} A string representing the organization. */ - matchOrganizationFromOrganizationNotificationChannelName(organizationNotificationChannelName: string) { - return this.pathTemplates.organizationNotificationChannelPathTemplate.match(organizationNotificationChannelName).organization; + matchOrganizationFromOrganizationNotificationChannelName( + organizationNotificationChannelName: string, + ) { + return this.pathTemplates.organizationNotificationChannelPathTemplate.match( + organizationNotificationChannelName, + ).organization; } /** @@ -2541,8 +3111,12 @@ export class MetricServiceClient { * A fully-qualified path representing organization_notification_channel resource. * @returns {string} A string representing the notification_channel. */ - matchNotificationChannelFromOrganizationNotificationChannelName(organizationNotificationChannelName: string) { - return this.pathTemplates.organizationNotificationChannelPathTemplate.match(organizationNotificationChannelName).notification_channel; + matchNotificationChannelFromOrganizationNotificationChannelName( + organizationNotificationChannelName: string, + ) { + return this.pathTemplates.organizationNotificationChannelPathTemplate.match( + organizationNotificationChannelName, + ).notification_channel; } /** @@ -2552,7 +3126,7 @@ export class MetricServiceClient { * @param {string} service * @returns {string} Resource name string. */ - organizationServicePath(organization:string,service:string) { + organizationServicePath(organization: string, service: string) { return this.pathTemplates.organizationServicePathTemplate.render({ organization: organization, service: service, @@ -2566,8 +3140,12 @@ export class MetricServiceClient { * A fully-qualified path representing organization_service resource. * @returns {string} A string representing the organization. */ - matchOrganizationFromOrganizationServiceName(organizationServiceName: string) { - return this.pathTemplates.organizationServicePathTemplate.match(organizationServiceName).organization; + matchOrganizationFromOrganizationServiceName( + organizationServiceName: string, + ) { + return this.pathTemplates.organizationServicePathTemplate.match( + organizationServiceName, + ).organization; } /** @@ -2578,7 +3156,9 @@ export class MetricServiceClient { * @returns {string} A string representing the service. */ matchServiceFromOrganizationServiceName(organizationServiceName: string) { - return this.pathTemplates.organizationServicePathTemplate.match(organizationServiceName).service; + return this.pathTemplates.organizationServicePathTemplate.match( + organizationServiceName, + ).service; } /** @@ -2589,12 +3169,18 @@ export class MetricServiceClient { * @param {string} service_level_objective * @returns {string} Resource name string. */ - organizationServiceServiceLevelObjectivePath(organization:string,service:string,serviceLevelObjective:string) { - return this.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.render({ - organization: organization, - service: service, - service_level_objective: serviceLevelObjective, - }); + organizationServiceServiceLevelObjectivePath( + organization: string, + service: string, + serviceLevelObjective: string, + ) { + return this.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.render( + { + organization: organization, + service: service, + service_level_objective: serviceLevelObjective, + }, + ); } /** @@ -2604,8 +3190,12 @@ export class MetricServiceClient { * A fully-qualified path representing organization_service_service_level_objective resource. * @returns {string} A string representing the organization. */ - matchOrganizationFromOrganizationServiceServiceLevelObjectiveName(organizationServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match(organizationServiceServiceLevelObjectiveName).organization; + matchOrganizationFromOrganizationServiceServiceLevelObjectiveName( + organizationServiceServiceLevelObjectiveName: string, + ) { + return this.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match( + organizationServiceServiceLevelObjectiveName, + ).organization; } /** @@ -2615,8 +3205,12 @@ export class MetricServiceClient { * A fully-qualified path representing organization_service_service_level_objective resource. * @returns {string} A string representing the service. */ - matchServiceFromOrganizationServiceServiceLevelObjectiveName(organizationServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match(organizationServiceServiceLevelObjectiveName).service; + matchServiceFromOrganizationServiceServiceLevelObjectiveName( + organizationServiceServiceLevelObjectiveName: string, + ) { + return this.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match( + organizationServiceServiceLevelObjectiveName, + ).service; } /** @@ -2626,8 +3220,12 @@ export class MetricServiceClient { * A fully-qualified path representing organization_service_service_level_objective resource. * @returns {string} A string representing the service_level_objective. */ - matchServiceLevelObjectiveFromOrganizationServiceServiceLevelObjectiveName(organizationServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match(organizationServiceServiceLevelObjectiveName).service_level_objective; + matchServiceLevelObjectiveFromOrganizationServiceServiceLevelObjectiveName( + organizationServiceServiceLevelObjectiveName: string, + ) { + return this.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match( + organizationServiceServiceLevelObjectiveName, + ).service_level_objective; } /** @@ -2637,7 +3235,10 @@ export class MetricServiceClient { * @param {string} uptime_check_config * @returns {string} Resource name string. */ - organizationUptimeCheckConfigPath(organization:string,uptimeCheckConfig:string) { + organizationUptimeCheckConfigPath( + organization: string, + uptimeCheckConfig: string, + ) { return this.pathTemplates.organizationUptimeCheckConfigPathTemplate.render({ organization: organization, uptime_check_config: uptimeCheckConfig, @@ -2651,8 +3252,12 @@ export class MetricServiceClient { * A fully-qualified path representing organization_uptime_check_config resource. * @returns {string} A string representing the organization. */ - matchOrganizationFromOrganizationUptimeCheckConfigName(organizationUptimeCheckConfigName: string) { - return this.pathTemplates.organizationUptimeCheckConfigPathTemplate.match(organizationUptimeCheckConfigName).organization; + matchOrganizationFromOrganizationUptimeCheckConfigName( + organizationUptimeCheckConfigName: string, + ) { + return this.pathTemplates.organizationUptimeCheckConfigPathTemplate.match( + organizationUptimeCheckConfigName, + ).organization; } /** @@ -2662,8 +3267,12 @@ export class MetricServiceClient { * A fully-qualified path representing organization_uptime_check_config resource. * @returns {string} A string representing the uptime_check_config. */ - matchUptimeCheckConfigFromOrganizationUptimeCheckConfigName(organizationUptimeCheckConfigName: string) { - return this.pathTemplates.organizationUptimeCheckConfigPathTemplate.match(organizationUptimeCheckConfigName).uptime_check_config; + matchUptimeCheckConfigFromOrganizationUptimeCheckConfigName( + organizationUptimeCheckConfigName: string, + ) { + return this.pathTemplates.organizationUptimeCheckConfigPathTemplate.match( + organizationUptimeCheckConfigName, + ).uptime_check_config; } /** @@ -2672,7 +3281,7 @@ export class MetricServiceClient { * @param {string} project * @returns {string} Resource name string. */ - projectPath(project:string) { + projectPath(project: string) { return this.pathTemplates.projectPathTemplate.render({ project: project, }); @@ -2696,7 +3305,7 @@ export class MetricServiceClient { * @param {string} alert_policy * @returns {string} Resource name string. */ - projectAlertPolicyPath(project:string,alertPolicy:string) { + projectAlertPolicyPath(project: string, alertPolicy: string) { return this.pathTemplates.projectAlertPolicyPathTemplate.render({ project: project, alert_policy: alertPolicy, @@ -2711,7 +3320,9 @@ export class MetricServiceClient { * @returns {string} A string representing the project. */ matchProjectFromProjectAlertPolicyName(projectAlertPolicyName: string) { - return this.pathTemplates.projectAlertPolicyPathTemplate.match(projectAlertPolicyName).project; + return this.pathTemplates.projectAlertPolicyPathTemplate.match( + projectAlertPolicyName, + ).project; } /** @@ -2722,7 +3333,9 @@ export class MetricServiceClient { * @returns {string} A string representing the alert_policy. */ matchAlertPolicyFromProjectAlertPolicyName(projectAlertPolicyName: string) { - return this.pathTemplates.projectAlertPolicyPathTemplate.match(projectAlertPolicyName).alert_policy; + return this.pathTemplates.projectAlertPolicyPathTemplate.match( + projectAlertPolicyName, + ).alert_policy; } /** @@ -2733,7 +3346,11 @@ export class MetricServiceClient { * @param {string} condition * @returns {string} Resource name string. */ - projectAlertPolicyConditionPath(project:string,alertPolicy:string,condition:string) { + projectAlertPolicyConditionPath( + project: string, + alertPolicy: string, + condition: string, + ) { return this.pathTemplates.projectAlertPolicyConditionPathTemplate.render({ project: project, alert_policy: alertPolicy, @@ -2748,8 +3365,12 @@ export class MetricServiceClient { * A fully-qualified path representing project_alert_policy_condition resource. * @returns {string} A string representing the project. */ - matchProjectFromProjectAlertPolicyConditionName(projectAlertPolicyConditionName: string) { - return this.pathTemplates.projectAlertPolicyConditionPathTemplate.match(projectAlertPolicyConditionName).project; + matchProjectFromProjectAlertPolicyConditionName( + projectAlertPolicyConditionName: string, + ) { + return this.pathTemplates.projectAlertPolicyConditionPathTemplate.match( + projectAlertPolicyConditionName, + ).project; } /** @@ -2759,8 +3380,12 @@ export class MetricServiceClient { * A fully-qualified path representing project_alert_policy_condition resource. * @returns {string} A string representing the alert_policy. */ - matchAlertPolicyFromProjectAlertPolicyConditionName(projectAlertPolicyConditionName: string) { - return this.pathTemplates.projectAlertPolicyConditionPathTemplate.match(projectAlertPolicyConditionName).alert_policy; + matchAlertPolicyFromProjectAlertPolicyConditionName( + projectAlertPolicyConditionName: string, + ) { + return this.pathTemplates.projectAlertPolicyConditionPathTemplate.match( + projectAlertPolicyConditionName, + ).alert_policy; } /** @@ -2770,8 +3395,12 @@ export class MetricServiceClient { * A fully-qualified path representing project_alert_policy_condition resource. * @returns {string} A string representing the condition. */ - matchConditionFromProjectAlertPolicyConditionName(projectAlertPolicyConditionName: string) { - return this.pathTemplates.projectAlertPolicyConditionPathTemplate.match(projectAlertPolicyConditionName).condition; + matchConditionFromProjectAlertPolicyConditionName( + projectAlertPolicyConditionName: string, + ) { + return this.pathTemplates.projectAlertPolicyConditionPathTemplate.match( + projectAlertPolicyConditionName, + ).condition; } /** @@ -2781,7 +3410,7 @@ export class MetricServiceClient { * @param {string} channel_descriptor * @returns {string} Resource name string. */ - projectChannelDescriptorPath(project:string,channelDescriptor:string) { + projectChannelDescriptorPath(project: string, channelDescriptor: string) { return this.pathTemplates.projectChannelDescriptorPathTemplate.render({ project: project, channel_descriptor: channelDescriptor, @@ -2795,8 +3424,12 @@ export class MetricServiceClient { * A fully-qualified path representing project_channel_descriptor resource. * @returns {string} A string representing the project. */ - matchProjectFromProjectChannelDescriptorName(projectChannelDescriptorName: string) { - return this.pathTemplates.projectChannelDescriptorPathTemplate.match(projectChannelDescriptorName).project; + matchProjectFromProjectChannelDescriptorName( + projectChannelDescriptorName: string, + ) { + return this.pathTemplates.projectChannelDescriptorPathTemplate.match( + projectChannelDescriptorName, + ).project; } /** @@ -2806,8 +3439,12 @@ export class MetricServiceClient { * A fully-qualified path representing project_channel_descriptor resource. * @returns {string} A string representing the channel_descriptor. */ - matchChannelDescriptorFromProjectChannelDescriptorName(projectChannelDescriptorName: string) { - return this.pathTemplates.projectChannelDescriptorPathTemplate.match(projectChannelDescriptorName).channel_descriptor; + matchChannelDescriptorFromProjectChannelDescriptorName( + projectChannelDescriptorName: string, + ) { + return this.pathTemplates.projectChannelDescriptorPathTemplate.match( + projectChannelDescriptorName, + ).channel_descriptor; } /** @@ -2817,7 +3454,7 @@ export class MetricServiceClient { * @param {string} group * @returns {string} Resource name string. */ - projectGroupPath(project:string,group:string) { + projectGroupPath(project: string, group: string) { return this.pathTemplates.projectGroupPathTemplate.render({ project: project, group: group, @@ -2832,7 +3469,8 @@ export class MetricServiceClient { * @returns {string} A string representing the project. */ matchProjectFromProjectGroupName(projectGroupName: string) { - return this.pathTemplates.projectGroupPathTemplate.match(projectGroupName).project; + return this.pathTemplates.projectGroupPathTemplate.match(projectGroupName) + .project; } /** @@ -2843,7 +3481,8 @@ export class MetricServiceClient { * @returns {string} A string representing the group. */ matchGroupFromProjectGroupName(projectGroupName: string) { - return this.pathTemplates.projectGroupPathTemplate.match(projectGroupName).group; + return this.pathTemplates.projectGroupPathTemplate.match(projectGroupName) + .group; } /** @@ -2853,7 +3492,7 @@ export class MetricServiceClient { * @param {string} metric_descriptor * @returns {string} Resource name string. */ - projectMetricDescriptorPath(project:string,metricDescriptor:string) { + projectMetricDescriptorPath(project: string, metricDescriptor: string) { return this.pathTemplates.projectMetricDescriptorPathTemplate.render({ project: project, metric_descriptor: metricDescriptor, @@ -2867,8 +3506,12 @@ export class MetricServiceClient { * A fully-qualified path representing project_metric_descriptor resource. * @returns {string} A string representing the project. */ - matchProjectFromProjectMetricDescriptorName(projectMetricDescriptorName: string) { - return this.pathTemplates.projectMetricDescriptorPathTemplate.match(projectMetricDescriptorName).project; + matchProjectFromProjectMetricDescriptorName( + projectMetricDescriptorName: string, + ) { + return this.pathTemplates.projectMetricDescriptorPathTemplate.match( + projectMetricDescriptorName, + ).project; } /** @@ -2878,8 +3521,12 @@ export class MetricServiceClient { * A fully-qualified path representing project_metric_descriptor resource. * @returns {string} A string representing the metric_descriptor. */ - matchMetricDescriptorFromProjectMetricDescriptorName(projectMetricDescriptorName: string) { - return this.pathTemplates.projectMetricDescriptorPathTemplate.match(projectMetricDescriptorName).metric_descriptor; + matchMetricDescriptorFromProjectMetricDescriptorName( + projectMetricDescriptorName: string, + ) { + return this.pathTemplates.projectMetricDescriptorPathTemplate.match( + projectMetricDescriptorName, + ).metric_descriptor; } /** @@ -2889,11 +3536,16 @@ export class MetricServiceClient { * @param {string} monitored_resource_descriptor * @returns {string} Resource name string. */ - projectMonitoredResourceDescriptorPath(project:string,monitoredResourceDescriptor:string) { - return this.pathTemplates.projectMonitoredResourceDescriptorPathTemplate.render({ - project: project, - monitored_resource_descriptor: monitoredResourceDescriptor, - }); + projectMonitoredResourceDescriptorPath( + project: string, + monitoredResourceDescriptor: string, + ) { + return this.pathTemplates.projectMonitoredResourceDescriptorPathTemplate.render( + { + project: project, + monitored_resource_descriptor: monitoredResourceDescriptor, + }, + ); } /** @@ -2903,8 +3555,12 @@ export class MetricServiceClient { * A fully-qualified path representing project_monitored_resource_descriptor resource. * @returns {string} A string representing the project. */ - matchProjectFromProjectMonitoredResourceDescriptorName(projectMonitoredResourceDescriptorName: string) { - return this.pathTemplates.projectMonitoredResourceDescriptorPathTemplate.match(projectMonitoredResourceDescriptorName).project; + matchProjectFromProjectMonitoredResourceDescriptorName( + projectMonitoredResourceDescriptorName: string, + ) { + return this.pathTemplates.projectMonitoredResourceDescriptorPathTemplate.match( + projectMonitoredResourceDescriptorName, + ).project; } /** @@ -2914,8 +3570,12 @@ export class MetricServiceClient { * A fully-qualified path representing project_monitored_resource_descriptor resource. * @returns {string} A string representing the monitored_resource_descriptor. */ - matchMonitoredResourceDescriptorFromProjectMonitoredResourceDescriptorName(projectMonitoredResourceDescriptorName: string) { - return this.pathTemplates.projectMonitoredResourceDescriptorPathTemplate.match(projectMonitoredResourceDescriptorName).monitored_resource_descriptor; + matchMonitoredResourceDescriptorFromProjectMonitoredResourceDescriptorName( + projectMonitoredResourceDescriptorName: string, + ) { + return this.pathTemplates.projectMonitoredResourceDescriptorPathTemplate.match( + projectMonitoredResourceDescriptorName, + ).monitored_resource_descriptor; } /** @@ -2925,7 +3585,7 @@ export class MetricServiceClient { * @param {string} notification_channel * @returns {string} Resource name string. */ - projectNotificationChannelPath(project:string,notificationChannel:string) { + projectNotificationChannelPath(project: string, notificationChannel: string) { return this.pathTemplates.projectNotificationChannelPathTemplate.render({ project: project, notification_channel: notificationChannel, @@ -2939,8 +3599,12 @@ export class MetricServiceClient { * A fully-qualified path representing project_notification_channel resource. * @returns {string} A string representing the project. */ - matchProjectFromProjectNotificationChannelName(projectNotificationChannelName: string) { - return this.pathTemplates.projectNotificationChannelPathTemplate.match(projectNotificationChannelName).project; + matchProjectFromProjectNotificationChannelName( + projectNotificationChannelName: string, + ) { + return this.pathTemplates.projectNotificationChannelPathTemplate.match( + projectNotificationChannelName, + ).project; } /** @@ -2950,8 +3614,12 @@ export class MetricServiceClient { * A fully-qualified path representing project_notification_channel resource. * @returns {string} A string representing the notification_channel. */ - matchNotificationChannelFromProjectNotificationChannelName(projectNotificationChannelName: string) { - return this.pathTemplates.projectNotificationChannelPathTemplate.match(projectNotificationChannelName).notification_channel; + matchNotificationChannelFromProjectNotificationChannelName( + projectNotificationChannelName: string, + ) { + return this.pathTemplates.projectNotificationChannelPathTemplate.match( + projectNotificationChannelName, + ).notification_channel; } /** @@ -2961,7 +3629,7 @@ export class MetricServiceClient { * @param {string} service * @returns {string} Resource name string. */ - projectServicePath(project:string,service:string) { + projectServicePath(project: string, service: string) { return this.pathTemplates.projectServicePathTemplate.render({ project: project, service: service, @@ -2976,7 +3644,9 @@ export class MetricServiceClient { * @returns {string} A string representing the project. */ matchProjectFromProjectServiceName(projectServiceName: string) { - return this.pathTemplates.projectServicePathTemplate.match(projectServiceName).project; + return this.pathTemplates.projectServicePathTemplate.match( + projectServiceName, + ).project; } /** @@ -2987,7 +3657,9 @@ export class MetricServiceClient { * @returns {string} A string representing the service. */ matchServiceFromProjectServiceName(projectServiceName: string) { - return this.pathTemplates.projectServicePathTemplate.match(projectServiceName).service; + return this.pathTemplates.projectServicePathTemplate.match( + projectServiceName, + ).service; } /** @@ -2998,12 +3670,18 @@ export class MetricServiceClient { * @param {string} service_level_objective * @returns {string} Resource name string. */ - projectServiceServiceLevelObjectivePath(project:string,service:string,serviceLevelObjective:string) { - return this.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.render({ - project: project, - service: service, - service_level_objective: serviceLevelObjective, - }); + projectServiceServiceLevelObjectivePath( + project: string, + service: string, + serviceLevelObjective: string, + ) { + return this.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.render( + { + project: project, + service: service, + service_level_objective: serviceLevelObjective, + }, + ); } /** @@ -3013,8 +3691,12 @@ export class MetricServiceClient { * A fully-qualified path representing project_service_service_level_objective resource. * @returns {string} A string representing the project. */ - matchProjectFromProjectServiceServiceLevelObjectiveName(projectServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match(projectServiceServiceLevelObjectiveName).project; + matchProjectFromProjectServiceServiceLevelObjectiveName( + projectServiceServiceLevelObjectiveName: string, + ) { + return this.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match( + projectServiceServiceLevelObjectiveName, + ).project; } /** @@ -3024,8 +3706,12 @@ export class MetricServiceClient { * A fully-qualified path representing project_service_service_level_objective resource. * @returns {string} A string representing the service. */ - matchServiceFromProjectServiceServiceLevelObjectiveName(projectServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match(projectServiceServiceLevelObjectiveName).service; + matchServiceFromProjectServiceServiceLevelObjectiveName( + projectServiceServiceLevelObjectiveName: string, + ) { + return this.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match( + projectServiceServiceLevelObjectiveName, + ).service; } /** @@ -3035,8 +3721,12 @@ export class MetricServiceClient { * A fully-qualified path representing project_service_service_level_objective resource. * @returns {string} A string representing the service_level_objective. */ - matchServiceLevelObjectiveFromProjectServiceServiceLevelObjectiveName(projectServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match(projectServiceServiceLevelObjectiveName).service_level_objective; + matchServiceLevelObjectiveFromProjectServiceServiceLevelObjectiveName( + projectServiceServiceLevelObjectiveName: string, + ) { + return this.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match( + projectServiceServiceLevelObjectiveName, + ).service_level_objective; } /** @@ -3046,7 +3736,7 @@ export class MetricServiceClient { * @param {string} time_series * @returns {string} Resource name string. */ - projectTimeSeriesPath(project:string,timeSeries:string) { + projectTimeSeriesPath(project: string, timeSeries: string) { return this.pathTemplates.projectTimeSeriesPathTemplate.render({ project: project, time_series: timeSeries, @@ -3061,7 +3751,9 @@ export class MetricServiceClient { * @returns {string} A string representing the project. */ matchProjectFromProjectTimeSeriesName(projectTimeSeriesName: string) { - return this.pathTemplates.projectTimeSeriesPathTemplate.match(projectTimeSeriesName).project; + return this.pathTemplates.projectTimeSeriesPathTemplate.match( + projectTimeSeriesName, + ).project; } /** @@ -3072,7 +3764,9 @@ export class MetricServiceClient { * @returns {string} A string representing the time_series. */ matchTimeSeriesFromProjectTimeSeriesName(projectTimeSeriesName: string) { - return this.pathTemplates.projectTimeSeriesPathTemplate.match(projectTimeSeriesName).time_series; + return this.pathTemplates.projectTimeSeriesPathTemplate.match( + projectTimeSeriesName, + ).time_series; } /** @@ -3082,7 +3776,7 @@ export class MetricServiceClient { * @param {string} uptime_check_config * @returns {string} Resource name string. */ - projectUptimeCheckConfigPath(project:string,uptimeCheckConfig:string) { + projectUptimeCheckConfigPath(project: string, uptimeCheckConfig: string) { return this.pathTemplates.projectUptimeCheckConfigPathTemplate.render({ project: project, uptime_check_config: uptimeCheckConfig, @@ -3096,8 +3790,12 @@ export class MetricServiceClient { * A fully-qualified path representing project_uptime_check_config resource. * @returns {string} A string representing the project. */ - matchProjectFromProjectUptimeCheckConfigName(projectUptimeCheckConfigName: string) { - return this.pathTemplates.projectUptimeCheckConfigPathTemplate.match(projectUptimeCheckConfigName).project; + matchProjectFromProjectUptimeCheckConfigName( + projectUptimeCheckConfigName: string, + ) { + return this.pathTemplates.projectUptimeCheckConfigPathTemplate.match( + projectUptimeCheckConfigName, + ).project; } /** @@ -3107,8 +3805,12 @@ export class MetricServiceClient { * A fully-qualified path representing project_uptime_check_config resource. * @returns {string} A string representing the uptime_check_config. */ - matchUptimeCheckConfigFromProjectUptimeCheckConfigName(projectUptimeCheckConfigName: string) { - return this.pathTemplates.projectUptimeCheckConfigPathTemplate.match(projectUptimeCheckConfigName).uptime_check_config; + matchUptimeCheckConfigFromProjectUptimeCheckConfigName( + projectUptimeCheckConfigName: string, + ) { + return this.pathTemplates.projectUptimeCheckConfigPathTemplate.match( + projectUptimeCheckConfigName, + ).uptime_check_config; } /** @@ -3118,7 +3820,7 @@ export class MetricServiceClient { * @param {string} snooze * @returns {string} Resource name string. */ - snoozePath(project:string,snooze:string) { + snoozePath(project: string, snooze: string) { return this.pathTemplates.snoozePathTemplate.render({ project: project, snooze: snooze, @@ -3155,7 +3857,7 @@ export class MetricServiceClient { */ close(): Promise { if (this.metricServiceStub && !this._terminated) { - return this.metricServiceStub.then(stub => { + return this.metricServiceStub.then((stub) => { this._log.info('ending gRPC channel'); this._terminated = true; stub.close(); @@ -3163,4 +3865,4 @@ export class MetricServiceClient { } return Promise.resolve(); } -} \ No newline at end of file +} diff --git a/packages/google-cloud-monitoring/src/v3/notification_channel_service_client.ts b/packages/google-cloud-monitoring/src/v3/notification_channel_service_client.ts index 5eb25c239b09..ffc170c257a0 100644 --- a/packages/google-cloud-monitoring/src/v3/notification_channel_service_client.ts +++ b/packages/google-cloud-monitoring/src/v3/notification_channel_service_client.ts @@ -18,11 +18,18 @@ /* global window */ import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} from 'google-gax'; -import {Transform} from 'stream'; +import type { + Callback, + CallOptions, + Descriptors, + ClientOptions, + PaginationCallback, + GaxCall, +} from 'google-gax'; +import { Transform } from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; +import { loggingUtils as logging, decodeAnyProtosInArray } from 'google-gax'; /** * Client JSON configuration object, loaded from @@ -45,7 +52,7 @@ export class NotificationChannelServiceClient { 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('monitoring'); @@ -58,9 +65,9 @@ export class NotificationChannelServiceClient { batching: {}, }; warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - notificationChannelServiceStub?: Promise<{[name: string]: Function}>; + innerApiCalls: { [name: string]: Function }; + pathTemplates: { [name: string]: gax.PathTemplate }; + notificationChannelServiceStub?: Promise<{ [name: string]: Function }>; /** * Construct an instance of NotificationChannelServiceClient. @@ -101,21 +108,43 @@ export class NotificationChannelServiceClient { * const client = new NotificationChannelServiceClient({fallback: true}, gax); * ``` */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + constructor( + opts?: ClientOptions, + gaxInstance?: typeof gax | typeof gax.fallback, + ) { // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof NotificationChannelServiceClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); + const staticMembers = this + .constructor as typeof NotificationChannelServiceClient; + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.', + ); } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; + const universeDomainEnvVar = + typeof process === 'object' && typeof process.env === 'object' + ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] + : undefined; + this._universeDomain = + opts?.universeDomain ?? + opts?.universe_domain ?? + universeDomainEnvVar ?? + 'googleapis.com'; this._servicePath = 'monitoring.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + const servicePath = + opts?.servicePath || opts?.apiEndpoint || this._servicePath; + this._providedCustomServicePath = !!( + opts?.servicePath || opts?.apiEndpoint + ); const port = opts?.port || staticMembers.port; const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts); // Request numeric enum values if REST transport is used. opts.numericEnums = true; @@ -140,7 +169,7 @@ export class NotificationChannelServiceClient { this._opts = opts; // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set useJWTAccessWithScope on the auth object. this.auth.useJWTAccessWithScope = true; @@ -154,10 +183,7 @@ export class NotificationChannelServiceClient { } // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; if (typeof process === 'object' && 'versions' in process) { clientHeader.push(`gl-node/${process.versions.node}`); } else { @@ -179,82 +205,89 @@ export class NotificationChannelServiceClient { // Create useful helper objects for these. this.pathTemplates = { folderAlertPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/alertPolicies/{alert_policy}' + 'folders/{folder}/alertPolicies/{alert_policy}', ), folderAlertPolicyConditionPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/alertPolicies/{alert_policy}/conditions/{condition}' + 'folders/{folder}/alertPolicies/{alert_policy}/conditions/{condition}', ), folderChannelDescriptorPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/notificationChannelDescriptors/{channel_descriptor}' + 'folders/{folder}/notificationChannelDescriptors/{channel_descriptor}', ), folderGroupPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/groups/{group}' + 'folders/{folder}/groups/{group}', ), folderNotificationChannelPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/notificationChannels/{notification_channel}' + 'folders/{folder}/notificationChannels/{notification_channel}', ), folderServicePathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/services/{service}' - ), - folderServiceServiceLevelObjectivePathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/services/{service}/serviceLevelObjectives/{service_level_objective}' + 'folders/{folder}/services/{service}', ), + folderServiceServiceLevelObjectivePathTemplate: + new this._gaxModule.PathTemplate( + 'folders/{folder}/services/{service}/serviceLevelObjectives/{service_level_objective}', + ), folderUptimeCheckConfigPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/uptimeCheckConfigs/{uptime_check_config}' + 'folders/{folder}/uptimeCheckConfigs/{uptime_check_config}', ), organizationAlertPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/alertPolicies/{alert_policy}' - ), - organizationAlertPolicyConditionPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/alertPolicies/{alert_policy}/conditions/{condition}' - ), - organizationChannelDescriptorPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/notificationChannelDescriptors/{channel_descriptor}' + 'organizations/{organization}/alertPolicies/{alert_policy}', ), + organizationAlertPolicyConditionPathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/alertPolicies/{alert_policy}/conditions/{condition}', + ), + organizationChannelDescriptorPathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/notificationChannelDescriptors/{channel_descriptor}', + ), organizationGroupPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/groups/{group}' - ), - organizationNotificationChannelPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/notificationChannels/{notification_channel}' + 'organizations/{organization}/groups/{group}', ), + organizationNotificationChannelPathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/notificationChannels/{notification_channel}', + ), organizationServicePathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/services/{service}' - ), - organizationServiceServiceLevelObjectivePathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/services/{service}/serviceLevelObjectives/{service_level_objective}' - ), - organizationUptimeCheckConfigPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/uptimeCheckConfigs/{uptime_check_config}' + 'organizations/{organization}/services/{service}', ), + organizationServiceServiceLevelObjectivePathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/services/{service}/serviceLevelObjectives/{service_level_objective}', + ), + organizationUptimeCheckConfigPathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/uptimeCheckConfigs/{uptime_check_config}', + ), projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}' + 'projects/{project}', ), projectAlertPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/alertPolicies/{alert_policy}' + 'projects/{project}/alertPolicies/{alert_policy}', ), projectAlertPolicyConditionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/alertPolicies/{alert_policy}/conditions/{condition}' + 'projects/{project}/alertPolicies/{alert_policy}/conditions/{condition}', ), projectChannelDescriptorPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/notificationChannelDescriptors/{channel_descriptor}' + 'projects/{project}/notificationChannelDescriptors/{channel_descriptor}', ), projectGroupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/groups/{group}' + 'projects/{project}/groups/{group}', ), projectNotificationChannelPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/notificationChannels/{notification_channel}' + 'projects/{project}/notificationChannels/{notification_channel}', ), projectServicePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/services/{service}' - ), - projectServiceServiceLevelObjectivePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/services/{service}/serviceLevelObjectives/{service_level_objective}' + 'projects/{project}/services/{service}', ), + projectServiceServiceLevelObjectivePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/services/{service}/serviceLevelObjectives/{service_level_objective}', + ), projectUptimeCheckConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/uptimeCheckConfigs/{uptime_check_config}' + 'projects/{project}/uptimeCheckConfigs/{uptime_check_config}', ), snoozePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/snoozes/{snooze}' + 'projects/{project}/snoozes/{snooze}', ), }; @@ -262,16 +295,25 @@ export class NotificationChannelServiceClient { // (e.g. 50 results at a time, with tokens to get subsequent // pages). Denote the keys used for pagination and results. this.descriptors.page = { - listNotificationChannelDescriptors: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'channelDescriptors'), - listNotificationChannels: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'notificationChannels') + listNotificationChannelDescriptors: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'channelDescriptors', + ), + listNotificationChannels: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'notificationChannels', + ), }; // Put together the default options sent with requests. this._defaults = this._gaxGrpc.constructSettings( - 'google.monitoring.v3.NotificationChannelService', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + 'google.monitoring.v3.NotificationChannelService', + gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, + { 'x-goog-api-client': clientHeader.join(' ') }, + ); // Set up a dictionary of "inner API calls"; the core implementation // of calling the API is handled in `google-gax`, with this code @@ -302,37 +344,51 @@ export class NotificationChannelServiceClient { // Put together the "service stub" for // google.monitoring.v3.NotificationChannelService. this.notificationChannelServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.monitoring.v3.NotificationChannelService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.monitoring.v3.NotificationChannelService', + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any (this._protos as any).google.monitoring.v3.NotificationChannelService, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; + this._opts, + this._providedCustomServicePath, + ) as Promise<{ [method: string]: Function }>; // Iterate over each of the methods that the service provides // and create an API call method for each. - const notificationChannelServiceStubMethods = - ['listNotificationChannelDescriptors', 'getNotificationChannelDescriptor', 'listNotificationChannels', 'getNotificationChannel', 'createNotificationChannel', 'updateNotificationChannel', 'deleteNotificationChannel', 'sendNotificationChannelVerificationCode', 'getNotificationChannelVerificationCode', 'verifyNotificationChannel']; + const notificationChannelServiceStubMethods = [ + 'listNotificationChannelDescriptors', + 'getNotificationChannelDescriptor', + 'listNotificationChannels', + 'getNotificationChannel', + 'createNotificationChannel', + 'updateNotificationChannel', + 'deleteNotificationChannel', + 'sendNotificationChannelVerificationCode', + 'getNotificationChannelVerificationCode', + 'verifyNotificationChannel', + ]; for (const methodName of notificationChannelServiceStubMethods) { const callPromise = this.notificationChannelServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { + (stub) => + (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error | null | undefined) => () => { throw err; - }); + }, + ); - const descriptor = - this.descriptors.page[methodName] || - undefined; + const descriptor = this.descriptors.page[methodName] || undefined; const apiCall = this._gaxModule.createApiCall( callPromise, this._defaults[methodName], descriptor, - this._opts.fallback + this._opts.fallback, ); this.innerApiCalls[methodName] = apiCall; @@ -347,8 +403,14 @@ export class NotificationChannelServiceClient { * @returns {string} The DNS address for this service. */ static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); } return 'monitoring.googleapis.com'; } @@ -359,8 +421,14 @@ export class NotificationChannelServiceClient { * @returns {string} The DNS address for this service. */ static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); } return 'monitoring.googleapis.com'; } @@ -394,7 +462,7 @@ export class NotificationChannelServiceClient { return [ 'https://www.googleapis.com/auth/cloud-platform', 'https://www.googleapis.com/auth/monitoring', - 'https://www.googleapis.com/auth/monitoring.read' + 'https://www.googleapis.com/auth/monitoring.read', ]; } @@ -404,8 +472,9 @@ export class NotificationChannelServiceClient { * Return the project ID used by this class. * @returns {Promise} A promise that resolves to string containing the project ID. */ - getProjectId(callback?: Callback): - Promise|void { + getProjectId( + callback?: Callback, + ): Promise | void { if (callback) { this.auth.getProjectId(callback); return; @@ -416,1196 +485,1648 @@ export class NotificationChannelServiceClient { // ------------------- // -- Service calls -- // ------------------- -/** - * Gets a single channel descriptor. The descriptor indicates which fields - * are expected / permitted for a notification channel of the given type. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The channel type for which to execute the request. The format is: - * - * projects/[PROJECT_ID_OR_NUMBER]/notificationChannelDescriptors/[CHANNEL_TYPE] - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.monitoring.v3.NotificationChannelDescriptor|NotificationChannelDescriptor}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v3/notification_channel_service.get_notification_channel_descriptor.js - * region_tag:monitoring_v3_generated_NotificationChannelService_GetNotificationChannelDescriptor_async - */ + /** + * Gets a single channel descriptor. The descriptor indicates which fields + * are expected / permitted for a notification channel of the given type. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The channel type for which to execute the request. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER]/notificationChannelDescriptors/[CHANNEL_TYPE] + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.monitoring.v3.NotificationChannelDescriptor|NotificationChannelDescriptor}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v3/notification_channel_service.get_notification_channel_descriptor.js + * region_tag:monitoring_v3_generated_NotificationChannelService_GetNotificationChannelDescriptor_async + */ getNotificationChannelDescriptor( - request?: protos.google.monitoring.v3.IGetNotificationChannelDescriptorRequest, - options?: CallOptions): - Promise<[ - protos.google.monitoring.v3.INotificationChannelDescriptor, - protos.google.monitoring.v3.IGetNotificationChannelDescriptorRequest|undefined, {}|undefined - ]>; + request?: protos.google.monitoring.v3.IGetNotificationChannelDescriptorRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.monitoring.v3.INotificationChannelDescriptor, + ( + | protos.google.monitoring.v3.IGetNotificationChannelDescriptorRequest + | undefined + ), + {} | undefined, + ] + >; getNotificationChannelDescriptor( - request: protos.google.monitoring.v3.IGetNotificationChannelDescriptorRequest, - options: CallOptions, - callback: Callback< - protos.google.monitoring.v3.INotificationChannelDescriptor, - protos.google.monitoring.v3.IGetNotificationChannelDescriptorRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.monitoring.v3.IGetNotificationChannelDescriptorRequest, + options: CallOptions, + callback: Callback< + protos.google.monitoring.v3.INotificationChannelDescriptor, + | protos.google.monitoring.v3.IGetNotificationChannelDescriptorRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getNotificationChannelDescriptor( - request: protos.google.monitoring.v3.IGetNotificationChannelDescriptorRequest, - callback: Callback< - protos.google.monitoring.v3.INotificationChannelDescriptor, - protos.google.monitoring.v3.IGetNotificationChannelDescriptorRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.monitoring.v3.IGetNotificationChannelDescriptorRequest, + callback: Callback< + protos.google.monitoring.v3.INotificationChannelDescriptor, + | protos.google.monitoring.v3.IGetNotificationChannelDescriptorRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getNotificationChannelDescriptor( - request?: protos.google.monitoring.v3.IGetNotificationChannelDescriptorRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.monitoring.v3.INotificationChannelDescriptor, - protos.google.monitoring.v3.IGetNotificationChannelDescriptorRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.monitoring.v3.IGetNotificationChannelDescriptorRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.monitoring.v3.INotificationChannelDescriptor, - protos.google.monitoring.v3.IGetNotificationChannelDescriptorRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.monitoring.v3.INotificationChannelDescriptor, - protos.google.monitoring.v3.IGetNotificationChannelDescriptorRequest|undefined, {}|undefined - ]>|void { + | protos.google.monitoring.v3.IGetNotificationChannelDescriptorRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.monitoring.v3.INotificationChannelDescriptor, + | protos.google.monitoring.v3.IGetNotificationChannelDescriptorRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.monitoring.v3.INotificationChannelDescriptor, + ( + | protos.google.monitoring.v3.IGetNotificationChannelDescriptorRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('getNotificationChannelDescriptor request %j', request); - const wrappedCallback: Callback< - protos.google.monitoring.v3.INotificationChannelDescriptor, - protos.google.monitoring.v3.IGetNotificationChannelDescriptorRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.monitoring.v3.INotificationChannelDescriptor, + | protos.google.monitoring.v3.IGetNotificationChannelDescriptorRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { - this._log.info('getNotificationChannelDescriptor response %j', response); + this._log.info( + 'getNotificationChannelDescriptor response %j', + response, + ); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.getNotificationChannelDescriptor(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.monitoring.v3.INotificationChannelDescriptor, - protos.google.monitoring.v3.IGetNotificationChannelDescriptorRequest|undefined, - {}|undefined - ]) => { - this._log.info('getNotificationChannelDescriptor 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); + return this.innerApiCalls + .getNotificationChannelDescriptor(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.monitoring.v3.INotificationChannelDescriptor, + ( + | protos.google.monitoring.v3.IGetNotificationChannelDescriptorRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info( + 'getNotificationChannelDescriptor 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 single notification channel. The channel includes the relevant - * configuration details with which the channel was created. However, the - * response may truncate or omit passwords, API keys, or other private key - * matter and thus the response may not be 100% identical to the information - * that was supplied in the call to the create method. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The channel for which to execute the request. The format is: - * - * projects/[PROJECT_ID_OR_NUMBER]/notificationChannels/[CHANNEL_ID] - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.monitoring.v3.NotificationChannel|NotificationChannel}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v3/notification_channel_service.get_notification_channel.js - * region_tag:monitoring_v3_generated_NotificationChannelService_GetNotificationChannel_async - */ + /** + * Gets a single notification channel. The channel includes the relevant + * configuration details with which the channel was created. However, the + * response may truncate or omit passwords, API keys, or other private key + * matter and thus the response may not be 100% identical to the information + * that was supplied in the call to the create method. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The channel for which to execute the request. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER]/notificationChannels/[CHANNEL_ID] + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.monitoring.v3.NotificationChannel|NotificationChannel}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v3/notification_channel_service.get_notification_channel.js + * region_tag:monitoring_v3_generated_NotificationChannelService_GetNotificationChannel_async + */ getNotificationChannel( - request?: protos.google.monitoring.v3.IGetNotificationChannelRequest, - options?: CallOptions): - Promise<[ - protos.google.monitoring.v3.INotificationChannel, - protos.google.monitoring.v3.IGetNotificationChannelRequest|undefined, {}|undefined - ]>; + request?: protos.google.monitoring.v3.IGetNotificationChannelRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.monitoring.v3.INotificationChannel, + protos.google.monitoring.v3.IGetNotificationChannelRequest | undefined, + {} | undefined, + ] + >; getNotificationChannel( - request: protos.google.monitoring.v3.IGetNotificationChannelRequest, - options: CallOptions, - callback: Callback< - protos.google.monitoring.v3.INotificationChannel, - protos.google.monitoring.v3.IGetNotificationChannelRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.monitoring.v3.IGetNotificationChannelRequest, + options: CallOptions, + callback: Callback< + protos.google.monitoring.v3.INotificationChannel, + | protos.google.monitoring.v3.IGetNotificationChannelRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getNotificationChannel( - request: protos.google.monitoring.v3.IGetNotificationChannelRequest, - callback: Callback< - protos.google.monitoring.v3.INotificationChannel, - protos.google.monitoring.v3.IGetNotificationChannelRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.monitoring.v3.IGetNotificationChannelRequest, + callback: Callback< + protos.google.monitoring.v3.INotificationChannel, + | protos.google.monitoring.v3.IGetNotificationChannelRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getNotificationChannel( - request?: protos.google.monitoring.v3.IGetNotificationChannelRequest, - optionsOrCallback?: CallOptions|Callback< + request?: protos.google.monitoring.v3.IGetNotificationChannelRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.monitoring.v3.INotificationChannel, - protos.google.monitoring.v3.IGetNotificationChannelRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.monitoring.v3.INotificationChannel, - protos.google.monitoring.v3.IGetNotificationChannelRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.monitoring.v3.INotificationChannel, - protos.google.monitoring.v3.IGetNotificationChannelRequest|undefined, {}|undefined - ]>|void { + | protos.google.monitoring.v3.IGetNotificationChannelRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.monitoring.v3.INotificationChannel, + | protos.google.monitoring.v3.IGetNotificationChannelRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.monitoring.v3.INotificationChannel, + protos.google.monitoring.v3.IGetNotificationChannelRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('getNotificationChannel request %j', request); - const wrappedCallback: Callback< - protos.google.monitoring.v3.INotificationChannel, - protos.google.monitoring.v3.IGetNotificationChannelRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.monitoring.v3.INotificationChannel, + | protos.google.monitoring.v3.IGetNotificationChannelRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('getNotificationChannel response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.getNotificationChannel(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.monitoring.v3.INotificationChannel, - protos.google.monitoring.v3.IGetNotificationChannelRequest|undefined, - {}|undefined - ]) => { - this._log.info('getNotificationChannel 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); + return this.innerApiCalls + .getNotificationChannel(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.monitoring.v3.INotificationChannel, + ( + | protos.google.monitoring.v3.IGetNotificationChannelRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('getNotificationChannel 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 notification channel, representing a single notification - * endpoint such as an email address, SMS number, or PagerDuty service. - * - * Design your application to single-thread API calls that modify the state of - * notification channels in a single project. This includes calls to - * CreateNotificationChannel, DeleteNotificationChannel and - * UpdateNotificationChannel. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The - * [project](https://cloud.google.com/monitoring/api/v3#project_name) on which - * to execute the request. The format is: - * - * projects/[PROJECT_ID_OR_NUMBER] - * - * This names the container into which the channel will be - * written, this does not name the newly created channel. The resulting - * channel's name will have a normalized version of this field as a prefix, - * but will add `/notificationChannels/[CHANNEL_ID]` to identify the channel. - * @param {google.monitoring.v3.NotificationChannel} request.notificationChannel - * Required. The definition of the `NotificationChannel` to create. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.monitoring.v3.NotificationChannel|NotificationChannel}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v3/notification_channel_service.create_notification_channel.js - * region_tag:monitoring_v3_generated_NotificationChannelService_CreateNotificationChannel_async - */ + /** + * Creates a new notification channel, representing a single notification + * endpoint such as an email address, SMS number, or PagerDuty service. + * + * Design your application to single-thread API calls that modify the state of + * notification channels in a single project. This includes calls to + * CreateNotificationChannel, DeleteNotificationChannel and + * UpdateNotificationChannel. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The + * [project](https://cloud.google.com/monitoring/api/v3#project_name) on which + * to execute the request. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER] + * + * This names the container into which the channel will be + * written, this does not name the newly created channel. The resulting + * channel's name will have a normalized version of this field as a prefix, + * but will add `/notificationChannels/[CHANNEL_ID]` to identify the channel. + * @param {google.monitoring.v3.NotificationChannel} request.notificationChannel + * Required. The definition of the `NotificationChannel` to create. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.monitoring.v3.NotificationChannel|NotificationChannel}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v3/notification_channel_service.create_notification_channel.js + * region_tag:monitoring_v3_generated_NotificationChannelService_CreateNotificationChannel_async + */ createNotificationChannel( - request?: protos.google.monitoring.v3.ICreateNotificationChannelRequest, - options?: CallOptions): - Promise<[ - protos.google.monitoring.v3.INotificationChannel, - protos.google.monitoring.v3.ICreateNotificationChannelRequest|undefined, {}|undefined - ]>; + request?: protos.google.monitoring.v3.ICreateNotificationChannelRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.monitoring.v3.INotificationChannel, + protos.google.monitoring.v3.ICreateNotificationChannelRequest | undefined, + {} | undefined, + ] + >; createNotificationChannel( - request: protos.google.monitoring.v3.ICreateNotificationChannelRequest, - options: CallOptions, - callback: Callback< - protos.google.monitoring.v3.INotificationChannel, - protos.google.monitoring.v3.ICreateNotificationChannelRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.monitoring.v3.ICreateNotificationChannelRequest, + options: CallOptions, + callback: Callback< + protos.google.monitoring.v3.INotificationChannel, + | protos.google.monitoring.v3.ICreateNotificationChannelRequest + | null + | undefined, + {} | null | undefined + >, + ): void; createNotificationChannel( - request: protos.google.monitoring.v3.ICreateNotificationChannelRequest, - callback: Callback< - protos.google.monitoring.v3.INotificationChannel, - protos.google.monitoring.v3.ICreateNotificationChannelRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.monitoring.v3.ICreateNotificationChannelRequest, + callback: Callback< + protos.google.monitoring.v3.INotificationChannel, + | protos.google.monitoring.v3.ICreateNotificationChannelRequest + | null + | undefined, + {} | null | undefined + >, + ): void; createNotificationChannel( - request?: protos.google.monitoring.v3.ICreateNotificationChannelRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.monitoring.v3.INotificationChannel, - protos.google.monitoring.v3.ICreateNotificationChannelRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.monitoring.v3.ICreateNotificationChannelRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.monitoring.v3.INotificationChannel, - protos.google.monitoring.v3.ICreateNotificationChannelRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.monitoring.v3.INotificationChannel, - protos.google.monitoring.v3.ICreateNotificationChannelRequest|undefined, {}|undefined - ]>|void { + | protos.google.monitoring.v3.ICreateNotificationChannelRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.monitoring.v3.INotificationChannel, + | protos.google.monitoring.v3.ICreateNotificationChannelRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.monitoring.v3.INotificationChannel, + protos.google.monitoring.v3.ICreateNotificationChannelRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('createNotificationChannel request %j', request); - const wrappedCallback: Callback< - protos.google.monitoring.v3.INotificationChannel, - protos.google.monitoring.v3.ICreateNotificationChannelRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.monitoring.v3.INotificationChannel, + | protos.google.monitoring.v3.ICreateNotificationChannelRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('createNotificationChannel response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.createNotificationChannel(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.monitoring.v3.INotificationChannel, - protos.google.monitoring.v3.ICreateNotificationChannelRequest|undefined, - {}|undefined - ]) => { - this._log.info('createNotificationChannel 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); + return this.innerApiCalls + .createNotificationChannel(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.monitoring.v3.INotificationChannel, + ( + | protos.google.monitoring.v3.ICreateNotificationChannelRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('createNotificationChannel 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 notification channel. Fields not specified in the field mask - * remain unchanged. - * - * Design your application to single-thread API calls that modify the state of - * notification channels in a single project. This includes calls to - * CreateNotificationChannel, DeleteNotificationChannel and - * UpdateNotificationChannel. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.FieldMask} [request.updateMask] - * Optional. The fields to update. - * @param {google.monitoring.v3.NotificationChannel} request.notificationChannel - * Required. A description of the changes to be applied to the specified - * notification channel. The description must provide a definition for - * fields to be updated; the names of these fields should also be - * included in the `update_mask`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.monitoring.v3.NotificationChannel|NotificationChannel}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v3/notification_channel_service.update_notification_channel.js - * region_tag:monitoring_v3_generated_NotificationChannelService_UpdateNotificationChannel_async - */ + /** + * Updates a notification channel. Fields not specified in the field mask + * remain unchanged. + * + * Design your application to single-thread API calls that modify the state of + * notification channels in a single project. This includes calls to + * CreateNotificationChannel, DeleteNotificationChannel and + * UpdateNotificationChannel. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.protobuf.FieldMask} [request.updateMask] + * Optional. The fields to update. + * @param {google.monitoring.v3.NotificationChannel} request.notificationChannel + * Required. A description of the changes to be applied to the specified + * notification channel. The description must provide a definition for + * fields to be updated; the names of these fields should also be + * included in the `update_mask`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.monitoring.v3.NotificationChannel|NotificationChannel}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v3/notification_channel_service.update_notification_channel.js + * region_tag:monitoring_v3_generated_NotificationChannelService_UpdateNotificationChannel_async + */ updateNotificationChannel( - request?: protos.google.monitoring.v3.IUpdateNotificationChannelRequest, - options?: CallOptions): - Promise<[ - protos.google.monitoring.v3.INotificationChannel, - protos.google.monitoring.v3.IUpdateNotificationChannelRequest|undefined, {}|undefined - ]>; + request?: protos.google.monitoring.v3.IUpdateNotificationChannelRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.monitoring.v3.INotificationChannel, + protos.google.monitoring.v3.IUpdateNotificationChannelRequest | undefined, + {} | undefined, + ] + >; updateNotificationChannel( - request: protos.google.monitoring.v3.IUpdateNotificationChannelRequest, - options: CallOptions, - callback: Callback< - protos.google.monitoring.v3.INotificationChannel, - protos.google.monitoring.v3.IUpdateNotificationChannelRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.monitoring.v3.IUpdateNotificationChannelRequest, + options: CallOptions, + callback: Callback< + protos.google.monitoring.v3.INotificationChannel, + | protos.google.monitoring.v3.IUpdateNotificationChannelRequest + | null + | undefined, + {} | null | undefined + >, + ): void; updateNotificationChannel( - request: protos.google.monitoring.v3.IUpdateNotificationChannelRequest, - callback: Callback< - protos.google.monitoring.v3.INotificationChannel, - protos.google.monitoring.v3.IUpdateNotificationChannelRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.monitoring.v3.IUpdateNotificationChannelRequest, + callback: Callback< + protos.google.monitoring.v3.INotificationChannel, + | protos.google.monitoring.v3.IUpdateNotificationChannelRequest + | null + | undefined, + {} | null | undefined + >, + ): void; updateNotificationChannel( - request?: protos.google.monitoring.v3.IUpdateNotificationChannelRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.monitoring.v3.INotificationChannel, - protos.google.monitoring.v3.IUpdateNotificationChannelRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.monitoring.v3.IUpdateNotificationChannelRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.monitoring.v3.INotificationChannel, - protos.google.monitoring.v3.IUpdateNotificationChannelRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.monitoring.v3.INotificationChannel, - protos.google.monitoring.v3.IUpdateNotificationChannelRequest|undefined, {}|undefined - ]>|void { + | protos.google.monitoring.v3.IUpdateNotificationChannelRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.monitoring.v3.INotificationChannel, + | protos.google.monitoring.v3.IUpdateNotificationChannelRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.monitoring.v3.INotificationChannel, + protos.google.monitoring.v3.IUpdateNotificationChannelRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'notification_channel.name': request.notificationChannel!.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + 'notification_channel.name': request.notificationChannel!.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('updateNotificationChannel request %j', request); - const wrappedCallback: Callback< - protos.google.monitoring.v3.INotificationChannel, - protos.google.monitoring.v3.IUpdateNotificationChannelRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.monitoring.v3.INotificationChannel, + | protos.google.monitoring.v3.IUpdateNotificationChannelRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('updateNotificationChannel response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.updateNotificationChannel(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.monitoring.v3.INotificationChannel, - protos.google.monitoring.v3.IUpdateNotificationChannelRequest|undefined, - {}|undefined - ]) => { - this._log.info('updateNotificationChannel 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); + return this.innerApiCalls + .updateNotificationChannel(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.monitoring.v3.INotificationChannel, + ( + | protos.google.monitoring.v3.IUpdateNotificationChannelRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('updateNotificationChannel 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 notification channel. - * - * Design your application to single-thread API calls that modify the state of - * notification channels in a single project. This includes calls to - * CreateNotificationChannel, DeleteNotificationChannel and - * UpdateNotificationChannel. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The channel for which to execute the request. The format is: - * - * projects/[PROJECT_ID_OR_NUMBER]/notificationChannels/[CHANNEL_ID] - * @param {boolean} request.force - * If true, the notification channel will be deleted regardless of its - * use in alert policies (the policies will be updated to remove the - * channel). If false, this operation will fail if the notification channel - * is referenced by existing alerting policies. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v3/notification_channel_service.delete_notification_channel.js - * region_tag:monitoring_v3_generated_NotificationChannelService_DeleteNotificationChannel_async - */ + /** + * Deletes a notification channel. + * + * Design your application to single-thread API calls that modify the state of + * notification channels in a single project. This includes calls to + * CreateNotificationChannel, DeleteNotificationChannel and + * UpdateNotificationChannel. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The channel for which to execute the request. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER]/notificationChannels/[CHANNEL_ID] + * @param {boolean} request.force + * If true, the notification channel will be deleted regardless of its + * use in alert policies (the policies will be updated to remove the + * channel). If false, this operation will fail if the notification channel + * is referenced by existing alerting policies. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.protobuf.Empty|Empty}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v3/notification_channel_service.delete_notification_channel.js + * region_tag:monitoring_v3_generated_NotificationChannelService_DeleteNotificationChannel_async + */ deleteNotificationChannel( - request?: protos.google.monitoring.v3.IDeleteNotificationChannelRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteNotificationChannelRequest|undefined, {}|undefined - ]>; + request?: protos.google.monitoring.v3.IDeleteNotificationChannelRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.protobuf.IEmpty, + protos.google.monitoring.v3.IDeleteNotificationChannelRequest | undefined, + {} | undefined, + ] + >; deleteNotificationChannel( - request: protos.google.monitoring.v3.IDeleteNotificationChannelRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteNotificationChannelRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.monitoring.v3.IDeleteNotificationChannelRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + | protos.google.monitoring.v3.IDeleteNotificationChannelRequest + | null + | undefined, + {} | null | undefined + >, + ): void; deleteNotificationChannel( - request: protos.google.monitoring.v3.IDeleteNotificationChannelRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteNotificationChannelRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.monitoring.v3.IDeleteNotificationChannelRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + | protos.google.monitoring.v3.IDeleteNotificationChannelRequest + | null + | undefined, + {} | null | undefined + >, + ): void; deleteNotificationChannel( - request?: protos.google.monitoring.v3.IDeleteNotificationChannelRequest, - optionsOrCallback?: CallOptions|Callback< + request?: protos.google.monitoring.v3.IDeleteNotificationChannelRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteNotificationChannelRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteNotificationChannelRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteNotificationChannelRequest|undefined, {}|undefined - ]>|void { + | protos.google.monitoring.v3.IDeleteNotificationChannelRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.IEmpty, + | protos.google.monitoring.v3.IDeleteNotificationChannelRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.protobuf.IEmpty, + protos.google.monitoring.v3.IDeleteNotificationChannelRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('deleteNotificationChannel request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteNotificationChannelRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.protobuf.IEmpty, + | protos.google.monitoring.v3.IDeleteNotificationChannelRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('deleteNotificationChannel response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.deleteNotificationChannel(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteNotificationChannelRequest|undefined, - {}|undefined - ]) => { - this._log.info('deleteNotificationChannel 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); + return this.innerApiCalls + .deleteNotificationChannel(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.protobuf.IEmpty, + ( + | protos.google.monitoring.v3.IDeleteNotificationChannelRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('deleteNotificationChannel 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; }); } -/** - * Causes a verification code to be delivered to the channel. The code - * can then be supplied in `VerifyNotificationChannel` to verify the channel. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The notification channel to which to send a verification code. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v3/notification_channel_service.send_notification_channel_verification_code.js - * region_tag:monitoring_v3_generated_NotificationChannelService_SendNotificationChannelVerificationCode_async - */ + /** + * Causes a verification code to be delivered to the channel. The code + * can then be supplied in `VerifyNotificationChannel` to verify the channel. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The notification channel to which to send a verification code. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.protobuf.Empty|Empty}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v3/notification_channel_service.send_notification_channel_verification_code.js + * region_tag:monitoring_v3_generated_NotificationChannelService_SendNotificationChannelVerificationCode_async + */ sendNotificationChannelVerificationCode( - request?: protos.google.monitoring.v3.ISendNotificationChannelVerificationCodeRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.ISendNotificationChannelVerificationCodeRequest|undefined, {}|undefined - ]>; + request?: protos.google.monitoring.v3.ISendNotificationChannelVerificationCodeRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.protobuf.IEmpty, + ( + | protos.google.monitoring.v3.ISendNotificationChannelVerificationCodeRequest + | undefined + ), + {} | undefined, + ] + >; sendNotificationChannelVerificationCode( - request: protos.google.monitoring.v3.ISendNotificationChannelVerificationCodeRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.ISendNotificationChannelVerificationCodeRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.monitoring.v3.ISendNotificationChannelVerificationCodeRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + | protos.google.monitoring.v3.ISendNotificationChannelVerificationCodeRequest + | null + | undefined, + {} | null | undefined + >, + ): void; sendNotificationChannelVerificationCode( - request: protos.google.monitoring.v3.ISendNotificationChannelVerificationCodeRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.ISendNotificationChannelVerificationCodeRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.monitoring.v3.ISendNotificationChannelVerificationCodeRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + | protos.google.monitoring.v3.ISendNotificationChannelVerificationCodeRequest + | null + | undefined, + {} | null | undefined + >, + ): void; sendNotificationChannelVerificationCode( - request?: protos.google.monitoring.v3.ISendNotificationChannelVerificationCodeRequest, - optionsOrCallback?: CallOptions|Callback< + request?: protos.google.monitoring.v3.ISendNotificationChannelVerificationCodeRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.ISendNotificationChannelVerificationCodeRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.ISendNotificationChannelVerificationCodeRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.ISendNotificationChannelVerificationCodeRequest|undefined, {}|undefined - ]>|void { + | protos.google.monitoring.v3.ISendNotificationChannelVerificationCodeRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.IEmpty, + | protos.google.monitoring.v3.ISendNotificationChannelVerificationCodeRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.protobuf.IEmpty, + ( + | protos.google.monitoring.v3.ISendNotificationChannelVerificationCodeRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - this._log.info('sendNotificationChannelVerificationCode request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.ISendNotificationChannelVerificationCodeRequest|null|undefined, - {}|null|undefined>|undefined = callback + this._log.info( + 'sendNotificationChannelVerificationCode request %j', + request, + ); + const wrappedCallback: + | Callback< + protos.google.protobuf.IEmpty, + | protos.google.monitoring.v3.ISendNotificationChannelVerificationCodeRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { - this._log.info('sendNotificationChannelVerificationCode response %j', response); + this._log.info( + 'sendNotificationChannelVerificationCode response %j', + response, + ); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.sendNotificationChannelVerificationCode(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.ISendNotificationChannelVerificationCodeRequest|undefined, - {}|undefined - ]) => { - this._log.info('sendNotificationChannelVerificationCode 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); + return this.innerApiCalls + .sendNotificationChannelVerificationCode( + request, + options, + wrappedCallback, + ) + ?.then( + ([response, options, rawResponse]: [ + protos.google.protobuf.IEmpty, + ( + | protos.google.monitoring.v3.ISendNotificationChannelVerificationCodeRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info( + 'sendNotificationChannelVerificationCode 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; }); } -/** - * Requests a verification code for an already verified channel that can then - * be used in a call to VerifyNotificationChannel() on a different channel - * with an equivalent identity in the same or in a different project. This - * makes it possible to copy a channel between projects without requiring - * manual reverification of the channel. If the channel is not in the - * verified state, this method will fail (in other words, this may only be - * used if the SendNotificationChannelVerificationCode and - * VerifyNotificationChannel paths have already been used to put the given - * channel into the verified state). - * - * There is no guarantee that the verification codes returned by this method - * will be of a similar structure or form as the ones that are delivered - * to the channel via SendNotificationChannelVerificationCode; while - * VerifyNotificationChannel() will recognize both the codes delivered via - * SendNotificationChannelVerificationCode() and returned from - * GetNotificationChannelVerificationCode(), it is typically the case that - * the verification codes delivered via - * SendNotificationChannelVerificationCode() will be shorter and also - * have a shorter expiration (e.g. codes such as "G-123456") whereas - * GetVerificationCode() will typically return a much longer, websafe base - * 64 encoded string that has a longer expiration time. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The notification channel for which a verification code is to be - * generated and retrieved. This must name a channel that is already verified; - * if the specified channel is not verified, the request will fail. - * @param {google.protobuf.Timestamp} request.expireTime - * The desired expiration time. If specified, the API will guarantee that - * the returned code will not be valid after the specified timestamp; - * however, the API cannot guarantee that the returned code will be - * valid for at least as long as the requested time (the API puts an upper - * bound on the amount of time for which a code may be valid). If omitted, - * a default expiration will be used, which may be less than the max - * permissible expiration (so specifying an expiration may extend the - * code's lifetime over omitting an expiration, even though the API does - * impose an upper limit on the maximum expiration that is permitted). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.monitoring.v3.GetNotificationChannelVerificationCodeResponse|GetNotificationChannelVerificationCodeResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v3/notification_channel_service.get_notification_channel_verification_code.js - * region_tag:monitoring_v3_generated_NotificationChannelService_GetNotificationChannelVerificationCode_async - */ + /** + * Requests a verification code for an already verified channel that can then + * be used in a call to VerifyNotificationChannel() on a different channel + * with an equivalent identity in the same or in a different project. This + * makes it possible to copy a channel between projects without requiring + * manual reverification of the channel. If the channel is not in the + * verified state, this method will fail (in other words, this may only be + * used if the SendNotificationChannelVerificationCode and + * VerifyNotificationChannel paths have already been used to put the given + * channel into the verified state). + * + * There is no guarantee that the verification codes returned by this method + * will be of a similar structure or form as the ones that are delivered + * to the channel via SendNotificationChannelVerificationCode; while + * VerifyNotificationChannel() will recognize both the codes delivered via + * SendNotificationChannelVerificationCode() and returned from + * GetNotificationChannelVerificationCode(), it is typically the case that + * the verification codes delivered via + * SendNotificationChannelVerificationCode() will be shorter and also + * have a shorter expiration (e.g. codes such as "G-123456") whereas + * GetVerificationCode() will typically return a much longer, websafe base + * 64 encoded string that has a longer expiration time. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The notification channel for which a verification code is to be + * generated and retrieved. This must name a channel that is already verified; + * if the specified channel is not verified, the request will fail. + * @param {google.protobuf.Timestamp} request.expireTime + * The desired expiration time. If specified, the API will guarantee that + * the returned code will not be valid after the specified timestamp; + * however, the API cannot guarantee that the returned code will be + * valid for at least as long as the requested time (the API puts an upper + * bound on the amount of time for which a code may be valid). If omitted, + * a default expiration will be used, which may be less than the max + * permissible expiration (so specifying an expiration may extend the + * code's lifetime over omitting an expiration, even though the API does + * impose an upper limit on the maximum expiration that is permitted). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.monitoring.v3.GetNotificationChannelVerificationCodeResponse|GetNotificationChannelVerificationCodeResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v3/notification_channel_service.get_notification_channel_verification_code.js + * region_tag:monitoring_v3_generated_NotificationChannelService_GetNotificationChannelVerificationCode_async + */ getNotificationChannelVerificationCode( - request?: protos.google.monitoring.v3.IGetNotificationChannelVerificationCodeRequest, - options?: CallOptions): - Promise<[ - protos.google.monitoring.v3.IGetNotificationChannelVerificationCodeResponse, - protos.google.monitoring.v3.IGetNotificationChannelVerificationCodeRequest|undefined, {}|undefined - ]>; + request?: protos.google.monitoring.v3.IGetNotificationChannelVerificationCodeRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.monitoring.v3.IGetNotificationChannelVerificationCodeResponse, + ( + | protos.google.monitoring.v3.IGetNotificationChannelVerificationCodeRequest + | undefined + ), + {} | undefined, + ] + >; getNotificationChannelVerificationCode( - request: protos.google.monitoring.v3.IGetNotificationChannelVerificationCodeRequest, - options: CallOptions, - callback: Callback< - protos.google.monitoring.v3.IGetNotificationChannelVerificationCodeResponse, - protos.google.monitoring.v3.IGetNotificationChannelVerificationCodeRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.monitoring.v3.IGetNotificationChannelVerificationCodeRequest, + options: CallOptions, + callback: Callback< + protos.google.monitoring.v3.IGetNotificationChannelVerificationCodeResponse, + | protos.google.monitoring.v3.IGetNotificationChannelVerificationCodeRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getNotificationChannelVerificationCode( - request: protos.google.monitoring.v3.IGetNotificationChannelVerificationCodeRequest, - callback: Callback< - protos.google.monitoring.v3.IGetNotificationChannelVerificationCodeResponse, - protos.google.monitoring.v3.IGetNotificationChannelVerificationCodeRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.monitoring.v3.IGetNotificationChannelVerificationCodeRequest, + callback: Callback< + protos.google.monitoring.v3.IGetNotificationChannelVerificationCodeResponse, + | protos.google.monitoring.v3.IGetNotificationChannelVerificationCodeRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getNotificationChannelVerificationCode( - request?: protos.google.monitoring.v3.IGetNotificationChannelVerificationCodeRequest, - optionsOrCallback?: CallOptions|Callback< + request?: protos.google.monitoring.v3.IGetNotificationChannelVerificationCodeRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.monitoring.v3.IGetNotificationChannelVerificationCodeResponse, - protos.google.monitoring.v3.IGetNotificationChannelVerificationCodeRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.monitoring.v3.IGetNotificationChannelVerificationCodeResponse, - protos.google.monitoring.v3.IGetNotificationChannelVerificationCodeRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.monitoring.v3.IGetNotificationChannelVerificationCodeResponse, - protos.google.monitoring.v3.IGetNotificationChannelVerificationCodeRequest|undefined, {}|undefined - ]>|void { + | protos.google.monitoring.v3.IGetNotificationChannelVerificationCodeRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.monitoring.v3.IGetNotificationChannelVerificationCodeResponse, + | protos.google.monitoring.v3.IGetNotificationChannelVerificationCodeRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.monitoring.v3.IGetNotificationChannelVerificationCodeResponse, + ( + | protos.google.monitoring.v3.IGetNotificationChannelVerificationCodeRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - this._log.info('getNotificationChannelVerificationCode request %j', request); - const wrappedCallback: Callback< - protos.google.monitoring.v3.IGetNotificationChannelVerificationCodeResponse, - protos.google.monitoring.v3.IGetNotificationChannelVerificationCodeRequest|null|undefined, - {}|null|undefined>|undefined = callback + this._log.info( + 'getNotificationChannelVerificationCode request %j', + request, + ); + const wrappedCallback: + | Callback< + protos.google.monitoring.v3.IGetNotificationChannelVerificationCodeResponse, + | protos.google.monitoring.v3.IGetNotificationChannelVerificationCodeRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { - this._log.info('getNotificationChannelVerificationCode response %j', response); + this._log.info( + 'getNotificationChannelVerificationCode response %j', + response, + ); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.getNotificationChannelVerificationCode(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.monitoring.v3.IGetNotificationChannelVerificationCodeResponse, - protos.google.monitoring.v3.IGetNotificationChannelVerificationCodeRequest|undefined, - {}|undefined - ]) => { - this._log.info('getNotificationChannelVerificationCode 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); + return this.innerApiCalls + .getNotificationChannelVerificationCode(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.monitoring.v3.IGetNotificationChannelVerificationCodeResponse, + ( + | protos.google.monitoring.v3.IGetNotificationChannelVerificationCodeRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info( + 'getNotificationChannelVerificationCode 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; }); } -/** - * Verifies a `NotificationChannel` by proving receipt of the code - * delivered to the channel as a result of calling - * `SendNotificationChannelVerificationCode`. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The notification channel to verify. - * @param {string} request.code - * Required. The verification code that was delivered to the channel as - * a result of invoking the `SendNotificationChannelVerificationCode` API - * method or that was retrieved from a verified channel via - * `GetNotificationChannelVerificationCode`. For example, one might have - * "G-123456" or "TKNZGhhd2EyN3I1MnRnMjRv" (in general, one is only - * guaranteed that the code is valid UTF-8; one should not - * make any assumptions regarding the structure or format of the code). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.monitoring.v3.NotificationChannel|NotificationChannel}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v3/notification_channel_service.verify_notification_channel.js - * region_tag:monitoring_v3_generated_NotificationChannelService_VerifyNotificationChannel_async - */ + /** + * Verifies a `NotificationChannel` by proving receipt of the code + * delivered to the channel as a result of calling + * `SendNotificationChannelVerificationCode`. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The notification channel to verify. + * @param {string} request.code + * Required. The verification code that was delivered to the channel as + * a result of invoking the `SendNotificationChannelVerificationCode` API + * method or that was retrieved from a verified channel via + * `GetNotificationChannelVerificationCode`. For example, one might have + * "G-123456" or "TKNZGhhd2EyN3I1MnRnMjRv" (in general, one is only + * guaranteed that the code is valid UTF-8; one should not + * make any assumptions regarding the structure or format of the code). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.monitoring.v3.NotificationChannel|NotificationChannel}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v3/notification_channel_service.verify_notification_channel.js + * region_tag:monitoring_v3_generated_NotificationChannelService_VerifyNotificationChannel_async + */ verifyNotificationChannel( - request?: protos.google.monitoring.v3.IVerifyNotificationChannelRequest, - options?: CallOptions): - Promise<[ - protos.google.monitoring.v3.INotificationChannel, - protos.google.monitoring.v3.IVerifyNotificationChannelRequest|undefined, {}|undefined - ]>; + request?: protos.google.monitoring.v3.IVerifyNotificationChannelRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.monitoring.v3.INotificationChannel, + protos.google.monitoring.v3.IVerifyNotificationChannelRequest | undefined, + {} | undefined, + ] + >; verifyNotificationChannel( - request: protos.google.monitoring.v3.IVerifyNotificationChannelRequest, - options: CallOptions, - callback: Callback< - protos.google.monitoring.v3.INotificationChannel, - protos.google.monitoring.v3.IVerifyNotificationChannelRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.monitoring.v3.IVerifyNotificationChannelRequest, + options: CallOptions, + callback: Callback< + protos.google.monitoring.v3.INotificationChannel, + | protos.google.monitoring.v3.IVerifyNotificationChannelRequest + | null + | undefined, + {} | null | undefined + >, + ): void; verifyNotificationChannel( - request: protos.google.monitoring.v3.IVerifyNotificationChannelRequest, - callback: Callback< - protos.google.monitoring.v3.INotificationChannel, - protos.google.monitoring.v3.IVerifyNotificationChannelRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.monitoring.v3.IVerifyNotificationChannelRequest, + callback: Callback< + protos.google.monitoring.v3.INotificationChannel, + | protos.google.monitoring.v3.IVerifyNotificationChannelRequest + | null + | undefined, + {} | null | undefined + >, + ): void; verifyNotificationChannel( - request?: protos.google.monitoring.v3.IVerifyNotificationChannelRequest, - optionsOrCallback?: CallOptions|Callback< + request?: protos.google.monitoring.v3.IVerifyNotificationChannelRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.monitoring.v3.INotificationChannel, - protos.google.monitoring.v3.IVerifyNotificationChannelRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.monitoring.v3.INotificationChannel, - protos.google.monitoring.v3.IVerifyNotificationChannelRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.monitoring.v3.INotificationChannel, - protos.google.monitoring.v3.IVerifyNotificationChannelRequest|undefined, {}|undefined - ]>|void { + | protos.google.monitoring.v3.IVerifyNotificationChannelRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.monitoring.v3.INotificationChannel, + | protos.google.monitoring.v3.IVerifyNotificationChannelRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.monitoring.v3.INotificationChannel, + protos.google.monitoring.v3.IVerifyNotificationChannelRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('verifyNotificationChannel request %j', request); - const wrappedCallback: Callback< - protos.google.monitoring.v3.INotificationChannel, - protos.google.monitoring.v3.IVerifyNotificationChannelRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.monitoring.v3.INotificationChannel, + | protos.google.monitoring.v3.IVerifyNotificationChannelRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('verifyNotificationChannel response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.verifyNotificationChannel(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.monitoring.v3.INotificationChannel, - protos.google.monitoring.v3.IVerifyNotificationChannelRequest|undefined, - {}|undefined - ]) => { - this._log.info('verifyNotificationChannel 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); + return this.innerApiCalls + .verifyNotificationChannel(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.monitoring.v3.INotificationChannel, + ( + | protos.google.monitoring.v3.IVerifyNotificationChannelRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('verifyNotificationChannel 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; }); } - /** - * Lists the descriptors for supported channel types. The use of descriptors - * makes it possible for new channel types to be dynamically added. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The REST resource name of the parent from which to retrieve - * the notification channel descriptors. The expected syntax is: - * - * projects/[PROJECT_ID_OR_NUMBER] - * - * Note that this - * [names](https://cloud.google.com/monitoring/api/v3#project_name) the parent - * container in which to look for the descriptors; to retrieve a single - * descriptor by name, use the - * {@link protos.google.monitoring.v3.NotificationChannelService.GetNotificationChannelDescriptor|GetNotificationChannelDescriptor} - * operation, instead. - * @param {number} request.pageSize - * The maximum number of results to return in a single response. If - * not set to a positive number, a reasonable value will be chosen by the - * service. - * @param {string} request.pageToken - * If non-empty, `page_token` must contain a value returned as the - * `next_page_token` in a previous response to request the next set - * of results. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of {@link protos.google.monitoring.v3.NotificationChannelDescriptor|NotificationChannelDescriptor}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listNotificationChannelDescriptorsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Lists the descriptors for supported channel types. The use of descriptors + * makes it possible for new channel types to be dynamically added. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The REST resource name of the parent from which to retrieve + * the notification channel descriptors. The expected syntax is: + * + * projects/[PROJECT_ID_OR_NUMBER] + * + * Note that this + * [names](https://cloud.google.com/monitoring/api/v3#project_name) the parent + * container in which to look for the descriptors; to retrieve a single + * descriptor by name, use the + * {@link protos.google.monitoring.v3.NotificationChannelService.GetNotificationChannelDescriptor|GetNotificationChannelDescriptor} + * operation, instead. + * @param {number} request.pageSize + * The maximum number of results to return in a single response. If + * not set to a positive number, a reasonable value will be chosen by the + * service. + * @param {string} request.pageToken + * If non-empty, `page_token` must contain a value returned as the + * `next_page_token` in a previous response to request the next set + * of results. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of {@link protos.google.monitoring.v3.NotificationChannelDescriptor|NotificationChannelDescriptor}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listNotificationChannelDescriptorsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listNotificationChannelDescriptors( - request?: protos.google.monitoring.v3.IListNotificationChannelDescriptorsRequest, - options?: CallOptions): - Promise<[ - protos.google.monitoring.v3.INotificationChannelDescriptor[], - protos.google.monitoring.v3.IListNotificationChannelDescriptorsRequest|null, - protos.google.monitoring.v3.IListNotificationChannelDescriptorsResponse - ]>; + request?: protos.google.monitoring.v3.IListNotificationChannelDescriptorsRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.monitoring.v3.INotificationChannelDescriptor[], + protos.google.monitoring.v3.IListNotificationChannelDescriptorsRequest | null, + protos.google.monitoring.v3.IListNotificationChannelDescriptorsResponse, + ] + >; listNotificationChannelDescriptors( - request: protos.google.monitoring.v3.IListNotificationChannelDescriptorsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.monitoring.v3.IListNotificationChannelDescriptorsRequest, - protos.google.monitoring.v3.IListNotificationChannelDescriptorsResponse|null|undefined, - protos.google.monitoring.v3.INotificationChannelDescriptor>): void; + request: protos.google.monitoring.v3.IListNotificationChannelDescriptorsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.monitoring.v3.IListNotificationChannelDescriptorsRequest, + | protos.google.monitoring.v3.IListNotificationChannelDescriptorsResponse + | null + | undefined, + protos.google.monitoring.v3.INotificationChannelDescriptor + >, + ): void; listNotificationChannelDescriptors( - request: protos.google.monitoring.v3.IListNotificationChannelDescriptorsRequest, - callback: PaginationCallback< - protos.google.monitoring.v3.IListNotificationChannelDescriptorsRequest, - protos.google.monitoring.v3.IListNotificationChannelDescriptorsResponse|null|undefined, - protos.google.monitoring.v3.INotificationChannelDescriptor>): void; + request: protos.google.monitoring.v3.IListNotificationChannelDescriptorsRequest, + callback: PaginationCallback< + protos.google.monitoring.v3.IListNotificationChannelDescriptorsRequest, + | protos.google.monitoring.v3.IListNotificationChannelDescriptorsResponse + | null + | undefined, + protos.google.monitoring.v3.INotificationChannelDescriptor + >, + ): void; listNotificationChannelDescriptors( - request?: protos.google.monitoring.v3.IListNotificationChannelDescriptorsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.monitoring.v3.IListNotificationChannelDescriptorsRequest, - protos.google.monitoring.v3.IListNotificationChannelDescriptorsResponse|null|undefined, - protos.google.monitoring.v3.INotificationChannelDescriptor>, - callback?: PaginationCallback< + request?: protos.google.monitoring.v3.IListNotificationChannelDescriptorsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.monitoring.v3.IListNotificationChannelDescriptorsRequest, - protos.google.monitoring.v3.IListNotificationChannelDescriptorsResponse|null|undefined, - protos.google.monitoring.v3.INotificationChannelDescriptor>): - Promise<[ - protos.google.monitoring.v3.INotificationChannelDescriptor[], - protos.google.monitoring.v3.IListNotificationChannelDescriptorsRequest|null, - protos.google.monitoring.v3.IListNotificationChannelDescriptorsResponse - ]>|void { + | protos.google.monitoring.v3.IListNotificationChannelDescriptorsResponse + | null + | undefined, + protos.google.monitoring.v3.INotificationChannelDescriptor + >, + callback?: PaginationCallback< + protos.google.monitoring.v3.IListNotificationChannelDescriptorsRequest, + | protos.google.monitoring.v3.IListNotificationChannelDescriptorsResponse + | null + | undefined, + protos.google.monitoring.v3.INotificationChannelDescriptor + >, + ): Promise< + [ + protos.google.monitoring.v3.INotificationChannelDescriptor[], + protos.google.monitoring.v3.IListNotificationChannelDescriptorsRequest | null, + protos.google.monitoring.v3.IListNotificationChannelDescriptorsResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.monitoring.v3.IListNotificationChannelDescriptorsRequest, - protos.google.monitoring.v3.IListNotificationChannelDescriptorsResponse|null|undefined, - protos.google.monitoring.v3.INotificationChannelDescriptor>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.monitoring.v3.IListNotificationChannelDescriptorsRequest, + | protos.google.monitoring.v3.IListNotificationChannelDescriptorsResponse + | null + | undefined, + protos.google.monitoring.v3.INotificationChannelDescriptor + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('listNotificationChannelDescriptors values %j', values); + this._log.info( + 'listNotificationChannelDescriptors values %j', + values, + ); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. } : undefined; this._log.info('listNotificationChannelDescriptors request %j', request); return this.innerApiCalls .listNotificationChannelDescriptors(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.monitoring.v3.INotificationChannelDescriptor[], - protos.google.monitoring.v3.IListNotificationChannelDescriptorsRequest|null, - protos.google.monitoring.v3.IListNotificationChannelDescriptorsResponse - ]) => { - this._log.info('listNotificationChannelDescriptors values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.monitoring.v3.INotificationChannelDescriptor[], + protos.google.monitoring.v3.IListNotificationChannelDescriptorsRequest | null, + protos.google.monitoring.v3.IListNotificationChannelDescriptorsResponse, + ]) => { + this._log.info( + 'listNotificationChannelDescriptors values %j', + response, + ); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listNotificationChannelDescriptors`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The REST resource name of the parent from which to retrieve - * the notification channel descriptors. The expected syntax is: - * - * projects/[PROJECT_ID_OR_NUMBER] - * - * Note that this - * [names](https://cloud.google.com/monitoring/api/v3#project_name) the parent - * container in which to look for the descriptors; to retrieve a single - * descriptor by name, use the - * {@link protos.google.monitoring.v3.NotificationChannelService.GetNotificationChannelDescriptor|GetNotificationChannelDescriptor} - * operation, instead. - * @param {number} request.pageSize - * The maximum number of results to return in a single response. If - * not set to a positive number, a reasonable value will be chosen by the - * service. - * @param {string} request.pageToken - * If non-empty, `page_token` must contain a value returned as the - * `next_page_token` in a previous response to request the next set - * of results. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.monitoring.v3.NotificationChannelDescriptor|NotificationChannelDescriptor} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listNotificationChannelDescriptorsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Equivalent to `listNotificationChannelDescriptors`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The REST resource name of the parent from which to retrieve + * the notification channel descriptors. The expected syntax is: + * + * projects/[PROJECT_ID_OR_NUMBER] + * + * Note that this + * [names](https://cloud.google.com/monitoring/api/v3#project_name) the parent + * container in which to look for the descriptors; to retrieve a single + * descriptor by name, use the + * {@link protos.google.monitoring.v3.NotificationChannelService.GetNotificationChannelDescriptor|GetNotificationChannelDescriptor} + * operation, instead. + * @param {number} request.pageSize + * The maximum number of results to return in a single response. If + * not set to a positive number, a reasonable value will be chosen by the + * service. + * @param {string} request.pageToken + * If non-empty, `page_token` must contain a value returned as the + * `next_page_token` in a previous response to request the next set + * of results. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.monitoring.v3.NotificationChannelDescriptor|NotificationChannelDescriptor} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listNotificationChannelDescriptorsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listNotificationChannelDescriptorsStream( - request?: protos.google.monitoring.v3.IListNotificationChannelDescriptorsRequest, - options?: CallOptions): - Transform{ + request?: protos.google.monitoring.v3.IListNotificationChannelDescriptorsRequest, + options?: CallOptions, + ): Transform { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - const defaultCallSettings = this._defaults['listNotificationChannelDescriptors']; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + const defaultCallSettings = + this._defaults['listNotificationChannelDescriptors']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listNotificationChannelDescriptors stream %j', request); return this.descriptors.page.listNotificationChannelDescriptors.createStream( this.innerApiCalls.listNotificationChannelDescriptors as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `listNotificationChannelDescriptors`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The REST resource name of the parent from which to retrieve - * the notification channel descriptors. The expected syntax is: - * - * projects/[PROJECT_ID_OR_NUMBER] - * - * Note that this - * [names](https://cloud.google.com/monitoring/api/v3#project_name) the parent - * container in which to look for the descriptors; to retrieve a single - * descriptor by name, use the - * {@link protos.google.monitoring.v3.NotificationChannelService.GetNotificationChannelDescriptor|GetNotificationChannelDescriptor} - * operation, instead. - * @param {number} request.pageSize - * The maximum number of results to return in a single response. If - * not set to a positive number, a reasonable value will be chosen by the - * service. - * @param {string} request.pageToken - * If non-empty, `page_token` must contain a value returned as the - * `next_page_token` in a previous response to request the next set - * of results. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.monitoring.v3.NotificationChannelDescriptor|NotificationChannelDescriptor}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v3/notification_channel_service.list_notification_channel_descriptors.js - * region_tag:monitoring_v3_generated_NotificationChannelService_ListNotificationChannelDescriptors_async - */ + /** + * Equivalent to `listNotificationChannelDescriptors`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The REST resource name of the parent from which to retrieve + * the notification channel descriptors. The expected syntax is: + * + * projects/[PROJECT_ID_OR_NUMBER] + * + * Note that this + * [names](https://cloud.google.com/monitoring/api/v3#project_name) the parent + * container in which to look for the descriptors; to retrieve a single + * descriptor by name, use the + * {@link protos.google.monitoring.v3.NotificationChannelService.GetNotificationChannelDescriptor|GetNotificationChannelDescriptor} + * operation, instead. + * @param {number} request.pageSize + * The maximum number of results to return in a single response. If + * not set to a positive number, a reasonable value will be chosen by the + * service. + * @param {string} request.pageToken + * If non-empty, `page_token` must contain a value returned as the + * `next_page_token` in a previous response to request the next set + * of results. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.monitoring.v3.NotificationChannelDescriptor|NotificationChannelDescriptor}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v3/notification_channel_service.list_notification_channel_descriptors.js + * region_tag:monitoring_v3_generated_NotificationChannelService_ListNotificationChannelDescriptors_async + */ listNotificationChannelDescriptorsAsync( - request?: protos.google.monitoring.v3.IListNotificationChannelDescriptorsRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.monitoring.v3.IListNotificationChannelDescriptorsRequest, + options?: CallOptions, + ): AsyncIterable { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - const defaultCallSettings = this._defaults['listNotificationChannelDescriptors']; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + const defaultCallSettings = + this._defaults['listNotificationChannelDescriptors']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listNotificationChannelDescriptors iterate %j', request); return this.descriptors.page.listNotificationChannelDescriptors.asyncIterate( this.innerApiCalls['listNotificationChannelDescriptors'] as GaxCall, request as {}, - callSettings + callSettings, ) as AsyncIterable; } - /** - * Lists the notification channels that have been created for the project. - * To list the types of notification channels that are supported, use - * the `ListNotificationChannelDescriptors` method. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The - * [project](https://cloud.google.com/monitoring/api/v3#project_name) on which - * to execute the request. The format is: - * - * projects/[PROJECT_ID_OR_NUMBER] - * - * This names the container - * in which to look for the notification channels; it does not name a - * specific channel. To query a specific channel by REST resource name, use - * the - * {@link protos.google.monitoring.v3.NotificationChannelService.GetNotificationChannel|`GetNotificationChannel`} - * operation. - * @param {string} [request.filter] - * Optional. If provided, this field specifies the criteria that must be met - * by notification channels to be included in the response. - * - * For more details, see [sorting and - * filtering](https://cloud.google.com/monitoring/api/v3/sorting-and-filtering). - * @param {string} [request.orderBy] - * Optional. A comma-separated list of fields by which to sort the result. - * Supports the same set of fields as in `filter`. Entries can be prefixed - * with a minus sign to sort in descending rather than ascending order. - * - * For more details, see [sorting and - * filtering](https://cloud.google.com/monitoring/api/v3/sorting-and-filtering). - * @param {number} [request.pageSize] - * Optional. The maximum number of results to return in a single response. If - * not set to a positive number, a reasonable value will be chosen by the - * service. - * @param {string} [request.pageToken] - * Optional. If non-empty, `page_token` must contain a value returned as the - * `next_page_token` in a previous response to request the next set - * of results. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of {@link protos.google.monitoring.v3.NotificationChannel|NotificationChannel}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listNotificationChannelsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Lists the notification channels that have been created for the project. + * To list the types of notification channels that are supported, use + * the `ListNotificationChannelDescriptors` method. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The + * [project](https://cloud.google.com/monitoring/api/v3#project_name) on which + * to execute the request. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER] + * + * This names the container + * in which to look for the notification channels; it does not name a + * specific channel. To query a specific channel by REST resource name, use + * the + * {@link protos.google.monitoring.v3.NotificationChannelService.GetNotificationChannel|`GetNotificationChannel`} + * operation. + * @param {string} [request.filter] + * Optional. If provided, this field specifies the criteria that must be met + * by notification channels to be included in the response. + * + * For more details, see [sorting and + * filtering](https://cloud.google.com/monitoring/api/v3/sorting-and-filtering). + * @param {string} [request.orderBy] + * Optional. A comma-separated list of fields by which to sort the result. + * Supports the same set of fields as in `filter`. Entries can be prefixed + * with a minus sign to sort in descending rather than ascending order. + * + * For more details, see [sorting and + * filtering](https://cloud.google.com/monitoring/api/v3/sorting-and-filtering). + * @param {number} [request.pageSize] + * Optional. The maximum number of results to return in a single response. If + * not set to a positive number, a reasonable value will be chosen by the + * service. + * @param {string} [request.pageToken] + * Optional. If non-empty, `page_token` must contain a value returned as the + * `next_page_token` in a previous response to request the next set + * of results. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of {@link protos.google.monitoring.v3.NotificationChannel|NotificationChannel}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listNotificationChannelsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listNotificationChannels( - request?: protos.google.monitoring.v3.IListNotificationChannelsRequest, - options?: CallOptions): - Promise<[ - protos.google.monitoring.v3.INotificationChannel[], - protos.google.monitoring.v3.IListNotificationChannelsRequest|null, - protos.google.monitoring.v3.IListNotificationChannelsResponse - ]>; + request?: protos.google.monitoring.v3.IListNotificationChannelsRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.monitoring.v3.INotificationChannel[], + protos.google.monitoring.v3.IListNotificationChannelsRequest | null, + protos.google.monitoring.v3.IListNotificationChannelsResponse, + ] + >; listNotificationChannels( - request: protos.google.monitoring.v3.IListNotificationChannelsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.monitoring.v3.IListNotificationChannelsRequest, - protos.google.monitoring.v3.IListNotificationChannelsResponse|null|undefined, - protos.google.monitoring.v3.INotificationChannel>): void; + request: protos.google.monitoring.v3.IListNotificationChannelsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.monitoring.v3.IListNotificationChannelsRequest, + | protos.google.monitoring.v3.IListNotificationChannelsResponse + | null + | undefined, + protos.google.monitoring.v3.INotificationChannel + >, + ): void; listNotificationChannels( - request: protos.google.monitoring.v3.IListNotificationChannelsRequest, - callback: PaginationCallback< - protos.google.monitoring.v3.IListNotificationChannelsRequest, - protos.google.monitoring.v3.IListNotificationChannelsResponse|null|undefined, - protos.google.monitoring.v3.INotificationChannel>): void; + request: protos.google.monitoring.v3.IListNotificationChannelsRequest, + callback: PaginationCallback< + protos.google.monitoring.v3.IListNotificationChannelsRequest, + | protos.google.monitoring.v3.IListNotificationChannelsResponse + | null + | undefined, + protos.google.monitoring.v3.INotificationChannel + >, + ): void; listNotificationChannels( - request?: protos.google.monitoring.v3.IListNotificationChannelsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.monitoring.v3.IListNotificationChannelsRequest, - protos.google.monitoring.v3.IListNotificationChannelsResponse|null|undefined, - protos.google.monitoring.v3.INotificationChannel>, - callback?: PaginationCallback< + request?: protos.google.monitoring.v3.IListNotificationChannelsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.monitoring.v3.IListNotificationChannelsRequest, - protos.google.monitoring.v3.IListNotificationChannelsResponse|null|undefined, - protos.google.monitoring.v3.INotificationChannel>): - Promise<[ - protos.google.monitoring.v3.INotificationChannel[], - protos.google.monitoring.v3.IListNotificationChannelsRequest|null, - protos.google.monitoring.v3.IListNotificationChannelsResponse - ]>|void { + | protos.google.monitoring.v3.IListNotificationChannelsResponse + | null + | undefined, + protos.google.monitoring.v3.INotificationChannel + >, + callback?: PaginationCallback< + protos.google.monitoring.v3.IListNotificationChannelsRequest, + | protos.google.monitoring.v3.IListNotificationChannelsResponse + | null + | undefined, + protos.google.monitoring.v3.INotificationChannel + >, + ): Promise< + [ + protos.google.monitoring.v3.INotificationChannel[], + protos.google.monitoring.v3.IListNotificationChannelsRequest | null, + protos.google.monitoring.v3.IListNotificationChannelsResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.monitoring.v3.IListNotificationChannelsRequest, - protos.google.monitoring.v3.IListNotificationChannelsResponse|null|undefined, - protos.google.monitoring.v3.INotificationChannel>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.monitoring.v3.IListNotificationChannelsRequest, + | protos.google.monitoring.v3.IListNotificationChannelsResponse + | null + | undefined, + protos.google.monitoring.v3.INotificationChannel + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('listNotificationChannels values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -1614,162 +2135,166 @@ export class NotificationChannelServiceClient { this._log.info('listNotificationChannels request %j', request); return this.innerApiCalls .listNotificationChannels(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.monitoring.v3.INotificationChannel[], - protos.google.monitoring.v3.IListNotificationChannelsRequest|null, - protos.google.monitoring.v3.IListNotificationChannelsResponse - ]) => { - this._log.info('listNotificationChannels values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.monitoring.v3.INotificationChannel[], + protos.google.monitoring.v3.IListNotificationChannelsRequest | null, + protos.google.monitoring.v3.IListNotificationChannelsResponse, + ]) => { + this._log.info('listNotificationChannels values %j', response); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listNotificationChannels`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The - * [project](https://cloud.google.com/monitoring/api/v3#project_name) on which - * to execute the request. The format is: - * - * projects/[PROJECT_ID_OR_NUMBER] - * - * This names the container - * in which to look for the notification channels; it does not name a - * specific channel. To query a specific channel by REST resource name, use - * the - * {@link protos.google.monitoring.v3.NotificationChannelService.GetNotificationChannel|`GetNotificationChannel`} - * operation. - * @param {string} [request.filter] - * Optional. If provided, this field specifies the criteria that must be met - * by notification channels to be included in the response. - * - * For more details, see [sorting and - * filtering](https://cloud.google.com/monitoring/api/v3/sorting-and-filtering). - * @param {string} [request.orderBy] - * Optional. A comma-separated list of fields by which to sort the result. - * Supports the same set of fields as in `filter`. Entries can be prefixed - * with a minus sign to sort in descending rather than ascending order. - * - * For more details, see [sorting and - * filtering](https://cloud.google.com/monitoring/api/v3/sorting-and-filtering). - * @param {number} [request.pageSize] - * Optional. The maximum number of results to return in a single response. If - * not set to a positive number, a reasonable value will be chosen by the - * service. - * @param {string} [request.pageToken] - * Optional. If non-empty, `page_token` must contain a value returned as the - * `next_page_token` in a previous response to request the next set - * of results. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.monitoring.v3.NotificationChannel|NotificationChannel} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listNotificationChannelsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Equivalent to `listNotificationChannels`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The + * [project](https://cloud.google.com/monitoring/api/v3#project_name) on which + * to execute the request. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER] + * + * This names the container + * in which to look for the notification channels; it does not name a + * specific channel. To query a specific channel by REST resource name, use + * the + * {@link protos.google.monitoring.v3.NotificationChannelService.GetNotificationChannel|`GetNotificationChannel`} + * operation. + * @param {string} [request.filter] + * Optional. If provided, this field specifies the criteria that must be met + * by notification channels to be included in the response. + * + * For more details, see [sorting and + * filtering](https://cloud.google.com/monitoring/api/v3/sorting-and-filtering). + * @param {string} [request.orderBy] + * Optional. A comma-separated list of fields by which to sort the result. + * Supports the same set of fields as in `filter`. Entries can be prefixed + * with a minus sign to sort in descending rather than ascending order. + * + * For more details, see [sorting and + * filtering](https://cloud.google.com/monitoring/api/v3/sorting-and-filtering). + * @param {number} [request.pageSize] + * Optional. The maximum number of results to return in a single response. If + * not set to a positive number, a reasonable value will be chosen by the + * service. + * @param {string} [request.pageToken] + * Optional. If non-empty, `page_token` must contain a value returned as the + * `next_page_token` in a previous response to request the next set + * of results. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.monitoring.v3.NotificationChannel|NotificationChannel} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listNotificationChannelsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listNotificationChannelsStream( - request?: protos.google.monitoring.v3.IListNotificationChannelsRequest, - options?: CallOptions): - Transform{ + request?: protos.google.monitoring.v3.IListNotificationChannelsRequest, + options?: CallOptions, + ): Transform { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); const defaultCallSettings = this._defaults['listNotificationChannels']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listNotificationChannels stream %j', request); return this.descriptors.page.listNotificationChannels.createStream( this.innerApiCalls.listNotificationChannels as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `listNotificationChannels`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The - * [project](https://cloud.google.com/monitoring/api/v3#project_name) on which - * to execute the request. The format is: - * - * projects/[PROJECT_ID_OR_NUMBER] - * - * This names the container - * in which to look for the notification channels; it does not name a - * specific channel. To query a specific channel by REST resource name, use - * the - * {@link protos.google.monitoring.v3.NotificationChannelService.GetNotificationChannel|`GetNotificationChannel`} - * operation. - * @param {string} [request.filter] - * Optional. If provided, this field specifies the criteria that must be met - * by notification channels to be included in the response. - * - * For more details, see [sorting and - * filtering](https://cloud.google.com/monitoring/api/v3/sorting-and-filtering). - * @param {string} [request.orderBy] - * Optional. A comma-separated list of fields by which to sort the result. - * Supports the same set of fields as in `filter`. Entries can be prefixed - * with a minus sign to sort in descending rather than ascending order. - * - * For more details, see [sorting and - * filtering](https://cloud.google.com/monitoring/api/v3/sorting-and-filtering). - * @param {number} [request.pageSize] - * Optional. The maximum number of results to return in a single response. If - * not set to a positive number, a reasonable value will be chosen by the - * service. - * @param {string} [request.pageToken] - * Optional. If non-empty, `page_token` must contain a value returned as the - * `next_page_token` in a previous response to request the next set - * of results. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.monitoring.v3.NotificationChannel|NotificationChannel}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v3/notification_channel_service.list_notification_channels.js - * region_tag:monitoring_v3_generated_NotificationChannelService_ListNotificationChannels_async - */ + /** + * Equivalent to `listNotificationChannels`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The + * [project](https://cloud.google.com/monitoring/api/v3#project_name) on which + * to execute the request. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER] + * + * This names the container + * in which to look for the notification channels; it does not name a + * specific channel. To query a specific channel by REST resource name, use + * the + * {@link protos.google.monitoring.v3.NotificationChannelService.GetNotificationChannel|`GetNotificationChannel`} + * operation. + * @param {string} [request.filter] + * Optional. If provided, this field specifies the criteria that must be met + * by notification channels to be included in the response. + * + * For more details, see [sorting and + * filtering](https://cloud.google.com/monitoring/api/v3/sorting-and-filtering). + * @param {string} [request.orderBy] + * Optional. A comma-separated list of fields by which to sort the result. + * Supports the same set of fields as in `filter`. Entries can be prefixed + * with a minus sign to sort in descending rather than ascending order. + * + * For more details, see [sorting and + * filtering](https://cloud.google.com/monitoring/api/v3/sorting-and-filtering). + * @param {number} [request.pageSize] + * Optional. The maximum number of results to return in a single response. If + * not set to a positive number, a reasonable value will be chosen by the + * service. + * @param {string} [request.pageToken] + * Optional. If non-empty, `page_token` must contain a value returned as the + * `next_page_token` in a previous response to request the next set + * of results. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.monitoring.v3.NotificationChannel|NotificationChannel}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v3/notification_channel_service.list_notification_channels.js + * region_tag:monitoring_v3_generated_NotificationChannelService_ListNotificationChannels_async + */ listNotificationChannelsAsync( - request?: protos.google.monitoring.v3.IListNotificationChannelsRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.monitoring.v3.IListNotificationChannelsRequest, + options?: CallOptions, + ): AsyncIterable { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); const defaultCallSettings = this._defaults['listNotificationChannels']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listNotificationChannels iterate %j', request); return this.descriptors.page.listNotificationChannels.asyncIterate( this.innerApiCalls['listNotificationChannels'] as GaxCall, request as {}, - callSettings + callSettings, ) as AsyncIterable; } // -------------------- @@ -1783,7 +2308,7 @@ export class NotificationChannelServiceClient { * @param {string} alert_policy * @returns {string} Resource name string. */ - folderAlertPolicyPath(folder:string,alertPolicy:string) { + folderAlertPolicyPath(folder: string, alertPolicy: string) { return this.pathTemplates.folderAlertPolicyPathTemplate.render({ folder: folder, alert_policy: alertPolicy, @@ -1798,7 +2323,9 @@ export class NotificationChannelServiceClient { * @returns {string} A string representing the folder. */ matchFolderFromFolderAlertPolicyName(folderAlertPolicyName: string) { - return this.pathTemplates.folderAlertPolicyPathTemplate.match(folderAlertPolicyName).folder; + return this.pathTemplates.folderAlertPolicyPathTemplate.match( + folderAlertPolicyName, + ).folder; } /** @@ -1809,7 +2336,9 @@ export class NotificationChannelServiceClient { * @returns {string} A string representing the alert_policy. */ matchAlertPolicyFromFolderAlertPolicyName(folderAlertPolicyName: string) { - return this.pathTemplates.folderAlertPolicyPathTemplate.match(folderAlertPolicyName).alert_policy; + return this.pathTemplates.folderAlertPolicyPathTemplate.match( + folderAlertPolicyName, + ).alert_policy; } /** @@ -1820,7 +2349,11 @@ export class NotificationChannelServiceClient { * @param {string} condition * @returns {string} Resource name string. */ - folderAlertPolicyConditionPath(folder:string,alertPolicy:string,condition:string) { + folderAlertPolicyConditionPath( + folder: string, + alertPolicy: string, + condition: string, + ) { return this.pathTemplates.folderAlertPolicyConditionPathTemplate.render({ folder: folder, alert_policy: alertPolicy, @@ -1835,8 +2368,12 @@ export class NotificationChannelServiceClient { * A fully-qualified path representing folder_alert_policy_condition resource. * @returns {string} A string representing the folder. */ - matchFolderFromFolderAlertPolicyConditionName(folderAlertPolicyConditionName: string) { - return this.pathTemplates.folderAlertPolicyConditionPathTemplate.match(folderAlertPolicyConditionName).folder; + matchFolderFromFolderAlertPolicyConditionName( + folderAlertPolicyConditionName: string, + ) { + return this.pathTemplates.folderAlertPolicyConditionPathTemplate.match( + folderAlertPolicyConditionName, + ).folder; } /** @@ -1846,8 +2383,12 @@ export class NotificationChannelServiceClient { * A fully-qualified path representing folder_alert_policy_condition resource. * @returns {string} A string representing the alert_policy. */ - matchAlertPolicyFromFolderAlertPolicyConditionName(folderAlertPolicyConditionName: string) { - return this.pathTemplates.folderAlertPolicyConditionPathTemplate.match(folderAlertPolicyConditionName).alert_policy; + matchAlertPolicyFromFolderAlertPolicyConditionName( + folderAlertPolicyConditionName: string, + ) { + return this.pathTemplates.folderAlertPolicyConditionPathTemplate.match( + folderAlertPolicyConditionName, + ).alert_policy; } /** @@ -1857,8 +2398,12 @@ export class NotificationChannelServiceClient { * A fully-qualified path representing folder_alert_policy_condition resource. * @returns {string} A string representing the condition. */ - matchConditionFromFolderAlertPolicyConditionName(folderAlertPolicyConditionName: string) { - return this.pathTemplates.folderAlertPolicyConditionPathTemplate.match(folderAlertPolicyConditionName).condition; + matchConditionFromFolderAlertPolicyConditionName( + folderAlertPolicyConditionName: string, + ) { + return this.pathTemplates.folderAlertPolicyConditionPathTemplate.match( + folderAlertPolicyConditionName, + ).condition; } /** @@ -1868,7 +2413,7 @@ export class NotificationChannelServiceClient { * @param {string} channel_descriptor * @returns {string} Resource name string. */ - folderChannelDescriptorPath(folder:string,channelDescriptor:string) { + folderChannelDescriptorPath(folder: string, channelDescriptor: string) { return this.pathTemplates.folderChannelDescriptorPathTemplate.render({ folder: folder, channel_descriptor: channelDescriptor, @@ -1882,8 +2427,12 @@ export class NotificationChannelServiceClient { * A fully-qualified path representing folder_channel_descriptor resource. * @returns {string} A string representing the folder. */ - matchFolderFromFolderChannelDescriptorName(folderChannelDescriptorName: string) { - return this.pathTemplates.folderChannelDescriptorPathTemplate.match(folderChannelDescriptorName).folder; + matchFolderFromFolderChannelDescriptorName( + folderChannelDescriptorName: string, + ) { + return this.pathTemplates.folderChannelDescriptorPathTemplate.match( + folderChannelDescriptorName, + ).folder; } /** @@ -1893,8 +2442,12 @@ export class NotificationChannelServiceClient { * A fully-qualified path representing folder_channel_descriptor resource. * @returns {string} A string representing the channel_descriptor. */ - matchChannelDescriptorFromFolderChannelDescriptorName(folderChannelDescriptorName: string) { - return this.pathTemplates.folderChannelDescriptorPathTemplate.match(folderChannelDescriptorName).channel_descriptor; + matchChannelDescriptorFromFolderChannelDescriptorName( + folderChannelDescriptorName: string, + ) { + return this.pathTemplates.folderChannelDescriptorPathTemplate.match( + folderChannelDescriptorName, + ).channel_descriptor; } /** @@ -1904,7 +2457,7 @@ export class NotificationChannelServiceClient { * @param {string} group * @returns {string} Resource name string. */ - folderGroupPath(folder:string,group:string) { + folderGroupPath(folder: string, group: string) { return this.pathTemplates.folderGroupPathTemplate.render({ folder: folder, group: group, @@ -1919,7 +2472,8 @@ export class NotificationChannelServiceClient { * @returns {string} A string representing the folder. */ matchFolderFromFolderGroupName(folderGroupName: string) { - return this.pathTemplates.folderGroupPathTemplate.match(folderGroupName).folder; + return this.pathTemplates.folderGroupPathTemplate.match(folderGroupName) + .folder; } /** @@ -1930,7 +2484,8 @@ export class NotificationChannelServiceClient { * @returns {string} A string representing the group. */ matchGroupFromFolderGroupName(folderGroupName: string) { - return this.pathTemplates.folderGroupPathTemplate.match(folderGroupName).group; + return this.pathTemplates.folderGroupPathTemplate.match(folderGroupName) + .group; } /** @@ -1940,7 +2495,7 @@ export class NotificationChannelServiceClient { * @param {string} notification_channel * @returns {string} Resource name string. */ - folderNotificationChannelPath(folder:string,notificationChannel:string) { + folderNotificationChannelPath(folder: string, notificationChannel: string) { return this.pathTemplates.folderNotificationChannelPathTemplate.render({ folder: folder, notification_channel: notificationChannel, @@ -1954,8 +2509,12 @@ export class NotificationChannelServiceClient { * A fully-qualified path representing folder_notification_channel resource. * @returns {string} A string representing the folder. */ - matchFolderFromFolderNotificationChannelName(folderNotificationChannelName: string) { - return this.pathTemplates.folderNotificationChannelPathTemplate.match(folderNotificationChannelName).folder; + matchFolderFromFolderNotificationChannelName( + folderNotificationChannelName: string, + ) { + return this.pathTemplates.folderNotificationChannelPathTemplate.match( + folderNotificationChannelName, + ).folder; } /** @@ -1965,8 +2524,12 @@ export class NotificationChannelServiceClient { * A fully-qualified path representing folder_notification_channel resource. * @returns {string} A string representing the notification_channel. */ - matchNotificationChannelFromFolderNotificationChannelName(folderNotificationChannelName: string) { - return this.pathTemplates.folderNotificationChannelPathTemplate.match(folderNotificationChannelName).notification_channel; + matchNotificationChannelFromFolderNotificationChannelName( + folderNotificationChannelName: string, + ) { + return this.pathTemplates.folderNotificationChannelPathTemplate.match( + folderNotificationChannelName, + ).notification_channel; } /** @@ -1976,7 +2539,7 @@ export class NotificationChannelServiceClient { * @param {string} service * @returns {string} Resource name string. */ - folderServicePath(folder:string,service:string) { + folderServicePath(folder: string, service: string) { return this.pathTemplates.folderServicePathTemplate.render({ folder: folder, service: service, @@ -1991,7 +2554,8 @@ export class NotificationChannelServiceClient { * @returns {string} A string representing the folder. */ matchFolderFromFolderServiceName(folderServiceName: string) { - return this.pathTemplates.folderServicePathTemplate.match(folderServiceName).folder; + return this.pathTemplates.folderServicePathTemplate.match(folderServiceName) + .folder; } /** @@ -2002,7 +2566,8 @@ export class NotificationChannelServiceClient { * @returns {string} A string representing the service. */ matchServiceFromFolderServiceName(folderServiceName: string) { - return this.pathTemplates.folderServicePathTemplate.match(folderServiceName).service; + return this.pathTemplates.folderServicePathTemplate.match(folderServiceName) + .service; } /** @@ -2013,12 +2578,18 @@ export class NotificationChannelServiceClient { * @param {string} service_level_objective * @returns {string} Resource name string. */ - folderServiceServiceLevelObjectivePath(folder:string,service:string,serviceLevelObjective:string) { - return this.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.render({ - folder: folder, - service: service, - service_level_objective: serviceLevelObjective, - }); + folderServiceServiceLevelObjectivePath( + folder: string, + service: string, + serviceLevelObjective: string, + ) { + return this.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.render( + { + folder: folder, + service: service, + service_level_objective: serviceLevelObjective, + }, + ); } /** @@ -2028,8 +2599,12 @@ export class NotificationChannelServiceClient { * A fully-qualified path representing folder_service_service_level_objective resource. * @returns {string} A string representing the folder. */ - matchFolderFromFolderServiceServiceLevelObjectiveName(folderServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match(folderServiceServiceLevelObjectiveName).folder; + matchFolderFromFolderServiceServiceLevelObjectiveName( + folderServiceServiceLevelObjectiveName: string, + ) { + return this.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match( + folderServiceServiceLevelObjectiveName, + ).folder; } /** @@ -2039,8 +2614,12 @@ export class NotificationChannelServiceClient { * A fully-qualified path representing folder_service_service_level_objective resource. * @returns {string} A string representing the service. */ - matchServiceFromFolderServiceServiceLevelObjectiveName(folderServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match(folderServiceServiceLevelObjectiveName).service; + matchServiceFromFolderServiceServiceLevelObjectiveName( + folderServiceServiceLevelObjectiveName: string, + ) { + return this.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match( + folderServiceServiceLevelObjectiveName, + ).service; } /** @@ -2050,8 +2629,12 @@ export class NotificationChannelServiceClient { * A fully-qualified path representing folder_service_service_level_objective resource. * @returns {string} A string representing the service_level_objective. */ - matchServiceLevelObjectiveFromFolderServiceServiceLevelObjectiveName(folderServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match(folderServiceServiceLevelObjectiveName).service_level_objective; + matchServiceLevelObjectiveFromFolderServiceServiceLevelObjectiveName( + folderServiceServiceLevelObjectiveName: string, + ) { + return this.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match( + folderServiceServiceLevelObjectiveName, + ).service_level_objective; } /** @@ -2061,7 +2644,7 @@ export class NotificationChannelServiceClient { * @param {string} uptime_check_config * @returns {string} Resource name string. */ - folderUptimeCheckConfigPath(folder:string,uptimeCheckConfig:string) { + folderUptimeCheckConfigPath(folder: string, uptimeCheckConfig: string) { return this.pathTemplates.folderUptimeCheckConfigPathTemplate.render({ folder: folder, uptime_check_config: uptimeCheckConfig, @@ -2075,8 +2658,12 @@ export class NotificationChannelServiceClient { * A fully-qualified path representing folder_uptime_check_config resource. * @returns {string} A string representing the folder. */ - matchFolderFromFolderUptimeCheckConfigName(folderUptimeCheckConfigName: string) { - return this.pathTemplates.folderUptimeCheckConfigPathTemplate.match(folderUptimeCheckConfigName).folder; + matchFolderFromFolderUptimeCheckConfigName( + folderUptimeCheckConfigName: string, + ) { + return this.pathTemplates.folderUptimeCheckConfigPathTemplate.match( + folderUptimeCheckConfigName, + ).folder; } /** @@ -2086,8 +2673,12 @@ export class NotificationChannelServiceClient { * A fully-qualified path representing folder_uptime_check_config resource. * @returns {string} A string representing the uptime_check_config. */ - matchUptimeCheckConfigFromFolderUptimeCheckConfigName(folderUptimeCheckConfigName: string) { - return this.pathTemplates.folderUptimeCheckConfigPathTemplate.match(folderUptimeCheckConfigName).uptime_check_config; + matchUptimeCheckConfigFromFolderUptimeCheckConfigName( + folderUptimeCheckConfigName: string, + ) { + return this.pathTemplates.folderUptimeCheckConfigPathTemplate.match( + folderUptimeCheckConfigName, + ).uptime_check_config; } /** @@ -2097,7 +2688,7 @@ export class NotificationChannelServiceClient { * @param {string} alert_policy * @returns {string} Resource name string. */ - organizationAlertPolicyPath(organization:string,alertPolicy:string) { + organizationAlertPolicyPath(organization: string, alertPolicy: string) { return this.pathTemplates.organizationAlertPolicyPathTemplate.render({ organization: organization, alert_policy: alertPolicy, @@ -2111,8 +2702,12 @@ export class NotificationChannelServiceClient { * A fully-qualified path representing organization_alert_policy resource. * @returns {string} A string representing the organization. */ - matchOrganizationFromOrganizationAlertPolicyName(organizationAlertPolicyName: string) { - return this.pathTemplates.organizationAlertPolicyPathTemplate.match(organizationAlertPolicyName).organization; + matchOrganizationFromOrganizationAlertPolicyName( + organizationAlertPolicyName: string, + ) { + return this.pathTemplates.organizationAlertPolicyPathTemplate.match( + organizationAlertPolicyName, + ).organization; } /** @@ -2122,8 +2717,12 @@ export class NotificationChannelServiceClient { * A fully-qualified path representing organization_alert_policy resource. * @returns {string} A string representing the alert_policy. */ - matchAlertPolicyFromOrganizationAlertPolicyName(organizationAlertPolicyName: string) { - return this.pathTemplates.organizationAlertPolicyPathTemplate.match(organizationAlertPolicyName).alert_policy; + matchAlertPolicyFromOrganizationAlertPolicyName( + organizationAlertPolicyName: string, + ) { + return this.pathTemplates.organizationAlertPolicyPathTemplate.match( + organizationAlertPolicyName, + ).alert_policy; } /** @@ -2134,12 +2733,18 @@ export class NotificationChannelServiceClient { * @param {string} condition * @returns {string} Resource name string. */ - organizationAlertPolicyConditionPath(organization:string,alertPolicy:string,condition:string) { - return this.pathTemplates.organizationAlertPolicyConditionPathTemplate.render({ - organization: organization, - alert_policy: alertPolicy, - condition: condition, - }); + organizationAlertPolicyConditionPath( + organization: string, + alertPolicy: string, + condition: string, + ) { + return this.pathTemplates.organizationAlertPolicyConditionPathTemplate.render( + { + organization: organization, + alert_policy: alertPolicy, + condition: condition, + }, + ); } /** @@ -2149,8 +2754,12 @@ export class NotificationChannelServiceClient { * A fully-qualified path representing organization_alert_policy_condition resource. * @returns {string} A string representing the organization. */ - matchOrganizationFromOrganizationAlertPolicyConditionName(organizationAlertPolicyConditionName: string) { - return this.pathTemplates.organizationAlertPolicyConditionPathTemplate.match(organizationAlertPolicyConditionName).organization; + matchOrganizationFromOrganizationAlertPolicyConditionName( + organizationAlertPolicyConditionName: string, + ) { + return this.pathTemplates.organizationAlertPolicyConditionPathTemplate.match( + organizationAlertPolicyConditionName, + ).organization; } /** @@ -2160,8 +2769,12 @@ export class NotificationChannelServiceClient { * A fully-qualified path representing organization_alert_policy_condition resource. * @returns {string} A string representing the alert_policy. */ - matchAlertPolicyFromOrganizationAlertPolicyConditionName(organizationAlertPolicyConditionName: string) { - return this.pathTemplates.organizationAlertPolicyConditionPathTemplate.match(organizationAlertPolicyConditionName).alert_policy; + matchAlertPolicyFromOrganizationAlertPolicyConditionName( + organizationAlertPolicyConditionName: string, + ) { + return this.pathTemplates.organizationAlertPolicyConditionPathTemplate.match( + organizationAlertPolicyConditionName, + ).alert_policy; } /** @@ -2171,8 +2784,12 @@ export class NotificationChannelServiceClient { * A fully-qualified path representing organization_alert_policy_condition resource. * @returns {string} A string representing the condition. */ - matchConditionFromOrganizationAlertPolicyConditionName(organizationAlertPolicyConditionName: string) { - return this.pathTemplates.organizationAlertPolicyConditionPathTemplate.match(organizationAlertPolicyConditionName).condition; + matchConditionFromOrganizationAlertPolicyConditionName( + organizationAlertPolicyConditionName: string, + ) { + return this.pathTemplates.organizationAlertPolicyConditionPathTemplate.match( + organizationAlertPolicyConditionName, + ).condition; } /** @@ -2182,7 +2799,10 @@ export class NotificationChannelServiceClient { * @param {string} channel_descriptor * @returns {string} Resource name string. */ - organizationChannelDescriptorPath(organization:string,channelDescriptor:string) { + organizationChannelDescriptorPath( + organization: string, + channelDescriptor: string, + ) { return this.pathTemplates.organizationChannelDescriptorPathTemplate.render({ organization: organization, channel_descriptor: channelDescriptor, @@ -2196,8 +2816,12 @@ export class NotificationChannelServiceClient { * A fully-qualified path representing organization_channel_descriptor resource. * @returns {string} A string representing the organization. */ - matchOrganizationFromOrganizationChannelDescriptorName(organizationChannelDescriptorName: string) { - return this.pathTemplates.organizationChannelDescriptorPathTemplate.match(organizationChannelDescriptorName).organization; + matchOrganizationFromOrganizationChannelDescriptorName( + organizationChannelDescriptorName: string, + ) { + return this.pathTemplates.organizationChannelDescriptorPathTemplate.match( + organizationChannelDescriptorName, + ).organization; } /** @@ -2207,8 +2831,12 @@ export class NotificationChannelServiceClient { * A fully-qualified path representing organization_channel_descriptor resource. * @returns {string} A string representing the channel_descriptor. */ - matchChannelDescriptorFromOrganizationChannelDescriptorName(organizationChannelDescriptorName: string) { - return this.pathTemplates.organizationChannelDescriptorPathTemplate.match(organizationChannelDescriptorName).channel_descriptor; + matchChannelDescriptorFromOrganizationChannelDescriptorName( + organizationChannelDescriptorName: string, + ) { + return this.pathTemplates.organizationChannelDescriptorPathTemplate.match( + organizationChannelDescriptorName, + ).channel_descriptor; } /** @@ -2218,7 +2846,7 @@ export class NotificationChannelServiceClient { * @param {string} group * @returns {string} Resource name string. */ - organizationGroupPath(organization:string,group:string) { + organizationGroupPath(organization: string, group: string) { return this.pathTemplates.organizationGroupPathTemplate.render({ organization: organization, group: group, @@ -2233,7 +2861,9 @@ export class NotificationChannelServiceClient { * @returns {string} A string representing the organization. */ matchOrganizationFromOrganizationGroupName(organizationGroupName: string) { - return this.pathTemplates.organizationGroupPathTemplate.match(organizationGroupName).organization; + return this.pathTemplates.organizationGroupPathTemplate.match( + organizationGroupName, + ).organization; } /** @@ -2244,7 +2874,9 @@ export class NotificationChannelServiceClient { * @returns {string} A string representing the group. */ matchGroupFromOrganizationGroupName(organizationGroupName: string) { - return this.pathTemplates.organizationGroupPathTemplate.match(organizationGroupName).group; + return this.pathTemplates.organizationGroupPathTemplate.match( + organizationGroupName, + ).group; } /** @@ -2254,11 +2886,16 @@ export class NotificationChannelServiceClient { * @param {string} notification_channel * @returns {string} Resource name string. */ - organizationNotificationChannelPath(organization:string,notificationChannel:string) { - return this.pathTemplates.organizationNotificationChannelPathTemplate.render({ - organization: organization, - notification_channel: notificationChannel, - }); + organizationNotificationChannelPath( + organization: string, + notificationChannel: string, + ) { + return this.pathTemplates.organizationNotificationChannelPathTemplate.render( + { + organization: organization, + notification_channel: notificationChannel, + }, + ); } /** @@ -2268,8 +2905,12 @@ export class NotificationChannelServiceClient { * A fully-qualified path representing organization_notification_channel resource. * @returns {string} A string representing the organization. */ - matchOrganizationFromOrganizationNotificationChannelName(organizationNotificationChannelName: string) { - return this.pathTemplates.organizationNotificationChannelPathTemplate.match(organizationNotificationChannelName).organization; + matchOrganizationFromOrganizationNotificationChannelName( + organizationNotificationChannelName: string, + ) { + return this.pathTemplates.organizationNotificationChannelPathTemplate.match( + organizationNotificationChannelName, + ).organization; } /** @@ -2279,8 +2920,12 @@ export class NotificationChannelServiceClient { * A fully-qualified path representing organization_notification_channel resource. * @returns {string} A string representing the notification_channel. */ - matchNotificationChannelFromOrganizationNotificationChannelName(organizationNotificationChannelName: string) { - return this.pathTemplates.organizationNotificationChannelPathTemplate.match(organizationNotificationChannelName).notification_channel; + matchNotificationChannelFromOrganizationNotificationChannelName( + organizationNotificationChannelName: string, + ) { + return this.pathTemplates.organizationNotificationChannelPathTemplate.match( + organizationNotificationChannelName, + ).notification_channel; } /** @@ -2290,7 +2935,7 @@ export class NotificationChannelServiceClient { * @param {string} service * @returns {string} Resource name string. */ - organizationServicePath(organization:string,service:string) { + organizationServicePath(organization: string, service: string) { return this.pathTemplates.organizationServicePathTemplate.render({ organization: organization, service: service, @@ -2304,8 +2949,12 @@ export class NotificationChannelServiceClient { * A fully-qualified path representing organization_service resource. * @returns {string} A string representing the organization. */ - matchOrganizationFromOrganizationServiceName(organizationServiceName: string) { - return this.pathTemplates.organizationServicePathTemplate.match(organizationServiceName).organization; + matchOrganizationFromOrganizationServiceName( + organizationServiceName: string, + ) { + return this.pathTemplates.organizationServicePathTemplate.match( + organizationServiceName, + ).organization; } /** @@ -2316,7 +2965,9 @@ export class NotificationChannelServiceClient { * @returns {string} A string representing the service. */ matchServiceFromOrganizationServiceName(organizationServiceName: string) { - return this.pathTemplates.organizationServicePathTemplate.match(organizationServiceName).service; + return this.pathTemplates.organizationServicePathTemplate.match( + organizationServiceName, + ).service; } /** @@ -2327,12 +2978,18 @@ export class NotificationChannelServiceClient { * @param {string} service_level_objective * @returns {string} Resource name string. */ - organizationServiceServiceLevelObjectivePath(organization:string,service:string,serviceLevelObjective:string) { - return this.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.render({ - organization: organization, - service: service, - service_level_objective: serviceLevelObjective, - }); + organizationServiceServiceLevelObjectivePath( + organization: string, + service: string, + serviceLevelObjective: string, + ) { + return this.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.render( + { + organization: organization, + service: service, + service_level_objective: serviceLevelObjective, + }, + ); } /** @@ -2342,8 +2999,12 @@ export class NotificationChannelServiceClient { * A fully-qualified path representing organization_service_service_level_objective resource. * @returns {string} A string representing the organization. */ - matchOrganizationFromOrganizationServiceServiceLevelObjectiveName(organizationServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match(organizationServiceServiceLevelObjectiveName).organization; + matchOrganizationFromOrganizationServiceServiceLevelObjectiveName( + organizationServiceServiceLevelObjectiveName: string, + ) { + return this.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match( + organizationServiceServiceLevelObjectiveName, + ).organization; } /** @@ -2353,8 +3014,12 @@ export class NotificationChannelServiceClient { * A fully-qualified path representing organization_service_service_level_objective resource. * @returns {string} A string representing the service. */ - matchServiceFromOrganizationServiceServiceLevelObjectiveName(organizationServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match(organizationServiceServiceLevelObjectiveName).service; + matchServiceFromOrganizationServiceServiceLevelObjectiveName( + organizationServiceServiceLevelObjectiveName: string, + ) { + return this.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match( + organizationServiceServiceLevelObjectiveName, + ).service; } /** @@ -2364,8 +3029,12 @@ export class NotificationChannelServiceClient { * A fully-qualified path representing organization_service_service_level_objective resource. * @returns {string} A string representing the service_level_objective. */ - matchServiceLevelObjectiveFromOrganizationServiceServiceLevelObjectiveName(organizationServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match(organizationServiceServiceLevelObjectiveName).service_level_objective; + matchServiceLevelObjectiveFromOrganizationServiceServiceLevelObjectiveName( + organizationServiceServiceLevelObjectiveName: string, + ) { + return this.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match( + organizationServiceServiceLevelObjectiveName, + ).service_level_objective; } /** @@ -2375,7 +3044,10 @@ export class NotificationChannelServiceClient { * @param {string} uptime_check_config * @returns {string} Resource name string. */ - organizationUptimeCheckConfigPath(organization:string,uptimeCheckConfig:string) { + organizationUptimeCheckConfigPath( + organization: string, + uptimeCheckConfig: string, + ) { return this.pathTemplates.organizationUptimeCheckConfigPathTemplate.render({ organization: organization, uptime_check_config: uptimeCheckConfig, @@ -2389,8 +3061,12 @@ export class NotificationChannelServiceClient { * A fully-qualified path representing organization_uptime_check_config resource. * @returns {string} A string representing the organization. */ - matchOrganizationFromOrganizationUptimeCheckConfigName(organizationUptimeCheckConfigName: string) { - return this.pathTemplates.organizationUptimeCheckConfigPathTemplate.match(organizationUptimeCheckConfigName).organization; + matchOrganizationFromOrganizationUptimeCheckConfigName( + organizationUptimeCheckConfigName: string, + ) { + return this.pathTemplates.organizationUptimeCheckConfigPathTemplate.match( + organizationUptimeCheckConfigName, + ).organization; } /** @@ -2400,8 +3076,12 @@ export class NotificationChannelServiceClient { * A fully-qualified path representing organization_uptime_check_config resource. * @returns {string} A string representing the uptime_check_config. */ - matchUptimeCheckConfigFromOrganizationUptimeCheckConfigName(organizationUptimeCheckConfigName: string) { - return this.pathTemplates.organizationUptimeCheckConfigPathTemplate.match(organizationUptimeCheckConfigName).uptime_check_config; + matchUptimeCheckConfigFromOrganizationUptimeCheckConfigName( + organizationUptimeCheckConfigName: string, + ) { + return this.pathTemplates.organizationUptimeCheckConfigPathTemplate.match( + organizationUptimeCheckConfigName, + ).uptime_check_config; } /** @@ -2410,7 +3090,7 @@ export class NotificationChannelServiceClient { * @param {string} project * @returns {string} Resource name string. */ - projectPath(project:string) { + projectPath(project: string) { return this.pathTemplates.projectPathTemplate.render({ project: project, }); @@ -2434,7 +3114,7 @@ export class NotificationChannelServiceClient { * @param {string} alert_policy * @returns {string} Resource name string. */ - projectAlertPolicyPath(project:string,alertPolicy:string) { + projectAlertPolicyPath(project: string, alertPolicy: string) { return this.pathTemplates.projectAlertPolicyPathTemplate.render({ project: project, alert_policy: alertPolicy, @@ -2449,7 +3129,9 @@ export class NotificationChannelServiceClient { * @returns {string} A string representing the project. */ matchProjectFromProjectAlertPolicyName(projectAlertPolicyName: string) { - return this.pathTemplates.projectAlertPolicyPathTemplate.match(projectAlertPolicyName).project; + return this.pathTemplates.projectAlertPolicyPathTemplate.match( + projectAlertPolicyName, + ).project; } /** @@ -2460,7 +3142,9 @@ export class NotificationChannelServiceClient { * @returns {string} A string representing the alert_policy. */ matchAlertPolicyFromProjectAlertPolicyName(projectAlertPolicyName: string) { - return this.pathTemplates.projectAlertPolicyPathTemplate.match(projectAlertPolicyName).alert_policy; + return this.pathTemplates.projectAlertPolicyPathTemplate.match( + projectAlertPolicyName, + ).alert_policy; } /** @@ -2471,7 +3155,11 @@ export class NotificationChannelServiceClient { * @param {string} condition * @returns {string} Resource name string. */ - projectAlertPolicyConditionPath(project:string,alertPolicy:string,condition:string) { + projectAlertPolicyConditionPath( + project: string, + alertPolicy: string, + condition: string, + ) { return this.pathTemplates.projectAlertPolicyConditionPathTemplate.render({ project: project, alert_policy: alertPolicy, @@ -2486,8 +3174,12 @@ export class NotificationChannelServiceClient { * A fully-qualified path representing project_alert_policy_condition resource. * @returns {string} A string representing the project. */ - matchProjectFromProjectAlertPolicyConditionName(projectAlertPolicyConditionName: string) { - return this.pathTemplates.projectAlertPolicyConditionPathTemplate.match(projectAlertPolicyConditionName).project; + matchProjectFromProjectAlertPolicyConditionName( + projectAlertPolicyConditionName: string, + ) { + return this.pathTemplates.projectAlertPolicyConditionPathTemplate.match( + projectAlertPolicyConditionName, + ).project; } /** @@ -2497,8 +3189,12 @@ export class NotificationChannelServiceClient { * A fully-qualified path representing project_alert_policy_condition resource. * @returns {string} A string representing the alert_policy. */ - matchAlertPolicyFromProjectAlertPolicyConditionName(projectAlertPolicyConditionName: string) { - return this.pathTemplates.projectAlertPolicyConditionPathTemplate.match(projectAlertPolicyConditionName).alert_policy; + matchAlertPolicyFromProjectAlertPolicyConditionName( + projectAlertPolicyConditionName: string, + ) { + return this.pathTemplates.projectAlertPolicyConditionPathTemplate.match( + projectAlertPolicyConditionName, + ).alert_policy; } /** @@ -2508,8 +3204,12 @@ export class NotificationChannelServiceClient { * A fully-qualified path representing project_alert_policy_condition resource. * @returns {string} A string representing the condition. */ - matchConditionFromProjectAlertPolicyConditionName(projectAlertPolicyConditionName: string) { - return this.pathTemplates.projectAlertPolicyConditionPathTemplate.match(projectAlertPolicyConditionName).condition; + matchConditionFromProjectAlertPolicyConditionName( + projectAlertPolicyConditionName: string, + ) { + return this.pathTemplates.projectAlertPolicyConditionPathTemplate.match( + projectAlertPolicyConditionName, + ).condition; } /** @@ -2519,7 +3219,7 @@ export class NotificationChannelServiceClient { * @param {string} channel_descriptor * @returns {string} Resource name string. */ - projectChannelDescriptorPath(project:string,channelDescriptor:string) { + projectChannelDescriptorPath(project: string, channelDescriptor: string) { return this.pathTemplates.projectChannelDescriptorPathTemplate.render({ project: project, channel_descriptor: channelDescriptor, @@ -2533,8 +3233,12 @@ export class NotificationChannelServiceClient { * A fully-qualified path representing project_channel_descriptor resource. * @returns {string} A string representing the project. */ - matchProjectFromProjectChannelDescriptorName(projectChannelDescriptorName: string) { - return this.pathTemplates.projectChannelDescriptorPathTemplate.match(projectChannelDescriptorName).project; + matchProjectFromProjectChannelDescriptorName( + projectChannelDescriptorName: string, + ) { + return this.pathTemplates.projectChannelDescriptorPathTemplate.match( + projectChannelDescriptorName, + ).project; } /** @@ -2544,8 +3248,12 @@ export class NotificationChannelServiceClient { * A fully-qualified path representing project_channel_descriptor resource. * @returns {string} A string representing the channel_descriptor. */ - matchChannelDescriptorFromProjectChannelDescriptorName(projectChannelDescriptorName: string) { - return this.pathTemplates.projectChannelDescriptorPathTemplate.match(projectChannelDescriptorName).channel_descriptor; + matchChannelDescriptorFromProjectChannelDescriptorName( + projectChannelDescriptorName: string, + ) { + return this.pathTemplates.projectChannelDescriptorPathTemplate.match( + projectChannelDescriptorName, + ).channel_descriptor; } /** @@ -2555,7 +3263,7 @@ export class NotificationChannelServiceClient { * @param {string} group * @returns {string} Resource name string. */ - projectGroupPath(project:string,group:string) { + projectGroupPath(project: string, group: string) { return this.pathTemplates.projectGroupPathTemplate.render({ project: project, group: group, @@ -2570,7 +3278,8 @@ export class NotificationChannelServiceClient { * @returns {string} A string representing the project. */ matchProjectFromProjectGroupName(projectGroupName: string) { - return this.pathTemplates.projectGroupPathTemplate.match(projectGroupName).project; + return this.pathTemplates.projectGroupPathTemplate.match(projectGroupName) + .project; } /** @@ -2581,7 +3290,8 @@ export class NotificationChannelServiceClient { * @returns {string} A string representing the group. */ matchGroupFromProjectGroupName(projectGroupName: string) { - return this.pathTemplates.projectGroupPathTemplate.match(projectGroupName).group; + return this.pathTemplates.projectGroupPathTemplate.match(projectGroupName) + .group; } /** @@ -2591,7 +3301,7 @@ export class NotificationChannelServiceClient { * @param {string} notification_channel * @returns {string} Resource name string. */ - projectNotificationChannelPath(project:string,notificationChannel:string) { + projectNotificationChannelPath(project: string, notificationChannel: string) { return this.pathTemplates.projectNotificationChannelPathTemplate.render({ project: project, notification_channel: notificationChannel, @@ -2605,8 +3315,12 @@ export class NotificationChannelServiceClient { * A fully-qualified path representing project_notification_channel resource. * @returns {string} A string representing the project. */ - matchProjectFromProjectNotificationChannelName(projectNotificationChannelName: string) { - return this.pathTemplates.projectNotificationChannelPathTemplate.match(projectNotificationChannelName).project; + matchProjectFromProjectNotificationChannelName( + projectNotificationChannelName: string, + ) { + return this.pathTemplates.projectNotificationChannelPathTemplate.match( + projectNotificationChannelName, + ).project; } /** @@ -2616,8 +3330,12 @@ export class NotificationChannelServiceClient { * A fully-qualified path representing project_notification_channel resource. * @returns {string} A string representing the notification_channel. */ - matchNotificationChannelFromProjectNotificationChannelName(projectNotificationChannelName: string) { - return this.pathTemplates.projectNotificationChannelPathTemplate.match(projectNotificationChannelName).notification_channel; + matchNotificationChannelFromProjectNotificationChannelName( + projectNotificationChannelName: string, + ) { + return this.pathTemplates.projectNotificationChannelPathTemplate.match( + projectNotificationChannelName, + ).notification_channel; } /** @@ -2627,7 +3345,7 @@ export class NotificationChannelServiceClient { * @param {string} service * @returns {string} Resource name string. */ - projectServicePath(project:string,service:string) { + projectServicePath(project: string, service: string) { return this.pathTemplates.projectServicePathTemplate.render({ project: project, service: service, @@ -2642,7 +3360,9 @@ export class NotificationChannelServiceClient { * @returns {string} A string representing the project. */ matchProjectFromProjectServiceName(projectServiceName: string) { - return this.pathTemplates.projectServicePathTemplate.match(projectServiceName).project; + return this.pathTemplates.projectServicePathTemplate.match( + projectServiceName, + ).project; } /** @@ -2653,7 +3373,9 @@ export class NotificationChannelServiceClient { * @returns {string} A string representing the service. */ matchServiceFromProjectServiceName(projectServiceName: string) { - return this.pathTemplates.projectServicePathTemplate.match(projectServiceName).service; + return this.pathTemplates.projectServicePathTemplate.match( + projectServiceName, + ).service; } /** @@ -2664,12 +3386,18 @@ export class NotificationChannelServiceClient { * @param {string} service_level_objective * @returns {string} Resource name string. */ - projectServiceServiceLevelObjectivePath(project:string,service:string,serviceLevelObjective:string) { - return this.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.render({ - project: project, - service: service, - service_level_objective: serviceLevelObjective, - }); + projectServiceServiceLevelObjectivePath( + project: string, + service: string, + serviceLevelObjective: string, + ) { + return this.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.render( + { + project: project, + service: service, + service_level_objective: serviceLevelObjective, + }, + ); } /** @@ -2679,8 +3407,12 @@ export class NotificationChannelServiceClient { * A fully-qualified path representing project_service_service_level_objective resource. * @returns {string} A string representing the project. */ - matchProjectFromProjectServiceServiceLevelObjectiveName(projectServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match(projectServiceServiceLevelObjectiveName).project; + matchProjectFromProjectServiceServiceLevelObjectiveName( + projectServiceServiceLevelObjectiveName: string, + ) { + return this.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match( + projectServiceServiceLevelObjectiveName, + ).project; } /** @@ -2690,8 +3422,12 @@ export class NotificationChannelServiceClient { * A fully-qualified path representing project_service_service_level_objective resource. * @returns {string} A string representing the service. */ - matchServiceFromProjectServiceServiceLevelObjectiveName(projectServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match(projectServiceServiceLevelObjectiveName).service; + matchServiceFromProjectServiceServiceLevelObjectiveName( + projectServiceServiceLevelObjectiveName: string, + ) { + return this.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match( + projectServiceServiceLevelObjectiveName, + ).service; } /** @@ -2701,8 +3437,12 @@ export class NotificationChannelServiceClient { * A fully-qualified path representing project_service_service_level_objective resource. * @returns {string} A string representing the service_level_objective. */ - matchServiceLevelObjectiveFromProjectServiceServiceLevelObjectiveName(projectServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match(projectServiceServiceLevelObjectiveName).service_level_objective; + matchServiceLevelObjectiveFromProjectServiceServiceLevelObjectiveName( + projectServiceServiceLevelObjectiveName: string, + ) { + return this.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match( + projectServiceServiceLevelObjectiveName, + ).service_level_objective; } /** @@ -2712,7 +3452,7 @@ export class NotificationChannelServiceClient { * @param {string} uptime_check_config * @returns {string} Resource name string. */ - projectUptimeCheckConfigPath(project:string,uptimeCheckConfig:string) { + projectUptimeCheckConfigPath(project: string, uptimeCheckConfig: string) { return this.pathTemplates.projectUptimeCheckConfigPathTemplate.render({ project: project, uptime_check_config: uptimeCheckConfig, @@ -2726,8 +3466,12 @@ export class NotificationChannelServiceClient { * A fully-qualified path representing project_uptime_check_config resource. * @returns {string} A string representing the project. */ - matchProjectFromProjectUptimeCheckConfigName(projectUptimeCheckConfigName: string) { - return this.pathTemplates.projectUptimeCheckConfigPathTemplate.match(projectUptimeCheckConfigName).project; + matchProjectFromProjectUptimeCheckConfigName( + projectUptimeCheckConfigName: string, + ) { + return this.pathTemplates.projectUptimeCheckConfigPathTemplate.match( + projectUptimeCheckConfigName, + ).project; } /** @@ -2737,8 +3481,12 @@ export class NotificationChannelServiceClient { * A fully-qualified path representing project_uptime_check_config resource. * @returns {string} A string representing the uptime_check_config. */ - matchUptimeCheckConfigFromProjectUptimeCheckConfigName(projectUptimeCheckConfigName: string) { - return this.pathTemplates.projectUptimeCheckConfigPathTemplate.match(projectUptimeCheckConfigName).uptime_check_config; + matchUptimeCheckConfigFromProjectUptimeCheckConfigName( + projectUptimeCheckConfigName: string, + ) { + return this.pathTemplates.projectUptimeCheckConfigPathTemplate.match( + projectUptimeCheckConfigName, + ).uptime_check_config; } /** @@ -2748,7 +3496,7 @@ export class NotificationChannelServiceClient { * @param {string} snooze * @returns {string} Resource name string. */ - snoozePath(project:string,snooze:string) { + snoozePath(project: string, snooze: string) { return this.pathTemplates.snoozePathTemplate.render({ project: project, snooze: snooze, @@ -2785,7 +3533,7 @@ export class NotificationChannelServiceClient { */ close(): Promise { if (this.notificationChannelServiceStub && !this._terminated) { - return this.notificationChannelServiceStub.then(stub => { + return this.notificationChannelServiceStub.then((stub) => { this._log.info('ending gRPC channel'); this._terminated = true; stub.close(); @@ -2793,4 +3541,4 @@ export class NotificationChannelServiceClient { } return Promise.resolve(); } -} \ No newline at end of file +} diff --git a/packages/google-cloud-monitoring/src/v3/query_service_client.ts b/packages/google-cloud-monitoring/src/v3/query_service_client.ts index 1f7867b010cb..29a6346ae7fa 100644 --- a/packages/google-cloud-monitoring/src/v3/query_service_client.ts +++ b/packages/google-cloud-monitoring/src/v3/query_service_client.ts @@ -18,11 +18,18 @@ /* global window */ import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} from 'google-gax'; -import {Transform} from 'stream'; +import type { + Callback, + CallOptions, + Descriptors, + ClientOptions, + PaginationCallback, + GaxCall, +} from 'google-gax'; +import { Transform } from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; +import { loggingUtils as logging, decodeAnyProtosInArray } from 'google-gax'; /** * Client JSON configuration object, loaded from @@ -46,7 +53,7 @@ export class QueryServiceClient { 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('monitoring'); @@ -59,9 +66,9 @@ export class QueryServiceClient { batching: {}, }; warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - queryServiceStub?: Promise<{[name: string]: Function}>; + innerApiCalls: { [name: string]: Function }; + pathTemplates: { [name: string]: gax.PathTemplate }; + queryServiceStub?: Promise<{ [name: string]: Function }>; /** * Construct an instance of QueryServiceClient. @@ -102,21 +109,42 @@ export class QueryServiceClient { * const client = new QueryServiceClient({fallback: true}, gax); * ``` */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + constructor( + opts?: ClientOptions, + gaxInstance?: typeof gax | typeof gax.fallback, + ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof QueryServiceClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.', + ); } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; + const universeDomainEnvVar = + typeof process === 'object' && typeof process.env === 'object' + ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] + : undefined; + this._universeDomain = + opts?.universeDomain ?? + opts?.universe_domain ?? + universeDomainEnvVar ?? + 'googleapis.com'; this._servicePath = 'monitoring.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + const servicePath = + opts?.servicePath || opts?.apiEndpoint || this._servicePath; + this._providedCustomServicePath = !!( + opts?.servicePath || opts?.apiEndpoint + ); const port = opts?.port || staticMembers.port; const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts); // Request numeric enum values if REST transport is used. opts.numericEnums = true; @@ -141,7 +169,7 @@ export class QueryServiceClient { this._opts = opts; // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set useJWTAccessWithScope on the auth object. this.auth.useJWTAccessWithScope = true; @@ -155,10 +183,7 @@ export class QueryServiceClient { } // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; if (typeof process === 'object' && 'versions' in process) { clientHeader.push(`gl-node/${process.versions.node}`); } else { @@ -180,79 +205,86 @@ export class QueryServiceClient { // Create useful helper objects for these. this.pathTemplates = { folderAlertPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/alertPolicies/{alert_policy}' + 'folders/{folder}/alertPolicies/{alert_policy}', ), folderAlertPolicyConditionPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/alertPolicies/{alert_policy}/conditions/{condition}' + 'folders/{folder}/alertPolicies/{alert_policy}/conditions/{condition}', ), folderChannelDescriptorPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/notificationChannelDescriptors/{channel_descriptor}' + 'folders/{folder}/notificationChannelDescriptors/{channel_descriptor}', ), folderGroupPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/groups/{group}' + 'folders/{folder}/groups/{group}', ), folderNotificationChannelPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/notificationChannels/{notification_channel}' + 'folders/{folder}/notificationChannels/{notification_channel}', ), folderServicePathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/services/{service}' - ), - folderServiceServiceLevelObjectivePathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/services/{service}/serviceLevelObjectives/{service_level_objective}' + 'folders/{folder}/services/{service}', ), + folderServiceServiceLevelObjectivePathTemplate: + new this._gaxModule.PathTemplate( + 'folders/{folder}/services/{service}/serviceLevelObjectives/{service_level_objective}', + ), folderUptimeCheckConfigPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/uptimeCheckConfigs/{uptime_check_config}' + 'folders/{folder}/uptimeCheckConfigs/{uptime_check_config}', ), organizationAlertPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/alertPolicies/{alert_policy}' - ), - organizationAlertPolicyConditionPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/alertPolicies/{alert_policy}/conditions/{condition}' - ), - organizationChannelDescriptorPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/notificationChannelDescriptors/{channel_descriptor}' + 'organizations/{organization}/alertPolicies/{alert_policy}', ), + organizationAlertPolicyConditionPathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/alertPolicies/{alert_policy}/conditions/{condition}', + ), + organizationChannelDescriptorPathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/notificationChannelDescriptors/{channel_descriptor}', + ), organizationGroupPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/groups/{group}' - ), - organizationNotificationChannelPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/notificationChannels/{notification_channel}' + 'organizations/{organization}/groups/{group}', ), + organizationNotificationChannelPathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/notificationChannels/{notification_channel}', + ), organizationServicePathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/services/{service}' - ), - organizationServiceServiceLevelObjectivePathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/services/{service}/serviceLevelObjectives/{service_level_objective}' - ), - organizationUptimeCheckConfigPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/uptimeCheckConfigs/{uptime_check_config}' + 'organizations/{organization}/services/{service}', ), + organizationServiceServiceLevelObjectivePathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/services/{service}/serviceLevelObjectives/{service_level_objective}', + ), + organizationUptimeCheckConfigPathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/uptimeCheckConfigs/{uptime_check_config}', + ), projectAlertPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/alertPolicies/{alert_policy}' + 'projects/{project}/alertPolicies/{alert_policy}', ), projectAlertPolicyConditionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/alertPolicies/{alert_policy}/conditions/{condition}' + 'projects/{project}/alertPolicies/{alert_policy}/conditions/{condition}', ), projectChannelDescriptorPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/notificationChannelDescriptors/{channel_descriptor}' + 'projects/{project}/notificationChannelDescriptors/{channel_descriptor}', ), projectGroupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/groups/{group}' + 'projects/{project}/groups/{group}', ), projectNotificationChannelPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/notificationChannels/{notification_channel}' + 'projects/{project}/notificationChannels/{notification_channel}', ), projectServicePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/services/{service}' - ), - projectServiceServiceLevelObjectivePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/services/{service}/serviceLevelObjectives/{service_level_objective}' + 'projects/{project}/services/{service}', ), + projectServiceServiceLevelObjectivePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/services/{service}/serviceLevelObjectives/{service_level_objective}', + ), projectUptimeCheckConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/uptimeCheckConfigs/{uptime_check_config}' + 'projects/{project}/uptimeCheckConfigs/{uptime_check_config}', ), snoozePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/snoozes/{snooze}' + 'projects/{project}/snoozes/{snooze}', ), }; @@ -260,14 +292,20 @@ export class QueryServiceClient { // (e.g. 50 results at a time, with tokens to get subsequent // pages). Denote the keys used for pagination and results. this.descriptors.page = { - queryTimeSeries: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'timeSeriesData') + queryTimeSeries: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'timeSeriesData', + ), }; // Put together the default options sent with requests. this._defaults = this._gaxGrpc.constructSettings( - 'google.monitoring.v3.QueryService', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + 'google.monitoring.v3.QueryService', + gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, + { 'x-goog-api-client': clientHeader.join(' ') }, + ); // Set up a dictionary of "inner API calls"; the core implementation // of calling the API is handled in `google-gax`, with this code @@ -298,37 +336,40 @@ export class QueryServiceClient { // Put together the "service stub" for // google.monitoring.v3.QueryService. this.queryServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.monitoring.v3.QueryService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.monitoring.v3.QueryService', + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any (this._protos as any).google.monitoring.v3.QueryService, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; + this._opts, + this._providedCustomServicePath, + ) as Promise<{ [method: string]: Function }>; // Iterate over each of the methods that the service provides // and create an API call method for each. - const queryServiceStubMethods = - ['queryTimeSeries']; + const queryServiceStubMethods = ['queryTimeSeries']; for (const methodName of queryServiceStubMethods) { const callPromise = this.queryServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { + (stub) => + (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error | null | undefined) => () => { throw err; - }); + }, + ); - const descriptor = - this.descriptors.page[methodName] || - undefined; + const descriptor = this.descriptors.page[methodName] || undefined; const apiCall = this._gaxModule.createApiCall( callPromise, this._defaults[methodName], descriptor, - this._opts.fallback + this._opts.fallback, ); this.innerApiCalls[methodName] = apiCall; @@ -343,8 +384,14 @@ export class QueryServiceClient { * @returns {string} The DNS address for this service. */ static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); } return 'monitoring.googleapis.com'; } @@ -355,8 +402,14 @@ export class QueryServiceClient { * @returns {string} The DNS address for this service. */ static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); } return 'monitoring.googleapis.com'; } @@ -390,7 +443,7 @@ export class QueryServiceClient { return [ 'https://www.googleapis.com/auth/cloud-platform', 'https://www.googleapis.com/auth/monitoring', - 'https://www.googleapis.com/auth/monitoring.read' + 'https://www.googleapis.com/auth/monitoring.read', ]; } @@ -400,8 +453,9 @@ export class QueryServiceClient { * Return the project ID used by this class. * @returns {Promise} A promise that resolves to string containing the project ID. */ - getProjectId(callback?: Callback): - Promise|void { + getProjectId( + callback?: Callback, + ): Promise | void { if (callback) { this.auth.getProjectId(callback); return; @@ -413,102 +467,125 @@ export class QueryServiceClient { // -- Service calls -- // ------------------- - /** - * Queries time series by using Monitoring Query Language (MQL). We recommend - * using PromQL instead of MQL. For more information about the status of MQL, - * see the [MQL deprecation - * notice](https://cloud.google.com/stackdriver/docs/deprecations/mql). - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The - * [project](https://cloud.google.com/monitoring/api/v3#project_name) on which - * to execute the request. The format is: - * - * projects/[PROJECT_ID_OR_NUMBER] - * @param {string} request.query - * Required. The query in the [Monitoring Query - * Language](https://cloud.google.com/monitoring/mql/reference) format. - * The default time zone is in UTC. - * @param {number} request.pageSize - * A positive number that is the maximum number of time_series_data to return. - * @param {string} request.pageToken - * If this field is not empty then it must contain the `nextPageToken` value - * returned by a previous call to this method. Using this field causes the - * method to return additional results from the previous method call. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of {@link protos.google.monitoring.v3.TimeSeriesData|TimeSeriesData}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `queryTimeSeriesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @deprecated QueryTimeSeries is deprecated and may be removed in a future version. - */ + /** + * Queries time series by using Monitoring Query Language (MQL). We recommend + * using PromQL instead of MQL. For more information about the status of MQL, + * see the [MQL deprecation + * notice](https://cloud.google.com/stackdriver/docs/deprecations/mql). + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The + * [project](https://cloud.google.com/monitoring/api/v3#project_name) on which + * to execute the request. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER] + * @param {string} request.query + * Required. The query in the [Monitoring Query + * Language](https://cloud.google.com/monitoring/mql/reference) format. + * The default time zone is in UTC. + * @param {number} request.pageSize + * A positive number that is the maximum number of time_series_data to return. + * @param {string} request.pageToken + * If this field is not empty then it must contain the `nextPageToken` value + * returned by a previous call to this method. Using this field causes the + * method to return additional results from the previous method call. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of {@link protos.google.monitoring.v3.TimeSeriesData|TimeSeriesData}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `queryTimeSeriesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @deprecated QueryTimeSeries is deprecated and may be removed in a future version. + */ queryTimeSeries( - request?: protos.google.monitoring.v3.IQueryTimeSeriesRequest, - options?: CallOptions): - Promise<[ - protos.google.monitoring.v3.ITimeSeriesData[], - protos.google.monitoring.v3.IQueryTimeSeriesRequest|null, - protos.google.monitoring.v3.IQueryTimeSeriesResponse - ]>; + request?: protos.google.monitoring.v3.IQueryTimeSeriesRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.monitoring.v3.ITimeSeriesData[], + protos.google.monitoring.v3.IQueryTimeSeriesRequest | null, + protos.google.monitoring.v3.IQueryTimeSeriesResponse, + ] + >; queryTimeSeries( - request: protos.google.monitoring.v3.IQueryTimeSeriesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.monitoring.v3.IQueryTimeSeriesRequest, - protos.google.monitoring.v3.IQueryTimeSeriesResponse|null|undefined, - protos.google.monitoring.v3.ITimeSeriesData>): void; + request: protos.google.monitoring.v3.IQueryTimeSeriesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.monitoring.v3.IQueryTimeSeriesRequest, + protos.google.monitoring.v3.IQueryTimeSeriesResponse | null | undefined, + protos.google.monitoring.v3.ITimeSeriesData + >, + ): void; queryTimeSeries( - request: protos.google.monitoring.v3.IQueryTimeSeriesRequest, - callback: PaginationCallback< - protos.google.monitoring.v3.IQueryTimeSeriesRequest, - protos.google.monitoring.v3.IQueryTimeSeriesResponse|null|undefined, - protos.google.monitoring.v3.ITimeSeriesData>): void; + request: protos.google.monitoring.v3.IQueryTimeSeriesRequest, + callback: PaginationCallback< + protos.google.monitoring.v3.IQueryTimeSeriesRequest, + protos.google.monitoring.v3.IQueryTimeSeriesResponse | null | undefined, + protos.google.monitoring.v3.ITimeSeriesData + >, + ): void; queryTimeSeries( - request?: protos.google.monitoring.v3.IQueryTimeSeriesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.monitoring.v3.IQueryTimeSeriesRequest, - protos.google.monitoring.v3.IQueryTimeSeriesResponse|null|undefined, - protos.google.monitoring.v3.ITimeSeriesData>, - callback?: PaginationCallback< + request?: protos.google.monitoring.v3.IQueryTimeSeriesRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.monitoring.v3.IQueryTimeSeriesRequest, - protos.google.monitoring.v3.IQueryTimeSeriesResponse|null|undefined, - protos.google.monitoring.v3.ITimeSeriesData>): - Promise<[ - protos.google.monitoring.v3.ITimeSeriesData[], - protos.google.monitoring.v3.IQueryTimeSeriesRequest|null, - protos.google.monitoring.v3.IQueryTimeSeriesResponse - ]>|void { + | protos.google.monitoring.v3.IQueryTimeSeriesResponse + | null + | undefined, + protos.google.monitoring.v3.ITimeSeriesData + >, + callback?: PaginationCallback< + protos.google.monitoring.v3.IQueryTimeSeriesRequest, + protos.google.monitoring.v3.IQueryTimeSeriesResponse | null | undefined, + protos.google.monitoring.v3.ITimeSeriesData + >, + ): Promise< + [ + protos.google.monitoring.v3.ITimeSeriesData[], + protos.google.monitoring.v3.IQueryTimeSeriesRequest | null, + protos.google.monitoring.v3.IQueryTimeSeriesResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - this.warn('DEP$QueryService-$QueryTimeSeries','QueryTimeSeries is deprecated and may be removed in a future version.', 'DeprecationWarning'); - const wrappedCallback: PaginationCallback< - protos.google.monitoring.v3.IQueryTimeSeriesRequest, - protos.google.monitoring.v3.IQueryTimeSeriesResponse|null|undefined, - protos.google.monitoring.v3.ITimeSeriesData>|undefined = callback + this.warn( + 'DEP$QueryService-$QueryTimeSeries', + 'QueryTimeSeries is deprecated and may be removed in a future version.', + 'DeprecationWarning', + ); + const wrappedCallback: + | PaginationCallback< + protos.google.monitoring.v3.IQueryTimeSeriesRequest, + | protos.google.monitoring.v3.IQueryTimeSeriesResponse + | null + | undefined, + protos.google.monitoring.v3.ITimeSeriesData + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('queryTimeSeries values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -517,130 +594,142 @@ export class QueryServiceClient { this._log.info('queryTimeSeries request %j', request); return this.innerApiCalls .queryTimeSeries(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.monitoring.v3.ITimeSeriesData[], - protos.google.monitoring.v3.IQueryTimeSeriesRequest|null, - protos.google.monitoring.v3.IQueryTimeSeriesResponse - ]) => { - this._log.info('queryTimeSeries values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.monitoring.v3.ITimeSeriesData[], + protos.google.monitoring.v3.IQueryTimeSeriesRequest | null, + protos.google.monitoring.v3.IQueryTimeSeriesResponse, + ]) => { + this._log.info('queryTimeSeries values %j', response); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `queryTimeSeries`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The - * [project](https://cloud.google.com/monitoring/api/v3#project_name) on which - * to execute the request. The format is: - * - * projects/[PROJECT_ID_OR_NUMBER] - * @param {string} request.query - * Required. The query in the [Monitoring Query - * Language](https://cloud.google.com/monitoring/mql/reference) format. - * The default time zone is in UTC. - * @param {number} request.pageSize - * A positive number that is the maximum number of time_series_data to return. - * @param {string} request.pageToken - * If this field is not empty then it must contain the `nextPageToken` value - * returned by a previous call to this method. Using this field causes the - * method to return additional results from the previous method call. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.monitoring.v3.TimeSeriesData|TimeSeriesData} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `queryTimeSeriesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @deprecated QueryTimeSeries is deprecated and may be removed in a future version. - */ + /** + * Equivalent to `queryTimeSeries`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The + * [project](https://cloud.google.com/monitoring/api/v3#project_name) on which + * to execute the request. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER] + * @param {string} request.query + * Required. The query in the [Monitoring Query + * Language](https://cloud.google.com/monitoring/mql/reference) format. + * The default time zone is in UTC. + * @param {number} request.pageSize + * A positive number that is the maximum number of time_series_data to return. + * @param {string} request.pageToken + * If this field is not empty then it must contain the `nextPageToken` value + * returned by a previous call to this method. Using this field causes the + * method to return additional results from the previous method call. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.monitoring.v3.TimeSeriesData|TimeSeriesData} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `queryTimeSeriesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @deprecated QueryTimeSeries is deprecated and may be removed in a future version. + */ queryTimeSeriesStream( - request?: protos.google.monitoring.v3.IQueryTimeSeriesRequest, - options?: CallOptions): - Transform{ + request?: protos.google.monitoring.v3.IQueryTimeSeriesRequest, + options?: CallOptions, + ): Transform { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); const defaultCallSettings = this._defaults['queryTimeSeries']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this.warn('DEP$QueryService-$QueryTimeSeries','QueryTimeSeries is deprecated and may be removed in a future version.', 'DeprecationWarning'); + this.initialize().catch((err) => { + throw err; + }); + this.warn( + 'DEP$QueryService-$QueryTimeSeries', + 'QueryTimeSeries is deprecated and may be removed in a future version.', + 'DeprecationWarning', + ); this._log.info('queryTimeSeries stream %j', request); return this.descriptors.page.queryTimeSeries.createStream( this.innerApiCalls.queryTimeSeries as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `queryTimeSeries`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The - * [project](https://cloud.google.com/monitoring/api/v3#project_name) on which - * to execute the request. The format is: - * - * projects/[PROJECT_ID_OR_NUMBER] - * @param {string} request.query - * Required. The query in the [Monitoring Query - * Language](https://cloud.google.com/monitoring/mql/reference) format. - * The default time zone is in UTC. - * @param {number} request.pageSize - * A positive number that is the maximum number of time_series_data to return. - * @param {string} request.pageToken - * If this field is not empty then it must contain the `nextPageToken` value - * returned by a previous call to this method. Using this field causes the - * method to return additional results from the previous method call. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.monitoring.v3.TimeSeriesData|TimeSeriesData}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v3/query_service.query_time_series.js - * region_tag:monitoring_v3_generated_QueryService_QueryTimeSeries_async - * @deprecated QueryTimeSeries is deprecated and may be removed in a future version. - */ + /** + * Equivalent to `queryTimeSeries`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The + * [project](https://cloud.google.com/monitoring/api/v3#project_name) on which + * to execute the request. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER] + * @param {string} request.query + * Required. The query in the [Monitoring Query + * Language](https://cloud.google.com/monitoring/mql/reference) format. + * The default time zone is in UTC. + * @param {number} request.pageSize + * A positive number that is the maximum number of time_series_data to return. + * @param {string} request.pageToken + * If this field is not empty then it must contain the `nextPageToken` value + * returned by a previous call to this method. Using this field causes the + * method to return additional results from the previous method call. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.monitoring.v3.TimeSeriesData|TimeSeriesData}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v3/query_service.query_time_series.js + * region_tag:monitoring_v3_generated_QueryService_QueryTimeSeries_async + * @deprecated QueryTimeSeries is deprecated and may be removed in a future version. + */ queryTimeSeriesAsync( - request?: protos.google.monitoring.v3.IQueryTimeSeriesRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.monitoring.v3.IQueryTimeSeriesRequest, + options?: CallOptions, + ): AsyncIterable { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); const defaultCallSettings = this._defaults['queryTimeSeries']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this.warn('DEP$QueryService-$QueryTimeSeries','QueryTimeSeries is deprecated and may be removed in a future version.', 'DeprecationWarning'); + this.initialize().catch((err) => { + throw err; + }); + this.warn( + 'DEP$QueryService-$QueryTimeSeries', + 'QueryTimeSeries is deprecated and may be removed in a future version.', + 'DeprecationWarning', + ); this._log.info('queryTimeSeries iterate %j', request); return this.descriptors.page.queryTimeSeries.asyncIterate( this.innerApiCalls['queryTimeSeries'] as GaxCall, request as {}, - callSettings + callSettings, ) as AsyncIterable; } // -------------------- @@ -654,7 +743,7 @@ export class QueryServiceClient { * @param {string} alert_policy * @returns {string} Resource name string. */ - folderAlertPolicyPath(folder:string,alertPolicy:string) { + folderAlertPolicyPath(folder: string, alertPolicy: string) { return this.pathTemplates.folderAlertPolicyPathTemplate.render({ folder: folder, alert_policy: alertPolicy, @@ -669,7 +758,9 @@ export class QueryServiceClient { * @returns {string} A string representing the folder. */ matchFolderFromFolderAlertPolicyName(folderAlertPolicyName: string) { - return this.pathTemplates.folderAlertPolicyPathTemplate.match(folderAlertPolicyName).folder; + return this.pathTemplates.folderAlertPolicyPathTemplate.match( + folderAlertPolicyName, + ).folder; } /** @@ -680,7 +771,9 @@ export class QueryServiceClient { * @returns {string} A string representing the alert_policy. */ matchAlertPolicyFromFolderAlertPolicyName(folderAlertPolicyName: string) { - return this.pathTemplates.folderAlertPolicyPathTemplate.match(folderAlertPolicyName).alert_policy; + return this.pathTemplates.folderAlertPolicyPathTemplate.match( + folderAlertPolicyName, + ).alert_policy; } /** @@ -691,7 +784,11 @@ export class QueryServiceClient { * @param {string} condition * @returns {string} Resource name string. */ - folderAlertPolicyConditionPath(folder:string,alertPolicy:string,condition:string) { + folderAlertPolicyConditionPath( + folder: string, + alertPolicy: string, + condition: string, + ) { return this.pathTemplates.folderAlertPolicyConditionPathTemplate.render({ folder: folder, alert_policy: alertPolicy, @@ -706,8 +803,12 @@ export class QueryServiceClient { * A fully-qualified path representing folder_alert_policy_condition resource. * @returns {string} A string representing the folder. */ - matchFolderFromFolderAlertPolicyConditionName(folderAlertPolicyConditionName: string) { - return this.pathTemplates.folderAlertPolicyConditionPathTemplate.match(folderAlertPolicyConditionName).folder; + matchFolderFromFolderAlertPolicyConditionName( + folderAlertPolicyConditionName: string, + ) { + return this.pathTemplates.folderAlertPolicyConditionPathTemplate.match( + folderAlertPolicyConditionName, + ).folder; } /** @@ -717,8 +818,12 @@ export class QueryServiceClient { * A fully-qualified path representing folder_alert_policy_condition resource. * @returns {string} A string representing the alert_policy. */ - matchAlertPolicyFromFolderAlertPolicyConditionName(folderAlertPolicyConditionName: string) { - return this.pathTemplates.folderAlertPolicyConditionPathTemplate.match(folderAlertPolicyConditionName).alert_policy; + matchAlertPolicyFromFolderAlertPolicyConditionName( + folderAlertPolicyConditionName: string, + ) { + return this.pathTemplates.folderAlertPolicyConditionPathTemplate.match( + folderAlertPolicyConditionName, + ).alert_policy; } /** @@ -728,8 +833,12 @@ export class QueryServiceClient { * A fully-qualified path representing folder_alert_policy_condition resource. * @returns {string} A string representing the condition. */ - matchConditionFromFolderAlertPolicyConditionName(folderAlertPolicyConditionName: string) { - return this.pathTemplates.folderAlertPolicyConditionPathTemplate.match(folderAlertPolicyConditionName).condition; + matchConditionFromFolderAlertPolicyConditionName( + folderAlertPolicyConditionName: string, + ) { + return this.pathTemplates.folderAlertPolicyConditionPathTemplate.match( + folderAlertPolicyConditionName, + ).condition; } /** @@ -739,7 +848,7 @@ export class QueryServiceClient { * @param {string} channel_descriptor * @returns {string} Resource name string. */ - folderChannelDescriptorPath(folder:string,channelDescriptor:string) { + folderChannelDescriptorPath(folder: string, channelDescriptor: string) { return this.pathTemplates.folderChannelDescriptorPathTemplate.render({ folder: folder, channel_descriptor: channelDescriptor, @@ -753,8 +862,12 @@ export class QueryServiceClient { * A fully-qualified path representing folder_channel_descriptor resource. * @returns {string} A string representing the folder. */ - matchFolderFromFolderChannelDescriptorName(folderChannelDescriptorName: string) { - return this.pathTemplates.folderChannelDescriptorPathTemplate.match(folderChannelDescriptorName).folder; + matchFolderFromFolderChannelDescriptorName( + folderChannelDescriptorName: string, + ) { + return this.pathTemplates.folderChannelDescriptorPathTemplate.match( + folderChannelDescriptorName, + ).folder; } /** @@ -764,8 +877,12 @@ export class QueryServiceClient { * A fully-qualified path representing folder_channel_descriptor resource. * @returns {string} A string representing the channel_descriptor. */ - matchChannelDescriptorFromFolderChannelDescriptorName(folderChannelDescriptorName: string) { - return this.pathTemplates.folderChannelDescriptorPathTemplate.match(folderChannelDescriptorName).channel_descriptor; + matchChannelDescriptorFromFolderChannelDescriptorName( + folderChannelDescriptorName: string, + ) { + return this.pathTemplates.folderChannelDescriptorPathTemplate.match( + folderChannelDescriptorName, + ).channel_descriptor; } /** @@ -775,7 +892,7 @@ export class QueryServiceClient { * @param {string} group * @returns {string} Resource name string. */ - folderGroupPath(folder:string,group:string) { + folderGroupPath(folder: string, group: string) { return this.pathTemplates.folderGroupPathTemplate.render({ folder: folder, group: group, @@ -790,7 +907,8 @@ export class QueryServiceClient { * @returns {string} A string representing the folder. */ matchFolderFromFolderGroupName(folderGroupName: string) { - return this.pathTemplates.folderGroupPathTemplate.match(folderGroupName).folder; + return this.pathTemplates.folderGroupPathTemplate.match(folderGroupName) + .folder; } /** @@ -801,7 +919,8 @@ export class QueryServiceClient { * @returns {string} A string representing the group. */ matchGroupFromFolderGroupName(folderGroupName: string) { - return this.pathTemplates.folderGroupPathTemplate.match(folderGroupName).group; + return this.pathTemplates.folderGroupPathTemplate.match(folderGroupName) + .group; } /** @@ -811,7 +930,7 @@ export class QueryServiceClient { * @param {string} notification_channel * @returns {string} Resource name string. */ - folderNotificationChannelPath(folder:string,notificationChannel:string) { + folderNotificationChannelPath(folder: string, notificationChannel: string) { return this.pathTemplates.folderNotificationChannelPathTemplate.render({ folder: folder, notification_channel: notificationChannel, @@ -825,8 +944,12 @@ export class QueryServiceClient { * A fully-qualified path representing folder_notification_channel resource. * @returns {string} A string representing the folder. */ - matchFolderFromFolderNotificationChannelName(folderNotificationChannelName: string) { - return this.pathTemplates.folderNotificationChannelPathTemplate.match(folderNotificationChannelName).folder; + matchFolderFromFolderNotificationChannelName( + folderNotificationChannelName: string, + ) { + return this.pathTemplates.folderNotificationChannelPathTemplate.match( + folderNotificationChannelName, + ).folder; } /** @@ -836,8 +959,12 @@ export class QueryServiceClient { * A fully-qualified path representing folder_notification_channel resource. * @returns {string} A string representing the notification_channel. */ - matchNotificationChannelFromFolderNotificationChannelName(folderNotificationChannelName: string) { - return this.pathTemplates.folderNotificationChannelPathTemplate.match(folderNotificationChannelName).notification_channel; + matchNotificationChannelFromFolderNotificationChannelName( + folderNotificationChannelName: string, + ) { + return this.pathTemplates.folderNotificationChannelPathTemplate.match( + folderNotificationChannelName, + ).notification_channel; } /** @@ -847,7 +974,7 @@ export class QueryServiceClient { * @param {string} service * @returns {string} Resource name string. */ - folderServicePath(folder:string,service:string) { + folderServicePath(folder: string, service: string) { return this.pathTemplates.folderServicePathTemplate.render({ folder: folder, service: service, @@ -862,7 +989,8 @@ export class QueryServiceClient { * @returns {string} A string representing the folder. */ matchFolderFromFolderServiceName(folderServiceName: string) { - return this.pathTemplates.folderServicePathTemplate.match(folderServiceName).folder; + return this.pathTemplates.folderServicePathTemplate.match(folderServiceName) + .folder; } /** @@ -873,7 +1001,8 @@ export class QueryServiceClient { * @returns {string} A string representing the service. */ matchServiceFromFolderServiceName(folderServiceName: string) { - return this.pathTemplates.folderServicePathTemplate.match(folderServiceName).service; + return this.pathTemplates.folderServicePathTemplate.match(folderServiceName) + .service; } /** @@ -884,12 +1013,18 @@ export class QueryServiceClient { * @param {string} service_level_objective * @returns {string} Resource name string. */ - folderServiceServiceLevelObjectivePath(folder:string,service:string,serviceLevelObjective:string) { - return this.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.render({ - folder: folder, - service: service, - service_level_objective: serviceLevelObjective, - }); + folderServiceServiceLevelObjectivePath( + folder: string, + service: string, + serviceLevelObjective: string, + ) { + return this.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.render( + { + folder: folder, + service: service, + service_level_objective: serviceLevelObjective, + }, + ); } /** @@ -899,8 +1034,12 @@ export class QueryServiceClient { * A fully-qualified path representing folder_service_service_level_objective resource. * @returns {string} A string representing the folder. */ - matchFolderFromFolderServiceServiceLevelObjectiveName(folderServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match(folderServiceServiceLevelObjectiveName).folder; + matchFolderFromFolderServiceServiceLevelObjectiveName( + folderServiceServiceLevelObjectiveName: string, + ) { + return this.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match( + folderServiceServiceLevelObjectiveName, + ).folder; } /** @@ -910,8 +1049,12 @@ export class QueryServiceClient { * A fully-qualified path representing folder_service_service_level_objective resource. * @returns {string} A string representing the service. */ - matchServiceFromFolderServiceServiceLevelObjectiveName(folderServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match(folderServiceServiceLevelObjectiveName).service; + matchServiceFromFolderServiceServiceLevelObjectiveName( + folderServiceServiceLevelObjectiveName: string, + ) { + return this.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match( + folderServiceServiceLevelObjectiveName, + ).service; } /** @@ -921,8 +1064,12 @@ export class QueryServiceClient { * A fully-qualified path representing folder_service_service_level_objective resource. * @returns {string} A string representing the service_level_objective. */ - matchServiceLevelObjectiveFromFolderServiceServiceLevelObjectiveName(folderServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match(folderServiceServiceLevelObjectiveName).service_level_objective; + matchServiceLevelObjectiveFromFolderServiceServiceLevelObjectiveName( + folderServiceServiceLevelObjectiveName: string, + ) { + return this.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match( + folderServiceServiceLevelObjectiveName, + ).service_level_objective; } /** @@ -932,7 +1079,7 @@ export class QueryServiceClient { * @param {string} uptime_check_config * @returns {string} Resource name string. */ - folderUptimeCheckConfigPath(folder:string,uptimeCheckConfig:string) { + folderUptimeCheckConfigPath(folder: string, uptimeCheckConfig: string) { return this.pathTemplates.folderUptimeCheckConfigPathTemplate.render({ folder: folder, uptime_check_config: uptimeCheckConfig, @@ -946,8 +1093,12 @@ export class QueryServiceClient { * A fully-qualified path representing folder_uptime_check_config resource. * @returns {string} A string representing the folder. */ - matchFolderFromFolderUptimeCheckConfigName(folderUptimeCheckConfigName: string) { - return this.pathTemplates.folderUptimeCheckConfigPathTemplate.match(folderUptimeCheckConfigName).folder; + matchFolderFromFolderUptimeCheckConfigName( + folderUptimeCheckConfigName: string, + ) { + return this.pathTemplates.folderUptimeCheckConfigPathTemplate.match( + folderUptimeCheckConfigName, + ).folder; } /** @@ -957,8 +1108,12 @@ export class QueryServiceClient { * A fully-qualified path representing folder_uptime_check_config resource. * @returns {string} A string representing the uptime_check_config. */ - matchUptimeCheckConfigFromFolderUptimeCheckConfigName(folderUptimeCheckConfigName: string) { - return this.pathTemplates.folderUptimeCheckConfigPathTemplate.match(folderUptimeCheckConfigName).uptime_check_config; + matchUptimeCheckConfigFromFolderUptimeCheckConfigName( + folderUptimeCheckConfigName: string, + ) { + return this.pathTemplates.folderUptimeCheckConfigPathTemplate.match( + folderUptimeCheckConfigName, + ).uptime_check_config; } /** @@ -968,7 +1123,7 @@ export class QueryServiceClient { * @param {string} alert_policy * @returns {string} Resource name string. */ - organizationAlertPolicyPath(organization:string,alertPolicy:string) { + organizationAlertPolicyPath(organization: string, alertPolicy: string) { return this.pathTemplates.organizationAlertPolicyPathTemplate.render({ organization: organization, alert_policy: alertPolicy, @@ -982,8 +1137,12 @@ export class QueryServiceClient { * A fully-qualified path representing organization_alert_policy resource. * @returns {string} A string representing the organization. */ - matchOrganizationFromOrganizationAlertPolicyName(organizationAlertPolicyName: string) { - return this.pathTemplates.organizationAlertPolicyPathTemplate.match(organizationAlertPolicyName).organization; + matchOrganizationFromOrganizationAlertPolicyName( + organizationAlertPolicyName: string, + ) { + return this.pathTemplates.organizationAlertPolicyPathTemplate.match( + organizationAlertPolicyName, + ).organization; } /** @@ -993,8 +1152,12 @@ export class QueryServiceClient { * A fully-qualified path representing organization_alert_policy resource. * @returns {string} A string representing the alert_policy. */ - matchAlertPolicyFromOrganizationAlertPolicyName(organizationAlertPolicyName: string) { - return this.pathTemplates.organizationAlertPolicyPathTemplate.match(organizationAlertPolicyName).alert_policy; + matchAlertPolicyFromOrganizationAlertPolicyName( + organizationAlertPolicyName: string, + ) { + return this.pathTemplates.organizationAlertPolicyPathTemplate.match( + organizationAlertPolicyName, + ).alert_policy; } /** @@ -1005,12 +1168,18 @@ export class QueryServiceClient { * @param {string} condition * @returns {string} Resource name string. */ - organizationAlertPolicyConditionPath(organization:string,alertPolicy:string,condition:string) { - return this.pathTemplates.organizationAlertPolicyConditionPathTemplate.render({ - organization: organization, - alert_policy: alertPolicy, - condition: condition, - }); + organizationAlertPolicyConditionPath( + organization: string, + alertPolicy: string, + condition: string, + ) { + return this.pathTemplates.organizationAlertPolicyConditionPathTemplate.render( + { + organization: organization, + alert_policy: alertPolicy, + condition: condition, + }, + ); } /** @@ -1020,8 +1189,12 @@ export class QueryServiceClient { * A fully-qualified path representing organization_alert_policy_condition resource. * @returns {string} A string representing the organization. */ - matchOrganizationFromOrganizationAlertPolicyConditionName(organizationAlertPolicyConditionName: string) { - return this.pathTemplates.organizationAlertPolicyConditionPathTemplate.match(organizationAlertPolicyConditionName).organization; + matchOrganizationFromOrganizationAlertPolicyConditionName( + organizationAlertPolicyConditionName: string, + ) { + return this.pathTemplates.organizationAlertPolicyConditionPathTemplate.match( + organizationAlertPolicyConditionName, + ).organization; } /** @@ -1031,8 +1204,12 @@ export class QueryServiceClient { * A fully-qualified path representing organization_alert_policy_condition resource. * @returns {string} A string representing the alert_policy. */ - matchAlertPolicyFromOrganizationAlertPolicyConditionName(organizationAlertPolicyConditionName: string) { - return this.pathTemplates.organizationAlertPolicyConditionPathTemplate.match(organizationAlertPolicyConditionName).alert_policy; + matchAlertPolicyFromOrganizationAlertPolicyConditionName( + organizationAlertPolicyConditionName: string, + ) { + return this.pathTemplates.organizationAlertPolicyConditionPathTemplate.match( + organizationAlertPolicyConditionName, + ).alert_policy; } /** @@ -1042,8 +1219,12 @@ export class QueryServiceClient { * A fully-qualified path representing organization_alert_policy_condition resource. * @returns {string} A string representing the condition. */ - matchConditionFromOrganizationAlertPolicyConditionName(organizationAlertPolicyConditionName: string) { - return this.pathTemplates.organizationAlertPolicyConditionPathTemplate.match(organizationAlertPolicyConditionName).condition; + matchConditionFromOrganizationAlertPolicyConditionName( + organizationAlertPolicyConditionName: string, + ) { + return this.pathTemplates.organizationAlertPolicyConditionPathTemplate.match( + organizationAlertPolicyConditionName, + ).condition; } /** @@ -1053,7 +1234,10 @@ export class QueryServiceClient { * @param {string} channel_descriptor * @returns {string} Resource name string. */ - organizationChannelDescriptorPath(organization:string,channelDescriptor:string) { + organizationChannelDescriptorPath( + organization: string, + channelDescriptor: string, + ) { return this.pathTemplates.organizationChannelDescriptorPathTemplate.render({ organization: organization, channel_descriptor: channelDescriptor, @@ -1067,8 +1251,12 @@ export class QueryServiceClient { * A fully-qualified path representing organization_channel_descriptor resource. * @returns {string} A string representing the organization. */ - matchOrganizationFromOrganizationChannelDescriptorName(organizationChannelDescriptorName: string) { - return this.pathTemplates.organizationChannelDescriptorPathTemplate.match(organizationChannelDescriptorName).organization; + matchOrganizationFromOrganizationChannelDescriptorName( + organizationChannelDescriptorName: string, + ) { + return this.pathTemplates.organizationChannelDescriptorPathTemplate.match( + organizationChannelDescriptorName, + ).organization; } /** @@ -1078,8 +1266,12 @@ export class QueryServiceClient { * A fully-qualified path representing organization_channel_descriptor resource. * @returns {string} A string representing the channel_descriptor. */ - matchChannelDescriptorFromOrganizationChannelDescriptorName(organizationChannelDescriptorName: string) { - return this.pathTemplates.organizationChannelDescriptorPathTemplate.match(organizationChannelDescriptorName).channel_descriptor; + matchChannelDescriptorFromOrganizationChannelDescriptorName( + organizationChannelDescriptorName: string, + ) { + return this.pathTemplates.organizationChannelDescriptorPathTemplate.match( + organizationChannelDescriptorName, + ).channel_descriptor; } /** @@ -1089,7 +1281,7 @@ export class QueryServiceClient { * @param {string} group * @returns {string} Resource name string. */ - organizationGroupPath(organization:string,group:string) { + organizationGroupPath(organization: string, group: string) { return this.pathTemplates.organizationGroupPathTemplate.render({ organization: organization, group: group, @@ -1104,7 +1296,9 @@ export class QueryServiceClient { * @returns {string} A string representing the organization. */ matchOrganizationFromOrganizationGroupName(organizationGroupName: string) { - return this.pathTemplates.organizationGroupPathTemplate.match(organizationGroupName).organization; + return this.pathTemplates.organizationGroupPathTemplate.match( + organizationGroupName, + ).organization; } /** @@ -1115,7 +1309,9 @@ export class QueryServiceClient { * @returns {string} A string representing the group. */ matchGroupFromOrganizationGroupName(organizationGroupName: string) { - return this.pathTemplates.organizationGroupPathTemplate.match(organizationGroupName).group; + return this.pathTemplates.organizationGroupPathTemplate.match( + organizationGroupName, + ).group; } /** @@ -1125,11 +1321,16 @@ export class QueryServiceClient { * @param {string} notification_channel * @returns {string} Resource name string. */ - organizationNotificationChannelPath(organization:string,notificationChannel:string) { - return this.pathTemplates.organizationNotificationChannelPathTemplate.render({ - organization: organization, - notification_channel: notificationChannel, - }); + organizationNotificationChannelPath( + organization: string, + notificationChannel: string, + ) { + return this.pathTemplates.organizationNotificationChannelPathTemplate.render( + { + organization: organization, + notification_channel: notificationChannel, + }, + ); } /** @@ -1139,8 +1340,12 @@ export class QueryServiceClient { * A fully-qualified path representing organization_notification_channel resource. * @returns {string} A string representing the organization. */ - matchOrganizationFromOrganizationNotificationChannelName(organizationNotificationChannelName: string) { - return this.pathTemplates.organizationNotificationChannelPathTemplate.match(organizationNotificationChannelName).organization; + matchOrganizationFromOrganizationNotificationChannelName( + organizationNotificationChannelName: string, + ) { + return this.pathTemplates.organizationNotificationChannelPathTemplate.match( + organizationNotificationChannelName, + ).organization; } /** @@ -1150,8 +1355,12 @@ export class QueryServiceClient { * A fully-qualified path representing organization_notification_channel resource. * @returns {string} A string representing the notification_channel. */ - matchNotificationChannelFromOrganizationNotificationChannelName(organizationNotificationChannelName: string) { - return this.pathTemplates.organizationNotificationChannelPathTemplate.match(organizationNotificationChannelName).notification_channel; + matchNotificationChannelFromOrganizationNotificationChannelName( + organizationNotificationChannelName: string, + ) { + return this.pathTemplates.organizationNotificationChannelPathTemplate.match( + organizationNotificationChannelName, + ).notification_channel; } /** @@ -1161,7 +1370,7 @@ export class QueryServiceClient { * @param {string} service * @returns {string} Resource name string. */ - organizationServicePath(organization:string,service:string) { + organizationServicePath(organization: string, service: string) { return this.pathTemplates.organizationServicePathTemplate.render({ organization: organization, service: service, @@ -1175,8 +1384,12 @@ export class QueryServiceClient { * A fully-qualified path representing organization_service resource. * @returns {string} A string representing the organization. */ - matchOrganizationFromOrganizationServiceName(organizationServiceName: string) { - return this.pathTemplates.organizationServicePathTemplate.match(organizationServiceName).organization; + matchOrganizationFromOrganizationServiceName( + organizationServiceName: string, + ) { + return this.pathTemplates.organizationServicePathTemplate.match( + organizationServiceName, + ).organization; } /** @@ -1187,7 +1400,9 @@ export class QueryServiceClient { * @returns {string} A string representing the service. */ matchServiceFromOrganizationServiceName(organizationServiceName: string) { - return this.pathTemplates.organizationServicePathTemplate.match(organizationServiceName).service; + return this.pathTemplates.organizationServicePathTemplate.match( + organizationServiceName, + ).service; } /** @@ -1198,12 +1413,18 @@ export class QueryServiceClient { * @param {string} service_level_objective * @returns {string} Resource name string. */ - organizationServiceServiceLevelObjectivePath(organization:string,service:string,serviceLevelObjective:string) { - return this.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.render({ - organization: organization, - service: service, - service_level_objective: serviceLevelObjective, - }); + organizationServiceServiceLevelObjectivePath( + organization: string, + service: string, + serviceLevelObjective: string, + ) { + return this.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.render( + { + organization: organization, + service: service, + service_level_objective: serviceLevelObjective, + }, + ); } /** @@ -1213,8 +1434,12 @@ export class QueryServiceClient { * A fully-qualified path representing organization_service_service_level_objective resource. * @returns {string} A string representing the organization. */ - matchOrganizationFromOrganizationServiceServiceLevelObjectiveName(organizationServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match(organizationServiceServiceLevelObjectiveName).organization; + matchOrganizationFromOrganizationServiceServiceLevelObjectiveName( + organizationServiceServiceLevelObjectiveName: string, + ) { + return this.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match( + organizationServiceServiceLevelObjectiveName, + ).organization; } /** @@ -1224,8 +1449,12 @@ export class QueryServiceClient { * A fully-qualified path representing organization_service_service_level_objective resource. * @returns {string} A string representing the service. */ - matchServiceFromOrganizationServiceServiceLevelObjectiveName(organizationServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match(organizationServiceServiceLevelObjectiveName).service; + matchServiceFromOrganizationServiceServiceLevelObjectiveName( + organizationServiceServiceLevelObjectiveName: string, + ) { + return this.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match( + organizationServiceServiceLevelObjectiveName, + ).service; } /** @@ -1235,8 +1464,12 @@ export class QueryServiceClient { * A fully-qualified path representing organization_service_service_level_objective resource. * @returns {string} A string representing the service_level_objective. */ - matchServiceLevelObjectiveFromOrganizationServiceServiceLevelObjectiveName(organizationServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match(organizationServiceServiceLevelObjectiveName).service_level_objective; + matchServiceLevelObjectiveFromOrganizationServiceServiceLevelObjectiveName( + organizationServiceServiceLevelObjectiveName: string, + ) { + return this.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match( + organizationServiceServiceLevelObjectiveName, + ).service_level_objective; } /** @@ -1246,7 +1479,10 @@ export class QueryServiceClient { * @param {string} uptime_check_config * @returns {string} Resource name string. */ - organizationUptimeCheckConfigPath(organization:string,uptimeCheckConfig:string) { + organizationUptimeCheckConfigPath( + organization: string, + uptimeCheckConfig: string, + ) { return this.pathTemplates.organizationUptimeCheckConfigPathTemplate.render({ organization: organization, uptime_check_config: uptimeCheckConfig, @@ -1260,8 +1496,12 @@ export class QueryServiceClient { * A fully-qualified path representing organization_uptime_check_config resource. * @returns {string} A string representing the organization. */ - matchOrganizationFromOrganizationUptimeCheckConfigName(organizationUptimeCheckConfigName: string) { - return this.pathTemplates.organizationUptimeCheckConfigPathTemplate.match(organizationUptimeCheckConfigName).organization; + matchOrganizationFromOrganizationUptimeCheckConfigName( + organizationUptimeCheckConfigName: string, + ) { + return this.pathTemplates.organizationUptimeCheckConfigPathTemplate.match( + organizationUptimeCheckConfigName, + ).organization; } /** @@ -1271,8 +1511,12 @@ export class QueryServiceClient { * A fully-qualified path representing organization_uptime_check_config resource. * @returns {string} A string representing the uptime_check_config. */ - matchUptimeCheckConfigFromOrganizationUptimeCheckConfigName(organizationUptimeCheckConfigName: string) { - return this.pathTemplates.organizationUptimeCheckConfigPathTemplate.match(organizationUptimeCheckConfigName).uptime_check_config; + matchUptimeCheckConfigFromOrganizationUptimeCheckConfigName( + organizationUptimeCheckConfigName: string, + ) { + return this.pathTemplates.organizationUptimeCheckConfigPathTemplate.match( + organizationUptimeCheckConfigName, + ).uptime_check_config; } /** @@ -1282,7 +1526,7 @@ export class QueryServiceClient { * @param {string} alert_policy * @returns {string} Resource name string. */ - projectAlertPolicyPath(project:string,alertPolicy:string) { + projectAlertPolicyPath(project: string, alertPolicy: string) { return this.pathTemplates.projectAlertPolicyPathTemplate.render({ project: project, alert_policy: alertPolicy, @@ -1297,7 +1541,9 @@ export class QueryServiceClient { * @returns {string} A string representing the project. */ matchProjectFromProjectAlertPolicyName(projectAlertPolicyName: string) { - return this.pathTemplates.projectAlertPolicyPathTemplate.match(projectAlertPolicyName).project; + return this.pathTemplates.projectAlertPolicyPathTemplate.match( + projectAlertPolicyName, + ).project; } /** @@ -1308,7 +1554,9 @@ export class QueryServiceClient { * @returns {string} A string representing the alert_policy. */ matchAlertPolicyFromProjectAlertPolicyName(projectAlertPolicyName: string) { - return this.pathTemplates.projectAlertPolicyPathTemplate.match(projectAlertPolicyName).alert_policy; + return this.pathTemplates.projectAlertPolicyPathTemplate.match( + projectAlertPolicyName, + ).alert_policy; } /** @@ -1319,7 +1567,11 @@ export class QueryServiceClient { * @param {string} condition * @returns {string} Resource name string. */ - projectAlertPolicyConditionPath(project:string,alertPolicy:string,condition:string) { + projectAlertPolicyConditionPath( + project: string, + alertPolicy: string, + condition: string, + ) { return this.pathTemplates.projectAlertPolicyConditionPathTemplate.render({ project: project, alert_policy: alertPolicy, @@ -1334,8 +1586,12 @@ export class QueryServiceClient { * A fully-qualified path representing project_alert_policy_condition resource. * @returns {string} A string representing the project. */ - matchProjectFromProjectAlertPolicyConditionName(projectAlertPolicyConditionName: string) { - return this.pathTemplates.projectAlertPolicyConditionPathTemplate.match(projectAlertPolicyConditionName).project; + matchProjectFromProjectAlertPolicyConditionName( + projectAlertPolicyConditionName: string, + ) { + return this.pathTemplates.projectAlertPolicyConditionPathTemplate.match( + projectAlertPolicyConditionName, + ).project; } /** @@ -1345,8 +1601,12 @@ export class QueryServiceClient { * A fully-qualified path representing project_alert_policy_condition resource. * @returns {string} A string representing the alert_policy. */ - matchAlertPolicyFromProjectAlertPolicyConditionName(projectAlertPolicyConditionName: string) { - return this.pathTemplates.projectAlertPolicyConditionPathTemplate.match(projectAlertPolicyConditionName).alert_policy; + matchAlertPolicyFromProjectAlertPolicyConditionName( + projectAlertPolicyConditionName: string, + ) { + return this.pathTemplates.projectAlertPolicyConditionPathTemplate.match( + projectAlertPolicyConditionName, + ).alert_policy; } /** @@ -1356,8 +1616,12 @@ export class QueryServiceClient { * A fully-qualified path representing project_alert_policy_condition resource. * @returns {string} A string representing the condition. */ - matchConditionFromProjectAlertPolicyConditionName(projectAlertPolicyConditionName: string) { - return this.pathTemplates.projectAlertPolicyConditionPathTemplate.match(projectAlertPolicyConditionName).condition; + matchConditionFromProjectAlertPolicyConditionName( + projectAlertPolicyConditionName: string, + ) { + return this.pathTemplates.projectAlertPolicyConditionPathTemplate.match( + projectAlertPolicyConditionName, + ).condition; } /** @@ -1367,7 +1631,7 @@ export class QueryServiceClient { * @param {string} channel_descriptor * @returns {string} Resource name string. */ - projectChannelDescriptorPath(project:string,channelDescriptor:string) { + projectChannelDescriptorPath(project: string, channelDescriptor: string) { return this.pathTemplates.projectChannelDescriptorPathTemplate.render({ project: project, channel_descriptor: channelDescriptor, @@ -1381,8 +1645,12 @@ export class QueryServiceClient { * A fully-qualified path representing project_channel_descriptor resource. * @returns {string} A string representing the project. */ - matchProjectFromProjectChannelDescriptorName(projectChannelDescriptorName: string) { - return this.pathTemplates.projectChannelDescriptorPathTemplate.match(projectChannelDescriptorName).project; + matchProjectFromProjectChannelDescriptorName( + projectChannelDescriptorName: string, + ) { + return this.pathTemplates.projectChannelDescriptorPathTemplate.match( + projectChannelDescriptorName, + ).project; } /** @@ -1392,8 +1660,12 @@ export class QueryServiceClient { * A fully-qualified path representing project_channel_descriptor resource. * @returns {string} A string representing the channel_descriptor. */ - matchChannelDescriptorFromProjectChannelDescriptorName(projectChannelDescriptorName: string) { - return this.pathTemplates.projectChannelDescriptorPathTemplate.match(projectChannelDescriptorName).channel_descriptor; + matchChannelDescriptorFromProjectChannelDescriptorName( + projectChannelDescriptorName: string, + ) { + return this.pathTemplates.projectChannelDescriptorPathTemplate.match( + projectChannelDescriptorName, + ).channel_descriptor; } /** @@ -1403,7 +1675,7 @@ export class QueryServiceClient { * @param {string} group * @returns {string} Resource name string. */ - projectGroupPath(project:string,group:string) { + projectGroupPath(project: string, group: string) { return this.pathTemplates.projectGroupPathTemplate.render({ project: project, group: group, @@ -1418,7 +1690,8 @@ export class QueryServiceClient { * @returns {string} A string representing the project. */ matchProjectFromProjectGroupName(projectGroupName: string) { - return this.pathTemplates.projectGroupPathTemplate.match(projectGroupName).project; + return this.pathTemplates.projectGroupPathTemplate.match(projectGroupName) + .project; } /** @@ -1429,7 +1702,8 @@ export class QueryServiceClient { * @returns {string} A string representing the group. */ matchGroupFromProjectGroupName(projectGroupName: string) { - return this.pathTemplates.projectGroupPathTemplate.match(projectGroupName).group; + return this.pathTemplates.projectGroupPathTemplate.match(projectGroupName) + .group; } /** @@ -1439,7 +1713,7 @@ export class QueryServiceClient { * @param {string} notification_channel * @returns {string} Resource name string. */ - projectNotificationChannelPath(project:string,notificationChannel:string) { + projectNotificationChannelPath(project: string, notificationChannel: string) { return this.pathTemplates.projectNotificationChannelPathTemplate.render({ project: project, notification_channel: notificationChannel, @@ -1453,8 +1727,12 @@ export class QueryServiceClient { * A fully-qualified path representing project_notification_channel resource. * @returns {string} A string representing the project. */ - matchProjectFromProjectNotificationChannelName(projectNotificationChannelName: string) { - return this.pathTemplates.projectNotificationChannelPathTemplate.match(projectNotificationChannelName).project; + matchProjectFromProjectNotificationChannelName( + projectNotificationChannelName: string, + ) { + return this.pathTemplates.projectNotificationChannelPathTemplate.match( + projectNotificationChannelName, + ).project; } /** @@ -1464,8 +1742,12 @@ export class QueryServiceClient { * A fully-qualified path representing project_notification_channel resource. * @returns {string} A string representing the notification_channel. */ - matchNotificationChannelFromProjectNotificationChannelName(projectNotificationChannelName: string) { - return this.pathTemplates.projectNotificationChannelPathTemplate.match(projectNotificationChannelName).notification_channel; + matchNotificationChannelFromProjectNotificationChannelName( + projectNotificationChannelName: string, + ) { + return this.pathTemplates.projectNotificationChannelPathTemplate.match( + projectNotificationChannelName, + ).notification_channel; } /** @@ -1475,7 +1757,7 @@ export class QueryServiceClient { * @param {string} service * @returns {string} Resource name string. */ - projectServicePath(project:string,service:string) { + projectServicePath(project: string, service: string) { return this.pathTemplates.projectServicePathTemplate.render({ project: project, service: service, @@ -1490,7 +1772,9 @@ export class QueryServiceClient { * @returns {string} A string representing the project. */ matchProjectFromProjectServiceName(projectServiceName: string) { - return this.pathTemplates.projectServicePathTemplate.match(projectServiceName).project; + return this.pathTemplates.projectServicePathTemplate.match( + projectServiceName, + ).project; } /** @@ -1501,7 +1785,9 @@ export class QueryServiceClient { * @returns {string} A string representing the service. */ matchServiceFromProjectServiceName(projectServiceName: string) { - return this.pathTemplates.projectServicePathTemplate.match(projectServiceName).service; + return this.pathTemplates.projectServicePathTemplate.match( + projectServiceName, + ).service; } /** @@ -1512,12 +1798,18 @@ export class QueryServiceClient { * @param {string} service_level_objective * @returns {string} Resource name string. */ - projectServiceServiceLevelObjectivePath(project:string,service:string,serviceLevelObjective:string) { - return this.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.render({ - project: project, - service: service, - service_level_objective: serviceLevelObjective, - }); + projectServiceServiceLevelObjectivePath( + project: string, + service: string, + serviceLevelObjective: string, + ) { + return this.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.render( + { + project: project, + service: service, + service_level_objective: serviceLevelObjective, + }, + ); } /** @@ -1527,8 +1819,12 @@ export class QueryServiceClient { * A fully-qualified path representing project_service_service_level_objective resource. * @returns {string} A string representing the project. */ - matchProjectFromProjectServiceServiceLevelObjectiveName(projectServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match(projectServiceServiceLevelObjectiveName).project; + matchProjectFromProjectServiceServiceLevelObjectiveName( + projectServiceServiceLevelObjectiveName: string, + ) { + return this.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match( + projectServiceServiceLevelObjectiveName, + ).project; } /** @@ -1538,8 +1834,12 @@ export class QueryServiceClient { * A fully-qualified path representing project_service_service_level_objective resource. * @returns {string} A string representing the service. */ - matchServiceFromProjectServiceServiceLevelObjectiveName(projectServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match(projectServiceServiceLevelObjectiveName).service; + matchServiceFromProjectServiceServiceLevelObjectiveName( + projectServiceServiceLevelObjectiveName: string, + ) { + return this.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match( + projectServiceServiceLevelObjectiveName, + ).service; } /** @@ -1549,8 +1849,12 @@ export class QueryServiceClient { * A fully-qualified path representing project_service_service_level_objective resource. * @returns {string} A string representing the service_level_objective. */ - matchServiceLevelObjectiveFromProjectServiceServiceLevelObjectiveName(projectServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match(projectServiceServiceLevelObjectiveName).service_level_objective; + matchServiceLevelObjectiveFromProjectServiceServiceLevelObjectiveName( + projectServiceServiceLevelObjectiveName: string, + ) { + return this.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match( + projectServiceServiceLevelObjectiveName, + ).service_level_objective; } /** @@ -1560,7 +1864,7 @@ export class QueryServiceClient { * @param {string} uptime_check_config * @returns {string} Resource name string. */ - projectUptimeCheckConfigPath(project:string,uptimeCheckConfig:string) { + projectUptimeCheckConfigPath(project: string, uptimeCheckConfig: string) { return this.pathTemplates.projectUptimeCheckConfigPathTemplate.render({ project: project, uptime_check_config: uptimeCheckConfig, @@ -1574,8 +1878,12 @@ export class QueryServiceClient { * A fully-qualified path representing project_uptime_check_config resource. * @returns {string} A string representing the project. */ - matchProjectFromProjectUptimeCheckConfigName(projectUptimeCheckConfigName: string) { - return this.pathTemplates.projectUptimeCheckConfigPathTemplate.match(projectUptimeCheckConfigName).project; + matchProjectFromProjectUptimeCheckConfigName( + projectUptimeCheckConfigName: string, + ) { + return this.pathTemplates.projectUptimeCheckConfigPathTemplate.match( + projectUptimeCheckConfigName, + ).project; } /** @@ -1585,8 +1893,12 @@ export class QueryServiceClient { * A fully-qualified path representing project_uptime_check_config resource. * @returns {string} A string representing the uptime_check_config. */ - matchUptimeCheckConfigFromProjectUptimeCheckConfigName(projectUptimeCheckConfigName: string) { - return this.pathTemplates.projectUptimeCheckConfigPathTemplate.match(projectUptimeCheckConfigName).uptime_check_config; + matchUptimeCheckConfigFromProjectUptimeCheckConfigName( + projectUptimeCheckConfigName: string, + ) { + return this.pathTemplates.projectUptimeCheckConfigPathTemplate.match( + projectUptimeCheckConfigName, + ).uptime_check_config; } /** @@ -1596,7 +1908,7 @@ export class QueryServiceClient { * @param {string} snooze * @returns {string} Resource name string. */ - snoozePath(project:string,snooze:string) { + snoozePath(project: string, snooze: string) { return this.pathTemplates.snoozePathTemplate.render({ project: project, snooze: snooze, @@ -1633,7 +1945,7 @@ export class QueryServiceClient { */ close(): Promise { if (this.queryServiceStub && !this._terminated) { - return this.queryServiceStub.then(stub => { + return this.queryServiceStub.then((stub) => { this._log.info('ending gRPC channel'); this._terminated = true; stub.close(); @@ -1641,4 +1953,4 @@ export class QueryServiceClient { } return Promise.resolve(); } -} \ No newline at end of file +} diff --git a/packages/google-cloud-monitoring/src/v3/service_monitoring_service_client.ts b/packages/google-cloud-monitoring/src/v3/service_monitoring_service_client.ts index fd1fdc25002c..79ba56d3f7b5 100644 --- a/packages/google-cloud-monitoring/src/v3/service_monitoring_service_client.ts +++ b/packages/google-cloud-monitoring/src/v3/service_monitoring_service_client.ts @@ -18,11 +18,18 @@ /* global window */ import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} from 'google-gax'; -import {Transform} from 'stream'; +import type { + Callback, + CallOptions, + Descriptors, + ClientOptions, + PaginationCallback, + GaxCall, +} from 'google-gax'; +import { Transform } from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; +import { loggingUtils as logging, decodeAnyProtosInArray } from 'google-gax'; /** * Client JSON configuration object, loaded from @@ -47,7 +54,7 @@ export class ServiceMonitoringServiceClient { 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('monitoring'); @@ -60,9 +67,9 @@ export class ServiceMonitoringServiceClient { batching: {}, }; warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - serviceMonitoringServiceStub?: Promise<{[name: string]: Function}>; + innerApiCalls: { [name: string]: Function }; + pathTemplates: { [name: string]: gax.PathTemplate }; + serviceMonitoringServiceStub?: Promise<{ [name: string]: Function }>; /** * Construct an instance of ServiceMonitoringServiceClient. @@ -103,21 +110,43 @@ export class ServiceMonitoringServiceClient { * const client = new ServiceMonitoringServiceClient({fallback: true}, gax); * ``` */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + constructor( + opts?: ClientOptions, + gaxInstance?: typeof gax | typeof gax.fallback, + ) { // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof ServiceMonitoringServiceClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); + const staticMembers = this + .constructor as typeof ServiceMonitoringServiceClient; + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.', + ); } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; + const universeDomainEnvVar = + typeof process === 'object' && typeof process.env === 'object' + ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] + : undefined; + this._universeDomain = + opts?.universeDomain ?? + opts?.universe_domain ?? + universeDomainEnvVar ?? + 'googleapis.com'; this._servicePath = 'monitoring.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + const servicePath = + opts?.servicePath || opts?.apiEndpoint || this._servicePath; + this._providedCustomServicePath = !!( + opts?.servicePath || opts?.apiEndpoint + ); const port = opts?.port || staticMembers.port; const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts); // Request numeric enum values if REST transport is used. opts.numericEnums = true; @@ -142,7 +171,7 @@ export class ServiceMonitoringServiceClient { this._opts = opts; // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set useJWTAccessWithScope on the auth object. this.auth.useJWTAccessWithScope = true; @@ -156,10 +185,7 @@ export class ServiceMonitoringServiceClient { } // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; if (typeof process === 'object' && 'versions' in process) { clientHeader.push(`gl-node/${process.versions.node}`); } else { @@ -181,82 +207,89 @@ export class ServiceMonitoringServiceClient { // Create useful helper objects for these. this.pathTemplates = { folderAlertPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/alertPolicies/{alert_policy}' + 'folders/{folder}/alertPolicies/{alert_policy}', ), folderAlertPolicyConditionPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/alertPolicies/{alert_policy}/conditions/{condition}' + 'folders/{folder}/alertPolicies/{alert_policy}/conditions/{condition}', ), folderChannelDescriptorPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/notificationChannelDescriptors/{channel_descriptor}' + 'folders/{folder}/notificationChannelDescriptors/{channel_descriptor}', ), folderGroupPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/groups/{group}' + 'folders/{folder}/groups/{group}', ), folderNotificationChannelPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/notificationChannels/{notification_channel}' + 'folders/{folder}/notificationChannels/{notification_channel}', ), folderServicePathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/services/{service}' - ), - folderServiceServiceLevelObjectivePathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/services/{service}/serviceLevelObjectives/{service_level_objective}' + 'folders/{folder}/services/{service}', ), + folderServiceServiceLevelObjectivePathTemplate: + new this._gaxModule.PathTemplate( + 'folders/{folder}/services/{service}/serviceLevelObjectives/{service_level_objective}', + ), folderUptimeCheckConfigPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/uptimeCheckConfigs/{uptime_check_config}' + 'folders/{folder}/uptimeCheckConfigs/{uptime_check_config}', ), organizationAlertPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/alertPolicies/{alert_policy}' - ), - organizationAlertPolicyConditionPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/alertPolicies/{alert_policy}/conditions/{condition}' - ), - organizationChannelDescriptorPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/notificationChannelDescriptors/{channel_descriptor}' + 'organizations/{organization}/alertPolicies/{alert_policy}', ), + organizationAlertPolicyConditionPathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/alertPolicies/{alert_policy}/conditions/{condition}', + ), + organizationChannelDescriptorPathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/notificationChannelDescriptors/{channel_descriptor}', + ), organizationGroupPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/groups/{group}' - ), - organizationNotificationChannelPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/notificationChannels/{notification_channel}' + 'organizations/{organization}/groups/{group}', ), + organizationNotificationChannelPathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/notificationChannels/{notification_channel}', + ), organizationServicePathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/services/{service}' - ), - organizationServiceServiceLevelObjectivePathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/services/{service}/serviceLevelObjectives/{service_level_objective}' - ), - organizationUptimeCheckConfigPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/uptimeCheckConfigs/{uptime_check_config}' + 'organizations/{organization}/services/{service}', ), + organizationServiceServiceLevelObjectivePathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/services/{service}/serviceLevelObjectives/{service_level_objective}', + ), + organizationUptimeCheckConfigPathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/uptimeCheckConfigs/{uptime_check_config}', + ), projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}' + 'projects/{project}', ), projectAlertPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/alertPolicies/{alert_policy}' + 'projects/{project}/alertPolicies/{alert_policy}', ), projectAlertPolicyConditionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/alertPolicies/{alert_policy}/conditions/{condition}' + 'projects/{project}/alertPolicies/{alert_policy}/conditions/{condition}', ), projectChannelDescriptorPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/notificationChannelDescriptors/{channel_descriptor}' + 'projects/{project}/notificationChannelDescriptors/{channel_descriptor}', ), projectGroupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/groups/{group}' + 'projects/{project}/groups/{group}', ), projectNotificationChannelPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/notificationChannels/{notification_channel}' + 'projects/{project}/notificationChannels/{notification_channel}', ), projectServicePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/services/{service}' - ), - projectServiceServiceLevelObjectivePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/services/{service}/serviceLevelObjectives/{service_level_objective}' + 'projects/{project}/services/{service}', ), + projectServiceServiceLevelObjectivePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/services/{service}/serviceLevelObjectives/{service_level_objective}', + ), projectUptimeCheckConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/uptimeCheckConfigs/{uptime_check_config}' + 'projects/{project}/uptimeCheckConfigs/{uptime_check_config}', ), snoozePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/snoozes/{snooze}' + 'projects/{project}/snoozes/{snooze}', ), }; @@ -264,16 +297,25 @@ export class ServiceMonitoringServiceClient { // (e.g. 50 results at a time, with tokens to get subsequent // pages). Denote the keys used for pagination and results. this.descriptors.page = { - listServices: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'services'), - listServiceLevelObjectives: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'serviceLevelObjectives') + listServices: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'services', + ), + listServiceLevelObjectives: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'serviceLevelObjectives', + ), }; // Put together the default options sent with requests. this._defaults = this._gaxGrpc.constructSettings( - 'google.monitoring.v3.ServiceMonitoringService', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + 'google.monitoring.v3.ServiceMonitoringService', + gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, + { 'x-goog-api-client': clientHeader.join(' ') }, + ); // Set up a dictionary of "inner API calls"; the core implementation // of calling the API is handled in `google-gax`, with this code @@ -304,37 +346,51 @@ export class ServiceMonitoringServiceClient { // Put together the "service stub" for // google.monitoring.v3.ServiceMonitoringService. this.serviceMonitoringServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.monitoring.v3.ServiceMonitoringService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.monitoring.v3.ServiceMonitoringService', + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any (this._protos as any).google.monitoring.v3.ServiceMonitoringService, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; + this._opts, + this._providedCustomServicePath, + ) as Promise<{ [method: string]: Function }>; // Iterate over each of the methods that the service provides // and create an API call method for each. - const serviceMonitoringServiceStubMethods = - ['createService', 'getService', 'listServices', 'updateService', 'deleteService', 'createServiceLevelObjective', 'getServiceLevelObjective', 'listServiceLevelObjectives', 'updateServiceLevelObjective', 'deleteServiceLevelObjective']; + const serviceMonitoringServiceStubMethods = [ + 'createService', + 'getService', + 'listServices', + 'updateService', + 'deleteService', + 'createServiceLevelObjective', + 'getServiceLevelObjective', + 'listServiceLevelObjectives', + 'updateServiceLevelObjective', + 'deleteServiceLevelObjective', + ]; for (const methodName of serviceMonitoringServiceStubMethods) { const callPromise = this.serviceMonitoringServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { + (stub) => + (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error | null | undefined) => () => { throw err; - }); + }, + ); - const descriptor = - this.descriptors.page[methodName] || - undefined; + const descriptor = this.descriptors.page[methodName] || undefined; const apiCall = this._gaxModule.createApiCall( callPromise, this._defaults[methodName], descriptor, - this._opts.fallback + this._opts.fallback, ); this.innerApiCalls[methodName] = apiCall; @@ -349,8 +405,14 @@ export class ServiceMonitoringServiceClient { * @returns {string} The DNS address for this service. */ static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); } return 'monitoring.googleapis.com'; } @@ -361,8 +423,14 @@ export class ServiceMonitoringServiceClient { * @returns {string} The DNS address for this service. */ static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); } return 'monitoring.googleapis.com'; } @@ -396,7 +464,7 @@ export class ServiceMonitoringServiceClient { return [ 'https://www.googleapis.com/auth/cloud-platform', 'https://www.googleapis.com/auth/monitoring', - 'https://www.googleapis.com/auth/monitoring.read' + 'https://www.googleapis.com/auth/monitoring.read', ]; } @@ -406,8 +474,9 @@ export class ServiceMonitoringServiceClient { * Return the project ID used by this class. * @returns {Promise} A promise that resolves to string containing the project ID. */ - getProjectId(callback?: Callback): - Promise|void { + getProjectId( + callback?: Callback, + ): Promise | void { if (callback) { this.auth.getProjectId(callback); return; @@ -418,907 +487,1233 @@ export class ServiceMonitoringServiceClient { // ------------------- // -- Service calls -- // ------------------- -/** - * Create a `Service`. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Resource - * [name](https://cloud.google.com/monitoring/api/v3#project_name) of the - * parent Metrics Scope. The format is: - * - * projects/[PROJECT_ID_OR_NUMBER] - * @param {string} request.serviceId - * Optional. The Service id to use for this Service. If omitted, an id will be - * generated instead. Must match the pattern `[a-z0-9\-]+` - * @param {google.monitoring.v3.Service} request.service - * Required. The `Service` to create. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.monitoring.v3.Service|Service}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v3/service_monitoring_service.create_service.js - * region_tag:monitoring_v3_generated_ServiceMonitoringService_CreateService_async - */ + /** + * Create a `Service`. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Resource + * [name](https://cloud.google.com/monitoring/api/v3#project_name) of the + * parent Metrics Scope. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER] + * @param {string} request.serviceId + * Optional. The Service id to use for this Service. If omitted, an id will be + * generated instead. Must match the pattern `[a-z0-9\-]+` + * @param {google.monitoring.v3.Service} request.service + * Required. The `Service` to create. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.monitoring.v3.Service|Service}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v3/service_monitoring_service.create_service.js + * region_tag:monitoring_v3_generated_ServiceMonitoringService_CreateService_async + */ createService( - request?: protos.google.monitoring.v3.ICreateServiceRequest, - options?: CallOptions): - Promise<[ - protos.google.monitoring.v3.IService, - protos.google.monitoring.v3.ICreateServiceRequest|undefined, {}|undefined - ]>; + request?: protos.google.monitoring.v3.ICreateServiceRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.monitoring.v3.IService, + protos.google.monitoring.v3.ICreateServiceRequest | undefined, + {} | undefined, + ] + >; createService( - request: protos.google.monitoring.v3.ICreateServiceRequest, - options: CallOptions, - callback: Callback< - protos.google.monitoring.v3.IService, - protos.google.monitoring.v3.ICreateServiceRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.monitoring.v3.ICreateServiceRequest, + options: CallOptions, + callback: Callback< + protos.google.monitoring.v3.IService, + protos.google.monitoring.v3.ICreateServiceRequest | null | undefined, + {} | null | undefined + >, + ): void; createService( - request: protos.google.monitoring.v3.ICreateServiceRequest, - callback: Callback< - protos.google.monitoring.v3.IService, - protos.google.monitoring.v3.ICreateServiceRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.monitoring.v3.ICreateServiceRequest, + callback: Callback< + protos.google.monitoring.v3.IService, + protos.google.monitoring.v3.ICreateServiceRequest | null | undefined, + {} | null | undefined + >, + ): void; createService( - request?: protos.google.monitoring.v3.ICreateServiceRequest, - optionsOrCallback?: CallOptions|Callback< + request?: protos.google.monitoring.v3.ICreateServiceRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.monitoring.v3.IService, - protos.google.monitoring.v3.ICreateServiceRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.monitoring.v3.IService, - protos.google.monitoring.v3.ICreateServiceRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.monitoring.v3.IService, - protos.google.monitoring.v3.ICreateServiceRequest|undefined, {}|undefined - ]>|void { + protos.google.monitoring.v3.ICreateServiceRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.monitoring.v3.IService, + protos.google.monitoring.v3.ICreateServiceRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.monitoring.v3.IService, + protos.google.monitoring.v3.ICreateServiceRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('createService request %j', request); - const wrappedCallback: Callback< - protos.google.monitoring.v3.IService, - protos.google.monitoring.v3.ICreateServiceRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.monitoring.v3.IService, + protos.google.monitoring.v3.ICreateServiceRequest | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('createService response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.createService(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.monitoring.v3.IService, - protos.google.monitoring.v3.ICreateServiceRequest|undefined, - {}|undefined - ]) => { - this._log.info('createService 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); + return this.innerApiCalls + .createService(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.monitoring.v3.IService, + protos.google.monitoring.v3.ICreateServiceRequest | undefined, + {} | undefined, + ]) => { + this._log.info('createService 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; }); } -/** - * Get the named `Service`. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Resource name of the `Service`. The format is: - * - * projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID] - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.monitoring.v3.Service|Service}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v3/service_monitoring_service.get_service.js - * region_tag:monitoring_v3_generated_ServiceMonitoringService_GetService_async - */ + /** + * Get the named `Service`. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Resource name of the `Service`. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID] + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.monitoring.v3.Service|Service}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v3/service_monitoring_service.get_service.js + * region_tag:monitoring_v3_generated_ServiceMonitoringService_GetService_async + */ getService( - request?: protos.google.monitoring.v3.IGetServiceRequest, - options?: CallOptions): - Promise<[ - protos.google.monitoring.v3.IService, - protos.google.monitoring.v3.IGetServiceRequest|undefined, {}|undefined - ]>; + request?: protos.google.monitoring.v3.IGetServiceRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.monitoring.v3.IService, + protos.google.monitoring.v3.IGetServiceRequest | undefined, + {} | undefined, + ] + >; getService( - request: protos.google.monitoring.v3.IGetServiceRequest, - options: CallOptions, - callback: Callback< - protos.google.monitoring.v3.IService, - protos.google.monitoring.v3.IGetServiceRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.monitoring.v3.IGetServiceRequest, + options: CallOptions, + callback: Callback< + protos.google.monitoring.v3.IService, + protos.google.monitoring.v3.IGetServiceRequest | null | undefined, + {} | null | undefined + >, + ): void; getService( - request: protos.google.monitoring.v3.IGetServiceRequest, - callback: Callback< - protos.google.monitoring.v3.IService, - protos.google.monitoring.v3.IGetServiceRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.monitoring.v3.IGetServiceRequest, + callback: Callback< + protos.google.monitoring.v3.IService, + protos.google.monitoring.v3.IGetServiceRequest | null | undefined, + {} | null | undefined + >, + ): void; getService( - request?: protos.google.monitoring.v3.IGetServiceRequest, - optionsOrCallback?: CallOptions|Callback< + request?: protos.google.monitoring.v3.IGetServiceRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.monitoring.v3.IService, - protos.google.monitoring.v3.IGetServiceRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.monitoring.v3.IService, - protos.google.monitoring.v3.IGetServiceRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.monitoring.v3.IService, - protos.google.monitoring.v3.IGetServiceRequest|undefined, {}|undefined - ]>|void { + protos.google.monitoring.v3.IGetServiceRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.monitoring.v3.IService, + protos.google.monitoring.v3.IGetServiceRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.monitoring.v3.IService, + protos.google.monitoring.v3.IGetServiceRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('getService request %j', request); - const wrappedCallback: Callback< - protos.google.monitoring.v3.IService, - protos.google.monitoring.v3.IGetServiceRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.monitoring.v3.IService, + protos.google.monitoring.v3.IGetServiceRequest | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('getService response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.getService(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.monitoring.v3.IService, - protos.google.monitoring.v3.IGetServiceRequest|undefined, - {}|undefined - ]) => { - this._log.info('getService 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); + return this.innerApiCalls + .getService(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.monitoring.v3.IService, + protos.google.monitoring.v3.IGetServiceRequest | undefined, + {} | undefined, + ]) => { + this._log.info('getService 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; }); } -/** - * Update this `Service`. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.monitoring.v3.Service} request.service - * Required. The `Service` to draw updates from. - * The given `name` specifies the resource to update. - * @param {google.protobuf.FieldMask} request.updateMask - * A set of field paths defining which fields to use for the update. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.monitoring.v3.Service|Service}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v3/service_monitoring_service.update_service.js - * region_tag:monitoring_v3_generated_ServiceMonitoringService_UpdateService_async - */ + /** + * Update this `Service`. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.monitoring.v3.Service} request.service + * Required. The `Service` to draw updates from. + * The given `name` specifies the resource to update. + * @param {google.protobuf.FieldMask} request.updateMask + * A set of field paths defining which fields to use for the update. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.monitoring.v3.Service|Service}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v3/service_monitoring_service.update_service.js + * region_tag:monitoring_v3_generated_ServiceMonitoringService_UpdateService_async + */ updateService( - request?: protos.google.monitoring.v3.IUpdateServiceRequest, - options?: CallOptions): - Promise<[ - protos.google.monitoring.v3.IService, - protos.google.monitoring.v3.IUpdateServiceRequest|undefined, {}|undefined - ]>; + request?: protos.google.monitoring.v3.IUpdateServiceRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.monitoring.v3.IService, + protos.google.monitoring.v3.IUpdateServiceRequest | undefined, + {} | undefined, + ] + >; updateService( - request: protos.google.monitoring.v3.IUpdateServiceRequest, - options: CallOptions, - callback: Callback< - protos.google.monitoring.v3.IService, - protos.google.monitoring.v3.IUpdateServiceRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.monitoring.v3.IUpdateServiceRequest, + options: CallOptions, + callback: Callback< + protos.google.monitoring.v3.IService, + protos.google.monitoring.v3.IUpdateServiceRequest | null | undefined, + {} | null | undefined + >, + ): void; updateService( - request: protos.google.monitoring.v3.IUpdateServiceRequest, - callback: Callback< - protos.google.monitoring.v3.IService, - protos.google.monitoring.v3.IUpdateServiceRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.monitoring.v3.IUpdateServiceRequest, + callback: Callback< + protos.google.monitoring.v3.IService, + protos.google.monitoring.v3.IUpdateServiceRequest | null | undefined, + {} | null | undefined + >, + ): void; updateService( - request?: protos.google.monitoring.v3.IUpdateServiceRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.monitoring.v3.IService, - protos.google.monitoring.v3.IUpdateServiceRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.monitoring.v3.IUpdateServiceRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.monitoring.v3.IService, - protos.google.monitoring.v3.IUpdateServiceRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.monitoring.v3.IService, - protos.google.monitoring.v3.IUpdateServiceRequest|undefined, {}|undefined - ]>|void { + protos.google.monitoring.v3.IUpdateServiceRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.monitoring.v3.IService, + protos.google.monitoring.v3.IUpdateServiceRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.monitoring.v3.IService, + protos.google.monitoring.v3.IUpdateServiceRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'service.name': request.service!.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + 'service.name': request.service!.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('updateService request %j', request); - const wrappedCallback: Callback< - protos.google.monitoring.v3.IService, - protos.google.monitoring.v3.IUpdateServiceRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.monitoring.v3.IService, + protos.google.monitoring.v3.IUpdateServiceRequest | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('updateService response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.updateService(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.monitoring.v3.IService, - protos.google.monitoring.v3.IUpdateServiceRequest|undefined, - {}|undefined - ]) => { - this._log.info('updateService 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); + return this.innerApiCalls + .updateService(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.monitoring.v3.IService, + protos.google.monitoring.v3.IUpdateServiceRequest | undefined, + {} | undefined, + ]) => { + this._log.info('updateService 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; }); } -/** - * Soft delete this `Service`. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Resource name of the `Service` to delete. The format is: - * - * projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID] - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v3/service_monitoring_service.delete_service.js - * region_tag:monitoring_v3_generated_ServiceMonitoringService_DeleteService_async - */ + /** + * Soft delete this `Service`. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Resource name of the `Service` to delete. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID] + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.protobuf.Empty|Empty}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v3/service_monitoring_service.delete_service.js + * region_tag:monitoring_v3_generated_ServiceMonitoringService_DeleteService_async + */ deleteService( - request?: protos.google.monitoring.v3.IDeleteServiceRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteServiceRequest|undefined, {}|undefined - ]>; + request?: protos.google.monitoring.v3.IDeleteServiceRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.protobuf.IEmpty, + protos.google.monitoring.v3.IDeleteServiceRequest | undefined, + {} | undefined, + ] + >; deleteService( - request: protos.google.monitoring.v3.IDeleteServiceRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteServiceRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.monitoring.v3.IDeleteServiceRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.monitoring.v3.IDeleteServiceRequest | null | undefined, + {} | null | undefined + >, + ): void; deleteService( - request: protos.google.monitoring.v3.IDeleteServiceRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteServiceRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.monitoring.v3.IDeleteServiceRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.monitoring.v3.IDeleteServiceRequest | null | undefined, + {} | null | undefined + >, + ): void; deleteService( - request?: protos.google.monitoring.v3.IDeleteServiceRequest, - optionsOrCallback?: CallOptions|Callback< + request?: protos.google.monitoring.v3.IDeleteServiceRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteServiceRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteServiceRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteServiceRequest|undefined, {}|undefined - ]>|void { + protos.google.monitoring.v3.IDeleteServiceRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.monitoring.v3.IDeleteServiceRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.protobuf.IEmpty, + protos.google.monitoring.v3.IDeleteServiceRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('deleteService request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteServiceRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.protobuf.IEmpty, + protos.google.monitoring.v3.IDeleteServiceRequest | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('deleteService response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.deleteService(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteServiceRequest|undefined, - {}|undefined - ]) => { - this._log.info('deleteService 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); + return this.innerApiCalls + .deleteService(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.protobuf.IEmpty, + protos.google.monitoring.v3.IDeleteServiceRequest | undefined, + {} | undefined, + ]) => { + this._log.info('deleteService 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; }); } -/** - * Create a `ServiceLevelObjective` for the given `Service`. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Resource name of the parent `Service`. The format is: - * - * projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID] - * @param {string} request.serviceLevelObjectiveId - * Optional. The ServiceLevelObjective id to use for this - * ServiceLevelObjective. If omitted, an id will be generated instead. Must - * match the pattern `^[a-zA-Z0-9-_:.]+$` - * @param {google.monitoring.v3.ServiceLevelObjective} request.serviceLevelObjective - * Required. The `ServiceLevelObjective` to create. - * The provided `name` will be respected if no `ServiceLevelObjective` exists - * with this name. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.monitoring.v3.ServiceLevelObjective|ServiceLevelObjective}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v3/service_monitoring_service.create_service_level_objective.js - * region_tag:monitoring_v3_generated_ServiceMonitoringService_CreateServiceLevelObjective_async - */ + /** + * Create a `ServiceLevelObjective` for the given `Service`. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Resource name of the parent `Service`. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID] + * @param {string} request.serviceLevelObjectiveId + * Optional. The ServiceLevelObjective id to use for this + * ServiceLevelObjective. If omitted, an id will be generated instead. Must + * match the pattern `^[a-zA-Z0-9-_:.]+$` + * @param {google.monitoring.v3.ServiceLevelObjective} request.serviceLevelObjective + * Required. The `ServiceLevelObjective` to create. + * The provided `name` will be respected if no `ServiceLevelObjective` exists + * with this name. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.monitoring.v3.ServiceLevelObjective|ServiceLevelObjective}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v3/service_monitoring_service.create_service_level_objective.js + * region_tag:monitoring_v3_generated_ServiceMonitoringService_CreateServiceLevelObjective_async + */ createServiceLevelObjective( - request?: protos.google.monitoring.v3.ICreateServiceLevelObjectiveRequest, - options?: CallOptions): - Promise<[ - protos.google.monitoring.v3.IServiceLevelObjective, - protos.google.monitoring.v3.ICreateServiceLevelObjectiveRequest|undefined, {}|undefined - ]>; + request?: protos.google.monitoring.v3.ICreateServiceLevelObjectiveRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.monitoring.v3.IServiceLevelObjective, + ( + | protos.google.monitoring.v3.ICreateServiceLevelObjectiveRequest + | undefined + ), + {} | undefined, + ] + >; createServiceLevelObjective( - request: protos.google.monitoring.v3.ICreateServiceLevelObjectiveRequest, - options: CallOptions, - callback: Callback< - protos.google.monitoring.v3.IServiceLevelObjective, - protos.google.monitoring.v3.ICreateServiceLevelObjectiveRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.monitoring.v3.ICreateServiceLevelObjectiveRequest, + options: CallOptions, + callback: Callback< + protos.google.monitoring.v3.IServiceLevelObjective, + | protos.google.monitoring.v3.ICreateServiceLevelObjectiveRequest + | null + | undefined, + {} | null | undefined + >, + ): void; createServiceLevelObjective( - request: protos.google.monitoring.v3.ICreateServiceLevelObjectiveRequest, - callback: Callback< - protos.google.monitoring.v3.IServiceLevelObjective, - protos.google.monitoring.v3.ICreateServiceLevelObjectiveRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.monitoring.v3.ICreateServiceLevelObjectiveRequest, + callback: Callback< + protos.google.monitoring.v3.IServiceLevelObjective, + | protos.google.monitoring.v3.ICreateServiceLevelObjectiveRequest + | null + | undefined, + {} | null | undefined + >, + ): void; createServiceLevelObjective( - request?: protos.google.monitoring.v3.ICreateServiceLevelObjectiveRequest, - optionsOrCallback?: CallOptions|Callback< + request?: protos.google.monitoring.v3.ICreateServiceLevelObjectiveRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.monitoring.v3.IServiceLevelObjective, - protos.google.monitoring.v3.ICreateServiceLevelObjectiveRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.monitoring.v3.IServiceLevelObjective, - protos.google.monitoring.v3.ICreateServiceLevelObjectiveRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.monitoring.v3.IServiceLevelObjective, - protos.google.monitoring.v3.ICreateServiceLevelObjectiveRequest|undefined, {}|undefined - ]>|void { + | protos.google.monitoring.v3.ICreateServiceLevelObjectiveRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.monitoring.v3.IServiceLevelObjective, + | protos.google.monitoring.v3.ICreateServiceLevelObjectiveRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.monitoring.v3.IServiceLevelObjective, + ( + | protos.google.monitoring.v3.ICreateServiceLevelObjectiveRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('createServiceLevelObjective request %j', request); - const wrappedCallback: Callback< - protos.google.monitoring.v3.IServiceLevelObjective, - protos.google.monitoring.v3.ICreateServiceLevelObjectiveRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.monitoring.v3.IServiceLevelObjective, + | protos.google.monitoring.v3.ICreateServiceLevelObjectiveRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('createServiceLevelObjective response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.createServiceLevelObjective(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.monitoring.v3.IServiceLevelObjective, - protos.google.monitoring.v3.ICreateServiceLevelObjectiveRequest|undefined, - {}|undefined - ]) => { - this._log.info('createServiceLevelObjective 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); + return this.innerApiCalls + .createServiceLevelObjective(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.monitoring.v3.IServiceLevelObjective, + ( + | protos.google.monitoring.v3.ICreateServiceLevelObjectiveRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('createServiceLevelObjective 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; }); } -/** - * Get a `ServiceLevelObjective` by name. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Resource name of the `ServiceLevelObjective` to get. The format - * is: - * - * projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID]/serviceLevelObjectives/[SLO_NAME] - * @param {google.monitoring.v3.ServiceLevelObjective.View} request.view - * View of the `ServiceLevelObjective` to return. If `DEFAULT`, return the - * `ServiceLevelObjective` as originally defined. If `EXPLICIT` and the - * `ServiceLevelObjective` is defined in terms of a `BasicSli`, replace the - * `BasicSli` with a `RequestBasedSli` spelling out how the SLI is computed. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.monitoring.v3.ServiceLevelObjective|ServiceLevelObjective}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v3/service_monitoring_service.get_service_level_objective.js - * region_tag:monitoring_v3_generated_ServiceMonitoringService_GetServiceLevelObjective_async - */ + /** + * Get a `ServiceLevelObjective` by name. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Resource name of the `ServiceLevelObjective` to get. The format + * is: + * + * projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID]/serviceLevelObjectives/[SLO_NAME] + * @param {google.monitoring.v3.ServiceLevelObjective.View} request.view + * View of the `ServiceLevelObjective` to return. If `DEFAULT`, return the + * `ServiceLevelObjective` as originally defined. If `EXPLICIT` and the + * `ServiceLevelObjective` is defined in terms of a `BasicSli`, replace the + * `BasicSli` with a `RequestBasedSli` spelling out how the SLI is computed. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.monitoring.v3.ServiceLevelObjective|ServiceLevelObjective}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v3/service_monitoring_service.get_service_level_objective.js + * region_tag:monitoring_v3_generated_ServiceMonitoringService_GetServiceLevelObjective_async + */ getServiceLevelObjective( - request?: protos.google.monitoring.v3.IGetServiceLevelObjectiveRequest, - options?: CallOptions): - Promise<[ - protos.google.monitoring.v3.IServiceLevelObjective, - protos.google.monitoring.v3.IGetServiceLevelObjectiveRequest|undefined, {}|undefined - ]>; + request?: protos.google.monitoring.v3.IGetServiceLevelObjectiveRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.monitoring.v3.IServiceLevelObjective, + protos.google.monitoring.v3.IGetServiceLevelObjectiveRequest | undefined, + {} | undefined, + ] + >; getServiceLevelObjective( - request: protos.google.monitoring.v3.IGetServiceLevelObjectiveRequest, - options: CallOptions, - callback: Callback< - protos.google.monitoring.v3.IServiceLevelObjective, - protos.google.monitoring.v3.IGetServiceLevelObjectiveRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.monitoring.v3.IGetServiceLevelObjectiveRequest, + options: CallOptions, + callback: Callback< + protos.google.monitoring.v3.IServiceLevelObjective, + | protos.google.monitoring.v3.IGetServiceLevelObjectiveRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getServiceLevelObjective( - request: protos.google.monitoring.v3.IGetServiceLevelObjectiveRequest, - callback: Callback< - protos.google.monitoring.v3.IServiceLevelObjective, - protos.google.monitoring.v3.IGetServiceLevelObjectiveRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.monitoring.v3.IGetServiceLevelObjectiveRequest, + callback: Callback< + protos.google.monitoring.v3.IServiceLevelObjective, + | protos.google.monitoring.v3.IGetServiceLevelObjectiveRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getServiceLevelObjective( - request?: protos.google.monitoring.v3.IGetServiceLevelObjectiveRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.monitoring.v3.IServiceLevelObjective, - protos.google.monitoring.v3.IGetServiceLevelObjectiveRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.monitoring.v3.IGetServiceLevelObjectiveRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.monitoring.v3.IServiceLevelObjective, - protos.google.monitoring.v3.IGetServiceLevelObjectiveRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.monitoring.v3.IServiceLevelObjective, - protos.google.monitoring.v3.IGetServiceLevelObjectiveRequest|undefined, {}|undefined - ]>|void { + | protos.google.monitoring.v3.IGetServiceLevelObjectiveRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.monitoring.v3.IServiceLevelObjective, + | protos.google.monitoring.v3.IGetServiceLevelObjectiveRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.monitoring.v3.IServiceLevelObjective, + protos.google.monitoring.v3.IGetServiceLevelObjectiveRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('getServiceLevelObjective request %j', request); - const wrappedCallback: Callback< - protos.google.monitoring.v3.IServiceLevelObjective, - protos.google.monitoring.v3.IGetServiceLevelObjectiveRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.monitoring.v3.IServiceLevelObjective, + | protos.google.monitoring.v3.IGetServiceLevelObjectiveRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('getServiceLevelObjective response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.getServiceLevelObjective(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.monitoring.v3.IServiceLevelObjective, - protos.google.monitoring.v3.IGetServiceLevelObjectiveRequest|undefined, - {}|undefined - ]) => { - this._log.info('getServiceLevelObjective 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); + return this.innerApiCalls + .getServiceLevelObjective(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.monitoring.v3.IServiceLevelObjective, + ( + | protos.google.monitoring.v3.IGetServiceLevelObjectiveRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('getServiceLevelObjective 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; }); } -/** - * Update the given `ServiceLevelObjective`. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.monitoring.v3.ServiceLevelObjective} request.serviceLevelObjective - * Required. The `ServiceLevelObjective` to draw updates from. - * The given `name` specifies the resource to update. - * @param {google.protobuf.FieldMask} request.updateMask - * A set of field paths defining which fields to use for the update. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.monitoring.v3.ServiceLevelObjective|ServiceLevelObjective}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v3/service_monitoring_service.update_service_level_objective.js - * region_tag:monitoring_v3_generated_ServiceMonitoringService_UpdateServiceLevelObjective_async - */ + /** + * Update the given `ServiceLevelObjective`. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.monitoring.v3.ServiceLevelObjective} request.serviceLevelObjective + * Required. The `ServiceLevelObjective` to draw updates from. + * The given `name` specifies the resource to update. + * @param {google.protobuf.FieldMask} request.updateMask + * A set of field paths defining which fields to use for the update. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.monitoring.v3.ServiceLevelObjective|ServiceLevelObjective}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v3/service_monitoring_service.update_service_level_objective.js + * region_tag:monitoring_v3_generated_ServiceMonitoringService_UpdateServiceLevelObjective_async + */ updateServiceLevelObjective( - request?: protos.google.monitoring.v3.IUpdateServiceLevelObjectiveRequest, - options?: CallOptions): - Promise<[ - protos.google.monitoring.v3.IServiceLevelObjective, - protos.google.monitoring.v3.IUpdateServiceLevelObjectiveRequest|undefined, {}|undefined - ]>; + request?: protos.google.monitoring.v3.IUpdateServiceLevelObjectiveRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.monitoring.v3.IServiceLevelObjective, + ( + | protos.google.monitoring.v3.IUpdateServiceLevelObjectiveRequest + | undefined + ), + {} | undefined, + ] + >; updateServiceLevelObjective( - request: protos.google.monitoring.v3.IUpdateServiceLevelObjectiveRequest, - options: CallOptions, - callback: Callback< - protos.google.monitoring.v3.IServiceLevelObjective, - protos.google.monitoring.v3.IUpdateServiceLevelObjectiveRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.monitoring.v3.IUpdateServiceLevelObjectiveRequest, + options: CallOptions, + callback: Callback< + protos.google.monitoring.v3.IServiceLevelObjective, + | protos.google.monitoring.v3.IUpdateServiceLevelObjectiveRequest + | null + | undefined, + {} | null | undefined + >, + ): void; updateServiceLevelObjective( - request: protos.google.monitoring.v3.IUpdateServiceLevelObjectiveRequest, - callback: Callback< - protos.google.monitoring.v3.IServiceLevelObjective, - protos.google.monitoring.v3.IUpdateServiceLevelObjectiveRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.monitoring.v3.IUpdateServiceLevelObjectiveRequest, + callback: Callback< + protos.google.monitoring.v3.IServiceLevelObjective, + | protos.google.monitoring.v3.IUpdateServiceLevelObjectiveRequest + | null + | undefined, + {} | null | undefined + >, + ): void; updateServiceLevelObjective( - request?: protos.google.monitoring.v3.IUpdateServiceLevelObjectiveRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.monitoring.v3.IServiceLevelObjective, - protos.google.monitoring.v3.IUpdateServiceLevelObjectiveRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.monitoring.v3.IUpdateServiceLevelObjectiveRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.monitoring.v3.IServiceLevelObjective, - protos.google.monitoring.v3.IUpdateServiceLevelObjectiveRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.monitoring.v3.IServiceLevelObjective, - protos.google.monitoring.v3.IUpdateServiceLevelObjectiveRequest|undefined, {}|undefined - ]>|void { + | protos.google.monitoring.v3.IUpdateServiceLevelObjectiveRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.monitoring.v3.IServiceLevelObjective, + | protos.google.monitoring.v3.IUpdateServiceLevelObjectiveRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.monitoring.v3.IServiceLevelObjective, + ( + | protos.google.monitoring.v3.IUpdateServiceLevelObjectiveRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'service_level_objective.name': request.serviceLevelObjective!.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + 'service_level_objective.name': + request.serviceLevelObjective!.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('updateServiceLevelObjective request %j', request); - const wrappedCallback: Callback< - protos.google.monitoring.v3.IServiceLevelObjective, - protos.google.monitoring.v3.IUpdateServiceLevelObjectiveRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.monitoring.v3.IServiceLevelObjective, + | protos.google.monitoring.v3.IUpdateServiceLevelObjectiveRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('updateServiceLevelObjective response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.updateServiceLevelObjective(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.monitoring.v3.IServiceLevelObjective, - protos.google.monitoring.v3.IUpdateServiceLevelObjectiveRequest|undefined, - {}|undefined - ]) => { - this._log.info('updateServiceLevelObjective 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); + return this.innerApiCalls + .updateServiceLevelObjective(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.monitoring.v3.IServiceLevelObjective, + ( + | protos.google.monitoring.v3.IUpdateServiceLevelObjectiveRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('updateServiceLevelObjective 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; }); } -/** - * Delete the given `ServiceLevelObjective`. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Resource name of the `ServiceLevelObjective` to delete. The - * format is: - * - * projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID]/serviceLevelObjectives/[SLO_NAME] - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v3/service_monitoring_service.delete_service_level_objective.js - * region_tag:monitoring_v3_generated_ServiceMonitoringService_DeleteServiceLevelObjective_async - */ + /** + * Delete the given `ServiceLevelObjective`. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Resource name of the `ServiceLevelObjective` to delete. The + * format is: + * + * projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID]/serviceLevelObjectives/[SLO_NAME] + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.protobuf.Empty|Empty}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v3/service_monitoring_service.delete_service_level_objective.js + * region_tag:monitoring_v3_generated_ServiceMonitoringService_DeleteServiceLevelObjective_async + */ deleteServiceLevelObjective( - request?: protos.google.monitoring.v3.IDeleteServiceLevelObjectiveRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteServiceLevelObjectiveRequest|undefined, {}|undefined - ]>; + request?: protos.google.monitoring.v3.IDeleteServiceLevelObjectiveRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.protobuf.IEmpty, + ( + | protos.google.monitoring.v3.IDeleteServiceLevelObjectiveRequest + | undefined + ), + {} | undefined, + ] + >; deleteServiceLevelObjective( - request: protos.google.monitoring.v3.IDeleteServiceLevelObjectiveRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteServiceLevelObjectiveRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.monitoring.v3.IDeleteServiceLevelObjectiveRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + | protos.google.monitoring.v3.IDeleteServiceLevelObjectiveRequest + | null + | undefined, + {} | null | undefined + >, + ): void; deleteServiceLevelObjective( - request: protos.google.monitoring.v3.IDeleteServiceLevelObjectiveRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteServiceLevelObjectiveRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.monitoring.v3.IDeleteServiceLevelObjectiveRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + | protos.google.monitoring.v3.IDeleteServiceLevelObjectiveRequest + | null + | undefined, + {} | null | undefined + >, + ): void; deleteServiceLevelObjective( - request?: protos.google.monitoring.v3.IDeleteServiceLevelObjectiveRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteServiceLevelObjectiveRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.monitoring.v3.IDeleteServiceLevelObjectiveRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteServiceLevelObjectiveRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteServiceLevelObjectiveRequest|undefined, {}|undefined - ]>|void { + | protos.google.monitoring.v3.IDeleteServiceLevelObjectiveRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.IEmpty, + | protos.google.monitoring.v3.IDeleteServiceLevelObjectiveRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.protobuf.IEmpty, + ( + | protos.google.monitoring.v3.IDeleteServiceLevelObjectiveRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('deleteServiceLevelObjective request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteServiceLevelObjectiveRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.protobuf.IEmpty, + | protos.google.monitoring.v3.IDeleteServiceLevelObjectiveRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('deleteServiceLevelObjective response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.deleteServiceLevelObjective(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteServiceLevelObjectiveRequest|undefined, - {}|undefined - ]) => { - this._log.info('deleteServiceLevelObjective 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); + return this.innerApiCalls + .deleteServiceLevelObjective(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.protobuf.IEmpty, + ( + | protos.google.monitoring.v3.IDeleteServiceLevelObjectiveRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('deleteServiceLevelObjective 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; }); } - /** - * List `Service`s for this Metrics Scope. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Resource name of the parent containing the listed services, - * either a [project](https://cloud.google.com/monitoring/api/v3#project_name) - * or a Monitoring Metrics Scope. The formats are: - * - * projects/[PROJECT_ID_OR_NUMBER] - * workspaces/[HOST_PROJECT_ID_OR_NUMBER] - * @param {string} request.filter - * A filter specifying what `Service`s to return. The filter supports - * filtering on a particular service-identifier type or one of its attributes. - * - * To filter on a particular service-identifier type, the `identifier_case` - * refers to which option in the `identifier` field is populated. For example, - * the filter `identifier_case = "CUSTOM"` would match all services with a - * value for the `custom` field. Valid options include "CUSTOM", "APP_ENGINE", - * "MESH_ISTIO", and the other options listed at - * https://cloud.google.com/monitoring/api/ref_v3/rest/v3/services#Service - * - * To filter on an attribute of a service-identifier type, apply the filter - * name by using the snake case of the service-identifier type and the - * attribute of that service-identifier type, and join the two with a period. - * For example, to filter by the `meshUid` field of the `MeshIstio` - * service-identifier type, you must filter on `mesh_istio.mesh_uid = - * "123"` to match all services with mesh UID "123". Service-identifier types - * and their attributes are described at - * https://cloud.google.com/monitoring/api/ref_v3/rest/v3/services#Service - * @param {number} request.pageSize - * A non-negative number that is the maximum number of results to return. - * When 0, use default page size. - * @param {string} request.pageToken - * If this field is not empty then it must contain the `nextPageToken` value - * returned by a previous call to this method. Using this field causes the - * method to return additional results from the previous method call. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of {@link protos.google.monitoring.v3.Service|Service}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listServicesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * List `Service`s for this Metrics Scope. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Resource name of the parent containing the listed services, + * either a [project](https://cloud.google.com/monitoring/api/v3#project_name) + * or a Monitoring Metrics Scope. The formats are: + * + * projects/[PROJECT_ID_OR_NUMBER] + * workspaces/[HOST_PROJECT_ID_OR_NUMBER] + * @param {string} request.filter + * A filter specifying what `Service`s to return. The filter supports + * filtering on a particular service-identifier type or one of its attributes. + * + * To filter on a particular service-identifier type, the `identifier_case` + * refers to which option in the `identifier` field is populated. For example, + * the filter `identifier_case = "CUSTOM"` would match all services with a + * value for the `custom` field. Valid options include "CUSTOM", "APP_ENGINE", + * "MESH_ISTIO", and the other options listed at + * https://cloud.google.com/monitoring/api/ref_v3/rest/v3/services#Service + * + * To filter on an attribute of a service-identifier type, apply the filter + * name by using the snake case of the service-identifier type and the + * attribute of that service-identifier type, and join the two with a period. + * For example, to filter by the `meshUid` field of the `MeshIstio` + * service-identifier type, you must filter on `mesh_istio.mesh_uid = + * "123"` to match all services with mesh UID "123". Service-identifier types + * and their attributes are described at + * https://cloud.google.com/monitoring/api/ref_v3/rest/v3/services#Service + * @param {number} request.pageSize + * A non-negative number that is the maximum number of results to return. + * When 0, use default page size. + * @param {string} request.pageToken + * If this field is not empty then it must contain the `nextPageToken` value + * returned by a previous call to this method. Using this field causes the + * method to return additional results from the previous method call. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of {@link protos.google.monitoring.v3.Service|Service}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listServicesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listServices( - request?: protos.google.monitoring.v3.IListServicesRequest, - options?: CallOptions): - Promise<[ - protos.google.monitoring.v3.IService[], - protos.google.monitoring.v3.IListServicesRequest|null, - protos.google.monitoring.v3.IListServicesResponse - ]>; + request?: protos.google.monitoring.v3.IListServicesRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.monitoring.v3.IService[], + protos.google.monitoring.v3.IListServicesRequest | null, + protos.google.monitoring.v3.IListServicesResponse, + ] + >; listServices( - request: protos.google.monitoring.v3.IListServicesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.monitoring.v3.IListServicesRequest, - protos.google.monitoring.v3.IListServicesResponse|null|undefined, - protos.google.monitoring.v3.IService>): void; + request: protos.google.monitoring.v3.IListServicesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.monitoring.v3.IListServicesRequest, + protos.google.monitoring.v3.IListServicesResponse | null | undefined, + protos.google.monitoring.v3.IService + >, + ): void; listServices( - request: protos.google.monitoring.v3.IListServicesRequest, - callback: PaginationCallback< - protos.google.monitoring.v3.IListServicesRequest, - protos.google.monitoring.v3.IListServicesResponse|null|undefined, - protos.google.monitoring.v3.IService>): void; + request: protos.google.monitoring.v3.IListServicesRequest, + callback: PaginationCallback< + protos.google.monitoring.v3.IListServicesRequest, + protos.google.monitoring.v3.IListServicesResponse | null | undefined, + protos.google.monitoring.v3.IService + >, + ): void; listServices( - request?: protos.google.monitoring.v3.IListServicesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.monitoring.v3.IListServicesRequest, - protos.google.monitoring.v3.IListServicesResponse|null|undefined, - protos.google.monitoring.v3.IService>, - callback?: PaginationCallback< + request?: protos.google.monitoring.v3.IListServicesRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.monitoring.v3.IListServicesRequest, - protos.google.monitoring.v3.IListServicesResponse|null|undefined, - protos.google.monitoring.v3.IService>): - Promise<[ - protos.google.monitoring.v3.IService[], - protos.google.monitoring.v3.IListServicesRequest|null, - protos.google.monitoring.v3.IListServicesResponse - ]>|void { + protos.google.monitoring.v3.IListServicesResponse | null | undefined, + protos.google.monitoring.v3.IService + >, + callback?: PaginationCallback< + protos.google.monitoring.v3.IListServicesRequest, + protos.google.monitoring.v3.IListServicesResponse | null | undefined, + protos.google.monitoring.v3.IService + >, + ): Promise< + [ + protos.google.monitoring.v3.IService[], + protos.google.monitoring.v3.IListServicesRequest | null, + protos.google.monitoring.v3.IListServicesResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.monitoring.v3.IListServicesRequest, - protos.google.monitoring.v3.IListServicesResponse|null|undefined, - protos.google.monitoring.v3.IService>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.monitoring.v3.IListServicesRequest, + protos.google.monitoring.v3.IListServicesResponse | null | undefined, + protos.google.monitoring.v3.IService + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('listServices values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -1327,257 +1722,286 @@ export class ServiceMonitoringServiceClient { this._log.info('listServices request %j', request); return this.innerApiCalls .listServices(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.monitoring.v3.IService[], - protos.google.monitoring.v3.IListServicesRequest|null, - protos.google.monitoring.v3.IListServicesResponse - ]) => { - this._log.info('listServices values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.monitoring.v3.IService[], + protos.google.monitoring.v3.IListServicesRequest | null, + protos.google.monitoring.v3.IListServicesResponse, + ]) => { + this._log.info('listServices values %j', response); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listServices`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Resource name of the parent containing the listed services, - * either a [project](https://cloud.google.com/monitoring/api/v3#project_name) - * or a Monitoring Metrics Scope. The formats are: - * - * projects/[PROJECT_ID_OR_NUMBER] - * workspaces/[HOST_PROJECT_ID_OR_NUMBER] - * @param {string} request.filter - * A filter specifying what `Service`s to return. The filter supports - * filtering on a particular service-identifier type or one of its attributes. - * - * To filter on a particular service-identifier type, the `identifier_case` - * refers to which option in the `identifier` field is populated. For example, - * the filter `identifier_case = "CUSTOM"` would match all services with a - * value for the `custom` field. Valid options include "CUSTOM", "APP_ENGINE", - * "MESH_ISTIO", and the other options listed at - * https://cloud.google.com/monitoring/api/ref_v3/rest/v3/services#Service - * - * To filter on an attribute of a service-identifier type, apply the filter - * name by using the snake case of the service-identifier type and the - * attribute of that service-identifier type, and join the two with a period. - * For example, to filter by the `meshUid` field of the `MeshIstio` - * service-identifier type, you must filter on `mesh_istio.mesh_uid = - * "123"` to match all services with mesh UID "123". Service-identifier types - * and their attributes are described at - * https://cloud.google.com/monitoring/api/ref_v3/rest/v3/services#Service - * @param {number} request.pageSize - * A non-negative number that is the maximum number of results to return. - * When 0, use default page size. - * @param {string} request.pageToken - * If this field is not empty then it must contain the `nextPageToken` value - * returned by a previous call to this method. Using this field causes the - * method to return additional results from the previous method call. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.monitoring.v3.Service|Service} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listServicesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Equivalent to `listServices`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Resource name of the parent containing the listed services, + * either a [project](https://cloud.google.com/monitoring/api/v3#project_name) + * or a Monitoring Metrics Scope. The formats are: + * + * projects/[PROJECT_ID_OR_NUMBER] + * workspaces/[HOST_PROJECT_ID_OR_NUMBER] + * @param {string} request.filter + * A filter specifying what `Service`s to return. The filter supports + * filtering on a particular service-identifier type or one of its attributes. + * + * To filter on a particular service-identifier type, the `identifier_case` + * refers to which option in the `identifier` field is populated. For example, + * the filter `identifier_case = "CUSTOM"` would match all services with a + * value for the `custom` field. Valid options include "CUSTOM", "APP_ENGINE", + * "MESH_ISTIO", and the other options listed at + * https://cloud.google.com/monitoring/api/ref_v3/rest/v3/services#Service + * + * To filter on an attribute of a service-identifier type, apply the filter + * name by using the snake case of the service-identifier type and the + * attribute of that service-identifier type, and join the two with a period. + * For example, to filter by the `meshUid` field of the `MeshIstio` + * service-identifier type, you must filter on `mesh_istio.mesh_uid = + * "123"` to match all services with mesh UID "123". Service-identifier types + * and their attributes are described at + * https://cloud.google.com/monitoring/api/ref_v3/rest/v3/services#Service + * @param {number} request.pageSize + * A non-negative number that is the maximum number of results to return. + * When 0, use default page size. + * @param {string} request.pageToken + * If this field is not empty then it must contain the `nextPageToken` value + * returned by a previous call to this method. Using this field causes the + * method to return additional results from the previous method call. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.monitoring.v3.Service|Service} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listServicesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listServicesStream( - request?: protos.google.monitoring.v3.IListServicesRequest, - options?: CallOptions): - Transform{ + request?: protos.google.monitoring.v3.IListServicesRequest, + options?: CallOptions, + ): Transform { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listServices']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listServices stream %j', request); return this.descriptors.page.listServices.createStream( this.innerApiCalls.listServices as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `listServices`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Resource name of the parent containing the listed services, - * either a [project](https://cloud.google.com/monitoring/api/v3#project_name) - * or a Monitoring Metrics Scope. The formats are: - * - * projects/[PROJECT_ID_OR_NUMBER] - * workspaces/[HOST_PROJECT_ID_OR_NUMBER] - * @param {string} request.filter - * A filter specifying what `Service`s to return. The filter supports - * filtering on a particular service-identifier type or one of its attributes. - * - * To filter on a particular service-identifier type, the `identifier_case` - * refers to which option in the `identifier` field is populated. For example, - * the filter `identifier_case = "CUSTOM"` would match all services with a - * value for the `custom` field. Valid options include "CUSTOM", "APP_ENGINE", - * "MESH_ISTIO", and the other options listed at - * https://cloud.google.com/monitoring/api/ref_v3/rest/v3/services#Service - * - * To filter on an attribute of a service-identifier type, apply the filter - * name by using the snake case of the service-identifier type and the - * attribute of that service-identifier type, and join the two with a period. - * For example, to filter by the `meshUid` field of the `MeshIstio` - * service-identifier type, you must filter on `mesh_istio.mesh_uid = - * "123"` to match all services with mesh UID "123". Service-identifier types - * and their attributes are described at - * https://cloud.google.com/monitoring/api/ref_v3/rest/v3/services#Service - * @param {number} request.pageSize - * A non-negative number that is the maximum number of results to return. - * When 0, use default page size. - * @param {string} request.pageToken - * If this field is not empty then it must contain the `nextPageToken` value - * returned by a previous call to this method. Using this field causes the - * method to return additional results from the previous method call. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.monitoring.v3.Service|Service}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v3/service_monitoring_service.list_services.js - * region_tag:monitoring_v3_generated_ServiceMonitoringService_ListServices_async - */ + /** + * Equivalent to `listServices`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Resource name of the parent containing the listed services, + * either a [project](https://cloud.google.com/monitoring/api/v3#project_name) + * or a Monitoring Metrics Scope. The formats are: + * + * projects/[PROJECT_ID_OR_NUMBER] + * workspaces/[HOST_PROJECT_ID_OR_NUMBER] + * @param {string} request.filter + * A filter specifying what `Service`s to return. The filter supports + * filtering on a particular service-identifier type or one of its attributes. + * + * To filter on a particular service-identifier type, the `identifier_case` + * refers to which option in the `identifier` field is populated. For example, + * the filter `identifier_case = "CUSTOM"` would match all services with a + * value for the `custom` field. Valid options include "CUSTOM", "APP_ENGINE", + * "MESH_ISTIO", and the other options listed at + * https://cloud.google.com/monitoring/api/ref_v3/rest/v3/services#Service + * + * To filter on an attribute of a service-identifier type, apply the filter + * name by using the snake case of the service-identifier type and the + * attribute of that service-identifier type, and join the two with a period. + * For example, to filter by the `meshUid` field of the `MeshIstio` + * service-identifier type, you must filter on `mesh_istio.mesh_uid = + * "123"` to match all services with mesh UID "123". Service-identifier types + * and their attributes are described at + * https://cloud.google.com/monitoring/api/ref_v3/rest/v3/services#Service + * @param {number} request.pageSize + * A non-negative number that is the maximum number of results to return. + * When 0, use default page size. + * @param {string} request.pageToken + * If this field is not empty then it must contain the `nextPageToken` value + * returned by a previous call to this method. Using this field causes the + * method to return additional results from the previous method call. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.monitoring.v3.Service|Service}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v3/service_monitoring_service.list_services.js + * region_tag:monitoring_v3_generated_ServiceMonitoringService_ListServices_async + */ listServicesAsync( - request?: protos.google.monitoring.v3.IListServicesRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.monitoring.v3.IListServicesRequest, + options?: CallOptions, + ): AsyncIterable { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listServices']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listServices iterate %j', request); return this.descriptors.page.listServices.asyncIterate( this.innerApiCalls['listServices'] as GaxCall, request as {}, - callSettings + callSettings, ) as AsyncIterable; } - /** - * List the `ServiceLevelObjective`s for the given `Service`. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Resource name of the parent containing the listed SLOs, either a - * project or a Monitoring Metrics Scope. The formats are: - * - * projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID] - * workspaces/[HOST_PROJECT_ID_OR_NUMBER]/services/- - * @param {string} request.filter - * A filter specifying what `ServiceLevelObjective`s to return. - * @param {number} request.pageSize - * A non-negative number that is the maximum number of results to return. - * When 0, use default page size. - * @param {string} request.pageToken - * If this field is not empty then it must contain the `nextPageToken` value - * returned by a previous call to this method. Using this field causes the - * method to return additional results from the previous method call. - * @param {google.monitoring.v3.ServiceLevelObjective.View} request.view - * View of the `ServiceLevelObjective`s to return. If `DEFAULT`, return each - * `ServiceLevelObjective` as originally defined. If `EXPLICIT` and the - * `ServiceLevelObjective` is defined in terms of a `BasicSli`, replace the - * `BasicSli` with a `RequestBasedSli` spelling out how the SLI is computed. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of {@link protos.google.monitoring.v3.ServiceLevelObjective|ServiceLevelObjective}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listServiceLevelObjectivesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * List the `ServiceLevelObjective`s for the given `Service`. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Resource name of the parent containing the listed SLOs, either a + * project or a Monitoring Metrics Scope. The formats are: + * + * projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID] + * workspaces/[HOST_PROJECT_ID_OR_NUMBER]/services/- + * @param {string} request.filter + * A filter specifying what `ServiceLevelObjective`s to return. + * @param {number} request.pageSize + * A non-negative number that is the maximum number of results to return. + * When 0, use default page size. + * @param {string} request.pageToken + * If this field is not empty then it must contain the `nextPageToken` value + * returned by a previous call to this method. Using this field causes the + * method to return additional results from the previous method call. + * @param {google.monitoring.v3.ServiceLevelObjective.View} request.view + * View of the `ServiceLevelObjective`s to return. If `DEFAULT`, return each + * `ServiceLevelObjective` as originally defined. If `EXPLICIT` and the + * `ServiceLevelObjective` is defined in terms of a `BasicSli`, replace the + * `BasicSli` with a `RequestBasedSli` spelling out how the SLI is computed. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of {@link protos.google.monitoring.v3.ServiceLevelObjective|ServiceLevelObjective}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listServiceLevelObjectivesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listServiceLevelObjectives( - request?: protos.google.monitoring.v3.IListServiceLevelObjectivesRequest, - options?: CallOptions): - Promise<[ - protos.google.monitoring.v3.IServiceLevelObjective[], - protos.google.monitoring.v3.IListServiceLevelObjectivesRequest|null, - protos.google.monitoring.v3.IListServiceLevelObjectivesResponse - ]>; + request?: protos.google.monitoring.v3.IListServiceLevelObjectivesRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.monitoring.v3.IServiceLevelObjective[], + protos.google.monitoring.v3.IListServiceLevelObjectivesRequest | null, + protos.google.monitoring.v3.IListServiceLevelObjectivesResponse, + ] + >; listServiceLevelObjectives( - request: protos.google.monitoring.v3.IListServiceLevelObjectivesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.monitoring.v3.IListServiceLevelObjectivesRequest, - protos.google.monitoring.v3.IListServiceLevelObjectivesResponse|null|undefined, - protos.google.monitoring.v3.IServiceLevelObjective>): void; + request: protos.google.monitoring.v3.IListServiceLevelObjectivesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.monitoring.v3.IListServiceLevelObjectivesRequest, + | protos.google.monitoring.v3.IListServiceLevelObjectivesResponse + | null + | undefined, + protos.google.monitoring.v3.IServiceLevelObjective + >, + ): void; listServiceLevelObjectives( - request: protos.google.monitoring.v3.IListServiceLevelObjectivesRequest, - callback: PaginationCallback< - protos.google.monitoring.v3.IListServiceLevelObjectivesRequest, - protos.google.monitoring.v3.IListServiceLevelObjectivesResponse|null|undefined, - protos.google.monitoring.v3.IServiceLevelObjective>): void; + request: protos.google.monitoring.v3.IListServiceLevelObjectivesRequest, + callback: PaginationCallback< + protos.google.monitoring.v3.IListServiceLevelObjectivesRequest, + | protos.google.monitoring.v3.IListServiceLevelObjectivesResponse + | null + | undefined, + protos.google.monitoring.v3.IServiceLevelObjective + >, + ): void; listServiceLevelObjectives( - request?: protos.google.monitoring.v3.IListServiceLevelObjectivesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.monitoring.v3.IListServiceLevelObjectivesRequest, - protos.google.monitoring.v3.IListServiceLevelObjectivesResponse|null|undefined, - protos.google.monitoring.v3.IServiceLevelObjective>, - callback?: PaginationCallback< + request?: protos.google.monitoring.v3.IListServiceLevelObjectivesRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.monitoring.v3.IListServiceLevelObjectivesRequest, - protos.google.monitoring.v3.IListServiceLevelObjectivesResponse|null|undefined, - protos.google.monitoring.v3.IServiceLevelObjective>): - Promise<[ - protos.google.monitoring.v3.IServiceLevelObjective[], - protos.google.monitoring.v3.IListServiceLevelObjectivesRequest|null, - protos.google.monitoring.v3.IListServiceLevelObjectivesResponse - ]>|void { + | protos.google.monitoring.v3.IListServiceLevelObjectivesResponse + | null + | undefined, + protos.google.monitoring.v3.IServiceLevelObjective + >, + callback?: PaginationCallback< + protos.google.monitoring.v3.IListServiceLevelObjectivesRequest, + | protos.google.monitoring.v3.IListServiceLevelObjectivesResponse + | null + | undefined, + protos.google.monitoring.v3.IServiceLevelObjective + >, + ): Promise< + [ + protos.google.monitoring.v3.IServiceLevelObjective[], + protos.google.monitoring.v3.IListServiceLevelObjectivesRequest | null, + protos.google.monitoring.v3.IListServiceLevelObjectivesResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.monitoring.v3.IListServiceLevelObjectivesRequest, - protos.google.monitoring.v3.IListServiceLevelObjectivesResponse|null|undefined, - protos.google.monitoring.v3.IServiceLevelObjective>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.monitoring.v3.IListServiceLevelObjectivesRequest, + | protos.google.monitoring.v3.IListServiceLevelObjectivesResponse + | null + | undefined, + protos.google.monitoring.v3.IServiceLevelObjective + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('listServiceLevelObjectives values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -1586,134 +2010,138 @@ export class ServiceMonitoringServiceClient { this._log.info('listServiceLevelObjectives request %j', request); return this.innerApiCalls .listServiceLevelObjectives(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.monitoring.v3.IServiceLevelObjective[], - protos.google.monitoring.v3.IListServiceLevelObjectivesRequest|null, - protos.google.monitoring.v3.IListServiceLevelObjectivesResponse - ]) => { - this._log.info('listServiceLevelObjectives values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.monitoring.v3.IServiceLevelObjective[], + protos.google.monitoring.v3.IListServiceLevelObjectivesRequest | null, + protos.google.monitoring.v3.IListServiceLevelObjectivesResponse, + ]) => { + this._log.info('listServiceLevelObjectives values %j', response); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listServiceLevelObjectives`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Resource name of the parent containing the listed SLOs, either a - * project or a Monitoring Metrics Scope. The formats are: - * - * projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID] - * workspaces/[HOST_PROJECT_ID_OR_NUMBER]/services/- - * @param {string} request.filter - * A filter specifying what `ServiceLevelObjective`s to return. - * @param {number} request.pageSize - * A non-negative number that is the maximum number of results to return. - * When 0, use default page size. - * @param {string} request.pageToken - * If this field is not empty then it must contain the `nextPageToken` value - * returned by a previous call to this method. Using this field causes the - * method to return additional results from the previous method call. - * @param {google.monitoring.v3.ServiceLevelObjective.View} request.view - * View of the `ServiceLevelObjective`s to return. If `DEFAULT`, return each - * `ServiceLevelObjective` as originally defined. If `EXPLICIT` and the - * `ServiceLevelObjective` is defined in terms of a `BasicSli`, replace the - * `BasicSli` with a `RequestBasedSli` spelling out how the SLI is computed. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.monitoring.v3.ServiceLevelObjective|ServiceLevelObjective} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listServiceLevelObjectivesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Equivalent to `listServiceLevelObjectives`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Resource name of the parent containing the listed SLOs, either a + * project or a Monitoring Metrics Scope. The formats are: + * + * projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID] + * workspaces/[HOST_PROJECT_ID_OR_NUMBER]/services/- + * @param {string} request.filter + * A filter specifying what `ServiceLevelObjective`s to return. + * @param {number} request.pageSize + * A non-negative number that is the maximum number of results to return. + * When 0, use default page size. + * @param {string} request.pageToken + * If this field is not empty then it must contain the `nextPageToken` value + * returned by a previous call to this method. Using this field causes the + * method to return additional results from the previous method call. + * @param {google.monitoring.v3.ServiceLevelObjective.View} request.view + * View of the `ServiceLevelObjective`s to return. If `DEFAULT`, return each + * `ServiceLevelObjective` as originally defined. If `EXPLICIT` and the + * `ServiceLevelObjective` is defined in terms of a `BasicSli`, replace the + * `BasicSli` with a `RequestBasedSli` spelling out how the SLI is computed. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.monitoring.v3.ServiceLevelObjective|ServiceLevelObjective} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listServiceLevelObjectivesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listServiceLevelObjectivesStream( - request?: protos.google.monitoring.v3.IListServiceLevelObjectivesRequest, - options?: CallOptions): - Transform{ + request?: protos.google.monitoring.v3.IListServiceLevelObjectivesRequest, + options?: CallOptions, + ): Transform { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listServiceLevelObjectives']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listServiceLevelObjectives stream %j', request); return this.descriptors.page.listServiceLevelObjectives.createStream( this.innerApiCalls.listServiceLevelObjectives as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `listServiceLevelObjectives`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Resource name of the parent containing the listed SLOs, either a - * project or a Monitoring Metrics Scope. The formats are: - * - * projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID] - * workspaces/[HOST_PROJECT_ID_OR_NUMBER]/services/- - * @param {string} request.filter - * A filter specifying what `ServiceLevelObjective`s to return. - * @param {number} request.pageSize - * A non-negative number that is the maximum number of results to return. - * When 0, use default page size. - * @param {string} request.pageToken - * If this field is not empty then it must contain the `nextPageToken` value - * returned by a previous call to this method. Using this field causes the - * method to return additional results from the previous method call. - * @param {google.monitoring.v3.ServiceLevelObjective.View} request.view - * View of the `ServiceLevelObjective`s to return. If `DEFAULT`, return each - * `ServiceLevelObjective` as originally defined. If `EXPLICIT` and the - * `ServiceLevelObjective` is defined in terms of a `BasicSli`, replace the - * `BasicSli` with a `RequestBasedSli` spelling out how the SLI is computed. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.monitoring.v3.ServiceLevelObjective|ServiceLevelObjective}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v3/service_monitoring_service.list_service_level_objectives.js - * region_tag:monitoring_v3_generated_ServiceMonitoringService_ListServiceLevelObjectives_async - */ + /** + * Equivalent to `listServiceLevelObjectives`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Resource name of the parent containing the listed SLOs, either a + * project or a Monitoring Metrics Scope. The formats are: + * + * projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID] + * workspaces/[HOST_PROJECT_ID_OR_NUMBER]/services/- + * @param {string} request.filter + * A filter specifying what `ServiceLevelObjective`s to return. + * @param {number} request.pageSize + * A non-negative number that is the maximum number of results to return. + * When 0, use default page size. + * @param {string} request.pageToken + * If this field is not empty then it must contain the `nextPageToken` value + * returned by a previous call to this method. Using this field causes the + * method to return additional results from the previous method call. + * @param {google.monitoring.v3.ServiceLevelObjective.View} request.view + * View of the `ServiceLevelObjective`s to return. If `DEFAULT`, return each + * `ServiceLevelObjective` as originally defined. If `EXPLICIT` and the + * `ServiceLevelObjective` is defined in terms of a `BasicSli`, replace the + * `BasicSli` with a `RequestBasedSli` spelling out how the SLI is computed. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.monitoring.v3.ServiceLevelObjective|ServiceLevelObjective}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v3/service_monitoring_service.list_service_level_objectives.js + * region_tag:monitoring_v3_generated_ServiceMonitoringService_ListServiceLevelObjectives_async + */ listServiceLevelObjectivesAsync( - request?: protos.google.monitoring.v3.IListServiceLevelObjectivesRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.monitoring.v3.IListServiceLevelObjectivesRequest, + options?: CallOptions, + ): AsyncIterable { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listServiceLevelObjectives']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listServiceLevelObjectives iterate %j', request); return this.descriptors.page.listServiceLevelObjectives.asyncIterate( this.innerApiCalls['listServiceLevelObjectives'] as GaxCall, request as {}, - callSettings + callSettings, ) as AsyncIterable; } // -------------------- @@ -1727,7 +2155,7 @@ export class ServiceMonitoringServiceClient { * @param {string} alert_policy * @returns {string} Resource name string. */ - folderAlertPolicyPath(folder:string,alertPolicy:string) { + folderAlertPolicyPath(folder: string, alertPolicy: string) { return this.pathTemplates.folderAlertPolicyPathTemplate.render({ folder: folder, alert_policy: alertPolicy, @@ -1742,7 +2170,9 @@ export class ServiceMonitoringServiceClient { * @returns {string} A string representing the folder. */ matchFolderFromFolderAlertPolicyName(folderAlertPolicyName: string) { - return this.pathTemplates.folderAlertPolicyPathTemplate.match(folderAlertPolicyName).folder; + return this.pathTemplates.folderAlertPolicyPathTemplate.match( + folderAlertPolicyName, + ).folder; } /** @@ -1753,7 +2183,9 @@ export class ServiceMonitoringServiceClient { * @returns {string} A string representing the alert_policy. */ matchAlertPolicyFromFolderAlertPolicyName(folderAlertPolicyName: string) { - return this.pathTemplates.folderAlertPolicyPathTemplate.match(folderAlertPolicyName).alert_policy; + return this.pathTemplates.folderAlertPolicyPathTemplate.match( + folderAlertPolicyName, + ).alert_policy; } /** @@ -1764,7 +2196,11 @@ export class ServiceMonitoringServiceClient { * @param {string} condition * @returns {string} Resource name string. */ - folderAlertPolicyConditionPath(folder:string,alertPolicy:string,condition:string) { + folderAlertPolicyConditionPath( + folder: string, + alertPolicy: string, + condition: string, + ) { return this.pathTemplates.folderAlertPolicyConditionPathTemplate.render({ folder: folder, alert_policy: alertPolicy, @@ -1779,8 +2215,12 @@ export class ServiceMonitoringServiceClient { * A fully-qualified path representing folder_alert_policy_condition resource. * @returns {string} A string representing the folder. */ - matchFolderFromFolderAlertPolicyConditionName(folderAlertPolicyConditionName: string) { - return this.pathTemplates.folderAlertPolicyConditionPathTemplate.match(folderAlertPolicyConditionName).folder; + matchFolderFromFolderAlertPolicyConditionName( + folderAlertPolicyConditionName: string, + ) { + return this.pathTemplates.folderAlertPolicyConditionPathTemplate.match( + folderAlertPolicyConditionName, + ).folder; } /** @@ -1790,8 +2230,12 @@ export class ServiceMonitoringServiceClient { * A fully-qualified path representing folder_alert_policy_condition resource. * @returns {string} A string representing the alert_policy. */ - matchAlertPolicyFromFolderAlertPolicyConditionName(folderAlertPolicyConditionName: string) { - return this.pathTemplates.folderAlertPolicyConditionPathTemplate.match(folderAlertPolicyConditionName).alert_policy; + matchAlertPolicyFromFolderAlertPolicyConditionName( + folderAlertPolicyConditionName: string, + ) { + return this.pathTemplates.folderAlertPolicyConditionPathTemplate.match( + folderAlertPolicyConditionName, + ).alert_policy; } /** @@ -1801,8 +2245,12 @@ export class ServiceMonitoringServiceClient { * A fully-qualified path representing folder_alert_policy_condition resource. * @returns {string} A string representing the condition. */ - matchConditionFromFolderAlertPolicyConditionName(folderAlertPolicyConditionName: string) { - return this.pathTemplates.folderAlertPolicyConditionPathTemplate.match(folderAlertPolicyConditionName).condition; + matchConditionFromFolderAlertPolicyConditionName( + folderAlertPolicyConditionName: string, + ) { + return this.pathTemplates.folderAlertPolicyConditionPathTemplate.match( + folderAlertPolicyConditionName, + ).condition; } /** @@ -1812,7 +2260,7 @@ export class ServiceMonitoringServiceClient { * @param {string} channel_descriptor * @returns {string} Resource name string. */ - folderChannelDescriptorPath(folder:string,channelDescriptor:string) { + folderChannelDescriptorPath(folder: string, channelDescriptor: string) { return this.pathTemplates.folderChannelDescriptorPathTemplate.render({ folder: folder, channel_descriptor: channelDescriptor, @@ -1826,8 +2274,12 @@ export class ServiceMonitoringServiceClient { * A fully-qualified path representing folder_channel_descriptor resource. * @returns {string} A string representing the folder. */ - matchFolderFromFolderChannelDescriptorName(folderChannelDescriptorName: string) { - return this.pathTemplates.folderChannelDescriptorPathTemplate.match(folderChannelDescriptorName).folder; + matchFolderFromFolderChannelDescriptorName( + folderChannelDescriptorName: string, + ) { + return this.pathTemplates.folderChannelDescriptorPathTemplate.match( + folderChannelDescriptorName, + ).folder; } /** @@ -1837,8 +2289,12 @@ export class ServiceMonitoringServiceClient { * A fully-qualified path representing folder_channel_descriptor resource. * @returns {string} A string representing the channel_descriptor. */ - matchChannelDescriptorFromFolderChannelDescriptorName(folderChannelDescriptorName: string) { - return this.pathTemplates.folderChannelDescriptorPathTemplate.match(folderChannelDescriptorName).channel_descriptor; + matchChannelDescriptorFromFolderChannelDescriptorName( + folderChannelDescriptorName: string, + ) { + return this.pathTemplates.folderChannelDescriptorPathTemplate.match( + folderChannelDescriptorName, + ).channel_descriptor; } /** @@ -1848,7 +2304,7 @@ export class ServiceMonitoringServiceClient { * @param {string} group * @returns {string} Resource name string. */ - folderGroupPath(folder:string,group:string) { + folderGroupPath(folder: string, group: string) { return this.pathTemplates.folderGroupPathTemplate.render({ folder: folder, group: group, @@ -1863,7 +2319,8 @@ export class ServiceMonitoringServiceClient { * @returns {string} A string representing the folder. */ matchFolderFromFolderGroupName(folderGroupName: string) { - return this.pathTemplates.folderGroupPathTemplate.match(folderGroupName).folder; + return this.pathTemplates.folderGroupPathTemplate.match(folderGroupName) + .folder; } /** @@ -1874,7 +2331,8 @@ export class ServiceMonitoringServiceClient { * @returns {string} A string representing the group. */ matchGroupFromFolderGroupName(folderGroupName: string) { - return this.pathTemplates.folderGroupPathTemplate.match(folderGroupName).group; + return this.pathTemplates.folderGroupPathTemplate.match(folderGroupName) + .group; } /** @@ -1884,7 +2342,7 @@ export class ServiceMonitoringServiceClient { * @param {string} notification_channel * @returns {string} Resource name string. */ - folderNotificationChannelPath(folder:string,notificationChannel:string) { + folderNotificationChannelPath(folder: string, notificationChannel: string) { return this.pathTemplates.folderNotificationChannelPathTemplate.render({ folder: folder, notification_channel: notificationChannel, @@ -1898,8 +2356,12 @@ export class ServiceMonitoringServiceClient { * A fully-qualified path representing folder_notification_channel resource. * @returns {string} A string representing the folder. */ - matchFolderFromFolderNotificationChannelName(folderNotificationChannelName: string) { - return this.pathTemplates.folderNotificationChannelPathTemplate.match(folderNotificationChannelName).folder; + matchFolderFromFolderNotificationChannelName( + folderNotificationChannelName: string, + ) { + return this.pathTemplates.folderNotificationChannelPathTemplate.match( + folderNotificationChannelName, + ).folder; } /** @@ -1909,8 +2371,12 @@ export class ServiceMonitoringServiceClient { * A fully-qualified path representing folder_notification_channel resource. * @returns {string} A string representing the notification_channel. */ - matchNotificationChannelFromFolderNotificationChannelName(folderNotificationChannelName: string) { - return this.pathTemplates.folderNotificationChannelPathTemplate.match(folderNotificationChannelName).notification_channel; + matchNotificationChannelFromFolderNotificationChannelName( + folderNotificationChannelName: string, + ) { + return this.pathTemplates.folderNotificationChannelPathTemplate.match( + folderNotificationChannelName, + ).notification_channel; } /** @@ -1920,7 +2386,7 @@ export class ServiceMonitoringServiceClient { * @param {string} service * @returns {string} Resource name string. */ - folderServicePath(folder:string,service:string) { + folderServicePath(folder: string, service: string) { return this.pathTemplates.folderServicePathTemplate.render({ folder: folder, service: service, @@ -1935,7 +2401,8 @@ export class ServiceMonitoringServiceClient { * @returns {string} A string representing the folder. */ matchFolderFromFolderServiceName(folderServiceName: string) { - return this.pathTemplates.folderServicePathTemplate.match(folderServiceName).folder; + return this.pathTemplates.folderServicePathTemplate.match(folderServiceName) + .folder; } /** @@ -1946,7 +2413,8 @@ export class ServiceMonitoringServiceClient { * @returns {string} A string representing the service. */ matchServiceFromFolderServiceName(folderServiceName: string) { - return this.pathTemplates.folderServicePathTemplate.match(folderServiceName).service; + return this.pathTemplates.folderServicePathTemplate.match(folderServiceName) + .service; } /** @@ -1957,12 +2425,18 @@ export class ServiceMonitoringServiceClient { * @param {string} service_level_objective * @returns {string} Resource name string. */ - folderServiceServiceLevelObjectivePath(folder:string,service:string,serviceLevelObjective:string) { - return this.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.render({ - folder: folder, - service: service, - service_level_objective: serviceLevelObjective, - }); + folderServiceServiceLevelObjectivePath( + folder: string, + service: string, + serviceLevelObjective: string, + ) { + return this.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.render( + { + folder: folder, + service: service, + service_level_objective: serviceLevelObjective, + }, + ); } /** @@ -1972,8 +2446,12 @@ export class ServiceMonitoringServiceClient { * A fully-qualified path representing folder_service_service_level_objective resource. * @returns {string} A string representing the folder. */ - matchFolderFromFolderServiceServiceLevelObjectiveName(folderServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match(folderServiceServiceLevelObjectiveName).folder; + matchFolderFromFolderServiceServiceLevelObjectiveName( + folderServiceServiceLevelObjectiveName: string, + ) { + return this.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match( + folderServiceServiceLevelObjectiveName, + ).folder; } /** @@ -1983,8 +2461,12 @@ export class ServiceMonitoringServiceClient { * A fully-qualified path representing folder_service_service_level_objective resource. * @returns {string} A string representing the service. */ - matchServiceFromFolderServiceServiceLevelObjectiveName(folderServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match(folderServiceServiceLevelObjectiveName).service; + matchServiceFromFolderServiceServiceLevelObjectiveName( + folderServiceServiceLevelObjectiveName: string, + ) { + return this.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match( + folderServiceServiceLevelObjectiveName, + ).service; } /** @@ -1994,8 +2476,12 @@ export class ServiceMonitoringServiceClient { * A fully-qualified path representing folder_service_service_level_objective resource. * @returns {string} A string representing the service_level_objective. */ - matchServiceLevelObjectiveFromFolderServiceServiceLevelObjectiveName(folderServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match(folderServiceServiceLevelObjectiveName).service_level_objective; + matchServiceLevelObjectiveFromFolderServiceServiceLevelObjectiveName( + folderServiceServiceLevelObjectiveName: string, + ) { + return this.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match( + folderServiceServiceLevelObjectiveName, + ).service_level_objective; } /** @@ -2005,7 +2491,7 @@ export class ServiceMonitoringServiceClient { * @param {string} uptime_check_config * @returns {string} Resource name string. */ - folderUptimeCheckConfigPath(folder:string,uptimeCheckConfig:string) { + folderUptimeCheckConfigPath(folder: string, uptimeCheckConfig: string) { return this.pathTemplates.folderUptimeCheckConfigPathTemplate.render({ folder: folder, uptime_check_config: uptimeCheckConfig, @@ -2019,8 +2505,12 @@ export class ServiceMonitoringServiceClient { * A fully-qualified path representing folder_uptime_check_config resource. * @returns {string} A string representing the folder. */ - matchFolderFromFolderUptimeCheckConfigName(folderUptimeCheckConfigName: string) { - return this.pathTemplates.folderUptimeCheckConfigPathTemplate.match(folderUptimeCheckConfigName).folder; + matchFolderFromFolderUptimeCheckConfigName( + folderUptimeCheckConfigName: string, + ) { + return this.pathTemplates.folderUptimeCheckConfigPathTemplate.match( + folderUptimeCheckConfigName, + ).folder; } /** @@ -2030,8 +2520,12 @@ export class ServiceMonitoringServiceClient { * A fully-qualified path representing folder_uptime_check_config resource. * @returns {string} A string representing the uptime_check_config. */ - matchUptimeCheckConfigFromFolderUptimeCheckConfigName(folderUptimeCheckConfigName: string) { - return this.pathTemplates.folderUptimeCheckConfigPathTemplate.match(folderUptimeCheckConfigName).uptime_check_config; + matchUptimeCheckConfigFromFolderUptimeCheckConfigName( + folderUptimeCheckConfigName: string, + ) { + return this.pathTemplates.folderUptimeCheckConfigPathTemplate.match( + folderUptimeCheckConfigName, + ).uptime_check_config; } /** @@ -2041,7 +2535,7 @@ export class ServiceMonitoringServiceClient { * @param {string} alert_policy * @returns {string} Resource name string. */ - organizationAlertPolicyPath(organization:string,alertPolicy:string) { + organizationAlertPolicyPath(organization: string, alertPolicy: string) { return this.pathTemplates.organizationAlertPolicyPathTemplate.render({ organization: organization, alert_policy: alertPolicy, @@ -2055,8 +2549,12 @@ export class ServiceMonitoringServiceClient { * A fully-qualified path representing organization_alert_policy resource. * @returns {string} A string representing the organization. */ - matchOrganizationFromOrganizationAlertPolicyName(organizationAlertPolicyName: string) { - return this.pathTemplates.organizationAlertPolicyPathTemplate.match(organizationAlertPolicyName).organization; + matchOrganizationFromOrganizationAlertPolicyName( + organizationAlertPolicyName: string, + ) { + return this.pathTemplates.organizationAlertPolicyPathTemplate.match( + organizationAlertPolicyName, + ).organization; } /** @@ -2066,8 +2564,12 @@ export class ServiceMonitoringServiceClient { * A fully-qualified path representing organization_alert_policy resource. * @returns {string} A string representing the alert_policy. */ - matchAlertPolicyFromOrganizationAlertPolicyName(organizationAlertPolicyName: string) { - return this.pathTemplates.organizationAlertPolicyPathTemplate.match(organizationAlertPolicyName).alert_policy; + matchAlertPolicyFromOrganizationAlertPolicyName( + organizationAlertPolicyName: string, + ) { + return this.pathTemplates.organizationAlertPolicyPathTemplate.match( + organizationAlertPolicyName, + ).alert_policy; } /** @@ -2078,12 +2580,18 @@ export class ServiceMonitoringServiceClient { * @param {string} condition * @returns {string} Resource name string. */ - organizationAlertPolicyConditionPath(organization:string,alertPolicy:string,condition:string) { - return this.pathTemplates.organizationAlertPolicyConditionPathTemplate.render({ - organization: organization, - alert_policy: alertPolicy, - condition: condition, - }); + organizationAlertPolicyConditionPath( + organization: string, + alertPolicy: string, + condition: string, + ) { + return this.pathTemplates.organizationAlertPolicyConditionPathTemplate.render( + { + organization: organization, + alert_policy: alertPolicy, + condition: condition, + }, + ); } /** @@ -2093,8 +2601,12 @@ export class ServiceMonitoringServiceClient { * A fully-qualified path representing organization_alert_policy_condition resource. * @returns {string} A string representing the organization. */ - matchOrganizationFromOrganizationAlertPolicyConditionName(organizationAlertPolicyConditionName: string) { - return this.pathTemplates.organizationAlertPolicyConditionPathTemplate.match(organizationAlertPolicyConditionName).organization; + matchOrganizationFromOrganizationAlertPolicyConditionName( + organizationAlertPolicyConditionName: string, + ) { + return this.pathTemplates.organizationAlertPolicyConditionPathTemplate.match( + organizationAlertPolicyConditionName, + ).organization; } /** @@ -2104,8 +2616,12 @@ export class ServiceMonitoringServiceClient { * A fully-qualified path representing organization_alert_policy_condition resource. * @returns {string} A string representing the alert_policy. */ - matchAlertPolicyFromOrganizationAlertPolicyConditionName(organizationAlertPolicyConditionName: string) { - return this.pathTemplates.organizationAlertPolicyConditionPathTemplate.match(organizationAlertPolicyConditionName).alert_policy; + matchAlertPolicyFromOrganizationAlertPolicyConditionName( + organizationAlertPolicyConditionName: string, + ) { + return this.pathTemplates.organizationAlertPolicyConditionPathTemplate.match( + organizationAlertPolicyConditionName, + ).alert_policy; } /** @@ -2115,8 +2631,12 @@ export class ServiceMonitoringServiceClient { * A fully-qualified path representing organization_alert_policy_condition resource. * @returns {string} A string representing the condition. */ - matchConditionFromOrganizationAlertPolicyConditionName(organizationAlertPolicyConditionName: string) { - return this.pathTemplates.organizationAlertPolicyConditionPathTemplate.match(organizationAlertPolicyConditionName).condition; + matchConditionFromOrganizationAlertPolicyConditionName( + organizationAlertPolicyConditionName: string, + ) { + return this.pathTemplates.organizationAlertPolicyConditionPathTemplate.match( + organizationAlertPolicyConditionName, + ).condition; } /** @@ -2126,7 +2646,10 @@ export class ServiceMonitoringServiceClient { * @param {string} channel_descriptor * @returns {string} Resource name string. */ - organizationChannelDescriptorPath(organization:string,channelDescriptor:string) { + organizationChannelDescriptorPath( + organization: string, + channelDescriptor: string, + ) { return this.pathTemplates.organizationChannelDescriptorPathTemplate.render({ organization: organization, channel_descriptor: channelDescriptor, @@ -2140,8 +2663,12 @@ export class ServiceMonitoringServiceClient { * A fully-qualified path representing organization_channel_descriptor resource. * @returns {string} A string representing the organization. */ - matchOrganizationFromOrganizationChannelDescriptorName(organizationChannelDescriptorName: string) { - return this.pathTemplates.organizationChannelDescriptorPathTemplate.match(organizationChannelDescriptorName).organization; + matchOrganizationFromOrganizationChannelDescriptorName( + organizationChannelDescriptorName: string, + ) { + return this.pathTemplates.organizationChannelDescriptorPathTemplate.match( + organizationChannelDescriptorName, + ).organization; } /** @@ -2151,8 +2678,12 @@ export class ServiceMonitoringServiceClient { * A fully-qualified path representing organization_channel_descriptor resource. * @returns {string} A string representing the channel_descriptor. */ - matchChannelDescriptorFromOrganizationChannelDescriptorName(organizationChannelDescriptorName: string) { - return this.pathTemplates.organizationChannelDescriptorPathTemplate.match(organizationChannelDescriptorName).channel_descriptor; + matchChannelDescriptorFromOrganizationChannelDescriptorName( + organizationChannelDescriptorName: string, + ) { + return this.pathTemplates.organizationChannelDescriptorPathTemplate.match( + organizationChannelDescriptorName, + ).channel_descriptor; } /** @@ -2162,7 +2693,7 @@ export class ServiceMonitoringServiceClient { * @param {string} group * @returns {string} Resource name string. */ - organizationGroupPath(organization:string,group:string) { + organizationGroupPath(organization: string, group: string) { return this.pathTemplates.organizationGroupPathTemplate.render({ organization: organization, group: group, @@ -2177,7 +2708,9 @@ export class ServiceMonitoringServiceClient { * @returns {string} A string representing the organization. */ matchOrganizationFromOrganizationGroupName(organizationGroupName: string) { - return this.pathTemplates.organizationGroupPathTemplate.match(organizationGroupName).organization; + return this.pathTemplates.organizationGroupPathTemplate.match( + organizationGroupName, + ).organization; } /** @@ -2188,7 +2721,9 @@ export class ServiceMonitoringServiceClient { * @returns {string} A string representing the group. */ matchGroupFromOrganizationGroupName(organizationGroupName: string) { - return this.pathTemplates.organizationGroupPathTemplate.match(organizationGroupName).group; + return this.pathTemplates.organizationGroupPathTemplate.match( + organizationGroupName, + ).group; } /** @@ -2198,11 +2733,16 @@ export class ServiceMonitoringServiceClient { * @param {string} notification_channel * @returns {string} Resource name string. */ - organizationNotificationChannelPath(organization:string,notificationChannel:string) { - return this.pathTemplates.organizationNotificationChannelPathTemplate.render({ - organization: organization, - notification_channel: notificationChannel, - }); + organizationNotificationChannelPath( + organization: string, + notificationChannel: string, + ) { + return this.pathTemplates.organizationNotificationChannelPathTemplate.render( + { + organization: organization, + notification_channel: notificationChannel, + }, + ); } /** @@ -2212,8 +2752,12 @@ export class ServiceMonitoringServiceClient { * A fully-qualified path representing organization_notification_channel resource. * @returns {string} A string representing the organization. */ - matchOrganizationFromOrganizationNotificationChannelName(organizationNotificationChannelName: string) { - return this.pathTemplates.organizationNotificationChannelPathTemplate.match(organizationNotificationChannelName).organization; + matchOrganizationFromOrganizationNotificationChannelName( + organizationNotificationChannelName: string, + ) { + return this.pathTemplates.organizationNotificationChannelPathTemplate.match( + organizationNotificationChannelName, + ).organization; } /** @@ -2223,8 +2767,12 @@ export class ServiceMonitoringServiceClient { * A fully-qualified path representing organization_notification_channel resource. * @returns {string} A string representing the notification_channel. */ - matchNotificationChannelFromOrganizationNotificationChannelName(organizationNotificationChannelName: string) { - return this.pathTemplates.organizationNotificationChannelPathTemplate.match(organizationNotificationChannelName).notification_channel; + matchNotificationChannelFromOrganizationNotificationChannelName( + organizationNotificationChannelName: string, + ) { + return this.pathTemplates.organizationNotificationChannelPathTemplate.match( + organizationNotificationChannelName, + ).notification_channel; } /** @@ -2234,7 +2782,7 @@ export class ServiceMonitoringServiceClient { * @param {string} service * @returns {string} Resource name string. */ - organizationServicePath(organization:string,service:string) { + organizationServicePath(organization: string, service: string) { return this.pathTemplates.organizationServicePathTemplate.render({ organization: organization, service: service, @@ -2248,8 +2796,12 @@ export class ServiceMonitoringServiceClient { * A fully-qualified path representing organization_service resource. * @returns {string} A string representing the organization. */ - matchOrganizationFromOrganizationServiceName(organizationServiceName: string) { - return this.pathTemplates.organizationServicePathTemplate.match(organizationServiceName).organization; + matchOrganizationFromOrganizationServiceName( + organizationServiceName: string, + ) { + return this.pathTemplates.organizationServicePathTemplate.match( + organizationServiceName, + ).organization; } /** @@ -2260,7 +2812,9 @@ export class ServiceMonitoringServiceClient { * @returns {string} A string representing the service. */ matchServiceFromOrganizationServiceName(organizationServiceName: string) { - return this.pathTemplates.organizationServicePathTemplate.match(organizationServiceName).service; + return this.pathTemplates.organizationServicePathTemplate.match( + organizationServiceName, + ).service; } /** @@ -2271,12 +2825,18 @@ export class ServiceMonitoringServiceClient { * @param {string} service_level_objective * @returns {string} Resource name string. */ - organizationServiceServiceLevelObjectivePath(organization:string,service:string,serviceLevelObjective:string) { - return this.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.render({ - organization: organization, - service: service, - service_level_objective: serviceLevelObjective, - }); + organizationServiceServiceLevelObjectivePath( + organization: string, + service: string, + serviceLevelObjective: string, + ) { + return this.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.render( + { + organization: organization, + service: service, + service_level_objective: serviceLevelObjective, + }, + ); } /** @@ -2286,8 +2846,12 @@ export class ServiceMonitoringServiceClient { * A fully-qualified path representing organization_service_service_level_objective resource. * @returns {string} A string representing the organization. */ - matchOrganizationFromOrganizationServiceServiceLevelObjectiveName(organizationServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match(organizationServiceServiceLevelObjectiveName).organization; + matchOrganizationFromOrganizationServiceServiceLevelObjectiveName( + organizationServiceServiceLevelObjectiveName: string, + ) { + return this.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match( + organizationServiceServiceLevelObjectiveName, + ).organization; } /** @@ -2297,8 +2861,12 @@ export class ServiceMonitoringServiceClient { * A fully-qualified path representing organization_service_service_level_objective resource. * @returns {string} A string representing the service. */ - matchServiceFromOrganizationServiceServiceLevelObjectiveName(organizationServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match(organizationServiceServiceLevelObjectiveName).service; + matchServiceFromOrganizationServiceServiceLevelObjectiveName( + organizationServiceServiceLevelObjectiveName: string, + ) { + return this.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match( + organizationServiceServiceLevelObjectiveName, + ).service; } /** @@ -2308,8 +2876,12 @@ export class ServiceMonitoringServiceClient { * A fully-qualified path representing organization_service_service_level_objective resource. * @returns {string} A string representing the service_level_objective. */ - matchServiceLevelObjectiveFromOrganizationServiceServiceLevelObjectiveName(organizationServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match(organizationServiceServiceLevelObjectiveName).service_level_objective; + matchServiceLevelObjectiveFromOrganizationServiceServiceLevelObjectiveName( + organizationServiceServiceLevelObjectiveName: string, + ) { + return this.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match( + organizationServiceServiceLevelObjectiveName, + ).service_level_objective; } /** @@ -2319,7 +2891,10 @@ export class ServiceMonitoringServiceClient { * @param {string} uptime_check_config * @returns {string} Resource name string. */ - organizationUptimeCheckConfigPath(organization:string,uptimeCheckConfig:string) { + organizationUptimeCheckConfigPath( + organization: string, + uptimeCheckConfig: string, + ) { return this.pathTemplates.organizationUptimeCheckConfigPathTemplate.render({ organization: organization, uptime_check_config: uptimeCheckConfig, @@ -2333,8 +2908,12 @@ export class ServiceMonitoringServiceClient { * A fully-qualified path representing organization_uptime_check_config resource. * @returns {string} A string representing the organization. */ - matchOrganizationFromOrganizationUptimeCheckConfigName(organizationUptimeCheckConfigName: string) { - return this.pathTemplates.organizationUptimeCheckConfigPathTemplate.match(organizationUptimeCheckConfigName).organization; + matchOrganizationFromOrganizationUptimeCheckConfigName( + organizationUptimeCheckConfigName: string, + ) { + return this.pathTemplates.organizationUptimeCheckConfigPathTemplate.match( + organizationUptimeCheckConfigName, + ).organization; } /** @@ -2344,8 +2923,12 @@ export class ServiceMonitoringServiceClient { * A fully-qualified path representing organization_uptime_check_config resource. * @returns {string} A string representing the uptime_check_config. */ - matchUptimeCheckConfigFromOrganizationUptimeCheckConfigName(organizationUptimeCheckConfigName: string) { - return this.pathTemplates.organizationUptimeCheckConfigPathTemplate.match(organizationUptimeCheckConfigName).uptime_check_config; + matchUptimeCheckConfigFromOrganizationUptimeCheckConfigName( + organizationUptimeCheckConfigName: string, + ) { + return this.pathTemplates.organizationUptimeCheckConfigPathTemplate.match( + organizationUptimeCheckConfigName, + ).uptime_check_config; } /** @@ -2354,7 +2937,7 @@ export class ServiceMonitoringServiceClient { * @param {string} project * @returns {string} Resource name string. */ - projectPath(project:string) { + projectPath(project: string) { return this.pathTemplates.projectPathTemplate.render({ project: project, }); @@ -2378,7 +2961,7 @@ export class ServiceMonitoringServiceClient { * @param {string} alert_policy * @returns {string} Resource name string. */ - projectAlertPolicyPath(project:string,alertPolicy:string) { + projectAlertPolicyPath(project: string, alertPolicy: string) { return this.pathTemplates.projectAlertPolicyPathTemplate.render({ project: project, alert_policy: alertPolicy, @@ -2393,7 +2976,9 @@ export class ServiceMonitoringServiceClient { * @returns {string} A string representing the project. */ matchProjectFromProjectAlertPolicyName(projectAlertPolicyName: string) { - return this.pathTemplates.projectAlertPolicyPathTemplate.match(projectAlertPolicyName).project; + return this.pathTemplates.projectAlertPolicyPathTemplate.match( + projectAlertPolicyName, + ).project; } /** @@ -2404,7 +2989,9 @@ export class ServiceMonitoringServiceClient { * @returns {string} A string representing the alert_policy. */ matchAlertPolicyFromProjectAlertPolicyName(projectAlertPolicyName: string) { - return this.pathTemplates.projectAlertPolicyPathTemplate.match(projectAlertPolicyName).alert_policy; + return this.pathTemplates.projectAlertPolicyPathTemplate.match( + projectAlertPolicyName, + ).alert_policy; } /** @@ -2415,7 +3002,11 @@ export class ServiceMonitoringServiceClient { * @param {string} condition * @returns {string} Resource name string. */ - projectAlertPolicyConditionPath(project:string,alertPolicy:string,condition:string) { + projectAlertPolicyConditionPath( + project: string, + alertPolicy: string, + condition: string, + ) { return this.pathTemplates.projectAlertPolicyConditionPathTemplate.render({ project: project, alert_policy: alertPolicy, @@ -2430,8 +3021,12 @@ export class ServiceMonitoringServiceClient { * A fully-qualified path representing project_alert_policy_condition resource. * @returns {string} A string representing the project. */ - matchProjectFromProjectAlertPolicyConditionName(projectAlertPolicyConditionName: string) { - return this.pathTemplates.projectAlertPolicyConditionPathTemplate.match(projectAlertPolicyConditionName).project; + matchProjectFromProjectAlertPolicyConditionName( + projectAlertPolicyConditionName: string, + ) { + return this.pathTemplates.projectAlertPolicyConditionPathTemplate.match( + projectAlertPolicyConditionName, + ).project; } /** @@ -2441,8 +3036,12 @@ export class ServiceMonitoringServiceClient { * A fully-qualified path representing project_alert_policy_condition resource. * @returns {string} A string representing the alert_policy. */ - matchAlertPolicyFromProjectAlertPolicyConditionName(projectAlertPolicyConditionName: string) { - return this.pathTemplates.projectAlertPolicyConditionPathTemplate.match(projectAlertPolicyConditionName).alert_policy; + matchAlertPolicyFromProjectAlertPolicyConditionName( + projectAlertPolicyConditionName: string, + ) { + return this.pathTemplates.projectAlertPolicyConditionPathTemplate.match( + projectAlertPolicyConditionName, + ).alert_policy; } /** @@ -2452,8 +3051,12 @@ export class ServiceMonitoringServiceClient { * A fully-qualified path representing project_alert_policy_condition resource. * @returns {string} A string representing the condition. */ - matchConditionFromProjectAlertPolicyConditionName(projectAlertPolicyConditionName: string) { - return this.pathTemplates.projectAlertPolicyConditionPathTemplate.match(projectAlertPolicyConditionName).condition; + matchConditionFromProjectAlertPolicyConditionName( + projectAlertPolicyConditionName: string, + ) { + return this.pathTemplates.projectAlertPolicyConditionPathTemplate.match( + projectAlertPolicyConditionName, + ).condition; } /** @@ -2463,7 +3066,7 @@ export class ServiceMonitoringServiceClient { * @param {string} channel_descriptor * @returns {string} Resource name string. */ - projectChannelDescriptorPath(project:string,channelDescriptor:string) { + projectChannelDescriptorPath(project: string, channelDescriptor: string) { return this.pathTemplates.projectChannelDescriptorPathTemplate.render({ project: project, channel_descriptor: channelDescriptor, @@ -2477,8 +3080,12 @@ export class ServiceMonitoringServiceClient { * A fully-qualified path representing project_channel_descriptor resource. * @returns {string} A string representing the project. */ - matchProjectFromProjectChannelDescriptorName(projectChannelDescriptorName: string) { - return this.pathTemplates.projectChannelDescriptorPathTemplate.match(projectChannelDescriptorName).project; + matchProjectFromProjectChannelDescriptorName( + projectChannelDescriptorName: string, + ) { + return this.pathTemplates.projectChannelDescriptorPathTemplate.match( + projectChannelDescriptorName, + ).project; } /** @@ -2488,8 +3095,12 @@ export class ServiceMonitoringServiceClient { * A fully-qualified path representing project_channel_descriptor resource. * @returns {string} A string representing the channel_descriptor. */ - matchChannelDescriptorFromProjectChannelDescriptorName(projectChannelDescriptorName: string) { - return this.pathTemplates.projectChannelDescriptorPathTemplate.match(projectChannelDescriptorName).channel_descriptor; + matchChannelDescriptorFromProjectChannelDescriptorName( + projectChannelDescriptorName: string, + ) { + return this.pathTemplates.projectChannelDescriptorPathTemplate.match( + projectChannelDescriptorName, + ).channel_descriptor; } /** @@ -2499,7 +3110,7 @@ export class ServiceMonitoringServiceClient { * @param {string} group * @returns {string} Resource name string. */ - projectGroupPath(project:string,group:string) { + projectGroupPath(project: string, group: string) { return this.pathTemplates.projectGroupPathTemplate.render({ project: project, group: group, @@ -2514,7 +3125,8 @@ export class ServiceMonitoringServiceClient { * @returns {string} A string representing the project. */ matchProjectFromProjectGroupName(projectGroupName: string) { - return this.pathTemplates.projectGroupPathTemplate.match(projectGroupName).project; + return this.pathTemplates.projectGroupPathTemplate.match(projectGroupName) + .project; } /** @@ -2525,7 +3137,8 @@ export class ServiceMonitoringServiceClient { * @returns {string} A string representing the group. */ matchGroupFromProjectGroupName(projectGroupName: string) { - return this.pathTemplates.projectGroupPathTemplate.match(projectGroupName).group; + return this.pathTemplates.projectGroupPathTemplate.match(projectGroupName) + .group; } /** @@ -2535,7 +3148,7 @@ export class ServiceMonitoringServiceClient { * @param {string} notification_channel * @returns {string} Resource name string. */ - projectNotificationChannelPath(project:string,notificationChannel:string) { + projectNotificationChannelPath(project: string, notificationChannel: string) { return this.pathTemplates.projectNotificationChannelPathTemplate.render({ project: project, notification_channel: notificationChannel, @@ -2549,8 +3162,12 @@ export class ServiceMonitoringServiceClient { * A fully-qualified path representing project_notification_channel resource. * @returns {string} A string representing the project. */ - matchProjectFromProjectNotificationChannelName(projectNotificationChannelName: string) { - return this.pathTemplates.projectNotificationChannelPathTemplate.match(projectNotificationChannelName).project; + matchProjectFromProjectNotificationChannelName( + projectNotificationChannelName: string, + ) { + return this.pathTemplates.projectNotificationChannelPathTemplate.match( + projectNotificationChannelName, + ).project; } /** @@ -2560,8 +3177,12 @@ export class ServiceMonitoringServiceClient { * A fully-qualified path representing project_notification_channel resource. * @returns {string} A string representing the notification_channel. */ - matchNotificationChannelFromProjectNotificationChannelName(projectNotificationChannelName: string) { - return this.pathTemplates.projectNotificationChannelPathTemplate.match(projectNotificationChannelName).notification_channel; + matchNotificationChannelFromProjectNotificationChannelName( + projectNotificationChannelName: string, + ) { + return this.pathTemplates.projectNotificationChannelPathTemplate.match( + projectNotificationChannelName, + ).notification_channel; } /** @@ -2571,7 +3192,7 @@ export class ServiceMonitoringServiceClient { * @param {string} service * @returns {string} Resource name string. */ - projectServicePath(project:string,service:string) { + projectServicePath(project: string, service: string) { return this.pathTemplates.projectServicePathTemplate.render({ project: project, service: service, @@ -2586,7 +3207,9 @@ export class ServiceMonitoringServiceClient { * @returns {string} A string representing the project. */ matchProjectFromProjectServiceName(projectServiceName: string) { - return this.pathTemplates.projectServicePathTemplate.match(projectServiceName).project; + return this.pathTemplates.projectServicePathTemplate.match( + projectServiceName, + ).project; } /** @@ -2597,7 +3220,9 @@ export class ServiceMonitoringServiceClient { * @returns {string} A string representing the service. */ matchServiceFromProjectServiceName(projectServiceName: string) { - return this.pathTemplates.projectServicePathTemplate.match(projectServiceName).service; + return this.pathTemplates.projectServicePathTemplate.match( + projectServiceName, + ).service; } /** @@ -2608,12 +3233,18 @@ export class ServiceMonitoringServiceClient { * @param {string} service_level_objective * @returns {string} Resource name string. */ - projectServiceServiceLevelObjectivePath(project:string,service:string,serviceLevelObjective:string) { - return this.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.render({ - project: project, - service: service, - service_level_objective: serviceLevelObjective, - }); + projectServiceServiceLevelObjectivePath( + project: string, + service: string, + serviceLevelObjective: string, + ) { + return this.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.render( + { + project: project, + service: service, + service_level_objective: serviceLevelObjective, + }, + ); } /** @@ -2623,8 +3254,12 @@ export class ServiceMonitoringServiceClient { * A fully-qualified path representing project_service_service_level_objective resource. * @returns {string} A string representing the project. */ - matchProjectFromProjectServiceServiceLevelObjectiveName(projectServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match(projectServiceServiceLevelObjectiveName).project; + matchProjectFromProjectServiceServiceLevelObjectiveName( + projectServiceServiceLevelObjectiveName: string, + ) { + return this.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match( + projectServiceServiceLevelObjectiveName, + ).project; } /** @@ -2634,8 +3269,12 @@ export class ServiceMonitoringServiceClient { * A fully-qualified path representing project_service_service_level_objective resource. * @returns {string} A string representing the service. */ - matchServiceFromProjectServiceServiceLevelObjectiveName(projectServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match(projectServiceServiceLevelObjectiveName).service; + matchServiceFromProjectServiceServiceLevelObjectiveName( + projectServiceServiceLevelObjectiveName: string, + ) { + return this.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match( + projectServiceServiceLevelObjectiveName, + ).service; } /** @@ -2645,8 +3284,12 @@ export class ServiceMonitoringServiceClient { * A fully-qualified path representing project_service_service_level_objective resource. * @returns {string} A string representing the service_level_objective. */ - matchServiceLevelObjectiveFromProjectServiceServiceLevelObjectiveName(projectServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match(projectServiceServiceLevelObjectiveName).service_level_objective; + matchServiceLevelObjectiveFromProjectServiceServiceLevelObjectiveName( + projectServiceServiceLevelObjectiveName: string, + ) { + return this.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match( + projectServiceServiceLevelObjectiveName, + ).service_level_objective; } /** @@ -2656,7 +3299,7 @@ export class ServiceMonitoringServiceClient { * @param {string} uptime_check_config * @returns {string} Resource name string. */ - projectUptimeCheckConfigPath(project:string,uptimeCheckConfig:string) { + projectUptimeCheckConfigPath(project: string, uptimeCheckConfig: string) { return this.pathTemplates.projectUptimeCheckConfigPathTemplate.render({ project: project, uptime_check_config: uptimeCheckConfig, @@ -2670,8 +3313,12 @@ export class ServiceMonitoringServiceClient { * A fully-qualified path representing project_uptime_check_config resource. * @returns {string} A string representing the project. */ - matchProjectFromProjectUptimeCheckConfigName(projectUptimeCheckConfigName: string) { - return this.pathTemplates.projectUptimeCheckConfigPathTemplate.match(projectUptimeCheckConfigName).project; + matchProjectFromProjectUptimeCheckConfigName( + projectUptimeCheckConfigName: string, + ) { + return this.pathTemplates.projectUptimeCheckConfigPathTemplate.match( + projectUptimeCheckConfigName, + ).project; } /** @@ -2681,8 +3328,12 @@ export class ServiceMonitoringServiceClient { * A fully-qualified path representing project_uptime_check_config resource. * @returns {string} A string representing the uptime_check_config. */ - matchUptimeCheckConfigFromProjectUptimeCheckConfigName(projectUptimeCheckConfigName: string) { - return this.pathTemplates.projectUptimeCheckConfigPathTemplate.match(projectUptimeCheckConfigName).uptime_check_config; + matchUptimeCheckConfigFromProjectUptimeCheckConfigName( + projectUptimeCheckConfigName: string, + ) { + return this.pathTemplates.projectUptimeCheckConfigPathTemplate.match( + projectUptimeCheckConfigName, + ).uptime_check_config; } /** @@ -2692,7 +3343,7 @@ export class ServiceMonitoringServiceClient { * @param {string} snooze * @returns {string} Resource name string. */ - snoozePath(project:string,snooze:string) { + snoozePath(project: string, snooze: string) { return this.pathTemplates.snoozePathTemplate.render({ project: project, snooze: snooze, @@ -2729,7 +3380,7 @@ export class ServiceMonitoringServiceClient { */ close(): Promise { if (this.serviceMonitoringServiceStub && !this._terminated) { - return this.serviceMonitoringServiceStub.then(stub => { + return this.serviceMonitoringServiceStub.then((stub) => { this._log.info('ending gRPC channel'); this._terminated = true; stub.close(); @@ -2737,4 +3388,4 @@ export class ServiceMonitoringServiceClient { } return Promise.resolve(); } -} \ No newline at end of file +} diff --git a/packages/google-cloud-monitoring/src/v3/snooze_service_client.ts b/packages/google-cloud-monitoring/src/v3/snooze_service_client.ts index 972ecd81dbc8..1f25c6e6e539 100644 --- a/packages/google-cloud-monitoring/src/v3/snooze_service_client.ts +++ b/packages/google-cloud-monitoring/src/v3/snooze_service_client.ts @@ -18,11 +18,18 @@ /* global window */ import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} from 'google-gax'; -import {Transform} from 'stream'; +import type { + Callback, + CallOptions, + Descriptors, + ClientOptions, + PaginationCallback, + GaxCall, +} from 'google-gax'; +import { Transform } from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; +import { loggingUtils as logging, decodeAnyProtosInArray } from 'google-gax'; /** * Client JSON configuration object, loaded from @@ -46,7 +53,7 @@ export class SnoozeServiceClient { 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('monitoring'); @@ -59,9 +66,9 @@ export class SnoozeServiceClient { batching: {}, }; warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - snoozeServiceStub?: Promise<{[name: string]: Function}>; + innerApiCalls: { [name: string]: Function }; + pathTemplates: { [name: string]: gax.PathTemplate }; + snoozeServiceStub?: Promise<{ [name: string]: Function }>; /** * Construct an instance of SnoozeServiceClient. @@ -102,21 +109,42 @@ export class SnoozeServiceClient { * const client = new SnoozeServiceClient({fallback: true}, gax); * ``` */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + constructor( + opts?: ClientOptions, + gaxInstance?: typeof gax | typeof gax.fallback, + ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof SnoozeServiceClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.', + ); } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; + const universeDomainEnvVar = + typeof process === 'object' && typeof process.env === 'object' + ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] + : undefined; + this._universeDomain = + opts?.universeDomain ?? + opts?.universe_domain ?? + universeDomainEnvVar ?? + 'googleapis.com'; this._servicePath = 'monitoring.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + const servicePath = + opts?.servicePath || opts?.apiEndpoint || this._servicePath; + this._providedCustomServicePath = !!( + opts?.servicePath || opts?.apiEndpoint + ); const port = opts?.port || staticMembers.port; const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts); // Request numeric enum values if REST transport is used. opts.numericEnums = true; @@ -141,7 +169,7 @@ export class SnoozeServiceClient { this._opts = opts; // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set useJWTAccessWithScope on the auth object. this.auth.useJWTAccessWithScope = true; @@ -155,10 +183,7 @@ export class SnoozeServiceClient { } // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; if (typeof process === 'object' && 'versions' in process) { clientHeader.push(`gl-node/${process.versions.node}`); } else { @@ -180,82 +205,89 @@ export class SnoozeServiceClient { // Create useful helper objects for these. this.pathTemplates = { folderAlertPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/alertPolicies/{alert_policy}' + 'folders/{folder}/alertPolicies/{alert_policy}', ), folderAlertPolicyConditionPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/alertPolicies/{alert_policy}/conditions/{condition}' + 'folders/{folder}/alertPolicies/{alert_policy}/conditions/{condition}', ), folderChannelDescriptorPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/notificationChannelDescriptors/{channel_descriptor}' + 'folders/{folder}/notificationChannelDescriptors/{channel_descriptor}', ), folderGroupPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/groups/{group}' + 'folders/{folder}/groups/{group}', ), folderNotificationChannelPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/notificationChannels/{notification_channel}' + 'folders/{folder}/notificationChannels/{notification_channel}', ), folderServicePathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/services/{service}' - ), - folderServiceServiceLevelObjectivePathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/services/{service}/serviceLevelObjectives/{service_level_objective}' + 'folders/{folder}/services/{service}', ), + folderServiceServiceLevelObjectivePathTemplate: + new this._gaxModule.PathTemplate( + 'folders/{folder}/services/{service}/serviceLevelObjectives/{service_level_objective}', + ), folderUptimeCheckConfigPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/uptimeCheckConfigs/{uptime_check_config}' + 'folders/{folder}/uptimeCheckConfigs/{uptime_check_config}', ), organizationAlertPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/alertPolicies/{alert_policy}' - ), - organizationAlertPolicyConditionPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/alertPolicies/{alert_policy}/conditions/{condition}' - ), - organizationChannelDescriptorPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/notificationChannelDescriptors/{channel_descriptor}' + 'organizations/{organization}/alertPolicies/{alert_policy}', ), + organizationAlertPolicyConditionPathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/alertPolicies/{alert_policy}/conditions/{condition}', + ), + organizationChannelDescriptorPathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/notificationChannelDescriptors/{channel_descriptor}', + ), organizationGroupPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/groups/{group}' - ), - organizationNotificationChannelPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/notificationChannels/{notification_channel}' + 'organizations/{organization}/groups/{group}', ), + organizationNotificationChannelPathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/notificationChannels/{notification_channel}', + ), organizationServicePathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/services/{service}' - ), - organizationServiceServiceLevelObjectivePathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/services/{service}/serviceLevelObjectives/{service_level_objective}' - ), - organizationUptimeCheckConfigPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/uptimeCheckConfigs/{uptime_check_config}' + 'organizations/{organization}/services/{service}', ), + organizationServiceServiceLevelObjectivePathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/services/{service}/serviceLevelObjectives/{service_level_objective}', + ), + organizationUptimeCheckConfigPathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/uptimeCheckConfigs/{uptime_check_config}', + ), projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}' + 'projects/{project}', ), projectAlertPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/alertPolicies/{alert_policy}' + 'projects/{project}/alertPolicies/{alert_policy}', ), projectAlertPolicyConditionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/alertPolicies/{alert_policy}/conditions/{condition}' + 'projects/{project}/alertPolicies/{alert_policy}/conditions/{condition}', ), projectChannelDescriptorPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/notificationChannelDescriptors/{channel_descriptor}' + 'projects/{project}/notificationChannelDescriptors/{channel_descriptor}', ), projectGroupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/groups/{group}' + 'projects/{project}/groups/{group}', ), projectNotificationChannelPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/notificationChannels/{notification_channel}' + 'projects/{project}/notificationChannels/{notification_channel}', ), projectServicePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/services/{service}' - ), - projectServiceServiceLevelObjectivePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/services/{service}/serviceLevelObjectives/{service_level_objective}' + 'projects/{project}/services/{service}', ), + projectServiceServiceLevelObjectivePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/services/{service}/serviceLevelObjectives/{service_level_objective}', + ), projectUptimeCheckConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/uptimeCheckConfigs/{uptime_check_config}' + 'projects/{project}/uptimeCheckConfigs/{uptime_check_config}', ), snoozePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/snoozes/{snooze}' + 'projects/{project}/snoozes/{snooze}', ), }; @@ -263,14 +295,20 @@ export class SnoozeServiceClient { // (e.g. 50 results at a time, with tokens to get subsequent // pages). Denote the keys used for pagination and results. this.descriptors.page = { - listSnoozes: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'snoozes') + listSnoozes: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'snoozes', + ), }; // Put together the default options sent with requests. this._defaults = this._gaxGrpc.constructSettings( - 'google.monitoring.v3.SnoozeService', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + 'google.monitoring.v3.SnoozeService', + gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, + { 'x-goog-api-client': clientHeader.join(' ') }, + ); // Set up a dictionary of "inner API calls"; the core implementation // of calling the API is handled in `google-gax`, with this code @@ -301,37 +339,45 @@ export class SnoozeServiceClient { // Put together the "service stub" for // google.monitoring.v3.SnoozeService. this.snoozeServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.monitoring.v3.SnoozeService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.monitoring.v3.SnoozeService', + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any (this._protos as any).google.monitoring.v3.SnoozeService, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; + this._opts, + this._providedCustomServicePath, + ) as Promise<{ [method: string]: Function }>; // Iterate over each of the methods that the service provides // and create an API call method for each. - const snoozeServiceStubMethods = - ['createSnooze', 'listSnoozes', 'getSnooze', 'updateSnooze']; + const snoozeServiceStubMethods = [ + 'createSnooze', + 'listSnoozes', + 'getSnooze', + 'updateSnooze', + ]; for (const methodName of snoozeServiceStubMethods) { const callPromise = this.snoozeServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { + (stub) => + (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error | null | undefined) => () => { throw err; - }); + }, + ); - const descriptor = - this.descriptors.page[methodName] || - undefined; + const descriptor = this.descriptors.page[methodName] || undefined; const apiCall = this._gaxModule.createApiCall( callPromise, this._defaults[methodName], descriptor, - this._opts.fallback + this._opts.fallback, ); this.innerApiCalls[methodName] = apiCall; @@ -346,8 +392,14 @@ export class SnoozeServiceClient { * @returns {string} The DNS address for this service. */ static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); } return 'monitoring.googleapis.com'; } @@ -358,8 +410,14 @@ export class SnoozeServiceClient { * @returns {string} The DNS address for this service. */ static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); } return 'monitoring.googleapis.com'; } @@ -393,7 +451,7 @@ export class SnoozeServiceClient { return [ 'https://www.googleapis.com/auth/cloud-platform', 'https://www.googleapis.com/auth/monitoring', - 'https://www.googleapis.com/auth/monitoring.read' + 'https://www.googleapis.com/auth/monitoring.read', ]; } @@ -403,8 +461,9 @@ export class SnoozeServiceClient { * Return the project ID used by this class. * @returns {Promise} A promise that resolves to string containing the project ID. */ - getProjectId(callback?: Callback): - Promise|void { + getProjectId( + callback?: Callback, + ): Promise | void { if (callback) { this.auth.getProjectId(callback); return; @@ -415,426 +474,531 @@ export class SnoozeServiceClient { // ------------------- // -- Service calls -- // ------------------- -/** - * Creates a `Snooze` that will prevent alerts, which match the provided - * criteria, from being opened. The `Snooze` applies for a specific time - * interval. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The - * [project](https://cloud.google.com/monitoring/api/v3#project_name) in which - * a `Snooze` should be created. The format is: - * - * projects/[PROJECT_ID_OR_NUMBER] - * @param {google.monitoring.v3.Snooze} request.snooze - * Required. The `Snooze` to create. Omit the `name` field, as it will be - * filled in by the API. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.monitoring.v3.Snooze|Snooze}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v3/snooze_service.create_snooze.js - * region_tag:monitoring_v3_generated_SnoozeService_CreateSnooze_async - */ + /** + * Creates a `Snooze` that will prevent alerts, which match the provided + * criteria, from being opened. The `Snooze` applies for a specific time + * interval. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The + * [project](https://cloud.google.com/monitoring/api/v3#project_name) in which + * a `Snooze` should be created. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER] + * @param {google.monitoring.v3.Snooze} request.snooze + * Required. The `Snooze` to create. Omit the `name` field, as it will be + * filled in by the API. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.monitoring.v3.Snooze|Snooze}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v3/snooze_service.create_snooze.js + * region_tag:monitoring_v3_generated_SnoozeService_CreateSnooze_async + */ createSnooze( - request?: protos.google.monitoring.v3.ICreateSnoozeRequest, - options?: CallOptions): - Promise<[ - protos.google.monitoring.v3.ISnooze, - protos.google.monitoring.v3.ICreateSnoozeRequest|undefined, {}|undefined - ]>; + request?: protos.google.monitoring.v3.ICreateSnoozeRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.monitoring.v3.ISnooze, + protos.google.monitoring.v3.ICreateSnoozeRequest | undefined, + {} | undefined, + ] + >; createSnooze( - request: protos.google.monitoring.v3.ICreateSnoozeRequest, - options: CallOptions, - callback: Callback< - protos.google.monitoring.v3.ISnooze, - protos.google.monitoring.v3.ICreateSnoozeRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.monitoring.v3.ICreateSnoozeRequest, + options: CallOptions, + callback: Callback< + protos.google.monitoring.v3.ISnooze, + protos.google.monitoring.v3.ICreateSnoozeRequest | null | undefined, + {} | null | undefined + >, + ): void; createSnooze( - request: protos.google.monitoring.v3.ICreateSnoozeRequest, - callback: Callback< - protos.google.monitoring.v3.ISnooze, - protos.google.monitoring.v3.ICreateSnoozeRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.monitoring.v3.ICreateSnoozeRequest, + callback: Callback< + protos.google.monitoring.v3.ISnooze, + protos.google.monitoring.v3.ICreateSnoozeRequest | null | undefined, + {} | null | undefined + >, + ): void; createSnooze( - request?: protos.google.monitoring.v3.ICreateSnoozeRequest, - optionsOrCallback?: CallOptions|Callback< + request?: protos.google.monitoring.v3.ICreateSnoozeRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.monitoring.v3.ISnooze, - protos.google.monitoring.v3.ICreateSnoozeRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.monitoring.v3.ISnooze, - protos.google.monitoring.v3.ICreateSnoozeRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.monitoring.v3.ISnooze, - protos.google.monitoring.v3.ICreateSnoozeRequest|undefined, {}|undefined - ]>|void { + protos.google.monitoring.v3.ICreateSnoozeRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.monitoring.v3.ISnooze, + protos.google.monitoring.v3.ICreateSnoozeRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.monitoring.v3.ISnooze, + protos.google.monitoring.v3.ICreateSnoozeRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('createSnooze request %j', request); - const wrappedCallback: Callback< - protos.google.monitoring.v3.ISnooze, - protos.google.monitoring.v3.ICreateSnoozeRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.monitoring.v3.ISnooze, + protos.google.monitoring.v3.ICreateSnoozeRequest | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('createSnooze response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.createSnooze(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.monitoring.v3.ISnooze, - protos.google.monitoring.v3.ICreateSnoozeRequest|undefined, - {}|undefined - ]) => { - this._log.info('createSnooze 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); + return this.innerApiCalls + .createSnooze(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.monitoring.v3.ISnooze, + protos.google.monitoring.v3.ICreateSnoozeRequest | undefined, + {} | undefined, + ]) => { + this._log.info('createSnooze 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; }); } -/** - * Retrieves a `Snooze` by `name`. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The ID of the `Snooze` to retrieve. The format is: - * - * projects/[PROJECT_ID_OR_NUMBER]/snoozes/[SNOOZE_ID] - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.monitoring.v3.Snooze|Snooze}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v3/snooze_service.get_snooze.js - * region_tag:monitoring_v3_generated_SnoozeService_GetSnooze_async - */ + /** + * Retrieves a `Snooze` by `name`. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The ID of the `Snooze` to retrieve. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER]/snoozes/[SNOOZE_ID] + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.monitoring.v3.Snooze|Snooze}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v3/snooze_service.get_snooze.js + * region_tag:monitoring_v3_generated_SnoozeService_GetSnooze_async + */ getSnooze( - request?: protos.google.monitoring.v3.IGetSnoozeRequest, - options?: CallOptions): - Promise<[ - protos.google.monitoring.v3.ISnooze, - protos.google.monitoring.v3.IGetSnoozeRequest|undefined, {}|undefined - ]>; + request?: protos.google.monitoring.v3.IGetSnoozeRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.monitoring.v3.ISnooze, + protos.google.monitoring.v3.IGetSnoozeRequest | undefined, + {} | undefined, + ] + >; getSnooze( - request: protos.google.monitoring.v3.IGetSnoozeRequest, - options: CallOptions, - callback: Callback< - protos.google.monitoring.v3.ISnooze, - protos.google.monitoring.v3.IGetSnoozeRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.monitoring.v3.IGetSnoozeRequest, + options: CallOptions, + callback: Callback< + protos.google.monitoring.v3.ISnooze, + protos.google.monitoring.v3.IGetSnoozeRequest | null | undefined, + {} | null | undefined + >, + ): void; getSnooze( - request: protos.google.monitoring.v3.IGetSnoozeRequest, - callback: Callback< - protos.google.monitoring.v3.ISnooze, - protos.google.monitoring.v3.IGetSnoozeRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.monitoring.v3.IGetSnoozeRequest, + callback: Callback< + protos.google.monitoring.v3.ISnooze, + protos.google.monitoring.v3.IGetSnoozeRequest | null | undefined, + {} | null | undefined + >, + ): void; getSnooze( - request?: protos.google.monitoring.v3.IGetSnoozeRequest, - optionsOrCallback?: CallOptions|Callback< + request?: protos.google.monitoring.v3.IGetSnoozeRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.monitoring.v3.ISnooze, - protos.google.monitoring.v3.IGetSnoozeRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.monitoring.v3.ISnooze, - protos.google.monitoring.v3.IGetSnoozeRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.monitoring.v3.ISnooze, - protos.google.monitoring.v3.IGetSnoozeRequest|undefined, {}|undefined - ]>|void { + protos.google.monitoring.v3.IGetSnoozeRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.monitoring.v3.ISnooze, + protos.google.monitoring.v3.IGetSnoozeRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.monitoring.v3.ISnooze, + protos.google.monitoring.v3.IGetSnoozeRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('getSnooze request %j', request); - const wrappedCallback: Callback< - protos.google.monitoring.v3.ISnooze, - protos.google.monitoring.v3.IGetSnoozeRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.monitoring.v3.ISnooze, + protos.google.monitoring.v3.IGetSnoozeRequest | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('getSnooze response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.getSnooze(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.monitoring.v3.ISnooze, - protos.google.monitoring.v3.IGetSnoozeRequest|undefined, - {}|undefined - ]) => { - this._log.info('getSnooze 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); + return this.innerApiCalls + .getSnooze(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.monitoring.v3.ISnooze, + protos.google.monitoring.v3.IGetSnoozeRequest | undefined, + {} | undefined, + ]) => { + this._log.info('getSnooze 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 `Snooze`, identified by its `name`, with the parameters in the - * given `Snooze` object. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.monitoring.v3.Snooze} request.snooze - * Required. The `Snooze` to update. Must have the name field present. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. The fields to update. - * - * For each field listed in `update_mask`: - * - * * If the `Snooze` object supplied in the `UpdateSnoozeRequest` has a - * value for that field, the value of the field in the existing `Snooze` - * will be set to the value of the field in the supplied `Snooze`. - * * If the field does not have a value in the supplied `Snooze`, the field - * in the existing `Snooze` is set to its default value. - * - * Fields not listed retain their existing value. - * - * The following are the field names that are accepted in `update_mask`: - * - * * `display_name` - * * `interval.start_time` - * * `interval.end_time` - * - * That said, the start time and end time of the `Snooze` determines which - * fields can legally be updated. Before attempting an update, users should - * consult the documentation for `UpdateSnoozeRequest`, which talks about - * which fields can be updated. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.monitoring.v3.Snooze|Snooze}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v3/snooze_service.update_snooze.js - * region_tag:monitoring_v3_generated_SnoozeService_UpdateSnooze_async - */ + /** + * Updates a `Snooze`, identified by its `name`, with the parameters in the + * given `Snooze` object. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.monitoring.v3.Snooze} request.snooze + * Required. The `Snooze` to update. Must have the name field present. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. The fields to update. + * + * For each field listed in `update_mask`: + * + * * If the `Snooze` object supplied in the `UpdateSnoozeRequest` has a + * value for that field, the value of the field in the existing `Snooze` + * will be set to the value of the field in the supplied `Snooze`. + * * If the field does not have a value in the supplied `Snooze`, the field + * in the existing `Snooze` is set to its default value. + * + * Fields not listed retain their existing value. + * + * The following are the field names that are accepted in `update_mask`: + * + * * `display_name` + * * `interval.start_time` + * * `interval.end_time` + * + * That said, the start time and end time of the `Snooze` determines which + * fields can legally be updated. Before attempting an update, users should + * consult the documentation for `UpdateSnoozeRequest`, which talks about + * which fields can be updated. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.monitoring.v3.Snooze|Snooze}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v3/snooze_service.update_snooze.js + * region_tag:monitoring_v3_generated_SnoozeService_UpdateSnooze_async + */ updateSnooze( - request?: protos.google.monitoring.v3.IUpdateSnoozeRequest, - options?: CallOptions): - Promise<[ - protos.google.monitoring.v3.ISnooze, - protos.google.monitoring.v3.IUpdateSnoozeRequest|undefined, {}|undefined - ]>; + request?: protos.google.monitoring.v3.IUpdateSnoozeRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.monitoring.v3.ISnooze, + protos.google.monitoring.v3.IUpdateSnoozeRequest | undefined, + {} | undefined, + ] + >; updateSnooze( - request: protos.google.monitoring.v3.IUpdateSnoozeRequest, - options: CallOptions, - callback: Callback< - protos.google.monitoring.v3.ISnooze, - protos.google.monitoring.v3.IUpdateSnoozeRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.monitoring.v3.IUpdateSnoozeRequest, + options: CallOptions, + callback: Callback< + protos.google.monitoring.v3.ISnooze, + protos.google.monitoring.v3.IUpdateSnoozeRequest | null | undefined, + {} | null | undefined + >, + ): void; updateSnooze( - request: protos.google.monitoring.v3.IUpdateSnoozeRequest, - callback: Callback< - protos.google.monitoring.v3.ISnooze, - protos.google.monitoring.v3.IUpdateSnoozeRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.monitoring.v3.IUpdateSnoozeRequest, + callback: Callback< + protos.google.monitoring.v3.ISnooze, + protos.google.monitoring.v3.IUpdateSnoozeRequest | null | undefined, + {} | null | undefined + >, + ): void; updateSnooze( - request?: protos.google.monitoring.v3.IUpdateSnoozeRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.monitoring.v3.ISnooze, - protos.google.monitoring.v3.IUpdateSnoozeRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.monitoring.v3.IUpdateSnoozeRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.monitoring.v3.ISnooze, - protos.google.monitoring.v3.IUpdateSnoozeRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.monitoring.v3.ISnooze, - protos.google.monitoring.v3.IUpdateSnoozeRequest|undefined, {}|undefined - ]>|void { + protos.google.monitoring.v3.IUpdateSnoozeRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.monitoring.v3.ISnooze, + protos.google.monitoring.v3.IUpdateSnoozeRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.monitoring.v3.ISnooze, + protos.google.monitoring.v3.IUpdateSnoozeRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'snooze.name': request.snooze!.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + 'snooze.name': request.snooze!.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('updateSnooze request %j', request); - const wrappedCallback: Callback< - protos.google.monitoring.v3.ISnooze, - protos.google.monitoring.v3.IUpdateSnoozeRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.monitoring.v3.ISnooze, + protos.google.monitoring.v3.IUpdateSnoozeRequest | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('updateSnooze response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.updateSnooze(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.monitoring.v3.ISnooze, - protos.google.monitoring.v3.IUpdateSnoozeRequest|undefined, - {}|undefined - ]) => { - this._log.info('updateSnooze 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); + return this.innerApiCalls + .updateSnooze(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.monitoring.v3.ISnooze, + protos.google.monitoring.v3.IUpdateSnoozeRequest | undefined, + {} | undefined, + ]) => { + this._log.info('updateSnooze 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; }); } - /** - * Lists the `Snooze`s associated with a project. Can optionally pass in - * `filter`, which specifies predicates to match `Snooze`s. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The - * [project](https://cloud.google.com/monitoring/api/v3#project_name) whose - * `Snooze`s should be listed. The format is: - * - * projects/[PROJECT_ID_OR_NUMBER] - * @param {string} [request.filter] - * Optional. Optional filter to restrict results to the given criteria. The - * following fields are supported. - * - * * `interval.start_time` - * * `interval.end_time` - * - * For example: - * - * interval.start_time > "2022-03-11T00:00:00-08:00" AND - * interval.end_time < "2022-03-12T00:00:00-08:00" - * @param {number} [request.pageSize] - * Optional. The maximum number of results to return for a single query. The - * server may further constrain the maximum number of results returned in a - * single page. The value should be in the range [1, 1000]. If the value given - * is outside this range, the server will decide the number of results to be - * returned. - * @param {string} [request.pageToken] - * Optional. The `next_page_token` from a previous call to - * `ListSnoozesRequest` to get the next page of results. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of {@link protos.google.monitoring.v3.Snooze|Snooze}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listSnoozesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Lists the `Snooze`s associated with a project. Can optionally pass in + * `filter`, which specifies predicates to match `Snooze`s. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The + * [project](https://cloud.google.com/monitoring/api/v3#project_name) whose + * `Snooze`s should be listed. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER] + * @param {string} [request.filter] + * Optional. Optional filter to restrict results to the given criteria. The + * following fields are supported. + * + * * `interval.start_time` + * * `interval.end_time` + * + * For example: + * + * interval.start_time > "2022-03-11T00:00:00-08:00" AND + * interval.end_time < "2022-03-12T00:00:00-08:00" + * @param {number} [request.pageSize] + * Optional. The maximum number of results to return for a single query. The + * server may further constrain the maximum number of results returned in a + * single page. The value should be in the range [1, 1000]. If the value given + * is outside this range, the server will decide the number of results to be + * returned. + * @param {string} [request.pageToken] + * Optional. The `next_page_token` from a previous call to + * `ListSnoozesRequest` to get the next page of results. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of {@link protos.google.monitoring.v3.Snooze|Snooze}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listSnoozesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listSnoozes( - request?: protos.google.monitoring.v3.IListSnoozesRequest, - options?: CallOptions): - Promise<[ - protos.google.monitoring.v3.ISnooze[], - protos.google.monitoring.v3.IListSnoozesRequest|null, - protos.google.monitoring.v3.IListSnoozesResponse - ]>; + request?: protos.google.monitoring.v3.IListSnoozesRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.monitoring.v3.ISnooze[], + protos.google.monitoring.v3.IListSnoozesRequest | null, + protos.google.monitoring.v3.IListSnoozesResponse, + ] + >; listSnoozes( - request: protos.google.monitoring.v3.IListSnoozesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.monitoring.v3.IListSnoozesRequest, - protos.google.monitoring.v3.IListSnoozesResponse|null|undefined, - protos.google.monitoring.v3.ISnooze>): void; + request: protos.google.monitoring.v3.IListSnoozesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.monitoring.v3.IListSnoozesRequest, + protos.google.monitoring.v3.IListSnoozesResponse | null | undefined, + protos.google.monitoring.v3.ISnooze + >, + ): void; listSnoozes( - request: protos.google.monitoring.v3.IListSnoozesRequest, - callback: PaginationCallback< - protos.google.monitoring.v3.IListSnoozesRequest, - protos.google.monitoring.v3.IListSnoozesResponse|null|undefined, - protos.google.monitoring.v3.ISnooze>): void; + request: protos.google.monitoring.v3.IListSnoozesRequest, + callback: PaginationCallback< + protos.google.monitoring.v3.IListSnoozesRequest, + protos.google.monitoring.v3.IListSnoozesResponse | null | undefined, + protos.google.monitoring.v3.ISnooze + >, + ): void; listSnoozes( - request?: protos.google.monitoring.v3.IListSnoozesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.monitoring.v3.IListSnoozesRequest, - protos.google.monitoring.v3.IListSnoozesResponse|null|undefined, - protos.google.monitoring.v3.ISnooze>, - callback?: PaginationCallback< + request?: protos.google.monitoring.v3.IListSnoozesRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.monitoring.v3.IListSnoozesRequest, - protos.google.monitoring.v3.IListSnoozesResponse|null|undefined, - protos.google.monitoring.v3.ISnooze>): - Promise<[ - protos.google.monitoring.v3.ISnooze[], - protos.google.monitoring.v3.IListSnoozesRequest|null, - protos.google.monitoring.v3.IListSnoozesResponse - ]>|void { + protos.google.monitoring.v3.IListSnoozesResponse | null | undefined, + protos.google.monitoring.v3.ISnooze + >, + callback?: PaginationCallback< + protos.google.monitoring.v3.IListSnoozesRequest, + protos.google.monitoring.v3.IListSnoozesResponse | null | undefined, + protos.google.monitoring.v3.ISnooze + >, + ): Promise< + [ + protos.google.monitoring.v3.ISnooze[], + protos.google.monitoring.v3.IListSnoozesRequest | null, + protos.google.monitoring.v3.IListSnoozesResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.monitoring.v3.IListSnoozesRequest, - protos.google.monitoring.v3.IListSnoozesResponse|null|undefined, - protos.google.monitoring.v3.ISnooze>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.monitoring.v3.IListSnoozesRequest, + protos.google.monitoring.v3.IListSnoozesResponse | null | undefined, + protos.google.monitoring.v3.ISnooze + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('listSnoozes values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -843,146 +1007,150 @@ export class SnoozeServiceClient { this._log.info('listSnoozes request %j', request); return this.innerApiCalls .listSnoozes(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.monitoring.v3.ISnooze[], - protos.google.monitoring.v3.IListSnoozesRequest|null, - protos.google.monitoring.v3.IListSnoozesResponse - ]) => { - this._log.info('listSnoozes values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.monitoring.v3.ISnooze[], + protos.google.monitoring.v3.IListSnoozesRequest | null, + protos.google.monitoring.v3.IListSnoozesResponse, + ]) => { + this._log.info('listSnoozes values %j', response); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listSnoozes`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The - * [project](https://cloud.google.com/monitoring/api/v3#project_name) whose - * `Snooze`s should be listed. The format is: - * - * projects/[PROJECT_ID_OR_NUMBER] - * @param {string} [request.filter] - * Optional. Optional filter to restrict results to the given criteria. The - * following fields are supported. - * - * * `interval.start_time` - * * `interval.end_time` - * - * For example: - * - * interval.start_time > "2022-03-11T00:00:00-08:00" AND - * interval.end_time < "2022-03-12T00:00:00-08:00" - * @param {number} [request.pageSize] - * Optional. The maximum number of results to return for a single query. The - * server may further constrain the maximum number of results returned in a - * single page. The value should be in the range [1, 1000]. If the value given - * is outside this range, the server will decide the number of results to be - * returned. - * @param {string} [request.pageToken] - * Optional. The `next_page_token` from a previous call to - * `ListSnoozesRequest` to get the next page of results. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.monitoring.v3.Snooze|Snooze} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listSnoozesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Equivalent to `listSnoozes`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The + * [project](https://cloud.google.com/monitoring/api/v3#project_name) whose + * `Snooze`s should be listed. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER] + * @param {string} [request.filter] + * Optional. Optional filter to restrict results to the given criteria. The + * following fields are supported. + * + * * `interval.start_time` + * * `interval.end_time` + * + * For example: + * + * interval.start_time > "2022-03-11T00:00:00-08:00" AND + * interval.end_time < "2022-03-12T00:00:00-08:00" + * @param {number} [request.pageSize] + * Optional. The maximum number of results to return for a single query. The + * server may further constrain the maximum number of results returned in a + * single page. The value should be in the range [1, 1000]. If the value given + * is outside this range, the server will decide the number of results to be + * returned. + * @param {string} [request.pageToken] + * Optional. The `next_page_token` from a previous call to + * `ListSnoozesRequest` to get the next page of results. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.monitoring.v3.Snooze|Snooze} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listSnoozesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listSnoozesStream( - request?: protos.google.monitoring.v3.IListSnoozesRequest, - options?: CallOptions): - Transform{ + request?: protos.google.monitoring.v3.IListSnoozesRequest, + options?: CallOptions, + ): Transform { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listSnoozes']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listSnoozes stream %j', request); return this.descriptors.page.listSnoozes.createStream( this.innerApiCalls.listSnoozes as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `listSnoozes`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The - * [project](https://cloud.google.com/monitoring/api/v3#project_name) whose - * `Snooze`s should be listed. The format is: - * - * projects/[PROJECT_ID_OR_NUMBER] - * @param {string} [request.filter] - * Optional. Optional filter to restrict results to the given criteria. The - * following fields are supported. - * - * * `interval.start_time` - * * `interval.end_time` - * - * For example: - * - * interval.start_time > "2022-03-11T00:00:00-08:00" AND - * interval.end_time < "2022-03-12T00:00:00-08:00" - * @param {number} [request.pageSize] - * Optional. The maximum number of results to return for a single query. The - * server may further constrain the maximum number of results returned in a - * single page. The value should be in the range [1, 1000]. If the value given - * is outside this range, the server will decide the number of results to be - * returned. - * @param {string} [request.pageToken] - * Optional. The `next_page_token` from a previous call to - * `ListSnoozesRequest` to get the next page of results. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.monitoring.v3.Snooze|Snooze}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v3/snooze_service.list_snoozes.js - * region_tag:monitoring_v3_generated_SnoozeService_ListSnoozes_async - */ + /** + * Equivalent to `listSnoozes`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The + * [project](https://cloud.google.com/monitoring/api/v3#project_name) whose + * `Snooze`s should be listed. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER] + * @param {string} [request.filter] + * Optional. Optional filter to restrict results to the given criteria. The + * following fields are supported. + * + * * `interval.start_time` + * * `interval.end_time` + * + * For example: + * + * interval.start_time > "2022-03-11T00:00:00-08:00" AND + * interval.end_time < "2022-03-12T00:00:00-08:00" + * @param {number} [request.pageSize] + * Optional. The maximum number of results to return for a single query. The + * server may further constrain the maximum number of results returned in a + * single page. The value should be in the range [1, 1000]. If the value given + * is outside this range, the server will decide the number of results to be + * returned. + * @param {string} [request.pageToken] + * Optional. The `next_page_token` from a previous call to + * `ListSnoozesRequest` to get the next page of results. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.monitoring.v3.Snooze|Snooze}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v3/snooze_service.list_snoozes.js + * region_tag:monitoring_v3_generated_SnoozeService_ListSnoozes_async + */ listSnoozesAsync( - request?: protos.google.monitoring.v3.IListSnoozesRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.monitoring.v3.IListSnoozesRequest, + options?: CallOptions, + ): AsyncIterable { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listSnoozes']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listSnoozes iterate %j', request); return this.descriptors.page.listSnoozes.asyncIterate( this.innerApiCalls['listSnoozes'] as GaxCall, request as {}, - callSettings + callSettings, ) as AsyncIterable; } // -------------------- @@ -996,7 +1164,7 @@ export class SnoozeServiceClient { * @param {string} alert_policy * @returns {string} Resource name string. */ - folderAlertPolicyPath(folder:string,alertPolicy:string) { + folderAlertPolicyPath(folder: string, alertPolicy: string) { return this.pathTemplates.folderAlertPolicyPathTemplate.render({ folder: folder, alert_policy: alertPolicy, @@ -1011,7 +1179,9 @@ export class SnoozeServiceClient { * @returns {string} A string representing the folder. */ matchFolderFromFolderAlertPolicyName(folderAlertPolicyName: string) { - return this.pathTemplates.folderAlertPolicyPathTemplate.match(folderAlertPolicyName).folder; + return this.pathTemplates.folderAlertPolicyPathTemplate.match( + folderAlertPolicyName, + ).folder; } /** @@ -1022,7 +1192,9 @@ export class SnoozeServiceClient { * @returns {string} A string representing the alert_policy. */ matchAlertPolicyFromFolderAlertPolicyName(folderAlertPolicyName: string) { - return this.pathTemplates.folderAlertPolicyPathTemplate.match(folderAlertPolicyName).alert_policy; + return this.pathTemplates.folderAlertPolicyPathTemplate.match( + folderAlertPolicyName, + ).alert_policy; } /** @@ -1033,7 +1205,11 @@ export class SnoozeServiceClient { * @param {string} condition * @returns {string} Resource name string. */ - folderAlertPolicyConditionPath(folder:string,alertPolicy:string,condition:string) { + folderAlertPolicyConditionPath( + folder: string, + alertPolicy: string, + condition: string, + ) { return this.pathTemplates.folderAlertPolicyConditionPathTemplate.render({ folder: folder, alert_policy: alertPolicy, @@ -1048,8 +1224,12 @@ export class SnoozeServiceClient { * A fully-qualified path representing folder_alert_policy_condition resource. * @returns {string} A string representing the folder. */ - matchFolderFromFolderAlertPolicyConditionName(folderAlertPolicyConditionName: string) { - return this.pathTemplates.folderAlertPolicyConditionPathTemplate.match(folderAlertPolicyConditionName).folder; + matchFolderFromFolderAlertPolicyConditionName( + folderAlertPolicyConditionName: string, + ) { + return this.pathTemplates.folderAlertPolicyConditionPathTemplate.match( + folderAlertPolicyConditionName, + ).folder; } /** @@ -1059,8 +1239,12 @@ export class SnoozeServiceClient { * A fully-qualified path representing folder_alert_policy_condition resource. * @returns {string} A string representing the alert_policy. */ - matchAlertPolicyFromFolderAlertPolicyConditionName(folderAlertPolicyConditionName: string) { - return this.pathTemplates.folderAlertPolicyConditionPathTemplate.match(folderAlertPolicyConditionName).alert_policy; + matchAlertPolicyFromFolderAlertPolicyConditionName( + folderAlertPolicyConditionName: string, + ) { + return this.pathTemplates.folderAlertPolicyConditionPathTemplate.match( + folderAlertPolicyConditionName, + ).alert_policy; } /** @@ -1070,8 +1254,12 @@ export class SnoozeServiceClient { * A fully-qualified path representing folder_alert_policy_condition resource. * @returns {string} A string representing the condition. */ - matchConditionFromFolderAlertPolicyConditionName(folderAlertPolicyConditionName: string) { - return this.pathTemplates.folderAlertPolicyConditionPathTemplate.match(folderAlertPolicyConditionName).condition; + matchConditionFromFolderAlertPolicyConditionName( + folderAlertPolicyConditionName: string, + ) { + return this.pathTemplates.folderAlertPolicyConditionPathTemplate.match( + folderAlertPolicyConditionName, + ).condition; } /** @@ -1081,7 +1269,7 @@ export class SnoozeServiceClient { * @param {string} channel_descriptor * @returns {string} Resource name string. */ - folderChannelDescriptorPath(folder:string,channelDescriptor:string) { + folderChannelDescriptorPath(folder: string, channelDescriptor: string) { return this.pathTemplates.folderChannelDescriptorPathTemplate.render({ folder: folder, channel_descriptor: channelDescriptor, @@ -1095,8 +1283,12 @@ export class SnoozeServiceClient { * A fully-qualified path representing folder_channel_descriptor resource. * @returns {string} A string representing the folder. */ - matchFolderFromFolderChannelDescriptorName(folderChannelDescriptorName: string) { - return this.pathTemplates.folderChannelDescriptorPathTemplate.match(folderChannelDescriptorName).folder; + matchFolderFromFolderChannelDescriptorName( + folderChannelDescriptorName: string, + ) { + return this.pathTemplates.folderChannelDescriptorPathTemplate.match( + folderChannelDescriptorName, + ).folder; } /** @@ -1106,8 +1298,12 @@ export class SnoozeServiceClient { * A fully-qualified path representing folder_channel_descriptor resource. * @returns {string} A string representing the channel_descriptor. */ - matchChannelDescriptorFromFolderChannelDescriptorName(folderChannelDescriptorName: string) { - return this.pathTemplates.folderChannelDescriptorPathTemplate.match(folderChannelDescriptorName).channel_descriptor; + matchChannelDescriptorFromFolderChannelDescriptorName( + folderChannelDescriptorName: string, + ) { + return this.pathTemplates.folderChannelDescriptorPathTemplate.match( + folderChannelDescriptorName, + ).channel_descriptor; } /** @@ -1117,7 +1313,7 @@ export class SnoozeServiceClient { * @param {string} group * @returns {string} Resource name string. */ - folderGroupPath(folder:string,group:string) { + folderGroupPath(folder: string, group: string) { return this.pathTemplates.folderGroupPathTemplate.render({ folder: folder, group: group, @@ -1132,7 +1328,8 @@ export class SnoozeServiceClient { * @returns {string} A string representing the folder. */ matchFolderFromFolderGroupName(folderGroupName: string) { - return this.pathTemplates.folderGroupPathTemplate.match(folderGroupName).folder; + return this.pathTemplates.folderGroupPathTemplate.match(folderGroupName) + .folder; } /** @@ -1143,7 +1340,8 @@ export class SnoozeServiceClient { * @returns {string} A string representing the group. */ matchGroupFromFolderGroupName(folderGroupName: string) { - return this.pathTemplates.folderGroupPathTemplate.match(folderGroupName).group; + return this.pathTemplates.folderGroupPathTemplate.match(folderGroupName) + .group; } /** @@ -1153,7 +1351,7 @@ export class SnoozeServiceClient { * @param {string} notification_channel * @returns {string} Resource name string. */ - folderNotificationChannelPath(folder:string,notificationChannel:string) { + folderNotificationChannelPath(folder: string, notificationChannel: string) { return this.pathTemplates.folderNotificationChannelPathTemplate.render({ folder: folder, notification_channel: notificationChannel, @@ -1167,8 +1365,12 @@ export class SnoozeServiceClient { * A fully-qualified path representing folder_notification_channel resource. * @returns {string} A string representing the folder. */ - matchFolderFromFolderNotificationChannelName(folderNotificationChannelName: string) { - return this.pathTemplates.folderNotificationChannelPathTemplate.match(folderNotificationChannelName).folder; + matchFolderFromFolderNotificationChannelName( + folderNotificationChannelName: string, + ) { + return this.pathTemplates.folderNotificationChannelPathTemplate.match( + folderNotificationChannelName, + ).folder; } /** @@ -1178,8 +1380,12 @@ export class SnoozeServiceClient { * A fully-qualified path representing folder_notification_channel resource. * @returns {string} A string representing the notification_channel. */ - matchNotificationChannelFromFolderNotificationChannelName(folderNotificationChannelName: string) { - return this.pathTemplates.folderNotificationChannelPathTemplate.match(folderNotificationChannelName).notification_channel; + matchNotificationChannelFromFolderNotificationChannelName( + folderNotificationChannelName: string, + ) { + return this.pathTemplates.folderNotificationChannelPathTemplate.match( + folderNotificationChannelName, + ).notification_channel; } /** @@ -1189,7 +1395,7 @@ export class SnoozeServiceClient { * @param {string} service * @returns {string} Resource name string. */ - folderServicePath(folder:string,service:string) { + folderServicePath(folder: string, service: string) { return this.pathTemplates.folderServicePathTemplate.render({ folder: folder, service: service, @@ -1204,7 +1410,8 @@ export class SnoozeServiceClient { * @returns {string} A string representing the folder. */ matchFolderFromFolderServiceName(folderServiceName: string) { - return this.pathTemplates.folderServicePathTemplate.match(folderServiceName).folder; + return this.pathTemplates.folderServicePathTemplate.match(folderServiceName) + .folder; } /** @@ -1215,7 +1422,8 @@ export class SnoozeServiceClient { * @returns {string} A string representing the service. */ matchServiceFromFolderServiceName(folderServiceName: string) { - return this.pathTemplates.folderServicePathTemplate.match(folderServiceName).service; + return this.pathTemplates.folderServicePathTemplate.match(folderServiceName) + .service; } /** @@ -1226,12 +1434,18 @@ export class SnoozeServiceClient { * @param {string} service_level_objective * @returns {string} Resource name string. */ - folderServiceServiceLevelObjectivePath(folder:string,service:string,serviceLevelObjective:string) { - return this.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.render({ - folder: folder, - service: service, - service_level_objective: serviceLevelObjective, - }); + folderServiceServiceLevelObjectivePath( + folder: string, + service: string, + serviceLevelObjective: string, + ) { + return this.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.render( + { + folder: folder, + service: service, + service_level_objective: serviceLevelObjective, + }, + ); } /** @@ -1241,8 +1455,12 @@ export class SnoozeServiceClient { * A fully-qualified path representing folder_service_service_level_objective resource. * @returns {string} A string representing the folder. */ - matchFolderFromFolderServiceServiceLevelObjectiveName(folderServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match(folderServiceServiceLevelObjectiveName).folder; + matchFolderFromFolderServiceServiceLevelObjectiveName( + folderServiceServiceLevelObjectiveName: string, + ) { + return this.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match( + folderServiceServiceLevelObjectiveName, + ).folder; } /** @@ -1252,8 +1470,12 @@ export class SnoozeServiceClient { * A fully-qualified path representing folder_service_service_level_objective resource. * @returns {string} A string representing the service. */ - matchServiceFromFolderServiceServiceLevelObjectiveName(folderServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match(folderServiceServiceLevelObjectiveName).service; + matchServiceFromFolderServiceServiceLevelObjectiveName( + folderServiceServiceLevelObjectiveName: string, + ) { + return this.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match( + folderServiceServiceLevelObjectiveName, + ).service; } /** @@ -1263,8 +1485,12 @@ export class SnoozeServiceClient { * A fully-qualified path representing folder_service_service_level_objective resource. * @returns {string} A string representing the service_level_objective. */ - matchServiceLevelObjectiveFromFolderServiceServiceLevelObjectiveName(folderServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match(folderServiceServiceLevelObjectiveName).service_level_objective; + matchServiceLevelObjectiveFromFolderServiceServiceLevelObjectiveName( + folderServiceServiceLevelObjectiveName: string, + ) { + return this.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match( + folderServiceServiceLevelObjectiveName, + ).service_level_objective; } /** @@ -1274,7 +1500,7 @@ export class SnoozeServiceClient { * @param {string} uptime_check_config * @returns {string} Resource name string. */ - folderUptimeCheckConfigPath(folder:string,uptimeCheckConfig:string) { + folderUptimeCheckConfigPath(folder: string, uptimeCheckConfig: string) { return this.pathTemplates.folderUptimeCheckConfigPathTemplate.render({ folder: folder, uptime_check_config: uptimeCheckConfig, @@ -1288,8 +1514,12 @@ export class SnoozeServiceClient { * A fully-qualified path representing folder_uptime_check_config resource. * @returns {string} A string representing the folder. */ - matchFolderFromFolderUptimeCheckConfigName(folderUptimeCheckConfigName: string) { - return this.pathTemplates.folderUptimeCheckConfigPathTemplate.match(folderUptimeCheckConfigName).folder; + matchFolderFromFolderUptimeCheckConfigName( + folderUptimeCheckConfigName: string, + ) { + return this.pathTemplates.folderUptimeCheckConfigPathTemplate.match( + folderUptimeCheckConfigName, + ).folder; } /** @@ -1299,8 +1529,12 @@ export class SnoozeServiceClient { * A fully-qualified path representing folder_uptime_check_config resource. * @returns {string} A string representing the uptime_check_config. */ - matchUptimeCheckConfigFromFolderUptimeCheckConfigName(folderUptimeCheckConfigName: string) { - return this.pathTemplates.folderUptimeCheckConfigPathTemplate.match(folderUptimeCheckConfigName).uptime_check_config; + matchUptimeCheckConfigFromFolderUptimeCheckConfigName( + folderUptimeCheckConfigName: string, + ) { + return this.pathTemplates.folderUptimeCheckConfigPathTemplate.match( + folderUptimeCheckConfigName, + ).uptime_check_config; } /** @@ -1310,7 +1544,7 @@ export class SnoozeServiceClient { * @param {string} alert_policy * @returns {string} Resource name string. */ - organizationAlertPolicyPath(organization:string,alertPolicy:string) { + organizationAlertPolicyPath(organization: string, alertPolicy: string) { return this.pathTemplates.organizationAlertPolicyPathTemplate.render({ organization: organization, alert_policy: alertPolicy, @@ -1324,8 +1558,12 @@ export class SnoozeServiceClient { * A fully-qualified path representing organization_alert_policy resource. * @returns {string} A string representing the organization. */ - matchOrganizationFromOrganizationAlertPolicyName(organizationAlertPolicyName: string) { - return this.pathTemplates.organizationAlertPolicyPathTemplate.match(organizationAlertPolicyName).organization; + matchOrganizationFromOrganizationAlertPolicyName( + organizationAlertPolicyName: string, + ) { + return this.pathTemplates.organizationAlertPolicyPathTemplate.match( + organizationAlertPolicyName, + ).organization; } /** @@ -1335,8 +1573,12 @@ export class SnoozeServiceClient { * A fully-qualified path representing organization_alert_policy resource. * @returns {string} A string representing the alert_policy. */ - matchAlertPolicyFromOrganizationAlertPolicyName(organizationAlertPolicyName: string) { - return this.pathTemplates.organizationAlertPolicyPathTemplate.match(organizationAlertPolicyName).alert_policy; + matchAlertPolicyFromOrganizationAlertPolicyName( + organizationAlertPolicyName: string, + ) { + return this.pathTemplates.organizationAlertPolicyPathTemplate.match( + organizationAlertPolicyName, + ).alert_policy; } /** @@ -1347,12 +1589,18 @@ export class SnoozeServiceClient { * @param {string} condition * @returns {string} Resource name string. */ - organizationAlertPolicyConditionPath(organization:string,alertPolicy:string,condition:string) { - return this.pathTemplates.organizationAlertPolicyConditionPathTemplate.render({ - organization: organization, - alert_policy: alertPolicy, - condition: condition, - }); + organizationAlertPolicyConditionPath( + organization: string, + alertPolicy: string, + condition: string, + ) { + return this.pathTemplates.organizationAlertPolicyConditionPathTemplate.render( + { + organization: organization, + alert_policy: alertPolicy, + condition: condition, + }, + ); } /** @@ -1362,8 +1610,12 @@ export class SnoozeServiceClient { * A fully-qualified path representing organization_alert_policy_condition resource. * @returns {string} A string representing the organization. */ - matchOrganizationFromOrganizationAlertPolicyConditionName(organizationAlertPolicyConditionName: string) { - return this.pathTemplates.organizationAlertPolicyConditionPathTemplate.match(organizationAlertPolicyConditionName).organization; + matchOrganizationFromOrganizationAlertPolicyConditionName( + organizationAlertPolicyConditionName: string, + ) { + return this.pathTemplates.organizationAlertPolicyConditionPathTemplate.match( + organizationAlertPolicyConditionName, + ).organization; } /** @@ -1373,8 +1625,12 @@ export class SnoozeServiceClient { * A fully-qualified path representing organization_alert_policy_condition resource. * @returns {string} A string representing the alert_policy. */ - matchAlertPolicyFromOrganizationAlertPolicyConditionName(organizationAlertPolicyConditionName: string) { - return this.pathTemplates.organizationAlertPolicyConditionPathTemplate.match(organizationAlertPolicyConditionName).alert_policy; + matchAlertPolicyFromOrganizationAlertPolicyConditionName( + organizationAlertPolicyConditionName: string, + ) { + return this.pathTemplates.organizationAlertPolicyConditionPathTemplate.match( + organizationAlertPolicyConditionName, + ).alert_policy; } /** @@ -1384,8 +1640,12 @@ export class SnoozeServiceClient { * A fully-qualified path representing organization_alert_policy_condition resource. * @returns {string} A string representing the condition. */ - matchConditionFromOrganizationAlertPolicyConditionName(organizationAlertPolicyConditionName: string) { - return this.pathTemplates.organizationAlertPolicyConditionPathTemplate.match(organizationAlertPolicyConditionName).condition; + matchConditionFromOrganizationAlertPolicyConditionName( + organizationAlertPolicyConditionName: string, + ) { + return this.pathTemplates.organizationAlertPolicyConditionPathTemplate.match( + organizationAlertPolicyConditionName, + ).condition; } /** @@ -1395,7 +1655,10 @@ export class SnoozeServiceClient { * @param {string} channel_descriptor * @returns {string} Resource name string. */ - organizationChannelDescriptorPath(organization:string,channelDescriptor:string) { + organizationChannelDescriptorPath( + organization: string, + channelDescriptor: string, + ) { return this.pathTemplates.organizationChannelDescriptorPathTemplate.render({ organization: organization, channel_descriptor: channelDescriptor, @@ -1409,8 +1672,12 @@ export class SnoozeServiceClient { * A fully-qualified path representing organization_channel_descriptor resource. * @returns {string} A string representing the organization. */ - matchOrganizationFromOrganizationChannelDescriptorName(organizationChannelDescriptorName: string) { - return this.pathTemplates.organizationChannelDescriptorPathTemplate.match(organizationChannelDescriptorName).organization; + matchOrganizationFromOrganizationChannelDescriptorName( + organizationChannelDescriptorName: string, + ) { + return this.pathTemplates.organizationChannelDescriptorPathTemplate.match( + organizationChannelDescriptorName, + ).organization; } /** @@ -1420,8 +1687,12 @@ export class SnoozeServiceClient { * A fully-qualified path representing organization_channel_descriptor resource. * @returns {string} A string representing the channel_descriptor. */ - matchChannelDescriptorFromOrganizationChannelDescriptorName(organizationChannelDescriptorName: string) { - return this.pathTemplates.organizationChannelDescriptorPathTemplate.match(organizationChannelDescriptorName).channel_descriptor; + matchChannelDescriptorFromOrganizationChannelDescriptorName( + organizationChannelDescriptorName: string, + ) { + return this.pathTemplates.organizationChannelDescriptorPathTemplate.match( + organizationChannelDescriptorName, + ).channel_descriptor; } /** @@ -1431,7 +1702,7 @@ export class SnoozeServiceClient { * @param {string} group * @returns {string} Resource name string. */ - organizationGroupPath(organization:string,group:string) { + organizationGroupPath(organization: string, group: string) { return this.pathTemplates.organizationGroupPathTemplate.render({ organization: organization, group: group, @@ -1446,7 +1717,9 @@ export class SnoozeServiceClient { * @returns {string} A string representing the organization. */ matchOrganizationFromOrganizationGroupName(organizationGroupName: string) { - return this.pathTemplates.organizationGroupPathTemplate.match(organizationGroupName).organization; + return this.pathTemplates.organizationGroupPathTemplate.match( + organizationGroupName, + ).organization; } /** @@ -1457,7 +1730,9 @@ export class SnoozeServiceClient { * @returns {string} A string representing the group. */ matchGroupFromOrganizationGroupName(organizationGroupName: string) { - return this.pathTemplates.organizationGroupPathTemplate.match(organizationGroupName).group; + return this.pathTemplates.organizationGroupPathTemplate.match( + organizationGroupName, + ).group; } /** @@ -1467,11 +1742,16 @@ export class SnoozeServiceClient { * @param {string} notification_channel * @returns {string} Resource name string. */ - organizationNotificationChannelPath(organization:string,notificationChannel:string) { - return this.pathTemplates.organizationNotificationChannelPathTemplate.render({ - organization: organization, - notification_channel: notificationChannel, - }); + organizationNotificationChannelPath( + organization: string, + notificationChannel: string, + ) { + return this.pathTemplates.organizationNotificationChannelPathTemplate.render( + { + organization: organization, + notification_channel: notificationChannel, + }, + ); } /** @@ -1481,8 +1761,12 @@ export class SnoozeServiceClient { * A fully-qualified path representing organization_notification_channel resource. * @returns {string} A string representing the organization. */ - matchOrganizationFromOrganizationNotificationChannelName(organizationNotificationChannelName: string) { - return this.pathTemplates.organizationNotificationChannelPathTemplate.match(organizationNotificationChannelName).organization; + matchOrganizationFromOrganizationNotificationChannelName( + organizationNotificationChannelName: string, + ) { + return this.pathTemplates.organizationNotificationChannelPathTemplate.match( + organizationNotificationChannelName, + ).organization; } /** @@ -1492,8 +1776,12 @@ export class SnoozeServiceClient { * A fully-qualified path representing organization_notification_channel resource. * @returns {string} A string representing the notification_channel. */ - matchNotificationChannelFromOrganizationNotificationChannelName(organizationNotificationChannelName: string) { - return this.pathTemplates.organizationNotificationChannelPathTemplate.match(organizationNotificationChannelName).notification_channel; + matchNotificationChannelFromOrganizationNotificationChannelName( + organizationNotificationChannelName: string, + ) { + return this.pathTemplates.organizationNotificationChannelPathTemplate.match( + organizationNotificationChannelName, + ).notification_channel; } /** @@ -1503,7 +1791,7 @@ export class SnoozeServiceClient { * @param {string} service * @returns {string} Resource name string. */ - organizationServicePath(organization:string,service:string) { + organizationServicePath(organization: string, service: string) { return this.pathTemplates.organizationServicePathTemplate.render({ organization: organization, service: service, @@ -1517,8 +1805,12 @@ export class SnoozeServiceClient { * A fully-qualified path representing organization_service resource. * @returns {string} A string representing the organization. */ - matchOrganizationFromOrganizationServiceName(organizationServiceName: string) { - return this.pathTemplates.organizationServicePathTemplate.match(organizationServiceName).organization; + matchOrganizationFromOrganizationServiceName( + organizationServiceName: string, + ) { + return this.pathTemplates.organizationServicePathTemplate.match( + organizationServiceName, + ).organization; } /** @@ -1529,7 +1821,9 @@ export class SnoozeServiceClient { * @returns {string} A string representing the service. */ matchServiceFromOrganizationServiceName(organizationServiceName: string) { - return this.pathTemplates.organizationServicePathTemplate.match(organizationServiceName).service; + return this.pathTemplates.organizationServicePathTemplate.match( + organizationServiceName, + ).service; } /** @@ -1540,12 +1834,18 @@ export class SnoozeServiceClient { * @param {string} service_level_objective * @returns {string} Resource name string. */ - organizationServiceServiceLevelObjectivePath(organization:string,service:string,serviceLevelObjective:string) { - return this.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.render({ - organization: organization, - service: service, - service_level_objective: serviceLevelObjective, - }); + organizationServiceServiceLevelObjectivePath( + organization: string, + service: string, + serviceLevelObjective: string, + ) { + return this.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.render( + { + organization: organization, + service: service, + service_level_objective: serviceLevelObjective, + }, + ); } /** @@ -1555,8 +1855,12 @@ export class SnoozeServiceClient { * A fully-qualified path representing organization_service_service_level_objective resource. * @returns {string} A string representing the organization. */ - matchOrganizationFromOrganizationServiceServiceLevelObjectiveName(organizationServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match(organizationServiceServiceLevelObjectiveName).organization; + matchOrganizationFromOrganizationServiceServiceLevelObjectiveName( + organizationServiceServiceLevelObjectiveName: string, + ) { + return this.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match( + organizationServiceServiceLevelObjectiveName, + ).organization; } /** @@ -1566,8 +1870,12 @@ export class SnoozeServiceClient { * A fully-qualified path representing organization_service_service_level_objective resource. * @returns {string} A string representing the service. */ - matchServiceFromOrganizationServiceServiceLevelObjectiveName(organizationServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match(organizationServiceServiceLevelObjectiveName).service; + matchServiceFromOrganizationServiceServiceLevelObjectiveName( + organizationServiceServiceLevelObjectiveName: string, + ) { + return this.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match( + organizationServiceServiceLevelObjectiveName, + ).service; } /** @@ -1577,8 +1885,12 @@ export class SnoozeServiceClient { * A fully-qualified path representing organization_service_service_level_objective resource. * @returns {string} A string representing the service_level_objective. */ - matchServiceLevelObjectiveFromOrganizationServiceServiceLevelObjectiveName(organizationServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match(organizationServiceServiceLevelObjectiveName).service_level_objective; + matchServiceLevelObjectiveFromOrganizationServiceServiceLevelObjectiveName( + organizationServiceServiceLevelObjectiveName: string, + ) { + return this.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match( + organizationServiceServiceLevelObjectiveName, + ).service_level_objective; } /** @@ -1588,7 +1900,10 @@ export class SnoozeServiceClient { * @param {string} uptime_check_config * @returns {string} Resource name string. */ - organizationUptimeCheckConfigPath(organization:string,uptimeCheckConfig:string) { + organizationUptimeCheckConfigPath( + organization: string, + uptimeCheckConfig: string, + ) { return this.pathTemplates.organizationUptimeCheckConfigPathTemplate.render({ organization: organization, uptime_check_config: uptimeCheckConfig, @@ -1602,8 +1917,12 @@ export class SnoozeServiceClient { * A fully-qualified path representing organization_uptime_check_config resource. * @returns {string} A string representing the organization. */ - matchOrganizationFromOrganizationUptimeCheckConfigName(organizationUptimeCheckConfigName: string) { - return this.pathTemplates.organizationUptimeCheckConfigPathTemplate.match(organizationUptimeCheckConfigName).organization; + matchOrganizationFromOrganizationUptimeCheckConfigName( + organizationUptimeCheckConfigName: string, + ) { + return this.pathTemplates.organizationUptimeCheckConfigPathTemplate.match( + organizationUptimeCheckConfigName, + ).organization; } /** @@ -1613,8 +1932,12 @@ export class SnoozeServiceClient { * A fully-qualified path representing organization_uptime_check_config resource. * @returns {string} A string representing the uptime_check_config. */ - matchUptimeCheckConfigFromOrganizationUptimeCheckConfigName(organizationUptimeCheckConfigName: string) { - return this.pathTemplates.organizationUptimeCheckConfigPathTemplate.match(organizationUptimeCheckConfigName).uptime_check_config; + matchUptimeCheckConfigFromOrganizationUptimeCheckConfigName( + organizationUptimeCheckConfigName: string, + ) { + return this.pathTemplates.organizationUptimeCheckConfigPathTemplate.match( + organizationUptimeCheckConfigName, + ).uptime_check_config; } /** @@ -1623,7 +1946,7 @@ export class SnoozeServiceClient { * @param {string} project * @returns {string} Resource name string. */ - projectPath(project:string) { + projectPath(project: string) { return this.pathTemplates.projectPathTemplate.render({ project: project, }); @@ -1647,7 +1970,7 @@ export class SnoozeServiceClient { * @param {string} alert_policy * @returns {string} Resource name string. */ - projectAlertPolicyPath(project:string,alertPolicy:string) { + projectAlertPolicyPath(project: string, alertPolicy: string) { return this.pathTemplates.projectAlertPolicyPathTemplate.render({ project: project, alert_policy: alertPolicy, @@ -1662,7 +1985,9 @@ export class SnoozeServiceClient { * @returns {string} A string representing the project. */ matchProjectFromProjectAlertPolicyName(projectAlertPolicyName: string) { - return this.pathTemplates.projectAlertPolicyPathTemplate.match(projectAlertPolicyName).project; + return this.pathTemplates.projectAlertPolicyPathTemplate.match( + projectAlertPolicyName, + ).project; } /** @@ -1673,7 +1998,9 @@ export class SnoozeServiceClient { * @returns {string} A string representing the alert_policy. */ matchAlertPolicyFromProjectAlertPolicyName(projectAlertPolicyName: string) { - return this.pathTemplates.projectAlertPolicyPathTemplate.match(projectAlertPolicyName).alert_policy; + return this.pathTemplates.projectAlertPolicyPathTemplate.match( + projectAlertPolicyName, + ).alert_policy; } /** @@ -1684,7 +2011,11 @@ export class SnoozeServiceClient { * @param {string} condition * @returns {string} Resource name string. */ - projectAlertPolicyConditionPath(project:string,alertPolicy:string,condition:string) { + projectAlertPolicyConditionPath( + project: string, + alertPolicy: string, + condition: string, + ) { return this.pathTemplates.projectAlertPolicyConditionPathTemplate.render({ project: project, alert_policy: alertPolicy, @@ -1699,8 +2030,12 @@ export class SnoozeServiceClient { * A fully-qualified path representing project_alert_policy_condition resource. * @returns {string} A string representing the project. */ - matchProjectFromProjectAlertPolicyConditionName(projectAlertPolicyConditionName: string) { - return this.pathTemplates.projectAlertPolicyConditionPathTemplate.match(projectAlertPolicyConditionName).project; + matchProjectFromProjectAlertPolicyConditionName( + projectAlertPolicyConditionName: string, + ) { + return this.pathTemplates.projectAlertPolicyConditionPathTemplate.match( + projectAlertPolicyConditionName, + ).project; } /** @@ -1710,8 +2045,12 @@ export class SnoozeServiceClient { * A fully-qualified path representing project_alert_policy_condition resource. * @returns {string} A string representing the alert_policy. */ - matchAlertPolicyFromProjectAlertPolicyConditionName(projectAlertPolicyConditionName: string) { - return this.pathTemplates.projectAlertPolicyConditionPathTemplate.match(projectAlertPolicyConditionName).alert_policy; + matchAlertPolicyFromProjectAlertPolicyConditionName( + projectAlertPolicyConditionName: string, + ) { + return this.pathTemplates.projectAlertPolicyConditionPathTemplate.match( + projectAlertPolicyConditionName, + ).alert_policy; } /** @@ -1721,8 +2060,12 @@ export class SnoozeServiceClient { * A fully-qualified path representing project_alert_policy_condition resource. * @returns {string} A string representing the condition. */ - matchConditionFromProjectAlertPolicyConditionName(projectAlertPolicyConditionName: string) { - return this.pathTemplates.projectAlertPolicyConditionPathTemplate.match(projectAlertPolicyConditionName).condition; + matchConditionFromProjectAlertPolicyConditionName( + projectAlertPolicyConditionName: string, + ) { + return this.pathTemplates.projectAlertPolicyConditionPathTemplate.match( + projectAlertPolicyConditionName, + ).condition; } /** @@ -1732,7 +2075,7 @@ export class SnoozeServiceClient { * @param {string} channel_descriptor * @returns {string} Resource name string. */ - projectChannelDescriptorPath(project:string,channelDescriptor:string) { + projectChannelDescriptorPath(project: string, channelDescriptor: string) { return this.pathTemplates.projectChannelDescriptorPathTemplate.render({ project: project, channel_descriptor: channelDescriptor, @@ -1746,8 +2089,12 @@ export class SnoozeServiceClient { * A fully-qualified path representing project_channel_descriptor resource. * @returns {string} A string representing the project. */ - matchProjectFromProjectChannelDescriptorName(projectChannelDescriptorName: string) { - return this.pathTemplates.projectChannelDescriptorPathTemplate.match(projectChannelDescriptorName).project; + matchProjectFromProjectChannelDescriptorName( + projectChannelDescriptorName: string, + ) { + return this.pathTemplates.projectChannelDescriptorPathTemplate.match( + projectChannelDescriptorName, + ).project; } /** @@ -1757,8 +2104,12 @@ export class SnoozeServiceClient { * A fully-qualified path representing project_channel_descriptor resource. * @returns {string} A string representing the channel_descriptor. */ - matchChannelDescriptorFromProjectChannelDescriptorName(projectChannelDescriptorName: string) { - return this.pathTemplates.projectChannelDescriptorPathTemplate.match(projectChannelDescriptorName).channel_descriptor; + matchChannelDescriptorFromProjectChannelDescriptorName( + projectChannelDescriptorName: string, + ) { + return this.pathTemplates.projectChannelDescriptorPathTemplate.match( + projectChannelDescriptorName, + ).channel_descriptor; } /** @@ -1768,7 +2119,7 @@ export class SnoozeServiceClient { * @param {string} group * @returns {string} Resource name string. */ - projectGroupPath(project:string,group:string) { + projectGroupPath(project: string, group: string) { return this.pathTemplates.projectGroupPathTemplate.render({ project: project, group: group, @@ -1783,7 +2134,8 @@ export class SnoozeServiceClient { * @returns {string} A string representing the project. */ matchProjectFromProjectGroupName(projectGroupName: string) { - return this.pathTemplates.projectGroupPathTemplate.match(projectGroupName).project; + return this.pathTemplates.projectGroupPathTemplate.match(projectGroupName) + .project; } /** @@ -1794,7 +2146,8 @@ export class SnoozeServiceClient { * @returns {string} A string representing the group. */ matchGroupFromProjectGroupName(projectGroupName: string) { - return this.pathTemplates.projectGroupPathTemplate.match(projectGroupName).group; + return this.pathTemplates.projectGroupPathTemplate.match(projectGroupName) + .group; } /** @@ -1804,7 +2157,7 @@ export class SnoozeServiceClient { * @param {string} notification_channel * @returns {string} Resource name string. */ - projectNotificationChannelPath(project:string,notificationChannel:string) { + projectNotificationChannelPath(project: string, notificationChannel: string) { return this.pathTemplates.projectNotificationChannelPathTemplate.render({ project: project, notification_channel: notificationChannel, @@ -1818,8 +2171,12 @@ export class SnoozeServiceClient { * A fully-qualified path representing project_notification_channel resource. * @returns {string} A string representing the project. */ - matchProjectFromProjectNotificationChannelName(projectNotificationChannelName: string) { - return this.pathTemplates.projectNotificationChannelPathTemplate.match(projectNotificationChannelName).project; + matchProjectFromProjectNotificationChannelName( + projectNotificationChannelName: string, + ) { + return this.pathTemplates.projectNotificationChannelPathTemplate.match( + projectNotificationChannelName, + ).project; } /** @@ -1829,8 +2186,12 @@ export class SnoozeServiceClient { * A fully-qualified path representing project_notification_channel resource. * @returns {string} A string representing the notification_channel. */ - matchNotificationChannelFromProjectNotificationChannelName(projectNotificationChannelName: string) { - return this.pathTemplates.projectNotificationChannelPathTemplate.match(projectNotificationChannelName).notification_channel; + matchNotificationChannelFromProjectNotificationChannelName( + projectNotificationChannelName: string, + ) { + return this.pathTemplates.projectNotificationChannelPathTemplate.match( + projectNotificationChannelName, + ).notification_channel; } /** @@ -1840,7 +2201,7 @@ export class SnoozeServiceClient { * @param {string} service * @returns {string} Resource name string. */ - projectServicePath(project:string,service:string) { + projectServicePath(project: string, service: string) { return this.pathTemplates.projectServicePathTemplate.render({ project: project, service: service, @@ -1855,7 +2216,9 @@ export class SnoozeServiceClient { * @returns {string} A string representing the project. */ matchProjectFromProjectServiceName(projectServiceName: string) { - return this.pathTemplates.projectServicePathTemplate.match(projectServiceName).project; + return this.pathTemplates.projectServicePathTemplate.match( + projectServiceName, + ).project; } /** @@ -1866,7 +2229,9 @@ export class SnoozeServiceClient { * @returns {string} A string representing the service. */ matchServiceFromProjectServiceName(projectServiceName: string) { - return this.pathTemplates.projectServicePathTemplate.match(projectServiceName).service; + return this.pathTemplates.projectServicePathTemplate.match( + projectServiceName, + ).service; } /** @@ -1877,12 +2242,18 @@ export class SnoozeServiceClient { * @param {string} service_level_objective * @returns {string} Resource name string. */ - projectServiceServiceLevelObjectivePath(project:string,service:string,serviceLevelObjective:string) { - return this.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.render({ - project: project, - service: service, - service_level_objective: serviceLevelObjective, - }); + projectServiceServiceLevelObjectivePath( + project: string, + service: string, + serviceLevelObjective: string, + ) { + return this.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.render( + { + project: project, + service: service, + service_level_objective: serviceLevelObjective, + }, + ); } /** @@ -1892,8 +2263,12 @@ export class SnoozeServiceClient { * A fully-qualified path representing project_service_service_level_objective resource. * @returns {string} A string representing the project. */ - matchProjectFromProjectServiceServiceLevelObjectiveName(projectServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match(projectServiceServiceLevelObjectiveName).project; + matchProjectFromProjectServiceServiceLevelObjectiveName( + projectServiceServiceLevelObjectiveName: string, + ) { + return this.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match( + projectServiceServiceLevelObjectiveName, + ).project; } /** @@ -1903,8 +2278,12 @@ export class SnoozeServiceClient { * A fully-qualified path representing project_service_service_level_objective resource. * @returns {string} A string representing the service. */ - matchServiceFromProjectServiceServiceLevelObjectiveName(projectServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match(projectServiceServiceLevelObjectiveName).service; + matchServiceFromProjectServiceServiceLevelObjectiveName( + projectServiceServiceLevelObjectiveName: string, + ) { + return this.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match( + projectServiceServiceLevelObjectiveName, + ).service; } /** @@ -1914,8 +2293,12 @@ export class SnoozeServiceClient { * A fully-qualified path representing project_service_service_level_objective resource. * @returns {string} A string representing the service_level_objective. */ - matchServiceLevelObjectiveFromProjectServiceServiceLevelObjectiveName(projectServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match(projectServiceServiceLevelObjectiveName).service_level_objective; + matchServiceLevelObjectiveFromProjectServiceServiceLevelObjectiveName( + projectServiceServiceLevelObjectiveName: string, + ) { + return this.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match( + projectServiceServiceLevelObjectiveName, + ).service_level_objective; } /** @@ -1925,7 +2308,7 @@ export class SnoozeServiceClient { * @param {string} uptime_check_config * @returns {string} Resource name string. */ - projectUptimeCheckConfigPath(project:string,uptimeCheckConfig:string) { + projectUptimeCheckConfigPath(project: string, uptimeCheckConfig: string) { return this.pathTemplates.projectUptimeCheckConfigPathTemplate.render({ project: project, uptime_check_config: uptimeCheckConfig, @@ -1939,8 +2322,12 @@ export class SnoozeServiceClient { * A fully-qualified path representing project_uptime_check_config resource. * @returns {string} A string representing the project. */ - matchProjectFromProjectUptimeCheckConfigName(projectUptimeCheckConfigName: string) { - return this.pathTemplates.projectUptimeCheckConfigPathTemplate.match(projectUptimeCheckConfigName).project; + matchProjectFromProjectUptimeCheckConfigName( + projectUptimeCheckConfigName: string, + ) { + return this.pathTemplates.projectUptimeCheckConfigPathTemplate.match( + projectUptimeCheckConfigName, + ).project; } /** @@ -1950,8 +2337,12 @@ export class SnoozeServiceClient { * A fully-qualified path representing project_uptime_check_config resource. * @returns {string} A string representing the uptime_check_config. */ - matchUptimeCheckConfigFromProjectUptimeCheckConfigName(projectUptimeCheckConfigName: string) { - return this.pathTemplates.projectUptimeCheckConfigPathTemplate.match(projectUptimeCheckConfigName).uptime_check_config; + matchUptimeCheckConfigFromProjectUptimeCheckConfigName( + projectUptimeCheckConfigName: string, + ) { + return this.pathTemplates.projectUptimeCheckConfigPathTemplate.match( + projectUptimeCheckConfigName, + ).uptime_check_config; } /** @@ -1961,7 +2352,7 @@ export class SnoozeServiceClient { * @param {string} snooze * @returns {string} Resource name string. */ - snoozePath(project:string,snooze:string) { + snoozePath(project: string, snooze: string) { return this.pathTemplates.snoozePathTemplate.render({ project: project, snooze: snooze, @@ -1998,7 +2389,7 @@ export class SnoozeServiceClient { */ close(): Promise { if (this.snoozeServiceStub && !this._terminated) { - return this.snoozeServiceStub.then(stub => { + return this.snoozeServiceStub.then((stub) => { this._log.info('ending gRPC channel'); this._terminated = true; stub.close(); @@ -2006,4 +2397,4 @@ export class SnoozeServiceClient { } return Promise.resolve(); } -} \ No newline at end of file +} diff --git a/packages/google-cloud-monitoring/src/v3/uptime_check_service_client.ts b/packages/google-cloud-monitoring/src/v3/uptime_check_service_client.ts index debc8b2f59fe..d03a78783e52 100644 --- a/packages/google-cloud-monitoring/src/v3/uptime_check_service_client.ts +++ b/packages/google-cloud-monitoring/src/v3/uptime_check_service_client.ts @@ -18,11 +18,18 @@ /* global window */ import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} from 'google-gax'; -import {Transform} from 'stream'; +import type { + Callback, + CallOptions, + Descriptors, + ClientOptions, + PaginationCallback, + GaxCall, +} from 'google-gax'; +import { Transform } from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; +import { loggingUtils as logging, decodeAnyProtosInArray } from 'google-gax'; /** * Client JSON configuration object, loaded from @@ -51,7 +58,7 @@ export class UptimeCheckServiceClient { 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('monitoring'); @@ -64,9 +71,9 @@ export class UptimeCheckServiceClient { batching: {}, }; warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - uptimeCheckServiceStub?: Promise<{[name: string]: Function}>; + innerApiCalls: { [name: string]: Function }; + pathTemplates: { [name: string]: gax.PathTemplate }; + uptimeCheckServiceStub?: Promise<{ [name: string]: Function }>; /** * Construct an instance of UptimeCheckServiceClient. @@ -107,21 +114,42 @@ export class UptimeCheckServiceClient { * const client = new UptimeCheckServiceClient({fallback: true}, gax); * ``` */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + constructor( + opts?: ClientOptions, + gaxInstance?: typeof gax | typeof gax.fallback, + ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof UptimeCheckServiceClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.', + ); } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; + const universeDomainEnvVar = + typeof process === 'object' && typeof process.env === 'object' + ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] + : undefined; + this._universeDomain = + opts?.universeDomain ?? + opts?.universe_domain ?? + universeDomainEnvVar ?? + 'googleapis.com'; this._servicePath = 'monitoring.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + const servicePath = + opts?.servicePath || opts?.apiEndpoint || this._servicePath; + this._providedCustomServicePath = !!( + opts?.servicePath || opts?.apiEndpoint + ); const port = opts?.port || staticMembers.port; const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts); // Request numeric enum values if REST transport is used. opts.numericEnums = true; @@ -146,7 +174,7 @@ export class UptimeCheckServiceClient { this._opts = opts; // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set useJWTAccessWithScope on the auth object. this.auth.useJWTAccessWithScope = true; @@ -160,10 +188,7 @@ export class UptimeCheckServiceClient { } // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; if (typeof process === 'object' && 'versions' in process) { clientHeader.push(`gl-node/${process.versions.node}`); } else { @@ -185,82 +210,89 @@ export class UptimeCheckServiceClient { // Create useful helper objects for these. this.pathTemplates = { folderAlertPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/alertPolicies/{alert_policy}' + 'folders/{folder}/alertPolicies/{alert_policy}', ), folderAlertPolicyConditionPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/alertPolicies/{alert_policy}/conditions/{condition}' + 'folders/{folder}/alertPolicies/{alert_policy}/conditions/{condition}', ), folderChannelDescriptorPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/notificationChannelDescriptors/{channel_descriptor}' + 'folders/{folder}/notificationChannelDescriptors/{channel_descriptor}', ), folderGroupPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/groups/{group}' + 'folders/{folder}/groups/{group}', ), folderNotificationChannelPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/notificationChannels/{notification_channel}' + 'folders/{folder}/notificationChannels/{notification_channel}', ), folderServicePathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/services/{service}' - ), - folderServiceServiceLevelObjectivePathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/services/{service}/serviceLevelObjectives/{service_level_objective}' + 'folders/{folder}/services/{service}', ), + folderServiceServiceLevelObjectivePathTemplate: + new this._gaxModule.PathTemplate( + 'folders/{folder}/services/{service}/serviceLevelObjectives/{service_level_objective}', + ), folderUptimeCheckConfigPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/uptimeCheckConfigs/{uptime_check_config}' + 'folders/{folder}/uptimeCheckConfigs/{uptime_check_config}', ), organizationAlertPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/alertPolicies/{alert_policy}' - ), - organizationAlertPolicyConditionPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/alertPolicies/{alert_policy}/conditions/{condition}' - ), - organizationChannelDescriptorPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/notificationChannelDescriptors/{channel_descriptor}' + 'organizations/{organization}/alertPolicies/{alert_policy}', ), + organizationAlertPolicyConditionPathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/alertPolicies/{alert_policy}/conditions/{condition}', + ), + organizationChannelDescriptorPathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/notificationChannelDescriptors/{channel_descriptor}', + ), organizationGroupPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/groups/{group}' - ), - organizationNotificationChannelPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/notificationChannels/{notification_channel}' + 'organizations/{organization}/groups/{group}', ), + organizationNotificationChannelPathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/notificationChannels/{notification_channel}', + ), organizationServicePathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/services/{service}' - ), - organizationServiceServiceLevelObjectivePathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/services/{service}/serviceLevelObjectives/{service_level_objective}' - ), - organizationUptimeCheckConfigPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/uptimeCheckConfigs/{uptime_check_config}' + 'organizations/{organization}/services/{service}', ), + organizationServiceServiceLevelObjectivePathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/services/{service}/serviceLevelObjectives/{service_level_objective}', + ), + organizationUptimeCheckConfigPathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/uptimeCheckConfigs/{uptime_check_config}', + ), projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}' + 'projects/{project}', ), projectAlertPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/alertPolicies/{alert_policy}' + 'projects/{project}/alertPolicies/{alert_policy}', ), projectAlertPolicyConditionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/alertPolicies/{alert_policy}/conditions/{condition}' + 'projects/{project}/alertPolicies/{alert_policy}/conditions/{condition}', ), projectChannelDescriptorPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/notificationChannelDescriptors/{channel_descriptor}' + 'projects/{project}/notificationChannelDescriptors/{channel_descriptor}', ), projectGroupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/groups/{group}' + 'projects/{project}/groups/{group}', ), projectNotificationChannelPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/notificationChannels/{notification_channel}' + 'projects/{project}/notificationChannels/{notification_channel}', ), projectServicePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/services/{service}' - ), - projectServiceServiceLevelObjectivePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/services/{service}/serviceLevelObjectives/{service_level_objective}' + 'projects/{project}/services/{service}', ), + projectServiceServiceLevelObjectivePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/services/{service}/serviceLevelObjectives/{service_level_objective}', + ), projectUptimeCheckConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/uptimeCheckConfigs/{uptime_check_config}' + 'projects/{project}/uptimeCheckConfigs/{uptime_check_config}', ), snoozePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/snoozes/{snooze}' + 'projects/{project}/snoozes/{snooze}', ), }; @@ -268,16 +300,25 @@ export class UptimeCheckServiceClient { // (e.g. 50 results at a time, with tokens to get subsequent // pages). Denote the keys used for pagination and results. this.descriptors.page = { - listUptimeCheckConfigs: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'uptimeCheckConfigs'), - listUptimeCheckIps: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'uptimeCheckIps') + listUptimeCheckConfigs: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'uptimeCheckConfigs', + ), + listUptimeCheckIps: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'uptimeCheckIps', + ), }; // Put together the default options sent with requests. this._defaults = this._gaxGrpc.constructSettings( - 'google.monitoring.v3.UptimeCheckService', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + 'google.monitoring.v3.UptimeCheckService', + gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, + { 'x-goog-api-client': clientHeader.join(' ') }, + ); // Set up a dictionary of "inner API calls"; the core implementation // of calling the API is handled in `google-gax`, with this code @@ -308,37 +349,47 @@ export class UptimeCheckServiceClient { // Put together the "service stub" for // google.monitoring.v3.UptimeCheckService. this.uptimeCheckServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.monitoring.v3.UptimeCheckService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.monitoring.v3.UptimeCheckService', + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any (this._protos as any).google.monitoring.v3.UptimeCheckService, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; + this._opts, + this._providedCustomServicePath, + ) as Promise<{ [method: string]: Function }>; // Iterate over each of the methods that the service provides // and create an API call method for each. - const uptimeCheckServiceStubMethods = - ['listUptimeCheckConfigs', 'getUptimeCheckConfig', 'createUptimeCheckConfig', 'updateUptimeCheckConfig', 'deleteUptimeCheckConfig', 'listUptimeCheckIps']; + const uptimeCheckServiceStubMethods = [ + 'listUptimeCheckConfigs', + 'getUptimeCheckConfig', + 'createUptimeCheckConfig', + 'updateUptimeCheckConfig', + 'deleteUptimeCheckConfig', + 'listUptimeCheckIps', + ]; for (const methodName of uptimeCheckServiceStubMethods) { const callPromise = this.uptimeCheckServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { + (stub) => + (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error | null | undefined) => () => { throw err; - }); + }, + ); - const descriptor = - this.descriptors.page[methodName] || - undefined; + const descriptor = this.descriptors.page[methodName] || undefined; const apiCall = this._gaxModule.createApiCall( callPromise, this._defaults[methodName], descriptor, - this._opts.fallback + this._opts.fallback, ); this.innerApiCalls[methodName] = apiCall; @@ -353,8 +404,14 @@ export class UptimeCheckServiceClient { * @returns {string} The DNS address for this service. */ static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); } return 'monitoring.googleapis.com'; } @@ -365,8 +422,14 @@ export class UptimeCheckServiceClient { * @returns {string} The DNS address for this service. */ static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); } return 'monitoring.googleapis.com'; } @@ -400,7 +463,7 @@ export class UptimeCheckServiceClient { return [ 'https://www.googleapis.com/auth/cloud-platform', 'https://www.googleapis.com/auth/monitoring', - 'https://www.googleapis.com/auth/monitoring.read' + 'https://www.googleapis.com/auth/monitoring.read', ]; } @@ -410,8 +473,9 @@ export class UptimeCheckServiceClient { * Return the project ID used by this class. * @returns {Promise} A promise that resolves to string containing the project ID. */ - getProjectId(callback?: Callback): - Promise|void { + getProjectId( + callback?: Callback, + ): Promise | void { if (callback) { this.auth.getProjectId(callback); return; @@ -422,510 +486,704 @@ export class UptimeCheckServiceClient { // ------------------- // -- Service calls -- // ------------------- -/** - * Gets a single Uptime check configuration. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The Uptime check configuration to retrieve. The format is: - * - * projects/[PROJECT_ID_OR_NUMBER]/uptimeCheckConfigs/[UPTIME_CHECK_ID] - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.monitoring.v3.UptimeCheckConfig|UptimeCheckConfig}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v3/uptime_check_service.get_uptime_check_config.js - * region_tag:monitoring_v3_generated_UptimeCheckService_GetUptimeCheckConfig_async - */ + /** + * Gets a single Uptime check configuration. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The Uptime check configuration to retrieve. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER]/uptimeCheckConfigs/[UPTIME_CHECK_ID] + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.monitoring.v3.UptimeCheckConfig|UptimeCheckConfig}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v3/uptime_check_service.get_uptime_check_config.js + * region_tag:monitoring_v3_generated_UptimeCheckService_GetUptimeCheckConfig_async + */ getUptimeCheckConfig( - request?: protos.google.monitoring.v3.IGetUptimeCheckConfigRequest, - options?: CallOptions): - Promise<[ - protos.google.monitoring.v3.IUptimeCheckConfig, - protos.google.monitoring.v3.IGetUptimeCheckConfigRequest|undefined, {}|undefined - ]>; + request?: protos.google.monitoring.v3.IGetUptimeCheckConfigRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.monitoring.v3.IUptimeCheckConfig, + protos.google.monitoring.v3.IGetUptimeCheckConfigRequest | undefined, + {} | undefined, + ] + >; getUptimeCheckConfig( - request: protos.google.monitoring.v3.IGetUptimeCheckConfigRequest, - options: CallOptions, - callback: Callback< - protos.google.monitoring.v3.IUptimeCheckConfig, - protos.google.monitoring.v3.IGetUptimeCheckConfigRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.monitoring.v3.IGetUptimeCheckConfigRequest, + options: CallOptions, + callback: Callback< + protos.google.monitoring.v3.IUptimeCheckConfig, + | protos.google.monitoring.v3.IGetUptimeCheckConfigRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getUptimeCheckConfig( - request: protos.google.monitoring.v3.IGetUptimeCheckConfigRequest, - callback: Callback< - protos.google.monitoring.v3.IUptimeCheckConfig, - protos.google.monitoring.v3.IGetUptimeCheckConfigRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.monitoring.v3.IGetUptimeCheckConfigRequest, + callback: Callback< + protos.google.monitoring.v3.IUptimeCheckConfig, + | protos.google.monitoring.v3.IGetUptimeCheckConfigRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getUptimeCheckConfig( - request?: protos.google.monitoring.v3.IGetUptimeCheckConfigRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.monitoring.v3.IUptimeCheckConfig, - protos.google.monitoring.v3.IGetUptimeCheckConfigRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.monitoring.v3.IGetUptimeCheckConfigRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.monitoring.v3.IUptimeCheckConfig, - protos.google.monitoring.v3.IGetUptimeCheckConfigRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.monitoring.v3.IUptimeCheckConfig, - protos.google.monitoring.v3.IGetUptimeCheckConfigRequest|undefined, {}|undefined - ]>|void { + | protos.google.monitoring.v3.IGetUptimeCheckConfigRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.monitoring.v3.IUptimeCheckConfig, + | protos.google.monitoring.v3.IGetUptimeCheckConfigRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.monitoring.v3.IUptimeCheckConfig, + protos.google.monitoring.v3.IGetUptimeCheckConfigRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('getUptimeCheckConfig request %j', request); - const wrappedCallback: Callback< - protos.google.monitoring.v3.IUptimeCheckConfig, - protos.google.monitoring.v3.IGetUptimeCheckConfigRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.monitoring.v3.IUptimeCheckConfig, + | protos.google.monitoring.v3.IGetUptimeCheckConfigRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('getUptimeCheckConfig response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.getUptimeCheckConfig(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.monitoring.v3.IUptimeCheckConfig, - protos.google.monitoring.v3.IGetUptimeCheckConfigRequest|undefined, - {}|undefined - ]) => { - this._log.info('getUptimeCheckConfig 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); + return this.innerApiCalls + .getUptimeCheckConfig(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.monitoring.v3.IUptimeCheckConfig, + protos.google.monitoring.v3.IGetUptimeCheckConfigRequest | undefined, + {} | undefined, + ]) => { + this._log.info('getUptimeCheckConfig 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 Uptime check configuration. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The - * [project](https://cloud.google.com/monitoring/api/v3#project_name) in which - * to create the Uptime check. The format is: - * - * projects/[PROJECT_ID_OR_NUMBER] - * @param {google.monitoring.v3.UptimeCheckConfig} request.uptimeCheckConfig - * Required. The new Uptime check configuration. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.monitoring.v3.UptimeCheckConfig|UptimeCheckConfig}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v3/uptime_check_service.create_uptime_check_config.js - * region_tag:monitoring_v3_generated_UptimeCheckService_CreateUptimeCheckConfig_async - */ + /** + * Creates a new Uptime check configuration. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The + * [project](https://cloud.google.com/monitoring/api/v3#project_name) in which + * to create the Uptime check. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER] + * @param {google.monitoring.v3.UptimeCheckConfig} request.uptimeCheckConfig + * Required. The new Uptime check configuration. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.monitoring.v3.UptimeCheckConfig|UptimeCheckConfig}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v3/uptime_check_service.create_uptime_check_config.js + * region_tag:monitoring_v3_generated_UptimeCheckService_CreateUptimeCheckConfig_async + */ createUptimeCheckConfig( - request?: protos.google.monitoring.v3.ICreateUptimeCheckConfigRequest, - options?: CallOptions): - Promise<[ - protos.google.monitoring.v3.IUptimeCheckConfig, - protos.google.monitoring.v3.ICreateUptimeCheckConfigRequest|undefined, {}|undefined - ]>; + request?: protos.google.monitoring.v3.ICreateUptimeCheckConfigRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.monitoring.v3.IUptimeCheckConfig, + protos.google.monitoring.v3.ICreateUptimeCheckConfigRequest | undefined, + {} | undefined, + ] + >; createUptimeCheckConfig( - request: protos.google.monitoring.v3.ICreateUptimeCheckConfigRequest, - options: CallOptions, - callback: Callback< - protos.google.monitoring.v3.IUptimeCheckConfig, - protos.google.monitoring.v3.ICreateUptimeCheckConfigRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.monitoring.v3.ICreateUptimeCheckConfigRequest, + options: CallOptions, + callback: Callback< + protos.google.monitoring.v3.IUptimeCheckConfig, + | protos.google.monitoring.v3.ICreateUptimeCheckConfigRequest + | null + | undefined, + {} | null | undefined + >, + ): void; createUptimeCheckConfig( - request: protos.google.monitoring.v3.ICreateUptimeCheckConfigRequest, - callback: Callback< - protos.google.monitoring.v3.IUptimeCheckConfig, - protos.google.monitoring.v3.ICreateUptimeCheckConfigRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.monitoring.v3.ICreateUptimeCheckConfigRequest, + callback: Callback< + protos.google.monitoring.v3.IUptimeCheckConfig, + | protos.google.monitoring.v3.ICreateUptimeCheckConfigRequest + | null + | undefined, + {} | null | undefined + >, + ): void; createUptimeCheckConfig( - request?: protos.google.monitoring.v3.ICreateUptimeCheckConfigRequest, - optionsOrCallback?: CallOptions|Callback< + request?: protos.google.monitoring.v3.ICreateUptimeCheckConfigRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.monitoring.v3.IUptimeCheckConfig, - protos.google.monitoring.v3.ICreateUptimeCheckConfigRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.monitoring.v3.IUptimeCheckConfig, - protos.google.monitoring.v3.ICreateUptimeCheckConfigRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.monitoring.v3.IUptimeCheckConfig, - protos.google.monitoring.v3.ICreateUptimeCheckConfigRequest|undefined, {}|undefined - ]>|void { + | protos.google.monitoring.v3.ICreateUptimeCheckConfigRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.monitoring.v3.IUptimeCheckConfig, + | protos.google.monitoring.v3.ICreateUptimeCheckConfigRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.monitoring.v3.IUptimeCheckConfig, + protos.google.monitoring.v3.ICreateUptimeCheckConfigRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('createUptimeCheckConfig request %j', request); - const wrappedCallback: Callback< - protos.google.monitoring.v3.IUptimeCheckConfig, - protos.google.monitoring.v3.ICreateUptimeCheckConfigRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.monitoring.v3.IUptimeCheckConfig, + | protos.google.monitoring.v3.ICreateUptimeCheckConfigRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('createUptimeCheckConfig response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.createUptimeCheckConfig(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.monitoring.v3.IUptimeCheckConfig, - protos.google.monitoring.v3.ICreateUptimeCheckConfigRequest|undefined, - {}|undefined - ]) => { - this._log.info('createUptimeCheckConfig 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); + return this.innerApiCalls + .createUptimeCheckConfig(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.monitoring.v3.IUptimeCheckConfig, + ( + | protos.google.monitoring.v3.ICreateUptimeCheckConfigRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('createUptimeCheckConfig 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 an Uptime check configuration. You can either replace the entire - * configuration with a new one or replace only certain fields in the current - * configuration by specifying the fields to be updated via `updateMask`. - * Returns the updated configuration. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.FieldMask} request.updateMask - * Optional. If present, only the listed fields in the current Uptime check - * configuration are updated with values from the new configuration. If this - * field is empty, then the current configuration is completely replaced with - * the new configuration. - * @param {google.monitoring.v3.UptimeCheckConfig} request.uptimeCheckConfig - * Required. If an `updateMask` has been specified, this field gives - * the values for the set of fields mentioned in the `updateMask`. If an - * `updateMask` has not been given, this Uptime check configuration replaces - * the current configuration. If a field is mentioned in `updateMask` but - * the corresponding field is omitted in this partial Uptime check - * configuration, it has the effect of deleting/clearing the field from the - * configuration on the server. - * - * The following fields can be updated: `display_name`, - * `http_check`, `tcp_check`, `timeout`, `content_matchers`, and - * `selected_regions`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.monitoring.v3.UptimeCheckConfig|UptimeCheckConfig}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v3/uptime_check_service.update_uptime_check_config.js - * region_tag:monitoring_v3_generated_UptimeCheckService_UpdateUptimeCheckConfig_async - */ + /** + * Updates an Uptime check configuration. You can either replace the entire + * configuration with a new one or replace only certain fields in the current + * configuration by specifying the fields to be updated via `updateMask`. + * Returns the updated configuration. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.protobuf.FieldMask} request.updateMask + * Optional. If present, only the listed fields in the current Uptime check + * configuration are updated with values from the new configuration. If this + * field is empty, then the current configuration is completely replaced with + * the new configuration. + * @param {google.monitoring.v3.UptimeCheckConfig} request.uptimeCheckConfig + * Required. If an `updateMask` has been specified, this field gives + * the values for the set of fields mentioned in the `updateMask`. If an + * `updateMask` has not been given, this Uptime check configuration replaces + * the current configuration. If a field is mentioned in `updateMask` but + * the corresponding field is omitted in this partial Uptime check + * configuration, it has the effect of deleting/clearing the field from the + * configuration on the server. + * + * The following fields can be updated: `display_name`, + * `http_check`, `tcp_check`, `timeout`, `content_matchers`, and + * `selected_regions`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.monitoring.v3.UptimeCheckConfig|UptimeCheckConfig}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v3/uptime_check_service.update_uptime_check_config.js + * region_tag:monitoring_v3_generated_UptimeCheckService_UpdateUptimeCheckConfig_async + */ updateUptimeCheckConfig( - request?: protos.google.monitoring.v3.IUpdateUptimeCheckConfigRequest, - options?: CallOptions): - Promise<[ - protos.google.monitoring.v3.IUptimeCheckConfig, - protos.google.monitoring.v3.IUpdateUptimeCheckConfigRequest|undefined, {}|undefined - ]>; + request?: protos.google.monitoring.v3.IUpdateUptimeCheckConfigRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.monitoring.v3.IUptimeCheckConfig, + protos.google.monitoring.v3.IUpdateUptimeCheckConfigRequest | undefined, + {} | undefined, + ] + >; updateUptimeCheckConfig( - request: protos.google.monitoring.v3.IUpdateUptimeCheckConfigRequest, - options: CallOptions, - callback: Callback< - protos.google.monitoring.v3.IUptimeCheckConfig, - protos.google.monitoring.v3.IUpdateUptimeCheckConfigRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.monitoring.v3.IUpdateUptimeCheckConfigRequest, + options: CallOptions, + callback: Callback< + protos.google.monitoring.v3.IUptimeCheckConfig, + | protos.google.monitoring.v3.IUpdateUptimeCheckConfigRequest + | null + | undefined, + {} | null | undefined + >, + ): void; updateUptimeCheckConfig( - request: protos.google.monitoring.v3.IUpdateUptimeCheckConfigRequest, - callback: Callback< - protos.google.monitoring.v3.IUptimeCheckConfig, - protos.google.monitoring.v3.IUpdateUptimeCheckConfigRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.monitoring.v3.IUpdateUptimeCheckConfigRequest, + callback: Callback< + protos.google.monitoring.v3.IUptimeCheckConfig, + | protos.google.monitoring.v3.IUpdateUptimeCheckConfigRequest + | null + | undefined, + {} | null | undefined + >, + ): void; updateUptimeCheckConfig( - request?: protos.google.monitoring.v3.IUpdateUptimeCheckConfigRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.monitoring.v3.IUptimeCheckConfig, - protos.google.monitoring.v3.IUpdateUptimeCheckConfigRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.monitoring.v3.IUpdateUptimeCheckConfigRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.monitoring.v3.IUptimeCheckConfig, - protos.google.monitoring.v3.IUpdateUptimeCheckConfigRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.monitoring.v3.IUptimeCheckConfig, - protos.google.monitoring.v3.IUpdateUptimeCheckConfigRequest|undefined, {}|undefined - ]>|void { + | protos.google.monitoring.v3.IUpdateUptimeCheckConfigRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.monitoring.v3.IUptimeCheckConfig, + | protos.google.monitoring.v3.IUpdateUptimeCheckConfigRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.monitoring.v3.IUptimeCheckConfig, + protos.google.monitoring.v3.IUpdateUptimeCheckConfigRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'uptime_check_config.name': request.uptimeCheckConfig!.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + 'uptime_check_config.name': request.uptimeCheckConfig!.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('updateUptimeCheckConfig request %j', request); - const wrappedCallback: Callback< - protos.google.monitoring.v3.IUptimeCheckConfig, - protos.google.monitoring.v3.IUpdateUptimeCheckConfigRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.monitoring.v3.IUptimeCheckConfig, + | protos.google.monitoring.v3.IUpdateUptimeCheckConfigRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('updateUptimeCheckConfig response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.updateUptimeCheckConfig(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.monitoring.v3.IUptimeCheckConfig, - protos.google.monitoring.v3.IUpdateUptimeCheckConfigRequest|undefined, - {}|undefined - ]) => { - this._log.info('updateUptimeCheckConfig 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); + return this.innerApiCalls + .updateUptimeCheckConfig(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.monitoring.v3.IUptimeCheckConfig, + ( + | protos.google.monitoring.v3.IUpdateUptimeCheckConfigRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('updateUptimeCheckConfig 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 Uptime check configuration. Note that this method will fail - * if the Uptime check configuration is referenced by an alert policy or - * other dependent configs that would be rendered invalid by the deletion. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The Uptime check configuration to delete. The format is: - * - * projects/[PROJECT_ID_OR_NUMBER]/uptimeCheckConfigs/[UPTIME_CHECK_ID] - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v3/uptime_check_service.delete_uptime_check_config.js - * region_tag:monitoring_v3_generated_UptimeCheckService_DeleteUptimeCheckConfig_async - */ + /** + * Deletes an Uptime check configuration. Note that this method will fail + * if the Uptime check configuration is referenced by an alert policy or + * other dependent configs that would be rendered invalid by the deletion. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The Uptime check configuration to delete. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER]/uptimeCheckConfigs/[UPTIME_CHECK_ID] + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.protobuf.Empty|Empty}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v3/uptime_check_service.delete_uptime_check_config.js + * region_tag:monitoring_v3_generated_UptimeCheckService_DeleteUptimeCheckConfig_async + */ deleteUptimeCheckConfig( - request?: protos.google.monitoring.v3.IDeleteUptimeCheckConfigRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteUptimeCheckConfigRequest|undefined, {}|undefined - ]>; + request?: protos.google.monitoring.v3.IDeleteUptimeCheckConfigRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.protobuf.IEmpty, + protos.google.monitoring.v3.IDeleteUptimeCheckConfigRequest | undefined, + {} | undefined, + ] + >; deleteUptimeCheckConfig( - request: protos.google.monitoring.v3.IDeleteUptimeCheckConfigRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteUptimeCheckConfigRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.monitoring.v3.IDeleteUptimeCheckConfigRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + | protos.google.monitoring.v3.IDeleteUptimeCheckConfigRequest + | null + | undefined, + {} | null | undefined + >, + ): void; deleteUptimeCheckConfig( - request: protos.google.monitoring.v3.IDeleteUptimeCheckConfigRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteUptimeCheckConfigRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.monitoring.v3.IDeleteUptimeCheckConfigRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + | protos.google.monitoring.v3.IDeleteUptimeCheckConfigRequest + | null + | undefined, + {} | null | undefined + >, + ): void; deleteUptimeCheckConfig( - request?: protos.google.monitoring.v3.IDeleteUptimeCheckConfigRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteUptimeCheckConfigRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.monitoring.v3.IDeleteUptimeCheckConfigRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteUptimeCheckConfigRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteUptimeCheckConfigRequest|undefined, {}|undefined - ]>|void { + | protos.google.monitoring.v3.IDeleteUptimeCheckConfigRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.IEmpty, + | protos.google.monitoring.v3.IDeleteUptimeCheckConfigRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.protobuf.IEmpty, + protos.google.monitoring.v3.IDeleteUptimeCheckConfigRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('deleteUptimeCheckConfig request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteUptimeCheckConfigRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.protobuf.IEmpty, + | protos.google.monitoring.v3.IDeleteUptimeCheckConfigRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('deleteUptimeCheckConfig response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.deleteUptimeCheckConfig(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteUptimeCheckConfigRequest|undefined, - {}|undefined - ]) => { - this._log.info('deleteUptimeCheckConfig 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); + return this.innerApiCalls + .deleteUptimeCheckConfig(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.protobuf.IEmpty, + ( + | protos.google.monitoring.v3.IDeleteUptimeCheckConfigRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('deleteUptimeCheckConfig 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; }); } - /** - * Lists the existing valid Uptime check configurations for the project - * (leaving out any invalid configurations). - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The - * [project](https://cloud.google.com/monitoring/api/v3#project_name) whose - * Uptime check configurations are listed. The format is: - * - * projects/[PROJECT_ID_OR_NUMBER] - * @param {string} request.filter - * If provided, this field specifies the criteria that must be met by - * uptime checks to be included in the response. - * - * For more details, see [Filtering - * syntax](https://cloud.google.com/monitoring/api/v3/sorting-and-filtering#filter_syntax). - * @param {number} request.pageSize - * The maximum number of results to return in a single response. The server - * may further constrain the maximum number of results returned in a single - * page. If the page_size is <=0, the server will decide the number of results - * to be returned. - * @param {string} request.pageToken - * If this field is not empty then it must contain the `nextPageToken` value - * returned by a previous call to this method. Using this field causes the - * method to return more results from the previous method call. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of {@link protos.google.monitoring.v3.UptimeCheckConfig|UptimeCheckConfig}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listUptimeCheckConfigsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Lists the existing valid Uptime check configurations for the project + * (leaving out any invalid configurations). + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The + * [project](https://cloud.google.com/monitoring/api/v3#project_name) whose + * Uptime check configurations are listed. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER] + * @param {string} request.filter + * If provided, this field specifies the criteria that must be met by + * uptime checks to be included in the response. + * + * For more details, see [Filtering + * syntax](https://cloud.google.com/monitoring/api/v3/sorting-and-filtering#filter_syntax). + * @param {number} request.pageSize + * The maximum number of results to return in a single response. The server + * may further constrain the maximum number of results returned in a single + * page. If the page_size is <=0, the server will decide the number of results + * to be returned. + * @param {string} request.pageToken + * If this field is not empty then it must contain the `nextPageToken` value + * returned by a previous call to this method. Using this field causes the + * method to return more results from the previous method call. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of {@link protos.google.monitoring.v3.UptimeCheckConfig|UptimeCheckConfig}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listUptimeCheckConfigsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listUptimeCheckConfigs( - request?: protos.google.monitoring.v3.IListUptimeCheckConfigsRequest, - options?: CallOptions): - Promise<[ - protos.google.monitoring.v3.IUptimeCheckConfig[], - protos.google.monitoring.v3.IListUptimeCheckConfigsRequest|null, - protos.google.monitoring.v3.IListUptimeCheckConfigsResponse - ]>; + request?: protos.google.monitoring.v3.IListUptimeCheckConfigsRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.monitoring.v3.IUptimeCheckConfig[], + protos.google.monitoring.v3.IListUptimeCheckConfigsRequest | null, + protos.google.monitoring.v3.IListUptimeCheckConfigsResponse, + ] + >; listUptimeCheckConfigs( - request: protos.google.monitoring.v3.IListUptimeCheckConfigsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.monitoring.v3.IListUptimeCheckConfigsRequest, - protos.google.monitoring.v3.IListUptimeCheckConfigsResponse|null|undefined, - protos.google.monitoring.v3.IUptimeCheckConfig>): void; + request: protos.google.monitoring.v3.IListUptimeCheckConfigsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.monitoring.v3.IListUptimeCheckConfigsRequest, + | protos.google.monitoring.v3.IListUptimeCheckConfigsResponse + | null + | undefined, + protos.google.monitoring.v3.IUptimeCheckConfig + >, + ): void; listUptimeCheckConfigs( - request: protos.google.monitoring.v3.IListUptimeCheckConfigsRequest, - callback: PaginationCallback< - protos.google.monitoring.v3.IListUptimeCheckConfigsRequest, - protos.google.monitoring.v3.IListUptimeCheckConfigsResponse|null|undefined, - protos.google.monitoring.v3.IUptimeCheckConfig>): void; + request: protos.google.monitoring.v3.IListUptimeCheckConfigsRequest, + callback: PaginationCallback< + protos.google.monitoring.v3.IListUptimeCheckConfigsRequest, + | protos.google.monitoring.v3.IListUptimeCheckConfigsResponse + | null + | undefined, + protos.google.monitoring.v3.IUptimeCheckConfig + >, + ): void; listUptimeCheckConfigs( - request?: protos.google.monitoring.v3.IListUptimeCheckConfigsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.monitoring.v3.IListUptimeCheckConfigsRequest, - protos.google.monitoring.v3.IListUptimeCheckConfigsResponse|null|undefined, - protos.google.monitoring.v3.IUptimeCheckConfig>, - callback?: PaginationCallback< + request?: protos.google.monitoring.v3.IListUptimeCheckConfigsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.monitoring.v3.IListUptimeCheckConfigsRequest, - protos.google.monitoring.v3.IListUptimeCheckConfigsResponse|null|undefined, - protos.google.monitoring.v3.IUptimeCheckConfig>): - Promise<[ - protos.google.monitoring.v3.IUptimeCheckConfig[], - protos.google.monitoring.v3.IListUptimeCheckConfigsRequest|null, - protos.google.monitoring.v3.IListUptimeCheckConfigsResponse - ]>|void { + | protos.google.monitoring.v3.IListUptimeCheckConfigsResponse + | null + | undefined, + protos.google.monitoring.v3.IUptimeCheckConfig + >, + callback?: PaginationCallback< + protos.google.monitoring.v3.IListUptimeCheckConfigsRequest, + | protos.google.monitoring.v3.IListUptimeCheckConfigsResponse + | null + | undefined, + protos.google.monitoring.v3.IUptimeCheckConfig + >, + ): Promise< + [ + protos.google.monitoring.v3.IUptimeCheckConfig[], + protos.google.monitoring.v3.IListUptimeCheckConfigsRequest | null, + protos.google.monitoring.v3.IListUptimeCheckConfigsResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.monitoring.v3.IListUptimeCheckConfigsRequest, - protos.google.monitoring.v3.IListUptimeCheckConfigsResponse|null|undefined, - protos.google.monitoring.v3.IUptimeCheckConfig>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.monitoring.v3.IListUptimeCheckConfigsRequest, + | protos.google.monitoring.v3.IListUptimeCheckConfigsResponse + | null + | undefined, + protos.google.monitoring.v3.IUptimeCheckConfig + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('listUptimeCheckConfigs values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -934,219 +1192,249 @@ export class UptimeCheckServiceClient { this._log.info('listUptimeCheckConfigs request %j', request); return this.innerApiCalls .listUptimeCheckConfigs(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.monitoring.v3.IUptimeCheckConfig[], - protos.google.monitoring.v3.IListUptimeCheckConfigsRequest|null, - protos.google.monitoring.v3.IListUptimeCheckConfigsResponse - ]) => { - this._log.info('listUptimeCheckConfigs values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.monitoring.v3.IUptimeCheckConfig[], + protos.google.monitoring.v3.IListUptimeCheckConfigsRequest | null, + protos.google.monitoring.v3.IListUptimeCheckConfigsResponse, + ]) => { + this._log.info('listUptimeCheckConfigs values %j', response); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listUptimeCheckConfigs`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The - * [project](https://cloud.google.com/monitoring/api/v3#project_name) whose - * Uptime check configurations are listed. The format is: - * - * projects/[PROJECT_ID_OR_NUMBER] - * @param {string} request.filter - * If provided, this field specifies the criteria that must be met by - * uptime checks to be included in the response. - * - * For more details, see [Filtering - * syntax](https://cloud.google.com/monitoring/api/v3/sorting-and-filtering#filter_syntax). - * @param {number} request.pageSize - * The maximum number of results to return in a single response. The server - * may further constrain the maximum number of results returned in a single - * page. If the page_size is <=0, the server will decide the number of results - * to be returned. - * @param {string} request.pageToken - * If this field is not empty then it must contain the `nextPageToken` value - * returned by a previous call to this method. Using this field causes the - * method to return more results from the previous method call. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.monitoring.v3.UptimeCheckConfig|UptimeCheckConfig} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listUptimeCheckConfigsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Equivalent to `listUptimeCheckConfigs`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The + * [project](https://cloud.google.com/monitoring/api/v3#project_name) whose + * Uptime check configurations are listed. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER] + * @param {string} request.filter + * If provided, this field specifies the criteria that must be met by + * uptime checks to be included in the response. + * + * For more details, see [Filtering + * syntax](https://cloud.google.com/monitoring/api/v3/sorting-and-filtering#filter_syntax). + * @param {number} request.pageSize + * The maximum number of results to return in a single response. The server + * may further constrain the maximum number of results returned in a single + * page. If the page_size is <=0, the server will decide the number of results + * to be returned. + * @param {string} request.pageToken + * If this field is not empty then it must contain the `nextPageToken` value + * returned by a previous call to this method. Using this field causes the + * method to return more results from the previous method call. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.monitoring.v3.UptimeCheckConfig|UptimeCheckConfig} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listUptimeCheckConfigsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listUptimeCheckConfigsStream( - request?: protos.google.monitoring.v3.IListUptimeCheckConfigsRequest, - options?: CallOptions): - Transform{ + request?: protos.google.monitoring.v3.IListUptimeCheckConfigsRequest, + options?: CallOptions, + ): Transform { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listUptimeCheckConfigs']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listUptimeCheckConfigs stream %j', request); return this.descriptors.page.listUptimeCheckConfigs.createStream( this.innerApiCalls.listUptimeCheckConfigs as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `listUptimeCheckConfigs`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The - * [project](https://cloud.google.com/monitoring/api/v3#project_name) whose - * Uptime check configurations are listed. The format is: - * - * projects/[PROJECT_ID_OR_NUMBER] - * @param {string} request.filter - * If provided, this field specifies the criteria that must be met by - * uptime checks to be included in the response. - * - * For more details, see [Filtering - * syntax](https://cloud.google.com/monitoring/api/v3/sorting-and-filtering#filter_syntax). - * @param {number} request.pageSize - * The maximum number of results to return in a single response. The server - * may further constrain the maximum number of results returned in a single - * page. If the page_size is <=0, the server will decide the number of results - * to be returned. - * @param {string} request.pageToken - * If this field is not empty then it must contain the `nextPageToken` value - * returned by a previous call to this method. Using this field causes the - * method to return more results from the previous method call. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.monitoring.v3.UptimeCheckConfig|UptimeCheckConfig}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v3/uptime_check_service.list_uptime_check_configs.js - * region_tag:monitoring_v3_generated_UptimeCheckService_ListUptimeCheckConfigs_async - */ + /** + * Equivalent to `listUptimeCheckConfigs`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The + * [project](https://cloud.google.com/monitoring/api/v3#project_name) whose + * Uptime check configurations are listed. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER] + * @param {string} request.filter + * If provided, this field specifies the criteria that must be met by + * uptime checks to be included in the response. + * + * For more details, see [Filtering + * syntax](https://cloud.google.com/monitoring/api/v3/sorting-and-filtering#filter_syntax). + * @param {number} request.pageSize + * The maximum number of results to return in a single response. The server + * may further constrain the maximum number of results returned in a single + * page. If the page_size is <=0, the server will decide the number of results + * to be returned. + * @param {string} request.pageToken + * If this field is not empty then it must contain the `nextPageToken` value + * returned by a previous call to this method. Using this field causes the + * method to return more results from the previous method call. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.monitoring.v3.UptimeCheckConfig|UptimeCheckConfig}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v3/uptime_check_service.list_uptime_check_configs.js + * region_tag:monitoring_v3_generated_UptimeCheckService_ListUptimeCheckConfigs_async + */ listUptimeCheckConfigsAsync( - request?: protos.google.monitoring.v3.IListUptimeCheckConfigsRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.monitoring.v3.IListUptimeCheckConfigsRequest, + options?: CallOptions, + ): AsyncIterable { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listUptimeCheckConfigs']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listUptimeCheckConfigs iterate %j', request); return this.descriptors.page.listUptimeCheckConfigs.asyncIterate( this.innerApiCalls['listUptimeCheckConfigs'] as GaxCall, request as {}, - callSettings + callSettings, ) as AsyncIterable; } - /** - * Returns the list of IP addresses that checkers run from. - * - * @param {Object} request - * The request object that will be sent. - * @param {number} request.pageSize - * The maximum number of results to return in a single response. The server - * may further constrain the maximum number of results returned in a single - * page. If the page_size is <=0, the server will decide the number of results - * to be returned. - * NOTE: this field is not yet implemented - * @param {string} request.pageToken - * If this field is not empty then it must contain the `nextPageToken` value - * returned by a previous call to this method. Using this field causes the - * method to return more results from the previous method call. - * NOTE: this field is not yet implemented - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of {@link protos.google.monitoring.v3.UptimeCheckIp|UptimeCheckIp}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listUptimeCheckIpsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Returns the list of IP addresses that checkers run from. + * + * @param {Object} request + * The request object that will be sent. + * @param {number} request.pageSize + * The maximum number of results to return in a single response. The server + * may further constrain the maximum number of results returned in a single + * page. If the page_size is <=0, the server will decide the number of results + * to be returned. + * NOTE: this field is not yet implemented + * @param {string} request.pageToken + * If this field is not empty then it must contain the `nextPageToken` value + * returned by a previous call to this method. Using this field causes the + * method to return more results from the previous method call. + * NOTE: this field is not yet implemented + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of {@link protos.google.monitoring.v3.UptimeCheckIp|UptimeCheckIp}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listUptimeCheckIpsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listUptimeCheckIps( - request?: protos.google.monitoring.v3.IListUptimeCheckIpsRequest, - options?: CallOptions): - Promise<[ - protos.google.monitoring.v3.IUptimeCheckIp[], - protos.google.monitoring.v3.IListUptimeCheckIpsRequest|null, - protos.google.monitoring.v3.IListUptimeCheckIpsResponse - ]>; + request?: protos.google.monitoring.v3.IListUptimeCheckIpsRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.monitoring.v3.IUptimeCheckIp[], + protos.google.monitoring.v3.IListUptimeCheckIpsRequest | null, + protos.google.monitoring.v3.IListUptimeCheckIpsResponse, + ] + >; listUptimeCheckIps( - request: protos.google.monitoring.v3.IListUptimeCheckIpsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.monitoring.v3.IListUptimeCheckIpsRequest, - protos.google.monitoring.v3.IListUptimeCheckIpsResponse|null|undefined, - protos.google.monitoring.v3.IUptimeCheckIp>): void; + request: protos.google.monitoring.v3.IListUptimeCheckIpsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.monitoring.v3.IListUptimeCheckIpsRequest, + | protos.google.monitoring.v3.IListUptimeCheckIpsResponse + | null + | undefined, + protos.google.monitoring.v3.IUptimeCheckIp + >, + ): void; listUptimeCheckIps( - request: protos.google.monitoring.v3.IListUptimeCheckIpsRequest, - callback: PaginationCallback< - protos.google.monitoring.v3.IListUptimeCheckIpsRequest, - protos.google.monitoring.v3.IListUptimeCheckIpsResponse|null|undefined, - protos.google.monitoring.v3.IUptimeCheckIp>): void; + request: protos.google.monitoring.v3.IListUptimeCheckIpsRequest, + callback: PaginationCallback< + protos.google.monitoring.v3.IListUptimeCheckIpsRequest, + | protos.google.monitoring.v3.IListUptimeCheckIpsResponse + | null + | undefined, + protos.google.monitoring.v3.IUptimeCheckIp + >, + ): void; listUptimeCheckIps( - request?: protos.google.monitoring.v3.IListUptimeCheckIpsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< + request?: protos.google.monitoring.v3.IListUptimeCheckIpsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.monitoring.v3.IListUptimeCheckIpsRequest, - protos.google.monitoring.v3.IListUptimeCheckIpsResponse|null|undefined, - protos.google.monitoring.v3.IUptimeCheckIp>, - callback?: PaginationCallback< - protos.google.monitoring.v3.IListUptimeCheckIpsRequest, - protos.google.monitoring.v3.IListUptimeCheckIpsResponse|null|undefined, - protos.google.monitoring.v3.IUptimeCheckIp>): - Promise<[ - protos.google.monitoring.v3.IUptimeCheckIp[], - protos.google.monitoring.v3.IListUptimeCheckIpsRequest|null, - protos.google.monitoring.v3.IListUptimeCheckIpsResponse - ]>|void { + | protos.google.monitoring.v3.IListUptimeCheckIpsResponse + | null + | undefined, + protos.google.monitoring.v3.IUptimeCheckIp + >, + callback?: PaginationCallback< + protos.google.monitoring.v3.IListUptimeCheckIpsRequest, + | protos.google.monitoring.v3.IListUptimeCheckIpsResponse + | null + | undefined, + protos.google.monitoring.v3.IUptimeCheckIp + >, + ): Promise< + [ + protos.google.monitoring.v3.IUptimeCheckIp[], + protos.google.monitoring.v3.IListUptimeCheckIpsRequest | null, + protos.google.monitoring.v3.IListUptimeCheckIpsResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.monitoring.v3.IListUptimeCheckIpsRequest, - protos.google.monitoring.v3.IListUptimeCheckIpsResponse|null|undefined, - protos.google.monitoring.v3.IUptimeCheckIp>|undefined = callback + this.initialize().catch((err) => { + throw err; + }); + const wrappedCallback: + | PaginationCallback< + protos.google.monitoring.v3.IListUptimeCheckIpsRequest, + | protos.google.monitoring.v3.IListUptimeCheckIpsResponse + | null + | undefined, + protos.google.monitoring.v3.IUptimeCheckIp + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('listUptimeCheckIps values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -1155,106 +1443,112 @@ export class UptimeCheckServiceClient { this._log.info('listUptimeCheckIps request %j', request); return this.innerApiCalls .listUptimeCheckIps(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.monitoring.v3.IUptimeCheckIp[], - protos.google.monitoring.v3.IListUptimeCheckIpsRequest|null, - protos.google.monitoring.v3.IListUptimeCheckIpsResponse - ]) => { - this._log.info('listUptimeCheckIps values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.monitoring.v3.IUptimeCheckIp[], + protos.google.monitoring.v3.IListUptimeCheckIpsRequest | null, + protos.google.monitoring.v3.IListUptimeCheckIpsResponse, + ]) => { + this._log.info('listUptimeCheckIps values %j', response); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listUptimeCheckIps`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {number} request.pageSize - * The maximum number of results to return in a single response. The server - * may further constrain the maximum number of results returned in a single - * page. If the page_size is <=0, the server will decide the number of results - * to be returned. - * NOTE: this field is not yet implemented - * @param {string} request.pageToken - * If this field is not empty then it must contain the `nextPageToken` value - * returned by a previous call to this method. Using this field causes the - * method to return more results from the previous method call. - * NOTE: this field is not yet implemented - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.monitoring.v3.UptimeCheckIp|UptimeCheckIp} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listUptimeCheckIpsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Equivalent to `listUptimeCheckIps`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {number} request.pageSize + * The maximum number of results to return in a single response. The server + * may further constrain the maximum number of results returned in a single + * page. If the page_size is <=0, the server will decide the number of results + * to be returned. + * NOTE: this field is not yet implemented + * @param {string} request.pageToken + * If this field is not empty then it must contain the `nextPageToken` value + * returned by a previous call to this method. Using this field causes the + * method to return more results from the previous method call. + * NOTE: this field is not yet implemented + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.monitoring.v3.UptimeCheckIp|UptimeCheckIp} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listUptimeCheckIpsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listUptimeCheckIpsStream( - request?: protos.google.monitoring.v3.IListUptimeCheckIpsRequest, - options?: CallOptions): - Transform{ + request?: protos.google.monitoring.v3.IListUptimeCheckIpsRequest, + options?: CallOptions, + ): Transform { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; const defaultCallSettings = this._defaults['listUptimeCheckIps']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listUptimeCheckIps stream %j', request); return this.descriptors.page.listUptimeCheckIps.createStream( this.innerApiCalls.listUptimeCheckIps as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `listUptimeCheckIps`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {number} request.pageSize - * The maximum number of results to return in a single response. The server - * may further constrain the maximum number of results returned in a single - * page. If the page_size is <=0, the server will decide the number of results - * to be returned. - * NOTE: this field is not yet implemented - * @param {string} request.pageToken - * If this field is not empty then it must contain the `nextPageToken` value - * returned by a previous call to this method. Using this field causes the - * method to return more results from the previous method call. - * NOTE: this field is not yet implemented - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.monitoring.v3.UptimeCheckIp|UptimeCheckIp}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v3/uptime_check_service.list_uptime_check_ips.js - * region_tag:monitoring_v3_generated_UptimeCheckService_ListUptimeCheckIps_async - */ + /** + * Equivalent to `listUptimeCheckIps`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {number} request.pageSize + * The maximum number of results to return in a single response. The server + * may further constrain the maximum number of results returned in a single + * page. If the page_size is <=0, the server will decide the number of results + * to be returned. + * NOTE: this field is not yet implemented + * @param {string} request.pageToken + * If this field is not empty then it must contain the `nextPageToken` value + * returned by a previous call to this method. Using this field causes the + * method to return more results from the previous method call. + * NOTE: this field is not yet implemented + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.monitoring.v3.UptimeCheckIp|UptimeCheckIp}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v3/uptime_check_service.list_uptime_check_ips.js + * region_tag:monitoring_v3_generated_UptimeCheckService_ListUptimeCheckIps_async + */ listUptimeCheckIpsAsync( - request?: protos.google.monitoring.v3.IListUptimeCheckIpsRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.monitoring.v3.IListUptimeCheckIpsRequest, + options?: CallOptions, + ): AsyncIterable { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; const defaultCallSettings = this._defaults['listUptimeCheckIps']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listUptimeCheckIps iterate %j', request); return this.descriptors.page.listUptimeCheckIps.asyncIterate( this.innerApiCalls['listUptimeCheckIps'] as GaxCall, request as {}, - callSettings + callSettings, ) as AsyncIterable; } // -------------------- @@ -1268,7 +1562,7 @@ export class UptimeCheckServiceClient { * @param {string} alert_policy * @returns {string} Resource name string. */ - folderAlertPolicyPath(folder:string,alertPolicy:string) { + folderAlertPolicyPath(folder: string, alertPolicy: string) { return this.pathTemplates.folderAlertPolicyPathTemplate.render({ folder: folder, alert_policy: alertPolicy, @@ -1283,7 +1577,9 @@ export class UptimeCheckServiceClient { * @returns {string} A string representing the folder. */ matchFolderFromFolderAlertPolicyName(folderAlertPolicyName: string) { - return this.pathTemplates.folderAlertPolicyPathTemplate.match(folderAlertPolicyName).folder; + return this.pathTemplates.folderAlertPolicyPathTemplate.match( + folderAlertPolicyName, + ).folder; } /** @@ -1294,7 +1590,9 @@ export class UptimeCheckServiceClient { * @returns {string} A string representing the alert_policy. */ matchAlertPolicyFromFolderAlertPolicyName(folderAlertPolicyName: string) { - return this.pathTemplates.folderAlertPolicyPathTemplate.match(folderAlertPolicyName).alert_policy; + return this.pathTemplates.folderAlertPolicyPathTemplate.match( + folderAlertPolicyName, + ).alert_policy; } /** @@ -1305,7 +1603,11 @@ export class UptimeCheckServiceClient { * @param {string} condition * @returns {string} Resource name string. */ - folderAlertPolicyConditionPath(folder:string,alertPolicy:string,condition:string) { + folderAlertPolicyConditionPath( + folder: string, + alertPolicy: string, + condition: string, + ) { return this.pathTemplates.folderAlertPolicyConditionPathTemplate.render({ folder: folder, alert_policy: alertPolicy, @@ -1320,8 +1622,12 @@ export class UptimeCheckServiceClient { * A fully-qualified path representing folder_alert_policy_condition resource. * @returns {string} A string representing the folder. */ - matchFolderFromFolderAlertPolicyConditionName(folderAlertPolicyConditionName: string) { - return this.pathTemplates.folderAlertPolicyConditionPathTemplate.match(folderAlertPolicyConditionName).folder; + matchFolderFromFolderAlertPolicyConditionName( + folderAlertPolicyConditionName: string, + ) { + return this.pathTemplates.folderAlertPolicyConditionPathTemplate.match( + folderAlertPolicyConditionName, + ).folder; } /** @@ -1331,8 +1637,12 @@ export class UptimeCheckServiceClient { * A fully-qualified path representing folder_alert_policy_condition resource. * @returns {string} A string representing the alert_policy. */ - matchAlertPolicyFromFolderAlertPolicyConditionName(folderAlertPolicyConditionName: string) { - return this.pathTemplates.folderAlertPolicyConditionPathTemplate.match(folderAlertPolicyConditionName).alert_policy; + matchAlertPolicyFromFolderAlertPolicyConditionName( + folderAlertPolicyConditionName: string, + ) { + return this.pathTemplates.folderAlertPolicyConditionPathTemplate.match( + folderAlertPolicyConditionName, + ).alert_policy; } /** @@ -1342,8 +1652,12 @@ export class UptimeCheckServiceClient { * A fully-qualified path representing folder_alert_policy_condition resource. * @returns {string} A string representing the condition. */ - matchConditionFromFolderAlertPolicyConditionName(folderAlertPolicyConditionName: string) { - return this.pathTemplates.folderAlertPolicyConditionPathTemplate.match(folderAlertPolicyConditionName).condition; + matchConditionFromFolderAlertPolicyConditionName( + folderAlertPolicyConditionName: string, + ) { + return this.pathTemplates.folderAlertPolicyConditionPathTemplate.match( + folderAlertPolicyConditionName, + ).condition; } /** @@ -1353,7 +1667,7 @@ export class UptimeCheckServiceClient { * @param {string} channel_descriptor * @returns {string} Resource name string. */ - folderChannelDescriptorPath(folder:string,channelDescriptor:string) { + folderChannelDescriptorPath(folder: string, channelDescriptor: string) { return this.pathTemplates.folderChannelDescriptorPathTemplate.render({ folder: folder, channel_descriptor: channelDescriptor, @@ -1367,8 +1681,12 @@ export class UptimeCheckServiceClient { * A fully-qualified path representing folder_channel_descriptor resource. * @returns {string} A string representing the folder. */ - matchFolderFromFolderChannelDescriptorName(folderChannelDescriptorName: string) { - return this.pathTemplates.folderChannelDescriptorPathTemplate.match(folderChannelDescriptorName).folder; + matchFolderFromFolderChannelDescriptorName( + folderChannelDescriptorName: string, + ) { + return this.pathTemplates.folderChannelDescriptorPathTemplate.match( + folderChannelDescriptorName, + ).folder; } /** @@ -1378,8 +1696,12 @@ export class UptimeCheckServiceClient { * A fully-qualified path representing folder_channel_descriptor resource. * @returns {string} A string representing the channel_descriptor. */ - matchChannelDescriptorFromFolderChannelDescriptorName(folderChannelDescriptorName: string) { - return this.pathTemplates.folderChannelDescriptorPathTemplate.match(folderChannelDescriptorName).channel_descriptor; + matchChannelDescriptorFromFolderChannelDescriptorName( + folderChannelDescriptorName: string, + ) { + return this.pathTemplates.folderChannelDescriptorPathTemplate.match( + folderChannelDescriptorName, + ).channel_descriptor; } /** @@ -1389,7 +1711,7 @@ export class UptimeCheckServiceClient { * @param {string} group * @returns {string} Resource name string. */ - folderGroupPath(folder:string,group:string) { + folderGroupPath(folder: string, group: string) { return this.pathTemplates.folderGroupPathTemplate.render({ folder: folder, group: group, @@ -1404,7 +1726,8 @@ export class UptimeCheckServiceClient { * @returns {string} A string representing the folder. */ matchFolderFromFolderGroupName(folderGroupName: string) { - return this.pathTemplates.folderGroupPathTemplate.match(folderGroupName).folder; + return this.pathTemplates.folderGroupPathTemplate.match(folderGroupName) + .folder; } /** @@ -1415,7 +1738,8 @@ export class UptimeCheckServiceClient { * @returns {string} A string representing the group. */ matchGroupFromFolderGroupName(folderGroupName: string) { - return this.pathTemplates.folderGroupPathTemplate.match(folderGroupName).group; + return this.pathTemplates.folderGroupPathTemplate.match(folderGroupName) + .group; } /** @@ -1425,7 +1749,7 @@ export class UptimeCheckServiceClient { * @param {string} notification_channel * @returns {string} Resource name string. */ - folderNotificationChannelPath(folder:string,notificationChannel:string) { + folderNotificationChannelPath(folder: string, notificationChannel: string) { return this.pathTemplates.folderNotificationChannelPathTemplate.render({ folder: folder, notification_channel: notificationChannel, @@ -1439,8 +1763,12 @@ export class UptimeCheckServiceClient { * A fully-qualified path representing folder_notification_channel resource. * @returns {string} A string representing the folder. */ - matchFolderFromFolderNotificationChannelName(folderNotificationChannelName: string) { - return this.pathTemplates.folderNotificationChannelPathTemplate.match(folderNotificationChannelName).folder; + matchFolderFromFolderNotificationChannelName( + folderNotificationChannelName: string, + ) { + return this.pathTemplates.folderNotificationChannelPathTemplate.match( + folderNotificationChannelName, + ).folder; } /** @@ -1450,8 +1778,12 @@ export class UptimeCheckServiceClient { * A fully-qualified path representing folder_notification_channel resource. * @returns {string} A string representing the notification_channel. */ - matchNotificationChannelFromFolderNotificationChannelName(folderNotificationChannelName: string) { - return this.pathTemplates.folderNotificationChannelPathTemplate.match(folderNotificationChannelName).notification_channel; + matchNotificationChannelFromFolderNotificationChannelName( + folderNotificationChannelName: string, + ) { + return this.pathTemplates.folderNotificationChannelPathTemplate.match( + folderNotificationChannelName, + ).notification_channel; } /** @@ -1461,7 +1793,7 @@ export class UptimeCheckServiceClient { * @param {string} service * @returns {string} Resource name string. */ - folderServicePath(folder:string,service:string) { + folderServicePath(folder: string, service: string) { return this.pathTemplates.folderServicePathTemplate.render({ folder: folder, service: service, @@ -1476,7 +1808,8 @@ export class UptimeCheckServiceClient { * @returns {string} A string representing the folder. */ matchFolderFromFolderServiceName(folderServiceName: string) { - return this.pathTemplates.folderServicePathTemplate.match(folderServiceName).folder; + return this.pathTemplates.folderServicePathTemplate.match(folderServiceName) + .folder; } /** @@ -1487,7 +1820,8 @@ export class UptimeCheckServiceClient { * @returns {string} A string representing the service. */ matchServiceFromFolderServiceName(folderServiceName: string) { - return this.pathTemplates.folderServicePathTemplate.match(folderServiceName).service; + return this.pathTemplates.folderServicePathTemplate.match(folderServiceName) + .service; } /** @@ -1498,12 +1832,18 @@ export class UptimeCheckServiceClient { * @param {string} service_level_objective * @returns {string} Resource name string. */ - folderServiceServiceLevelObjectivePath(folder:string,service:string,serviceLevelObjective:string) { - return this.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.render({ - folder: folder, - service: service, - service_level_objective: serviceLevelObjective, - }); + folderServiceServiceLevelObjectivePath( + folder: string, + service: string, + serviceLevelObjective: string, + ) { + return this.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.render( + { + folder: folder, + service: service, + service_level_objective: serviceLevelObjective, + }, + ); } /** @@ -1513,8 +1853,12 @@ export class UptimeCheckServiceClient { * A fully-qualified path representing folder_service_service_level_objective resource. * @returns {string} A string representing the folder. */ - matchFolderFromFolderServiceServiceLevelObjectiveName(folderServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match(folderServiceServiceLevelObjectiveName).folder; + matchFolderFromFolderServiceServiceLevelObjectiveName( + folderServiceServiceLevelObjectiveName: string, + ) { + return this.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match( + folderServiceServiceLevelObjectiveName, + ).folder; } /** @@ -1524,8 +1868,12 @@ export class UptimeCheckServiceClient { * A fully-qualified path representing folder_service_service_level_objective resource. * @returns {string} A string representing the service. */ - matchServiceFromFolderServiceServiceLevelObjectiveName(folderServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match(folderServiceServiceLevelObjectiveName).service; + matchServiceFromFolderServiceServiceLevelObjectiveName( + folderServiceServiceLevelObjectiveName: string, + ) { + return this.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match( + folderServiceServiceLevelObjectiveName, + ).service; } /** @@ -1535,8 +1883,12 @@ export class UptimeCheckServiceClient { * A fully-qualified path representing folder_service_service_level_objective resource. * @returns {string} A string representing the service_level_objective. */ - matchServiceLevelObjectiveFromFolderServiceServiceLevelObjectiveName(folderServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match(folderServiceServiceLevelObjectiveName).service_level_objective; + matchServiceLevelObjectiveFromFolderServiceServiceLevelObjectiveName( + folderServiceServiceLevelObjectiveName: string, + ) { + return this.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match( + folderServiceServiceLevelObjectiveName, + ).service_level_objective; } /** @@ -1546,7 +1898,7 @@ export class UptimeCheckServiceClient { * @param {string} uptime_check_config * @returns {string} Resource name string. */ - folderUptimeCheckConfigPath(folder:string,uptimeCheckConfig:string) { + folderUptimeCheckConfigPath(folder: string, uptimeCheckConfig: string) { return this.pathTemplates.folderUptimeCheckConfigPathTemplate.render({ folder: folder, uptime_check_config: uptimeCheckConfig, @@ -1560,8 +1912,12 @@ export class UptimeCheckServiceClient { * A fully-qualified path representing folder_uptime_check_config resource. * @returns {string} A string representing the folder. */ - matchFolderFromFolderUptimeCheckConfigName(folderUptimeCheckConfigName: string) { - return this.pathTemplates.folderUptimeCheckConfigPathTemplate.match(folderUptimeCheckConfigName).folder; + matchFolderFromFolderUptimeCheckConfigName( + folderUptimeCheckConfigName: string, + ) { + return this.pathTemplates.folderUptimeCheckConfigPathTemplate.match( + folderUptimeCheckConfigName, + ).folder; } /** @@ -1571,8 +1927,12 @@ export class UptimeCheckServiceClient { * A fully-qualified path representing folder_uptime_check_config resource. * @returns {string} A string representing the uptime_check_config. */ - matchUptimeCheckConfigFromFolderUptimeCheckConfigName(folderUptimeCheckConfigName: string) { - return this.pathTemplates.folderUptimeCheckConfigPathTemplate.match(folderUptimeCheckConfigName).uptime_check_config; + matchUptimeCheckConfigFromFolderUptimeCheckConfigName( + folderUptimeCheckConfigName: string, + ) { + return this.pathTemplates.folderUptimeCheckConfigPathTemplate.match( + folderUptimeCheckConfigName, + ).uptime_check_config; } /** @@ -1582,7 +1942,7 @@ export class UptimeCheckServiceClient { * @param {string} alert_policy * @returns {string} Resource name string. */ - organizationAlertPolicyPath(organization:string,alertPolicy:string) { + organizationAlertPolicyPath(organization: string, alertPolicy: string) { return this.pathTemplates.organizationAlertPolicyPathTemplate.render({ organization: organization, alert_policy: alertPolicy, @@ -1596,8 +1956,12 @@ export class UptimeCheckServiceClient { * A fully-qualified path representing organization_alert_policy resource. * @returns {string} A string representing the organization. */ - matchOrganizationFromOrganizationAlertPolicyName(organizationAlertPolicyName: string) { - return this.pathTemplates.organizationAlertPolicyPathTemplate.match(organizationAlertPolicyName).organization; + matchOrganizationFromOrganizationAlertPolicyName( + organizationAlertPolicyName: string, + ) { + return this.pathTemplates.organizationAlertPolicyPathTemplate.match( + organizationAlertPolicyName, + ).organization; } /** @@ -1607,8 +1971,12 @@ export class UptimeCheckServiceClient { * A fully-qualified path representing organization_alert_policy resource. * @returns {string} A string representing the alert_policy. */ - matchAlertPolicyFromOrganizationAlertPolicyName(organizationAlertPolicyName: string) { - return this.pathTemplates.organizationAlertPolicyPathTemplate.match(organizationAlertPolicyName).alert_policy; + matchAlertPolicyFromOrganizationAlertPolicyName( + organizationAlertPolicyName: string, + ) { + return this.pathTemplates.organizationAlertPolicyPathTemplate.match( + organizationAlertPolicyName, + ).alert_policy; } /** @@ -1619,12 +1987,18 @@ export class UptimeCheckServiceClient { * @param {string} condition * @returns {string} Resource name string. */ - organizationAlertPolicyConditionPath(organization:string,alertPolicy:string,condition:string) { - return this.pathTemplates.organizationAlertPolicyConditionPathTemplate.render({ - organization: organization, - alert_policy: alertPolicy, - condition: condition, - }); + organizationAlertPolicyConditionPath( + organization: string, + alertPolicy: string, + condition: string, + ) { + return this.pathTemplates.organizationAlertPolicyConditionPathTemplate.render( + { + organization: organization, + alert_policy: alertPolicy, + condition: condition, + }, + ); } /** @@ -1634,8 +2008,12 @@ export class UptimeCheckServiceClient { * A fully-qualified path representing organization_alert_policy_condition resource. * @returns {string} A string representing the organization. */ - matchOrganizationFromOrganizationAlertPolicyConditionName(organizationAlertPolicyConditionName: string) { - return this.pathTemplates.organizationAlertPolicyConditionPathTemplate.match(organizationAlertPolicyConditionName).organization; + matchOrganizationFromOrganizationAlertPolicyConditionName( + organizationAlertPolicyConditionName: string, + ) { + return this.pathTemplates.organizationAlertPolicyConditionPathTemplate.match( + organizationAlertPolicyConditionName, + ).organization; } /** @@ -1645,8 +2023,12 @@ export class UptimeCheckServiceClient { * A fully-qualified path representing organization_alert_policy_condition resource. * @returns {string} A string representing the alert_policy. */ - matchAlertPolicyFromOrganizationAlertPolicyConditionName(organizationAlertPolicyConditionName: string) { - return this.pathTemplates.organizationAlertPolicyConditionPathTemplate.match(organizationAlertPolicyConditionName).alert_policy; + matchAlertPolicyFromOrganizationAlertPolicyConditionName( + organizationAlertPolicyConditionName: string, + ) { + return this.pathTemplates.organizationAlertPolicyConditionPathTemplate.match( + organizationAlertPolicyConditionName, + ).alert_policy; } /** @@ -1656,8 +2038,12 @@ export class UptimeCheckServiceClient { * A fully-qualified path representing organization_alert_policy_condition resource. * @returns {string} A string representing the condition. */ - matchConditionFromOrganizationAlertPolicyConditionName(organizationAlertPolicyConditionName: string) { - return this.pathTemplates.organizationAlertPolicyConditionPathTemplate.match(organizationAlertPolicyConditionName).condition; + matchConditionFromOrganizationAlertPolicyConditionName( + organizationAlertPolicyConditionName: string, + ) { + return this.pathTemplates.organizationAlertPolicyConditionPathTemplate.match( + organizationAlertPolicyConditionName, + ).condition; } /** @@ -1667,7 +2053,10 @@ export class UptimeCheckServiceClient { * @param {string} channel_descriptor * @returns {string} Resource name string. */ - organizationChannelDescriptorPath(organization:string,channelDescriptor:string) { + organizationChannelDescriptorPath( + organization: string, + channelDescriptor: string, + ) { return this.pathTemplates.organizationChannelDescriptorPathTemplate.render({ organization: organization, channel_descriptor: channelDescriptor, @@ -1681,8 +2070,12 @@ export class UptimeCheckServiceClient { * A fully-qualified path representing organization_channel_descriptor resource. * @returns {string} A string representing the organization. */ - matchOrganizationFromOrganizationChannelDescriptorName(organizationChannelDescriptorName: string) { - return this.pathTemplates.organizationChannelDescriptorPathTemplate.match(organizationChannelDescriptorName).organization; + matchOrganizationFromOrganizationChannelDescriptorName( + organizationChannelDescriptorName: string, + ) { + return this.pathTemplates.organizationChannelDescriptorPathTemplate.match( + organizationChannelDescriptorName, + ).organization; } /** @@ -1692,8 +2085,12 @@ export class UptimeCheckServiceClient { * A fully-qualified path representing organization_channel_descriptor resource. * @returns {string} A string representing the channel_descriptor. */ - matchChannelDescriptorFromOrganizationChannelDescriptorName(organizationChannelDescriptorName: string) { - return this.pathTemplates.organizationChannelDescriptorPathTemplate.match(organizationChannelDescriptorName).channel_descriptor; + matchChannelDescriptorFromOrganizationChannelDescriptorName( + organizationChannelDescriptorName: string, + ) { + return this.pathTemplates.organizationChannelDescriptorPathTemplate.match( + organizationChannelDescriptorName, + ).channel_descriptor; } /** @@ -1703,7 +2100,7 @@ export class UptimeCheckServiceClient { * @param {string} group * @returns {string} Resource name string. */ - organizationGroupPath(organization:string,group:string) { + organizationGroupPath(organization: string, group: string) { return this.pathTemplates.organizationGroupPathTemplate.render({ organization: organization, group: group, @@ -1718,7 +2115,9 @@ export class UptimeCheckServiceClient { * @returns {string} A string representing the organization. */ matchOrganizationFromOrganizationGroupName(organizationGroupName: string) { - return this.pathTemplates.organizationGroupPathTemplate.match(organizationGroupName).organization; + return this.pathTemplates.organizationGroupPathTemplate.match( + organizationGroupName, + ).organization; } /** @@ -1729,7 +2128,9 @@ export class UptimeCheckServiceClient { * @returns {string} A string representing the group. */ matchGroupFromOrganizationGroupName(organizationGroupName: string) { - return this.pathTemplates.organizationGroupPathTemplate.match(organizationGroupName).group; + return this.pathTemplates.organizationGroupPathTemplate.match( + organizationGroupName, + ).group; } /** @@ -1739,11 +2140,16 @@ export class UptimeCheckServiceClient { * @param {string} notification_channel * @returns {string} Resource name string. */ - organizationNotificationChannelPath(organization:string,notificationChannel:string) { - return this.pathTemplates.organizationNotificationChannelPathTemplate.render({ - organization: organization, - notification_channel: notificationChannel, - }); + organizationNotificationChannelPath( + organization: string, + notificationChannel: string, + ) { + return this.pathTemplates.organizationNotificationChannelPathTemplate.render( + { + organization: organization, + notification_channel: notificationChannel, + }, + ); } /** @@ -1753,8 +2159,12 @@ export class UptimeCheckServiceClient { * A fully-qualified path representing organization_notification_channel resource. * @returns {string} A string representing the organization. */ - matchOrganizationFromOrganizationNotificationChannelName(organizationNotificationChannelName: string) { - return this.pathTemplates.organizationNotificationChannelPathTemplate.match(organizationNotificationChannelName).organization; + matchOrganizationFromOrganizationNotificationChannelName( + organizationNotificationChannelName: string, + ) { + return this.pathTemplates.organizationNotificationChannelPathTemplate.match( + organizationNotificationChannelName, + ).organization; } /** @@ -1764,8 +2174,12 @@ export class UptimeCheckServiceClient { * A fully-qualified path representing organization_notification_channel resource. * @returns {string} A string representing the notification_channel. */ - matchNotificationChannelFromOrganizationNotificationChannelName(organizationNotificationChannelName: string) { - return this.pathTemplates.organizationNotificationChannelPathTemplate.match(organizationNotificationChannelName).notification_channel; + matchNotificationChannelFromOrganizationNotificationChannelName( + organizationNotificationChannelName: string, + ) { + return this.pathTemplates.organizationNotificationChannelPathTemplate.match( + organizationNotificationChannelName, + ).notification_channel; } /** @@ -1775,7 +2189,7 @@ export class UptimeCheckServiceClient { * @param {string} service * @returns {string} Resource name string. */ - organizationServicePath(organization:string,service:string) { + organizationServicePath(organization: string, service: string) { return this.pathTemplates.organizationServicePathTemplate.render({ organization: organization, service: service, @@ -1789,8 +2203,12 @@ export class UptimeCheckServiceClient { * A fully-qualified path representing organization_service resource. * @returns {string} A string representing the organization. */ - matchOrganizationFromOrganizationServiceName(organizationServiceName: string) { - return this.pathTemplates.organizationServicePathTemplate.match(organizationServiceName).organization; + matchOrganizationFromOrganizationServiceName( + organizationServiceName: string, + ) { + return this.pathTemplates.organizationServicePathTemplate.match( + organizationServiceName, + ).organization; } /** @@ -1801,7 +2219,9 @@ export class UptimeCheckServiceClient { * @returns {string} A string representing the service. */ matchServiceFromOrganizationServiceName(organizationServiceName: string) { - return this.pathTemplates.organizationServicePathTemplate.match(organizationServiceName).service; + return this.pathTemplates.organizationServicePathTemplate.match( + organizationServiceName, + ).service; } /** @@ -1812,12 +2232,18 @@ export class UptimeCheckServiceClient { * @param {string} service_level_objective * @returns {string} Resource name string. */ - organizationServiceServiceLevelObjectivePath(organization:string,service:string,serviceLevelObjective:string) { - return this.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.render({ - organization: organization, - service: service, - service_level_objective: serviceLevelObjective, - }); + organizationServiceServiceLevelObjectivePath( + organization: string, + service: string, + serviceLevelObjective: string, + ) { + return this.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.render( + { + organization: organization, + service: service, + service_level_objective: serviceLevelObjective, + }, + ); } /** @@ -1827,8 +2253,12 @@ export class UptimeCheckServiceClient { * A fully-qualified path representing organization_service_service_level_objective resource. * @returns {string} A string representing the organization. */ - matchOrganizationFromOrganizationServiceServiceLevelObjectiveName(organizationServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match(organizationServiceServiceLevelObjectiveName).organization; + matchOrganizationFromOrganizationServiceServiceLevelObjectiveName( + organizationServiceServiceLevelObjectiveName: string, + ) { + return this.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match( + organizationServiceServiceLevelObjectiveName, + ).organization; } /** @@ -1838,8 +2268,12 @@ export class UptimeCheckServiceClient { * A fully-qualified path representing organization_service_service_level_objective resource. * @returns {string} A string representing the service. */ - matchServiceFromOrganizationServiceServiceLevelObjectiveName(organizationServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match(organizationServiceServiceLevelObjectiveName).service; + matchServiceFromOrganizationServiceServiceLevelObjectiveName( + organizationServiceServiceLevelObjectiveName: string, + ) { + return this.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match( + organizationServiceServiceLevelObjectiveName, + ).service; } /** @@ -1849,8 +2283,12 @@ export class UptimeCheckServiceClient { * A fully-qualified path representing organization_service_service_level_objective resource. * @returns {string} A string representing the service_level_objective. */ - matchServiceLevelObjectiveFromOrganizationServiceServiceLevelObjectiveName(organizationServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match(organizationServiceServiceLevelObjectiveName).service_level_objective; + matchServiceLevelObjectiveFromOrganizationServiceServiceLevelObjectiveName( + organizationServiceServiceLevelObjectiveName: string, + ) { + return this.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match( + organizationServiceServiceLevelObjectiveName, + ).service_level_objective; } /** @@ -1860,7 +2298,10 @@ export class UptimeCheckServiceClient { * @param {string} uptime_check_config * @returns {string} Resource name string. */ - organizationUptimeCheckConfigPath(organization:string,uptimeCheckConfig:string) { + organizationUptimeCheckConfigPath( + organization: string, + uptimeCheckConfig: string, + ) { return this.pathTemplates.organizationUptimeCheckConfigPathTemplate.render({ organization: organization, uptime_check_config: uptimeCheckConfig, @@ -1874,8 +2315,12 @@ export class UptimeCheckServiceClient { * A fully-qualified path representing organization_uptime_check_config resource. * @returns {string} A string representing the organization. */ - matchOrganizationFromOrganizationUptimeCheckConfigName(organizationUptimeCheckConfigName: string) { - return this.pathTemplates.organizationUptimeCheckConfigPathTemplate.match(organizationUptimeCheckConfigName).organization; + matchOrganizationFromOrganizationUptimeCheckConfigName( + organizationUptimeCheckConfigName: string, + ) { + return this.pathTemplates.organizationUptimeCheckConfigPathTemplate.match( + organizationUptimeCheckConfigName, + ).organization; } /** @@ -1885,8 +2330,12 @@ export class UptimeCheckServiceClient { * A fully-qualified path representing organization_uptime_check_config resource. * @returns {string} A string representing the uptime_check_config. */ - matchUptimeCheckConfigFromOrganizationUptimeCheckConfigName(organizationUptimeCheckConfigName: string) { - return this.pathTemplates.organizationUptimeCheckConfigPathTemplate.match(organizationUptimeCheckConfigName).uptime_check_config; + matchUptimeCheckConfigFromOrganizationUptimeCheckConfigName( + organizationUptimeCheckConfigName: string, + ) { + return this.pathTemplates.organizationUptimeCheckConfigPathTemplate.match( + organizationUptimeCheckConfigName, + ).uptime_check_config; } /** @@ -1895,7 +2344,7 @@ export class UptimeCheckServiceClient { * @param {string} project * @returns {string} Resource name string. */ - projectPath(project:string) { + projectPath(project: string) { return this.pathTemplates.projectPathTemplate.render({ project: project, }); @@ -1919,7 +2368,7 @@ export class UptimeCheckServiceClient { * @param {string} alert_policy * @returns {string} Resource name string. */ - projectAlertPolicyPath(project:string,alertPolicy:string) { + projectAlertPolicyPath(project: string, alertPolicy: string) { return this.pathTemplates.projectAlertPolicyPathTemplate.render({ project: project, alert_policy: alertPolicy, @@ -1934,7 +2383,9 @@ export class UptimeCheckServiceClient { * @returns {string} A string representing the project. */ matchProjectFromProjectAlertPolicyName(projectAlertPolicyName: string) { - return this.pathTemplates.projectAlertPolicyPathTemplate.match(projectAlertPolicyName).project; + return this.pathTemplates.projectAlertPolicyPathTemplate.match( + projectAlertPolicyName, + ).project; } /** @@ -1945,7 +2396,9 @@ export class UptimeCheckServiceClient { * @returns {string} A string representing the alert_policy. */ matchAlertPolicyFromProjectAlertPolicyName(projectAlertPolicyName: string) { - return this.pathTemplates.projectAlertPolicyPathTemplate.match(projectAlertPolicyName).alert_policy; + return this.pathTemplates.projectAlertPolicyPathTemplate.match( + projectAlertPolicyName, + ).alert_policy; } /** @@ -1956,7 +2409,11 @@ export class UptimeCheckServiceClient { * @param {string} condition * @returns {string} Resource name string. */ - projectAlertPolicyConditionPath(project:string,alertPolicy:string,condition:string) { + projectAlertPolicyConditionPath( + project: string, + alertPolicy: string, + condition: string, + ) { return this.pathTemplates.projectAlertPolicyConditionPathTemplate.render({ project: project, alert_policy: alertPolicy, @@ -1971,8 +2428,12 @@ export class UptimeCheckServiceClient { * A fully-qualified path representing project_alert_policy_condition resource. * @returns {string} A string representing the project. */ - matchProjectFromProjectAlertPolicyConditionName(projectAlertPolicyConditionName: string) { - return this.pathTemplates.projectAlertPolicyConditionPathTemplate.match(projectAlertPolicyConditionName).project; + matchProjectFromProjectAlertPolicyConditionName( + projectAlertPolicyConditionName: string, + ) { + return this.pathTemplates.projectAlertPolicyConditionPathTemplate.match( + projectAlertPolicyConditionName, + ).project; } /** @@ -1982,8 +2443,12 @@ export class UptimeCheckServiceClient { * A fully-qualified path representing project_alert_policy_condition resource. * @returns {string} A string representing the alert_policy. */ - matchAlertPolicyFromProjectAlertPolicyConditionName(projectAlertPolicyConditionName: string) { - return this.pathTemplates.projectAlertPolicyConditionPathTemplate.match(projectAlertPolicyConditionName).alert_policy; + matchAlertPolicyFromProjectAlertPolicyConditionName( + projectAlertPolicyConditionName: string, + ) { + return this.pathTemplates.projectAlertPolicyConditionPathTemplate.match( + projectAlertPolicyConditionName, + ).alert_policy; } /** @@ -1993,8 +2458,12 @@ export class UptimeCheckServiceClient { * A fully-qualified path representing project_alert_policy_condition resource. * @returns {string} A string representing the condition. */ - matchConditionFromProjectAlertPolicyConditionName(projectAlertPolicyConditionName: string) { - return this.pathTemplates.projectAlertPolicyConditionPathTemplate.match(projectAlertPolicyConditionName).condition; + matchConditionFromProjectAlertPolicyConditionName( + projectAlertPolicyConditionName: string, + ) { + return this.pathTemplates.projectAlertPolicyConditionPathTemplate.match( + projectAlertPolicyConditionName, + ).condition; } /** @@ -2004,7 +2473,7 @@ export class UptimeCheckServiceClient { * @param {string} channel_descriptor * @returns {string} Resource name string. */ - projectChannelDescriptorPath(project:string,channelDescriptor:string) { + projectChannelDescriptorPath(project: string, channelDescriptor: string) { return this.pathTemplates.projectChannelDescriptorPathTemplate.render({ project: project, channel_descriptor: channelDescriptor, @@ -2018,8 +2487,12 @@ export class UptimeCheckServiceClient { * A fully-qualified path representing project_channel_descriptor resource. * @returns {string} A string representing the project. */ - matchProjectFromProjectChannelDescriptorName(projectChannelDescriptorName: string) { - return this.pathTemplates.projectChannelDescriptorPathTemplate.match(projectChannelDescriptorName).project; + matchProjectFromProjectChannelDescriptorName( + projectChannelDescriptorName: string, + ) { + return this.pathTemplates.projectChannelDescriptorPathTemplate.match( + projectChannelDescriptorName, + ).project; } /** @@ -2029,8 +2502,12 @@ export class UptimeCheckServiceClient { * A fully-qualified path representing project_channel_descriptor resource. * @returns {string} A string representing the channel_descriptor. */ - matchChannelDescriptorFromProjectChannelDescriptorName(projectChannelDescriptorName: string) { - return this.pathTemplates.projectChannelDescriptorPathTemplate.match(projectChannelDescriptorName).channel_descriptor; + matchChannelDescriptorFromProjectChannelDescriptorName( + projectChannelDescriptorName: string, + ) { + return this.pathTemplates.projectChannelDescriptorPathTemplate.match( + projectChannelDescriptorName, + ).channel_descriptor; } /** @@ -2040,7 +2517,7 @@ export class UptimeCheckServiceClient { * @param {string} group * @returns {string} Resource name string. */ - projectGroupPath(project:string,group:string) { + projectGroupPath(project: string, group: string) { return this.pathTemplates.projectGroupPathTemplate.render({ project: project, group: group, @@ -2055,7 +2532,8 @@ export class UptimeCheckServiceClient { * @returns {string} A string representing the project. */ matchProjectFromProjectGroupName(projectGroupName: string) { - return this.pathTemplates.projectGroupPathTemplate.match(projectGroupName).project; + return this.pathTemplates.projectGroupPathTemplate.match(projectGroupName) + .project; } /** @@ -2066,7 +2544,8 @@ export class UptimeCheckServiceClient { * @returns {string} A string representing the group. */ matchGroupFromProjectGroupName(projectGroupName: string) { - return this.pathTemplates.projectGroupPathTemplate.match(projectGroupName).group; + return this.pathTemplates.projectGroupPathTemplate.match(projectGroupName) + .group; } /** @@ -2076,7 +2555,7 @@ export class UptimeCheckServiceClient { * @param {string} notification_channel * @returns {string} Resource name string. */ - projectNotificationChannelPath(project:string,notificationChannel:string) { + projectNotificationChannelPath(project: string, notificationChannel: string) { return this.pathTemplates.projectNotificationChannelPathTemplate.render({ project: project, notification_channel: notificationChannel, @@ -2090,8 +2569,12 @@ export class UptimeCheckServiceClient { * A fully-qualified path representing project_notification_channel resource. * @returns {string} A string representing the project. */ - matchProjectFromProjectNotificationChannelName(projectNotificationChannelName: string) { - return this.pathTemplates.projectNotificationChannelPathTemplate.match(projectNotificationChannelName).project; + matchProjectFromProjectNotificationChannelName( + projectNotificationChannelName: string, + ) { + return this.pathTemplates.projectNotificationChannelPathTemplate.match( + projectNotificationChannelName, + ).project; } /** @@ -2101,8 +2584,12 @@ export class UptimeCheckServiceClient { * A fully-qualified path representing project_notification_channel resource. * @returns {string} A string representing the notification_channel. */ - matchNotificationChannelFromProjectNotificationChannelName(projectNotificationChannelName: string) { - return this.pathTemplates.projectNotificationChannelPathTemplate.match(projectNotificationChannelName).notification_channel; + matchNotificationChannelFromProjectNotificationChannelName( + projectNotificationChannelName: string, + ) { + return this.pathTemplates.projectNotificationChannelPathTemplate.match( + projectNotificationChannelName, + ).notification_channel; } /** @@ -2112,7 +2599,7 @@ export class UptimeCheckServiceClient { * @param {string} service * @returns {string} Resource name string. */ - projectServicePath(project:string,service:string) { + projectServicePath(project: string, service: string) { return this.pathTemplates.projectServicePathTemplate.render({ project: project, service: service, @@ -2127,7 +2614,9 @@ export class UptimeCheckServiceClient { * @returns {string} A string representing the project. */ matchProjectFromProjectServiceName(projectServiceName: string) { - return this.pathTemplates.projectServicePathTemplate.match(projectServiceName).project; + return this.pathTemplates.projectServicePathTemplate.match( + projectServiceName, + ).project; } /** @@ -2138,7 +2627,9 @@ export class UptimeCheckServiceClient { * @returns {string} A string representing the service. */ matchServiceFromProjectServiceName(projectServiceName: string) { - return this.pathTemplates.projectServicePathTemplate.match(projectServiceName).service; + return this.pathTemplates.projectServicePathTemplate.match( + projectServiceName, + ).service; } /** @@ -2149,12 +2640,18 @@ export class UptimeCheckServiceClient { * @param {string} service_level_objective * @returns {string} Resource name string. */ - projectServiceServiceLevelObjectivePath(project:string,service:string,serviceLevelObjective:string) { - return this.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.render({ - project: project, - service: service, - service_level_objective: serviceLevelObjective, - }); + projectServiceServiceLevelObjectivePath( + project: string, + service: string, + serviceLevelObjective: string, + ) { + return this.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.render( + { + project: project, + service: service, + service_level_objective: serviceLevelObjective, + }, + ); } /** @@ -2164,8 +2661,12 @@ export class UptimeCheckServiceClient { * A fully-qualified path representing project_service_service_level_objective resource. * @returns {string} A string representing the project. */ - matchProjectFromProjectServiceServiceLevelObjectiveName(projectServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match(projectServiceServiceLevelObjectiveName).project; + matchProjectFromProjectServiceServiceLevelObjectiveName( + projectServiceServiceLevelObjectiveName: string, + ) { + return this.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match( + projectServiceServiceLevelObjectiveName, + ).project; } /** @@ -2175,8 +2676,12 @@ export class UptimeCheckServiceClient { * A fully-qualified path representing project_service_service_level_objective resource. * @returns {string} A string representing the service. */ - matchServiceFromProjectServiceServiceLevelObjectiveName(projectServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match(projectServiceServiceLevelObjectiveName).service; + matchServiceFromProjectServiceServiceLevelObjectiveName( + projectServiceServiceLevelObjectiveName: string, + ) { + return this.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match( + projectServiceServiceLevelObjectiveName, + ).service; } /** @@ -2186,8 +2691,12 @@ export class UptimeCheckServiceClient { * A fully-qualified path representing project_service_service_level_objective resource. * @returns {string} A string representing the service_level_objective. */ - matchServiceLevelObjectiveFromProjectServiceServiceLevelObjectiveName(projectServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match(projectServiceServiceLevelObjectiveName).service_level_objective; + matchServiceLevelObjectiveFromProjectServiceServiceLevelObjectiveName( + projectServiceServiceLevelObjectiveName: string, + ) { + return this.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match( + projectServiceServiceLevelObjectiveName, + ).service_level_objective; } /** @@ -2197,7 +2706,7 @@ export class UptimeCheckServiceClient { * @param {string} uptime_check_config * @returns {string} Resource name string. */ - projectUptimeCheckConfigPath(project:string,uptimeCheckConfig:string) { + projectUptimeCheckConfigPath(project: string, uptimeCheckConfig: string) { return this.pathTemplates.projectUptimeCheckConfigPathTemplate.render({ project: project, uptime_check_config: uptimeCheckConfig, @@ -2211,8 +2720,12 @@ export class UptimeCheckServiceClient { * A fully-qualified path representing project_uptime_check_config resource. * @returns {string} A string representing the project. */ - matchProjectFromProjectUptimeCheckConfigName(projectUptimeCheckConfigName: string) { - return this.pathTemplates.projectUptimeCheckConfigPathTemplate.match(projectUptimeCheckConfigName).project; + matchProjectFromProjectUptimeCheckConfigName( + projectUptimeCheckConfigName: string, + ) { + return this.pathTemplates.projectUptimeCheckConfigPathTemplate.match( + projectUptimeCheckConfigName, + ).project; } /** @@ -2222,8 +2735,12 @@ export class UptimeCheckServiceClient { * A fully-qualified path representing project_uptime_check_config resource. * @returns {string} A string representing the uptime_check_config. */ - matchUptimeCheckConfigFromProjectUptimeCheckConfigName(projectUptimeCheckConfigName: string) { - return this.pathTemplates.projectUptimeCheckConfigPathTemplate.match(projectUptimeCheckConfigName).uptime_check_config; + matchUptimeCheckConfigFromProjectUptimeCheckConfigName( + projectUptimeCheckConfigName: string, + ) { + return this.pathTemplates.projectUptimeCheckConfigPathTemplate.match( + projectUptimeCheckConfigName, + ).uptime_check_config; } /** @@ -2233,7 +2750,7 @@ export class UptimeCheckServiceClient { * @param {string} snooze * @returns {string} Resource name string. */ - snoozePath(project:string,snooze:string) { + snoozePath(project: string, snooze: string) { return this.pathTemplates.snoozePathTemplate.render({ project: project, snooze: snooze, @@ -2270,7 +2787,7 @@ export class UptimeCheckServiceClient { */ close(): Promise { if (this.uptimeCheckServiceStub && !this._terminated) { - return this.uptimeCheckServiceStub.then(stub => { + return this.uptimeCheckServiceStub.then((stub) => { this._log.info('ending gRPC channel'); this._terminated = true; stub.close(); @@ -2278,4 +2795,4 @@ export class UptimeCheckServiceClient { } return Promise.resolve(); } -} \ No newline at end of file +} diff --git a/packages/google-cloud-monitoring/system-test/fixtures/sample/src/index.ts b/packages/google-cloud-monitoring/system-test/fixtures/sample/src/index.ts index 3343a606a910..f8664d15f92d 100644 --- a/packages/google-cloud-monitoring/system-test/fixtures/sample/src/index.ts +++ b/packages/google-cloud-monitoring/system-test/fixtures/sample/src/index.ts @@ -16,7 +16,16 @@ // ** https://github.com/googleapis/gapic-generator-typescript ** // ** All changes to this file may be overwritten. ** -import {AlertPolicyServiceClient, GroupServiceClient, MetricServiceClient, NotificationChannelServiceClient, QueryServiceClient, ServiceMonitoringServiceClient, SnoozeServiceClient, UptimeCheckServiceClient} from '@google-cloud/monitoring'; +import { + AlertPolicyServiceClient, + GroupServiceClient, + MetricServiceClient, + NotificationChannelServiceClient, + QueryServiceClient, + ServiceMonitoringServiceClient, + SnoozeServiceClient, + UptimeCheckServiceClient, +} from '@google-cloud/monitoring'; // check that the client class type name can be used function doStuffWithAlertPolicyServiceClient(client: AlertPolicyServiceClient) { @@ -28,13 +37,17 @@ function doStuffWithGroupServiceClient(client: GroupServiceClient) { function doStuffWithMetricServiceClient(client: MetricServiceClient) { client.close(); } -function doStuffWithNotificationChannelServiceClient(client: NotificationChannelServiceClient) { +function doStuffWithNotificationChannelServiceClient( + client: NotificationChannelServiceClient, +) { client.close(); } function doStuffWithQueryServiceClient(client: QueryServiceClient) { client.close(); } -function doStuffWithServiceMonitoringServiceClient(client: ServiceMonitoringServiceClient) { +function doStuffWithServiceMonitoringServiceClient( + client: ServiceMonitoringServiceClient, +) { client.close(); } function doStuffWithSnoozeServiceClient(client: SnoozeServiceClient) { @@ -55,7 +68,8 @@ function main() { const metricServiceClient = new MetricServiceClient(); doStuffWithMetricServiceClient(metricServiceClient); // check that the client instance can be created - const notificationChannelServiceClient = new NotificationChannelServiceClient(); + const notificationChannelServiceClient = + new NotificationChannelServiceClient(); doStuffWithNotificationChannelServiceClient(notificationChannelServiceClient); // check that the client instance can be created const queryServiceClient = new QueryServiceClient(); diff --git a/packages/google-cloud-monitoring/system-test/install.ts b/packages/google-cloud-monitoring/system-test/install.ts index 394f3362d203..ccf167042d2e 100644 --- a/packages/google-cloud-monitoring/system-test/install.ts +++ b/packages/google-cloud-monitoring/system-test/install.ts @@ -16,34 +16,36 @@ // ** 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() { + it('TypeScript code', async function () { this.timeout(300000); const options = { packageDir: process.cwd(), sample: { description: 'TypeScript user can use the type definitions', - ts: readFileSync('./system-test/fixtures/sample/src/index.ts').toString() - } + ts: readFileSync( + './system-test/fixtures/sample/src/index.ts', + ).toString(), + }, }; await packNTest(options); }); - it('JavaScript code', async function() { + it('JavaScript code', async function () { this.timeout(300000); const options = { packageDir: process.cwd(), sample: { description: 'JavaScript user can use the library', - ts: readFileSync('./system-test/fixtures/sample/src/index.js').toString() - } + cjs: readFileSync( + './system-test/fixtures/sample/src/index.js', + ).toString(), + }, }; await packNTest(options); }); - }); diff --git a/packages/google-cloud-monitoring/test/gapic_alert_policy_service_v3.ts b/packages/google-cloud-monitoring/test/gapic_alert_policy_service_v3.ts index 0d87663a9b51..97c01a160cbe 100644 --- a/packages/google-cloud-monitoring/test/gapic_alert_policy_service_v3.ts +++ b/packages/google-cloud-monitoring/test/gapic_alert_policy_service_v3.ts @@ -19,1955 +19,2814 @@ 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 alertpolicyserviceModule 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 -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); +const root = protobuf.Root.fromJSON( + require('../protos/protos.json'), +).resolveAll(); // eslint-disable-next-line @typescript-eslint/no-unused-vars function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; } function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; + const filledObject = ( + instance.constructor as typeof protobuf.Message + ).toObject(instance as protobuf.Message, { defaults: true }); + return (instance.constructor as typeof protobuf.Message).fromObject( + filledObject, + ) as T; } function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); + return error + ? sinon.stub().rejects(error) + : sinon.stub().resolves([response]); } -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +function stubSimpleCallWithCallback( + response?: ResponseType, + error?: Error, +) { + return error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); } -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } +function stubPageStreamingCall( + responses?: ResponseType[], + error?: Error, +) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); + } + const transformStub = error + ? sinon.stub().callsArgWith(2, error) + : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { + mockStream.write({}); + }); } - return sinon.stub().returns(mockStream); + setImmediate(() => { + mockStream.end(); + }); + } else { + setImmediate(() => { + mockStream.write({}); + }); + setImmediate(() => { + mockStream.end(); + }); + } + return sinon.stub().returns(mockStream); } -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); +function stubAsyncIterationCall( + responses?: ResponseType[], + error?: Error, +) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({ done: true, value: undefined }); + } + return Promise.resolve({ done: false, value: responses![counter++] }); + }, + }; + }, + }; + return sinon.stub().returns(asyncIterable); } describe('v3.AlertPolicyServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'monitoring.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = alertpolicyserviceModule.v3.AlertPolicyServiceClient.servicePath; - assert.strictEqual(servicePath, 'monitoring.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = alertpolicyserviceModule.v3.AlertPolicyServiceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'monitoring.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'monitoring.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'monitoring.example.com'); - }); - - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'monitoring.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'monitoring.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new alertpolicyserviceModule.v3.AlertPolicyServiceClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); - - it('has port', () => { - const port = alertpolicyserviceModule.v3.AlertPolicyServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.alertPolicyServiceStub, undefined); - await client.initialize(); - assert(client.alertPolicyServiceStub); - }); - - it('has close method for the initialized client', done => { - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.alertPolicyServiceStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has close method for the non-initialized client', done => { - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.alertPolicyServiceStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); + describe('Common methods', () => { + it('has apiEndpoint', () => { + const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'monitoring.googleapis.com'); }); - describe('getAlertPolicy', () => { - it('invokes getAlertPolicy without error', async () => { - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.GetAlertPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.GetAlertPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.monitoring.v3.AlertPolicy() - ); - client.innerApiCalls.getAlertPolicy = stubSimpleCall(expectedResponse); - const [response] = await client.getAlertPolicy(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getAlertPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getAlertPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getAlertPolicy without error using callback', async () => { - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.GetAlertPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.GetAlertPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.monitoring.v3.AlertPolicy() - ); - client.innerApiCalls.getAlertPolicy = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getAlertPolicy( - request, - (err?: Error|null, result?: protos.google.monitoring.v3.IAlertPolicy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getAlertPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getAlertPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getAlertPolicy with error', async () => { - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.GetAlertPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.GetAlertPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getAlertPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getAlertPolicy(request), expectedError); - const actualRequest = (client.innerApiCalls.getAlertPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getAlertPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getAlertPolicy with closed client', async () => { - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.GetAlertPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.GetAlertPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getAlertPolicy(request), expectedError); - }); + it('has universeDomain', () => { + const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); }); - describe('createAlertPolicy', () => { - it('invokes createAlertPolicy without error', async () => { - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.CreateAlertPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.CreateAlertPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.monitoring.v3.AlertPolicy() - ); - client.innerApiCalls.createAlertPolicy = stubSimpleCall(expectedResponse); - const [response] = await client.createAlertPolicy(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createAlertPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createAlertPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createAlertPolicy without error using callback', async () => { - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.CreateAlertPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.CreateAlertPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.monitoring.v3.AlertPolicy() - ); - client.innerApiCalls.createAlertPolicy = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createAlertPolicy( - request, - (err?: Error|null, result?: protos.google.monitoring.v3.IAlertPolicy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createAlertPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createAlertPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createAlertPolicy with error', async () => { - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.CreateAlertPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.CreateAlertPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createAlertPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createAlertPolicy(request), expectedError); - const actualRequest = (client.innerApiCalls.createAlertPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createAlertPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + alertpolicyserviceModule.v3.AlertPolicyServiceClient.servicePath; + assert.strictEqual(servicePath, 'monitoring.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + alertpolicyserviceModule.v3.AlertPolicyServiceClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'monitoring.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'monitoring.example.com'); + }); - it('invokes createAlertPolicy with closed client', async () => { - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.CreateAlertPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.CreateAlertPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.createAlertPolicy(request), expectedError); - }); + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'monitoring.example.com'); }); - describe('deleteAlertPolicy', () => { - it('invokes deleteAlertPolicy without error', async () => { - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.DeleteAlertPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.DeleteAlertPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteAlertPolicy = stubSimpleCall(expectedResponse); - const [response] = await client.deleteAlertPolicy(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteAlertPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteAlertPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + if (typeof process === 'object' && 'env' in process) { + describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { + it('sets apiEndpoint from environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = + new alertpolicyserviceModule.v3.AlertPolicyServiceClient(); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'monitoring.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } }); - it('invokes deleteAlertPolicy without error using callback', async () => { - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.DeleteAlertPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.DeleteAlertPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteAlertPolicy = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteAlertPolicy( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteAlertPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteAlertPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + it('value configured in code has priority over environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = + new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ + universeDomain: 'configured.example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'monitoring.configured.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } }); - - it('invokes deleteAlertPolicy with error', async () => { - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.DeleteAlertPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.DeleteAlertPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteAlertPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteAlertPolicy(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteAlertPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteAlertPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteAlertPolicy with closed client', async () => { - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.DeleteAlertPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.DeleteAlertPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.deleteAlertPolicy(request), expectedError); + }); + } + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', }); + }); }); - describe('updateAlertPolicy', () => { - it('invokes updateAlertPolicy without error', async () => { - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.UpdateAlertPolicyRequest() - ); - request.alertPolicy ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.UpdateAlertPolicyRequest', ['alertPolicy', 'name']); - request.alertPolicy.name = defaultValue1; - const expectedHeaderRequestParams = `alert_policy.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.monitoring.v3.AlertPolicy() - ); - client.innerApiCalls.updateAlertPolicy = stubSimpleCall(expectedResponse); - const [response] = await client.updateAlertPolicy(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateAlertPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateAlertPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateAlertPolicy without error using callback', async () => { - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.UpdateAlertPolicyRequest() - ); - request.alertPolicy ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.UpdateAlertPolicyRequest', ['alertPolicy', 'name']); - request.alertPolicy.name = defaultValue1; - const expectedHeaderRequestParams = `alert_policy.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.monitoring.v3.AlertPolicy() - ); - client.innerApiCalls.updateAlertPolicy = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateAlertPolicy( - request, - (err?: Error|null, result?: protos.google.monitoring.v3.IAlertPolicy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateAlertPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateAlertPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('has port', () => { + const port = alertpolicyserviceModule.v3.AlertPolicyServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); - it('invokes updateAlertPolicy with error', async () => { - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.UpdateAlertPolicyRequest() - ); - request.alertPolicy ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.UpdateAlertPolicyRequest', ['alertPolicy', 'name']); - request.alertPolicy.name = defaultValue1; - const expectedHeaderRequestParams = `alert_policy.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateAlertPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateAlertPolicy(request), expectedError); - const actualRequest = (client.innerApiCalls.updateAlertPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateAlertPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('should create a client with no option', () => { + const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient(); + assert(client); + }); - it('invokes updateAlertPolicy with closed client', async () => { - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.UpdateAlertPolicyRequest() - ); - request.alertPolicy ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.UpdateAlertPolicyRequest', ['alertPolicy', 'name']); - request.alertPolicy.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.updateAlertPolicy(request), expectedError); - }); + it('should create a client with gRPC fallback', () => { + const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ + fallback: true, + }); + assert(client); }); - describe('listAlertPolicies', () => { - it('invokes listAlertPolicies without error', async () => { - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListAlertPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListAlertPoliciesRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.monitoring.v3.AlertPolicy()), - generateSampleMessage(new protos.google.monitoring.v3.AlertPolicy()), - generateSampleMessage(new protos.google.monitoring.v3.AlertPolicy()), - ]; - client.innerApiCalls.listAlertPolicies = stubSimpleCall(expectedResponse); - const [response] = await client.listAlertPolicies(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listAlertPolicies as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listAlertPolicies as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('has initialize method and supports deferred initialization', async () => { + const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.alertPolicyServiceStub, undefined); + await client.initialize(); + assert(client.alertPolicyServiceStub); + }); - it('invokes listAlertPolicies without error using callback', async () => { - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListAlertPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListAlertPoliciesRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.monitoring.v3.AlertPolicy()), - generateSampleMessage(new protos.google.monitoring.v3.AlertPolicy()), - generateSampleMessage(new protos.google.monitoring.v3.AlertPolicy()), - ]; - client.innerApiCalls.listAlertPolicies = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listAlertPolicies( - request, - (err?: Error|null, result?: protos.google.monitoring.v3.IAlertPolicy[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listAlertPolicies as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listAlertPolicies as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + it('has close method for the initialized client', (done) => { + const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.initialize().catch((err) => { + throw err; + }); + assert(client.alertPolicyServiceStub); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; }); + }); - it('invokes listAlertPolicies with error', async () => { - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListAlertPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListAlertPoliciesRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listAlertPolicies = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listAlertPolicies(request), expectedError); - const actualRequest = (client.innerApiCalls.listAlertPolicies as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listAlertPolicies as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + it('has close method for the non-initialized client', (done) => { + const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.alertPolicyServiceStub, undefined); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; }); + }); - it('invokes listAlertPoliciesStream without error', async () => { - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListAlertPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListAlertPoliciesRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.monitoring.v3.AlertPolicy()), - generateSampleMessage(new protos.google.monitoring.v3.AlertPolicy()), - generateSampleMessage(new protos.google.monitoring.v3.AlertPolicy()), - ]; - client.descriptors.page.listAlertPolicies.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listAlertPoliciesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.monitoring.v3.AlertPolicy[] = []; - stream.on('data', (response: protos.google.monitoring.v3.AlertPolicy) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listAlertPolicies.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listAlertPolicies, request)); - assert( - (client.descriptors.page.listAlertPolicies.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); - it('invokes listAlertPoliciesStream with error', async () => { - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListAlertPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListAlertPoliciesRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listAlertPolicies.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listAlertPoliciesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.monitoring.v3.AlertPolicy[] = []; - stream.on('data', (response: protos.google.monitoring.v3.AlertPolicy) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listAlertPolicies.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listAlertPolicies, request)); - assert( - (client.descriptors.page.listAlertPolicies.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + }); + + describe('getAlertPolicy', () => { + it('invokes getAlertPolicy without error', async () => { + const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.GetAlertPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.GetAlertPolicyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.monitoring.v3.AlertPolicy(), + ); + client.innerApiCalls.getAlertPolicy = stubSimpleCall(expectedResponse); + const [response] = await client.getAlertPolicy(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getAlertPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getAlertPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('uses async iteration with listAlertPolicies without error', async () => { - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListAlertPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListAlertPoliciesRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.monitoring.v3.AlertPolicy()), - generateSampleMessage(new protos.google.monitoring.v3.AlertPolicy()), - generateSampleMessage(new protos.google.monitoring.v3.AlertPolicy()), - ]; - client.descriptors.page.listAlertPolicies.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.monitoring.v3.IAlertPolicy[] = []; - const iterable = client.listAlertPoliciesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); + it('invokes getAlertPolicy without error using callback', async () => { + const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.GetAlertPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.GetAlertPolicyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.monitoring.v3.AlertPolicy(), + ); + client.innerApiCalls.getAlertPolicy = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getAlertPolicy( + request, + ( + err?: Error | null, + result?: protos.google.monitoring.v3.IAlertPolicy | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listAlertPolicies.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listAlertPolicies.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listAlertPolicies with error', async () => { - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListAlertPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListAlertPoliciesRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listAlertPolicies.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listAlertPoliciesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.monitoring.v3.IAlertPolicy[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listAlertPolicies.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listAlertPolicies.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getAlertPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getAlertPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('Path templates', () => { - - describe('folderAlertPolicy', async () => { - const fakePath = "/rendered/path/folderAlertPolicy"; - const expectedParameters = { - folder: "folderValue", - alert_policy: "alertPolicyValue", - }; - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.folderAlertPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderAlertPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderAlertPolicyPath', () => { - const result = client.folderAlertPolicyPath("folderValue", "alertPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderAlertPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderAlertPolicyName', () => { - const result = client.matchFolderFromFolderAlertPolicyName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderAlertPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAlertPolicyFromFolderAlertPolicyName', () => { - const result = client.matchAlertPolicyFromFolderAlertPolicyName(fakePath); - assert.strictEqual(result, "alertPolicyValue"); - assert((client.pathTemplates.folderAlertPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderAlertPolicyCondition', async () => { - const fakePath = "/rendered/path/folderAlertPolicyCondition"; - const expectedParameters = { - folder: "folderValue", - alert_policy: "alertPolicyValue", - condition: "conditionValue", - }; - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.folderAlertPolicyConditionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderAlertPolicyConditionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderAlertPolicyConditionPath', () => { - const result = client.folderAlertPolicyConditionPath("folderValue", "alertPolicyValue", "conditionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderAlertPolicyConditionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderAlertPolicyConditionName', () => { - const result = client.matchFolderFromFolderAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAlertPolicyFromFolderAlertPolicyConditionName', () => { - const result = client.matchAlertPolicyFromFolderAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "alertPolicyValue"); - assert((client.pathTemplates.folderAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConditionFromFolderAlertPolicyConditionName', () => { - const result = client.matchConditionFromFolderAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "conditionValue"); - assert((client.pathTemplates.folderAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderChannelDescriptor', async () => { - const fakePath = "/rendered/path/folderChannelDescriptor"; - const expectedParameters = { - folder: "folderValue", - channel_descriptor: "channelDescriptorValue", - }; - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.folderChannelDescriptorPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderChannelDescriptorPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderChannelDescriptorPath', () => { - const result = client.folderChannelDescriptorPath("folderValue", "channelDescriptorValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderChannelDescriptorPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderChannelDescriptorName', () => { - const result = client.matchFolderFromFolderChannelDescriptorName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderChannelDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchChannelDescriptorFromFolderChannelDescriptorName', () => { - const result = client.matchChannelDescriptorFromFolderChannelDescriptorName(fakePath); - assert.strictEqual(result, "channelDescriptorValue"); - assert((client.pathTemplates.folderChannelDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderGroup', async () => { - const fakePath = "/rendered/path/folderGroup"; - const expectedParameters = { - folder: "folderValue", - group: "groupValue", - }; - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.folderGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderGroupPath', () => { - const result = client.folderGroupPath("folderValue", "groupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderGroupName', () => { - const result = client.matchFolderFromFolderGroupName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchGroupFromFolderGroupName', () => { - const result = client.matchGroupFromFolderGroupName(fakePath); - assert.strictEqual(result, "groupValue"); - assert((client.pathTemplates.folderGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderNotificationChannel', async () => { - const fakePath = "/rendered/path/folderNotificationChannel"; - const expectedParameters = { - folder: "folderValue", - notification_channel: "notificationChannelValue", - }; - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.folderNotificationChannelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderNotificationChannelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderNotificationChannelPath', () => { - const result = client.folderNotificationChannelPath("folderValue", "notificationChannelValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderNotificationChannelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderNotificationChannelName', () => { - const result = client.matchFolderFromFolderNotificationChannelName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderNotificationChannelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchNotificationChannelFromFolderNotificationChannelName', () => { - const result = client.matchNotificationChannelFromFolderNotificationChannelName(fakePath); - assert.strictEqual(result, "notificationChannelValue"); - assert((client.pathTemplates.folderNotificationChannelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderService', async () => { - const fakePath = "/rendered/path/folderService"; - const expectedParameters = { - folder: "folderValue", - service: "serviceValue", - }; - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.folderServicePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderServicePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderServicePath', () => { - const result = client.folderServicePath("folderValue", "serviceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderServicePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderServiceName', () => { - const result = client.matchFolderFromFolderServiceName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderServicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromFolderServiceName', () => { - const result = client.matchServiceFromFolderServiceName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.folderServicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderServiceServiceLevelObjective', async () => { - const fakePath = "/rendered/path/folderServiceServiceLevelObjective"; - const expectedParameters = { - folder: "folderValue", - service: "serviceValue", - service_level_objective: "serviceLevelObjectiveValue", - }; - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderServiceServiceLevelObjectivePath', () => { - const result = client.folderServiceServiceLevelObjectivePath("folderValue", "serviceValue", "serviceLevelObjectiveValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderServiceServiceLevelObjectiveName', () => { - const result = client.matchFolderFromFolderServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromFolderServiceServiceLevelObjectiveName', () => { - const result = client.matchServiceFromFolderServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceLevelObjectiveFromFolderServiceServiceLevelObjectiveName', () => { - const result = client.matchServiceLevelObjectiveFromFolderServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "serviceLevelObjectiveValue"); - assert((client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderUptimeCheckConfig', async () => { - const fakePath = "/rendered/path/folderUptimeCheckConfig"; - const expectedParameters = { - folder: "folderValue", - uptime_check_config: "uptimeCheckConfigValue", - }; - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.folderUptimeCheckConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderUptimeCheckConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderUptimeCheckConfigPath', () => { - const result = client.folderUptimeCheckConfigPath("folderValue", "uptimeCheckConfigValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderUptimeCheckConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderUptimeCheckConfigName', () => { - const result = client.matchFolderFromFolderUptimeCheckConfigName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderUptimeCheckConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUptimeCheckConfigFromFolderUptimeCheckConfigName', () => { - const result = client.matchUptimeCheckConfigFromFolderUptimeCheckConfigName(fakePath); - assert.strictEqual(result, "uptimeCheckConfigValue"); - assert((client.pathTemplates.folderUptimeCheckConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationAlertPolicy', async () => { - const fakePath = "/rendered/path/organizationAlertPolicy"; - const expectedParameters = { - organization: "organizationValue", - alert_policy: "alertPolicyValue", - }; - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationAlertPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationAlertPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationAlertPolicyPath', () => { - const result = client.organizationAlertPolicyPath("organizationValue", "alertPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationAlertPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationAlertPolicyName', () => { - const result = client.matchOrganizationFromOrganizationAlertPolicyName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationAlertPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAlertPolicyFromOrganizationAlertPolicyName', () => { - const result = client.matchAlertPolicyFromOrganizationAlertPolicyName(fakePath); - assert.strictEqual(result, "alertPolicyValue"); - assert((client.pathTemplates.organizationAlertPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationAlertPolicyCondition', async () => { - const fakePath = "/rendered/path/organizationAlertPolicyCondition"; - const expectedParameters = { - organization: "organizationValue", - alert_policy: "alertPolicyValue", - condition: "conditionValue", - }; - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationAlertPolicyConditionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationAlertPolicyConditionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationAlertPolicyConditionPath', () => { - const result = client.organizationAlertPolicyConditionPath("organizationValue", "alertPolicyValue", "conditionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationAlertPolicyConditionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationAlertPolicyConditionName', () => { - const result = client.matchOrganizationFromOrganizationAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAlertPolicyFromOrganizationAlertPolicyConditionName', () => { - const result = client.matchAlertPolicyFromOrganizationAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "alertPolicyValue"); - assert((client.pathTemplates.organizationAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + it('invokes getAlertPolicy with error', async () => { + const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.GetAlertPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.GetAlertPolicyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getAlertPolicy = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.getAlertPolicy(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getAlertPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getAlertPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('matchConditionFromOrganizationAlertPolicyConditionName', () => { - const result = client.matchConditionFromOrganizationAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "conditionValue"); - assert((client.pathTemplates.organizationAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + it('invokes getAlertPolicy with closed client', async () => { + const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.GetAlertPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.GetAlertPolicyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.getAlertPolicy(request), expectedError); + }); + }); + + describe('createAlertPolicy', () => { + it('invokes createAlertPolicy without error', async () => { + const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.CreateAlertPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.CreateAlertPolicyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.monitoring.v3.AlertPolicy(), + ); + client.innerApiCalls.createAlertPolicy = stubSimpleCall(expectedResponse); + const [response] = await client.createAlertPolicy(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createAlertPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createAlertPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - describe('organizationChannelDescriptor', async () => { - const fakePath = "/rendered/path/organizationChannelDescriptor"; - const expectedParameters = { - organization: "organizationValue", - channel_descriptor: "channelDescriptorValue", - }; - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationChannelDescriptorPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationChannelDescriptorPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationChannelDescriptorPath', () => { - const result = client.organizationChannelDescriptorPath("organizationValue", "channelDescriptorValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationChannelDescriptorPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); + it('invokes createAlertPolicy without error using callback', async () => { + const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.CreateAlertPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.CreateAlertPolicyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.monitoring.v3.AlertPolicy(), + ); + client.innerApiCalls.createAlertPolicy = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createAlertPolicy( + request, + ( + err?: Error | null, + result?: protos.google.monitoring.v3.IAlertPolicy | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createAlertPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createAlertPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('matchOrganizationFromOrganizationChannelDescriptorName', () => { - const result = client.matchOrganizationFromOrganizationChannelDescriptorName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationChannelDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + it('invokes createAlertPolicy with error', async () => { + const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.CreateAlertPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.CreateAlertPolicyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createAlertPolicy = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.createAlertPolicy(request), expectedError); + const actualRequest = ( + client.innerApiCalls.createAlertPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createAlertPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('matchChannelDescriptorFromOrganizationChannelDescriptorName', () => { - const result = client.matchChannelDescriptorFromOrganizationChannelDescriptorName(fakePath); - assert.strictEqual(result, "channelDescriptorValue"); - assert((client.pathTemplates.organizationChannelDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + it('invokes createAlertPolicy with closed client', async () => { + const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.CreateAlertPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.CreateAlertPolicyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.createAlertPolicy(request), expectedError); + }); + }); + + describe('deleteAlertPolicy', () => { + it('invokes deleteAlertPolicy without error', async () => { + const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.DeleteAlertPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.DeleteAlertPolicyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty(), + ); + client.innerApiCalls.deleteAlertPolicy = stubSimpleCall(expectedResponse); + const [response] = await client.deleteAlertPolicy(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteAlertPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteAlertPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - describe('organizationGroup', async () => { - const fakePath = "/rendered/path/organizationGroup"; - const expectedParameters = { - organization: "organizationValue", - group: "groupValue", - }; - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationGroupPath', () => { - const result = client.organizationGroupPath("organizationValue", "groupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); + it('invokes deleteAlertPolicy without error using callback', async () => { + const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.DeleteAlertPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.DeleteAlertPolicyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty(), + ); + client.innerApiCalls.deleteAlertPolicy = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteAlertPolicy( + request, + ( + err?: Error | null, + result?: protos.google.protobuf.IEmpty | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteAlertPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteAlertPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('matchOrganizationFromOrganizationGroupName', () => { - const result = client.matchOrganizationFromOrganizationGroupName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + it('invokes deleteAlertPolicy with error', async () => { + const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.DeleteAlertPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.DeleteAlertPolicyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteAlertPolicy = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.deleteAlertPolicy(request), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteAlertPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteAlertPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('matchGroupFromOrganizationGroupName', () => { - const result = client.matchGroupFromOrganizationGroupName(fakePath); - assert.strictEqual(result, "groupValue"); - assert((client.pathTemplates.organizationGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + it('invokes deleteAlertPolicy with closed client', async () => { + const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.DeleteAlertPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.DeleteAlertPolicyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.deleteAlertPolicy(request), expectedError); + }); + }); + + describe('updateAlertPolicy', () => { + it('invokes updateAlertPolicy without error', async () => { + const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.UpdateAlertPolicyRequest(), + ); + request.alertPolicy ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.UpdateAlertPolicyRequest', + ['alertPolicy', 'name'], + ); + request.alertPolicy.name = defaultValue1; + const expectedHeaderRequestParams = `alert_policy.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.monitoring.v3.AlertPolicy(), + ); + client.innerApiCalls.updateAlertPolicy = stubSimpleCall(expectedResponse); + const [response] = await client.updateAlertPolicy(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateAlertPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateAlertPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - describe('organizationNotificationChannel', async () => { - const fakePath = "/rendered/path/organizationNotificationChannel"; - const expectedParameters = { - organization: "organizationValue", - notification_channel: "notificationChannelValue", - }; - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationNotificationChannelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationNotificationChannelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationNotificationChannelPath', () => { - const result = client.organizationNotificationChannelPath("organizationValue", "notificationChannelValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationNotificationChannelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); + it('invokes updateAlertPolicy without error using callback', async () => { + const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.UpdateAlertPolicyRequest(), + ); + request.alertPolicy ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.UpdateAlertPolicyRequest', + ['alertPolicy', 'name'], + ); + request.alertPolicy.name = defaultValue1; + const expectedHeaderRequestParams = `alert_policy.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.monitoring.v3.AlertPolicy(), + ); + client.innerApiCalls.updateAlertPolicy = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateAlertPolicy( + request, + ( + err?: Error | null, + result?: protos.google.monitoring.v3.IAlertPolicy | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateAlertPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateAlertPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('matchOrganizationFromOrganizationNotificationChannelName', () => { - const result = client.matchOrganizationFromOrganizationNotificationChannelName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationNotificationChannelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + it('invokes updateAlertPolicy with error', async () => { + const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.UpdateAlertPolicyRequest(), + ); + request.alertPolicy ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.UpdateAlertPolicyRequest', + ['alertPolicy', 'name'], + ); + request.alertPolicy.name = defaultValue1; + const expectedHeaderRequestParams = `alert_policy.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateAlertPolicy = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.updateAlertPolicy(request), expectedError); + const actualRequest = ( + client.innerApiCalls.updateAlertPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateAlertPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('matchNotificationChannelFromOrganizationNotificationChannelName', () => { - const result = client.matchNotificationChannelFromOrganizationNotificationChannelName(fakePath); - assert.strictEqual(result, "notificationChannelValue"); - assert((client.pathTemplates.organizationNotificationChannelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + it('invokes updateAlertPolicy with closed client', async () => { + const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.UpdateAlertPolicyRequest(), + ); + request.alertPolicy ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.UpdateAlertPolicyRequest', + ['alertPolicy', 'name'], + ); + request.alertPolicy.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.updateAlertPolicy(request), expectedError); + }); + }); + + describe('listAlertPolicies', () => { + it('invokes listAlertPolicies without error', async () => { + const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListAlertPoliciesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.ListAlertPoliciesRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.monitoring.v3.AlertPolicy()), + generateSampleMessage(new protos.google.monitoring.v3.AlertPolicy()), + generateSampleMessage(new protos.google.monitoring.v3.AlertPolicy()), + ]; + client.innerApiCalls.listAlertPolicies = stubSimpleCall(expectedResponse); + const [response] = await client.listAlertPolicies(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listAlertPolicies as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listAlertPolicies as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - describe('organizationService', async () => { - const fakePath = "/rendered/path/organizationService"; - const expectedParameters = { - organization: "organizationValue", - service: "serviceValue", - }; - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationServicePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationServicePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationServicePath', () => { - const result = client.organizationServicePath("organizationValue", "serviceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationServicePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); + it('invokes listAlertPolicies without error using callback', async () => { + const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListAlertPoliciesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.ListAlertPoliciesRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.monitoring.v3.AlertPolicy()), + generateSampleMessage(new protos.google.monitoring.v3.AlertPolicy()), + generateSampleMessage(new protos.google.monitoring.v3.AlertPolicy()), + ]; + client.innerApiCalls.listAlertPolicies = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listAlertPolicies( + request, + ( + err?: Error | null, + result?: protos.google.monitoring.v3.IAlertPolicy[] | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listAlertPolicies as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listAlertPolicies as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('matchOrganizationFromOrganizationServiceName', () => { - const result = client.matchOrganizationFromOrganizationServiceName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationServicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + it('invokes listAlertPolicies with error', async () => { + const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListAlertPoliciesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.ListAlertPoliciesRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listAlertPolicies = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.listAlertPolicies(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listAlertPolicies as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listAlertPolicies as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('matchServiceFromOrganizationServiceName', () => { - const result = client.matchServiceFromOrganizationServiceName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.organizationServicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + it('invokes listAlertPoliciesStream without error', async () => { + const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListAlertPoliciesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.ListAlertPoliciesRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.monitoring.v3.AlertPolicy()), + generateSampleMessage(new protos.google.monitoring.v3.AlertPolicy()), + generateSampleMessage(new protos.google.monitoring.v3.AlertPolicy()), + ]; + client.descriptors.page.listAlertPolicies.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listAlertPoliciesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.monitoring.v3.AlertPolicy[] = []; + stream.on( + 'data', + (response: protos.google.monitoring.v3.AlertPolicy) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); }); - - describe('organizationServiceServiceLevelObjective', async () => { - const fakePath = "/rendered/path/organizationServiceServiceLevelObjective"; - const expectedParameters = { - organization: "organizationValue", - service: "serviceValue", - service_level_objective: "serviceLevelObjectiveValue", - }; - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationServiceServiceLevelObjectivePath', () => { - const result = client.organizationServiceServiceLevelObjectivePath("organizationValue", "serviceValue", "serviceLevelObjectiveValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationServiceServiceLevelObjectiveName', () => { - const result = client.matchOrganizationFromOrganizationServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromOrganizationServiceServiceLevelObjectiveName', () => { - const result = client.matchServiceFromOrganizationServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceLevelObjectiveFromOrganizationServiceServiceLevelObjectiveName', () => { - const result = client.matchServiceLevelObjectiveFromOrganizationServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "serviceLevelObjectiveValue"); - assert((client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + stream.on('error', (err: Error) => { + reject(err); }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.listAlertPolicies.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listAlertPolicies, request), + ); + assert( + (client.descriptors.page.listAlertPolicies.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - describe('organizationUptimeCheckConfig', async () => { - const fakePath = "/rendered/path/organizationUptimeCheckConfig"; - const expectedParameters = { - organization: "organizationValue", - uptime_check_config: "uptimeCheckConfigValue", - }; - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationUptimeCheckConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationUptimeCheckConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationUptimeCheckConfigPath', () => { - const result = client.organizationUptimeCheckConfigPath("organizationValue", "uptimeCheckConfigValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationUptimeCheckConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationUptimeCheckConfigName', () => { - const result = client.matchOrganizationFromOrganizationUptimeCheckConfigName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationUptimeCheckConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUptimeCheckConfigFromOrganizationUptimeCheckConfigName', () => { - const result = client.matchUptimeCheckConfigFromOrganizationUptimeCheckConfigName(fakePath); - assert.strictEqual(result, "uptimeCheckConfigValue"); - assert((client.pathTemplates.organizationUptimeCheckConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + it('invokes listAlertPoliciesStream with error', async () => { + const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListAlertPoliciesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.ListAlertPoliciesRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listAlertPolicies.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listAlertPoliciesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.monitoring.v3.AlertPolicy[] = []; + stream.on( + 'data', + (response: protos.google.monitoring.v3.AlertPolicy) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); }); - - describe('project', async () => { - const fakePath = "/rendered/path/project"; - const expectedParameters = { - project: "projectValue", - }; - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectPath', () => { - const result = client.projectPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectName', () => { - const result = client.matchProjectFromProjectName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + stream.on('error', (err: Error) => { + reject(err); }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listAlertPolicies.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listAlertPolicies, request), + ); + assert( + (client.descriptors.page.listAlertPolicies.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - describe('projectAlertPolicy', async () => { - const fakePath = "/rendered/path/projectAlertPolicy"; - const expectedParameters = { - project: "projectValue", - alert_policy: "alertPolicyValue", - }; - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectAlertPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAlertPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAlertPolicyPath', () => { - const result = client.projectAlertPolicyPath("projectValue", "alertPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAlertPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAlertPolicyName', () => { - const result = client.matchProjectFromProjectAlertPolicyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAlertPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAlertPolicyFromProjectAlertPolicyName', () => { - const result = client.matchAlertPolicyFromProjectAlertPolicyName(fakePath); - assert.strictEqual(result, "alertPolicyValue"); - assert((client.pathTemplates.projectAlertPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + it('uses async iteration with listAlertPolicies without error', async () => { + const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListAlertPoliciesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.ListAlertPoliciesRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.monitoring.v3.AlertPolicy()), + generateSampleMessage(new protos.google.monitoring.v3.AlertPolicy()), + generateSampleMessage(new protos.google.monitoring.v3.AlertPolicy()), + ]; + client.descriptors.page.listAlertPolicies.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.monitoring.v3.IAlertPolicy[] = []; + const iterable = client.listAlertPoliciesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listAlertPolicies.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listAlertPolicies.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - describe('projectAlertPolicyCondition', async () => { - const fakePath = "/rendered/path/projectAlertPolicyCondition"; - const expectedParameters = { - project: "projectValue", - alert_policy: "alertPolicyValue", - condition: "conditionValue", - }; - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectAlertPolicyConditionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAlertPolicyConditionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAlertPolicyConditionPath', () => { - const result = client.projectAlertPolicyConditionPath("projectValue", "alertPolicyValue", "conditionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAlertPolicyConditionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); + it('uses async iteration with listAlertPolicies with error', async () => { + const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListAlertPoliciesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.ListAlertPoliciesRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listAlertPolicies.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listAlertPoliciesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.monitoring.v3.IAlertPolicy[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listAlertPolicies.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listAlertPolicies.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + }); + + describe('Path templates', () => { + describe('folderAlertPolicy', async () => { + const fakePath = '/rendered/path/folderAlertPolicy'; + const expectedParameters = { + folder: 'folderValue', + alert_policy: 'alertPolicyValue', + }; + const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.folderAlertPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.folderAlertPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('folderAlertPolicyPath', () => { + const result = client.folderAlertPolicyPath( + 'folderValue', + 'alertPolicyValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.folderAlertPolicyPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchFolderFromFolderAlertPolicyName', () => { + const result = client.matchFolderFromFolderAlertPolicyName(fakePath); + assert.strictEqual(result, 'folderValue'); + assert( + ( + client.pathTemplates.folderAlertPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchAlertPolicyFromFolderAlertPolicyName', () => { + const result = + client.matchAlertPolicyFromFolderAlertPolicyName(fakePath); + assert.strictEqual(result, 'alertPolicyValue'); + assert( + ( + client.pathTemplates.folderAlertPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchProjectFromProjectAlertPolicyConditionName', () => { - const result = client.matchProjectFromProjectAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + describe('folderAlertPolicyCondition', async () => { + const fakePath = '/rendered/path/folderAlertPolicyCondition'; + const expectedParameters = { + folder: 'folderValue', + alert_policy: 'alertPolicyValue', + condition: 'conditionValue', + }; + const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.folderAlertPolicyConditionPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.folderAlertPolicyConditionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('folderAlertPolicyConditionPath', () => { + const result = client.folderAlertPolicyConditionPath( + 'folderValue', + 'alertPolicyValue', + 'conditionValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.folderAlertPolicyConditionPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchFolderFromFolderAlertPolicyConditionName', () => { + const result = + client.matchFolderFromFolderAlertPolicyConditionName(fakePath); + assert.strictEqual(result, 'folderValue'); + assert( + ( + client.pathTemplates.folderAlertPolicyConditionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchAlertPolicyFromFolderAlertPolicyConditionName', () => { + const result = + client.matchAlertPolicyFromFolderAlertPolicyConditionName(fakePath); + assert.strictEqual(result, 'alertPolicyValue'); + assert( + ( + client.pathTemplates.folderAlertPolicyConditionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchConditionFromFolderAlertPolicyConditionName', () => { + const result = + client.matchConditionFromFolderAlertPolicyConditionName(fakePath); + assert.strictEqual(result, 'conditionValue'); + assert( + ( + client.pathTemplates.folderAlertPolicyConditionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchAlertPolicyFromProjectAlertPolicyConditionName', () => { - const result = client.matchAlertPolicyFromProjectAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "alertPolicyValue"); - assert((client.pathTemplates.projectAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + describe('folderChannelDescriptor', async () => { + const fakePath = '/rendered/path/folderChannelDescriptor'; + const expectedParameters = { + folder: 'folderValue', + channel_descriptor: 'channelDescriptorValue', + }; + const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.folderChannelDescriptorPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.folderChannelDescriptorPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('folderChannelDescriptorPath', () => { + const result = client.folderChannelDescriptorPath( + 'folderValue', + 'channelDescriptorValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.folderChannelDescriptorPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchFolderFromFolderChannelDescriptorName', () => { + const result = + client.matchFolderFromFolderChannelDescriptorName(fakePath); + assert.strictEqual(result, 'folderValue'); + assert( + ( + client.pathTemplates.folderChannelDescriptorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchChannelDescriptorFromFolderChannelDescriptorName', () => { + const result = + client.matchChannelDescriptorFromFolderChannelDescriptorName( + fakePath, + ); + assert.strictEqual(result, 'channelDescriptorValue'); + assert( + ( + client.pathTemplates.folderChannelDescriptorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchConditionFromProjectAlertPolicyConditionName', () => { - const result = client.matchConditionFromProjectAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "conditionValue"); - assert((client.pathTemplates.projectAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('folderGroup', async () => { + const fakePath = '/rendered/path/folderGroup'; + const expectedParameters = { + folder: 'folderValue', + group: 'groupValue', + }; + const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.folderGroupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.folderGroupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('folderGroupPath', () => { + const result = client.folderGroupPath('folderValue', 'groupValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.folderGroupPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchFolderFromFolderGroupName', () => { + const result = client.matchFolderFromFolderGroupName(fakePath); + assert.strictEqual(result, 'folderValue'); + assert( + (client.pathTemplates.folderGroupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchGroupFromFolderGroupName', () => { + const result = client.matchGroupFromFolderGroupName(fakePath); + assert.strictEqual(result, 'groupValue'); + assert( + (client.pathTemplates.folderGroupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('projectChannelDescriptor', async () => { - const fakePath = "/rendered/path/projectChannelDescriptor"; - const expectedParameters = { - project: "projectValue", - channel_descriptor: "channelDescriptorValue", - }; - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectChannelDescriptorPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectChannelDescriptorPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectChannelDescriptorPath', () => { - const result = client.projectChannelDescriptorPath("projectValue", "channelDescriptorValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectChannelDescriptorPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); + describe('folderNotificationChannel', async () => { + const fakePath = '/rendered/path/folderNotificationChannel'; + const expectedParameters = { + folder: 'folderValue', + notification_channel: 'notificationChannelValue', + }; + const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.folderNotificationChannelPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.folderNotificationChannelPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('folderNotificationChannelPath', () => { + const result = client.folderNotificationChannelPath( + 'folderValue', + 'notificationChannelValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.folderNotificationChannelPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchFolderFromFolderNotificationChannelName', () => { + const result = + client.matchFolderFromFolderNotificationChannelName(fakePath); + assert.strictEqual(result, 'folderValue'); + assert( + ( + client.pathTemplates.folderNotificationChannelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchNotificationChannelFromFolderNotificationChannelName', () => { + const result = + client.matchNotificationChannelFromFolderNotificationChannelName( + fakePath, + ); + assert.strictEqual(result, 'notificationChannelValue'); + assert( + ( + client.pathTemplates.folderNotificationChannelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchProjectFromProjectChannelDescriptorName', () => { - const result = client.matchProjectFromProjectChannelDescriptorName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectChannelDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + describe('folderService', async () => { + const fakePath = '/rendered/path/folderService'; + const expectedParameters = { + folder: 'folderValue', + service: 'serviceValue', + }; + const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.folderServicePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.folderServicePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('folderServicePath', () => { + const result = client.folderServicePath('folderValue', 'serviceValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.folderServicePathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchFolderFromFolderServiceName', () => { + const result = client.matchFolderFromFolderServiceName(fakePath); + assert.strictEqual(result, 'folderValue'); + assert( + (client.pathTemplates.folderServicePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchServiceFromFolderServiceName', () => { + const result = client.matchServiceFromFolderServiceName(fakePath); + assert.strictEqual(result, 'serviceValue'); + assert( + (client.pathTemplates.folderServicePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchChannelDescriptorFromProjectChannelDescriptorName', () => { - const result = client.matchChannelDescriptorFromProjectChannelDescriptorName(fakePath); - assert.strictEqual(result, "channelDescriptorValue"); - assert((client.pathTemplates.projectChannelDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('folderServiceServiceLevelObjective', async () => { + const fakePath = '/rendered/path/folderServiceServiceLevelObjective'; + const expectedParameters = { + folder: 'folderValue', + service: 'serviceValue', + service_level_objective: 'serviceLevelObjectiveValue', + }; + const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('folderServiceServiceLevelObjectivePath', () => { + const result = client.folderServiceServiceLevelObjectivePath( + 'folderValue', + 'serviceValue', + 'serviceLevelObjectiveValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchFolderFromFolderServiceServiceLevelObjectiveName', () => { + const result = + client.matchFolderFromFolderServiceServiceLevelObjectiveName( + fakePath, + ); + assert.strictEqual(result, 'folderValue'); + assert( + ( + client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchServiceFromFolderServiceServiceLevelObjectiveName', () => { + const result = + client.matchServiceFromFolderServiceServiceLevelObjectiveName( + fakePath, + ); + assert.strictEqual(result, 'serviceValue'); + assert( + ( + client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchServiceLevelObjectiveFromFolderServiceServiceLevelObjectiveName', () => { + const result = + client.matchServiceLevelObjectiveFromFolderServiceServiceLevelObjectiveName( + fakePath, + ); + assert.strictEqual(result, 'serviceLevelObjectiveValue'); + assert( + ( + client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('projectGroup', async () => { - const fakePath = "/rendered/path/projectGroup"; - const expectedParameters = { - project: "projectValue", - group: "groupValue", - }; - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectGroupPath', () => { - const result = client.projectGroupPath("projectValue", "groupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); + describe('folderUptimeCheckConfig', async () => { + const fakePath = '/rendered/path/folderUptimeCheckConfig'; + const expectedParameters = { + folder: 'folderValue', + uptime_check_config: 'uptimeCheckConfigValue', + }; + const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.folderUptimeCheckConfigPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.folderUptimeCheckConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('folderUptimeCheckConfigPath', () => { + const result = client.folderUptimeCheckConfigPath( + 'folderValue', + 'uptimeCheckConfigValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.folderUptimeCheckConfigPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchFolderFromFolderUptimeCheckConfigName', () => { + const result = + client.matchFolderFromFolderUptimeCheckConfigName(fakePath); + assert.strictEqual(result, 'folderValue'); + assert( + ( + client.pathTemplates.folderUptimeCheckConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchUptimeCheckConfigFromFolderUptimeCheckConfigName', () => { + const result = + client.matchUptimeCheckConfigFromFolderUptimeCheckConfigName( + fakePath, + ); + assert.strictEqual(result, 'uptimeCheckConfigValue'); + assert( + ( + client.pathTemplates.folderUptimeCheckConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchProjectFromProjectGroupName', () => { - const result = client.matchProjectFromProjectGroupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + describe('organizationAlertPolicy', async () => { + const fakePath = '/rendered/path/organizationAlertPolicy'; + const expectedParameters = { + organization: 'organizationValue', + alert_policy: 'alertPolicyValue', + }; + const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.organizationAlertPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.organizationAlertPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('organizationAlertPolicyPath', () => { + const result = client.organizationAlertPolicyPath( + 'organizationValue', + 'alertPolicyValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationAlertPolicyPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchOrganizationFromOrganizationAlertPolicyName', () => { + const result = + client.matchOrganizationFromOrganizationAlertPolicyName(fakePath); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationAlertPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchAlertPolicyFromOrganizationAlertPolicyName', () => { + const result = + client.matchAlertPolicyFromOrganizationAlertPolicyName(fakePath); + assert.strictEqual(result, 'alertPolicyValue'); + assert( + ( + client.pathTemplates.organizationAlertPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchGroupFromProjectGroupName', () => { - const result = client.matchGroupFromProjectGroupName(fakePath); - assert.strictEqual(result, "groupValue"); - assert((client.pathTemplates.projectGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('organizationAlertPolicyCondition', async () => { + const fakePath = '/rendered/path/organizationAlertPolicyCondition'; + const expectedParameters = { + organization: 'organizationValue', + alert_policy: 'alertPolicyValue', + condition: 'conditionValue', + }; + const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.organizationAlertPolicyConditionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationAlertPolicyConditionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationAlertPolicyConditionPath', () => { + const result = client.organizationAlertPolicyConditionPath( + 'organizationValue', + 'alertPolicyValue', + 'conditionValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationAlertPolicyConditionPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchOrganizationFromOrganizationAlertPolicyConditionName', () => { + const result = + client.matchOrganizationFromOrganizationAlertPolicyConditionName( + fakePath, + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationAlertPolicyConditionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchAlertPolicyFromOrganizationAlertPolicyConditionName', () => { + const result = + client.matchAlertPolicyFromOrganizationAlertPolicyConditionName( + fakePath, + ); + assert.strictEqual(result, 'alertPolicyValue'); + assert( + ( + client.pathTemplates.organizationAlertPolicyConditionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchConditionFromOrganizationAlertPolicyConditionName', () => { + const result = + client.matchConditionFromOrganizationAlertPolicyConditionName( + fakePath, + ); + assert.strictEqual(result, 'conditionValue'); + assert( + ( + client.pathTemplates.organizationAlertPolicyConditionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('projectNotificationChannel', async () => { - const fakePath = "/rendered/path/projectNotificationChannel"; - const expectedParameters = { - project: "projectValue", - notification_channel: "notificationChannelValue", - }; - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectNotificationChannelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectNotificationChannelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectNotificationChannelPath', () => { - const result = client.projectNotificationChannelPath("projectValue", "notificationChannelValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectNotificationChannelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); + describe('organizationChannelDescriptor', async () => { + const fakePath = '/rendered/path/organizationChannelDescriptor'; + const expectedParameters = { + organization: 'organizationValue', + channel_descriptor: 'channelDescriptorValue', + }; + const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.organizationChannelDescriptorPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationChannelDescriptorPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationChannelDescriptorPath', () => { + const result = client.organizationChannelDescriptorPath( + 'organizationValue', + 'channelDescriptorValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationChannelDescriptorPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchOrganizationFromOrganizationChannelDescriptorName', () => { + const result = + client.matchOrganizationFromOrganizationChannelDescriptorName( + fakePath, + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationChannelDescriptorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchChannelDescriptorFromOrganizationChannelDescriptorName', () => { + const result = + client.matchChannelDescriptorFromOrganizationChannelDescriptorName( + fakePath, + ); + assert.strictEqual(result, 'channelDescriptorValue'); + assert( + ( + client.pathTemplates.organizationChannelDescriptorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchProjectFromProjectNotificationChannelName', () => { - const result = client.matchProjectFromProjectNotificationChannelName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectNotificationChannelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + describe('organizationGroup', async () => { + const fakePath = '/rendered/path/organizationGroup'; + const expectedParameters = { + organization: 'organizationValue', + group: 'groupValue', + }; + const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.organizationGroupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.organizationGroupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('organizationGroupPath', () => { + const result = client.organizationGroupPath( + 'organizationValue', + 'groupValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchOrganizationFromOrganizationGroupName', () => { + const result = + client.matchOrganizationFromOrganizationGroupName(fakePath); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchGroupFromOrganizationGroupName', () => { + const result = client.matchGroupFromOrganizationGroupName(fakePath); + assert.strictEqual(result, 'groupValue'); + assert( + ( + client.pathTemplates.organizationGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchNotificationChannelFromProjectNotificationChannelName', () => { - const result = client.matchNotificationChannelFromProjectNotificationChannelName(fakePath); - assert.strictEqual(result, "notificationChannelValue"); - assert((client.pathTemplates.projectNotificationChannelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('organizationNotificationChannel', async () => { + const fakePath = '/rendered/path/organizationNotificationChannel'; + const expectedParameters = { + organization: 'organizationValue', + notification_channel: 'notificationChannelValue', + }; + const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.organizationNotificationChannelPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationNotificationChannelPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationNotificationChannelPath', () => { + const result = client.organizationNotificationChannelPath( + 'organizationValue', + 'notificationChannelValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationNotificationChannelPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchOrganizationFromOrganizationNotificationChannelName', () => { + const result = + client.matchOrganizationFromOrganizationNotificationChannelName( + fakePath, + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationNotificationChannelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchNotificationChannelFromOrganizationNotificationChannelName', () => { + const result = + client.matchNotificationChannelFromOrganizationNotificationChannelName( + fakePath, + ); + assert.strictEqual(result, 'notificationChannelValue'); + assert( + ( + client.pathTemplates.organizationNotificationChannelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('projectService', async () => { - const fakePath = "/rendered/path/projectService"; - const expectedParameters = { - project: "projectValue", - service: "serviceValue", - }; - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectServicePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectServicePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectServicePath', () => { - const result = client.projectServicePath("projectValue", "serviceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectServicePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); + describe('organizationService', async () => { + const fakePath = '/rendered/path/organizationService'; + const expectedParameters = { + organization: 'organizationValue', + service: 'serviceValue', + }; + const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.organizationServicePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.organizationServicePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('organizationServicePath', () => { + const result = client.organizationServicePath( + 'organizationValue', + 'serviceValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationServicePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchOrganizationFromOrganizationServiceName', () => { + const result = + client.matchOrganizationFromOrganizationServiceName(fakePath); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationServicePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchServiceFromOrganizationServiceName', () => { + const result = client.matchServiceFromOrganizationServiceName(fakePath); + assert.strictEqual(result, 'serviceValue'); + assert( + ( + client.pathTemplates.organizationServicePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchProjectFromProjectServiceName', () => { - const result = client.matchProjectFromProjectServiceName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectServicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + describe('organizationServiceServiceLevelObjective', async () => { + const fakePath = + '/rendered/path/organizationServiceServiceLevelObjective'; + const expectedParameters = { + organization: 'organizationValue', + service: 'serviceValue', + service_level_objective: 'serviceLevelObjectiveValue', + }; + const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationServiceServiceLevelObjectivePath', () => { + const result = client.organizationServiceServiceLevelObjectivePath( + 'organizationValue', + 'serviceValue', + 'serviceLevelObjectiveValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .organizationServiceServiceLevelObjectivePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchOrganizationFromOrganizationServiceServiceLevelObjectiveName', () => { + const result = + client.matchOrganizationFromOrganizationServiceServiceLevelObjectiveName( + fakePath, + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates + .organizationServiceServiceLevelObjectivePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchServiceFromOrganizationServiceServiceLevelObjectiveName', () => { + const result = + client.matchServiceFromOrganizationServiceServiceLevelObjectiveName( + fakePath, + ); + assert.strictEqual(result, 'serviceValue'); + assert( + ( + client.pathTemplates + .organizationServiceServiceLevelObjectivePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchServiceLevelObjectiveFromOrganizationServiceServiceLevelObjectiveName', () => { + const result = + client.matchServiceLevelObjectiveFromOrganizationServiceServiceLevelObjectiveName( + fakePath, + ); + assert.strictEqual(result, 'serviceLevelObjectiveValue'); + assert( + ( + client.pathTemplates + .organizationServiceServiceLevelObjectivePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchServiceFromProjectServiceName', () => { - const result = client.matchServiceFromProjectServiceName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.projectServicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('organizationUptimeCheckConfig', async () => { + const fakePath = '/rendered/path/organizationUptimeCheckConfig'; + const expectedParameters = { + organization: 'organizationValue', + uptime_check_config: 'uptimeCheckConfigValue', + }; + const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.organizationUptimeCheckConfigPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationUptimeCheckConfigPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationUptimeCheckConfigPath', () => { + const result = client.organizationUptimeCheckConfigPath( + 'organizationValue', + 'uptimeCheckConfigValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationUptimeCheckConfigPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchOrganizationFromOrganizationUptimeCheckConfigName', () => { + const result = + client.matchOrganizationFromOrganizationUptimeCheckConfigName( + fakePath, + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationUptimeCheckConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchUptimeCheckConfigFromOrganizationUptimeCheckConfigName', () => { + const result = + client.matchUptimeCheckConfigFromOrganizationUptimeCheckConfigName( + fakePath, + ); + assert.strictEqual(result, 'uptimeCheckConfigValue'); + assert( + ( + client.pathTemplates.organizationUptimeCheckConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('projectServiceServiceLevelObjective', async () => { - const fakePath = "/rendered/path/projectServiceServiceLevelObjective"; - const expectedParameters = { - project: "projectValue", - service: "serviceValue", - service_level_objective: "serviceLevelObjectiveValue", - }; - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectServiceServiceLevelObjectivePath', () => { - const result = client.projectServiceServiceLevelObjectivePath("projectValue", "serviceValue", "serviceLevelObjectiveValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); + describe('project', async () => { + const fakePath = '/rendered/path/project'; + const expectedParameters = { + project: 'projectValue', + }; + const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.projectPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectPath', () => { + const result = client.projectPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchProjectFromProjectServiceServiceLevelObjectiveName', () => { - const result = client.matchProjectFromProjectServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + describe('projectAlertPolicy', async () => { + const fakePath = '/rendered/path/projectAlertPolicy'; + const expectedParameters = { + project: 'projectValue', + alert_policy: 'alertPolicyValue', + }; + const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.projectAlertPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAlertPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAlertPolicyPath', () => { + const result = client.projectAlertPolicyPath( + 'projectValue', + 'alertPolicyValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAlertPolicyPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectAlertPolicyName', () => { + const result = client.matchProjectFromProjectAlertPolicyName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAlertPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchAlertPolicyFromProjectAlertPolicyName', () => { + const result = + client.matchAlertPolicyFromProjectAlertPolicyName(fakePath); + assert.strictEqual(result, 'alertPolicyValue'); + assert( + ( + client.pathTemplates.projectAlertPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchServiceFromProjectServiceServiceLevelObjectiveName', () => { - const result = client.matchServiceFromProjectServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + describe('projectAlertPolicyCondition', async () => { + const fakePath = '/rendered/path/projectAlertPolicyCondition'; + const expectedParameters = { + project: 'projectValue', + alert_policy: 'alertPolicyValue', + condition: 'conditionValue', + }; + const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.projectAlertPolicyConditionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAlertPolicyConditionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAlertPolicyConditionPath', () => { + const result = client.projectAlertPolicyConditionPath( + 'projectValue', + 'alertPolicyValue', + 'conditionValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAlertPolicyConditionPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectAlertPolicyConditionName', () => { + const result = + client.matchProjectFromProjectAlertPolicyConditionName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAlertPolicyConditionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchAlertPolicyFromProjectAlertPolicyConditionName', () => { + const result = + client.matchAlertPolicyFromProjectAlertPolicyConditionName(fakePath); + assert.strictEqual(result, 'alertPolicyValue'); + assert( + ( + client.pathTemplates.projectAlertPolicyConditionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchConditionFromProjectAlertPolicyConditionName', () => { + const result = + client.matchConditionFromProjectAlertPolicyConditionName(fakePath); + assert.strictEqual(result, 'conditionValue'); + assert( + ( + client.pathTemplates.projectAlertPolicyConditionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchServiceLevelObjectiveFromProjectServiceServiceLevelObjectiveName', () => { - const result = client.matchServiceLevelObjectiveFromProjectServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "serviceLevelObjectiveValue"); - assert((client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('projectChannelDescriptor', async () => { + const fakePath = '/rendered/path/projectChannelDescriptor'; + const expectedParameters = { + project: 'projectValue', + channel_descriptor: 'channelDescriptorValue', + }; + const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.projectChannelDescriptorPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectChannelDescriptorPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectChannelDescriptorPath', () => { + const result = client.projectChannelDescriptorPath( + 'projectValue', + 'channelDescriptorValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectChannelDescriptorPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectChannelDescriptorName', () => { + const result = + client.matchProjectFromProjectChannelDescriptorName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectChannelDescriptorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchChannelDescriptorFromProjectChannelDescriptorName', () => { + const result = + client.matchChannelDescriptorFromProjectChannelDescriptorName( + fakePath, + ); + assert.strictEqual(result, 'channelDescriptorValue'); + assert( + ( + client.pathTemplates.projectChannelDescriptorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('projectUptimeCheckConfig', async () => { - const fakePath = "/rendered/path/projectUptimeCheckConfig"; - const expectedParameters = { - project: "projectValue", - uptime_check_config: "uptimeCheckConfigValue", - }; - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectUptimeCheckConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectUptimeCheckConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectUptimeCheckConfigPath', () => { - const result = client.projectUptimeCheckConfigPath("projectValue", "uptimeCheckConfigValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectUptimeCheckConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); + describe('projectGroup', async () => { + const fakePath = '/rendered/path/projectGroup'; + const expectedParameters = { + project: 'projectValue', + group: 'groupValue', + }; + const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.projectGroupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectGroupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectGroupPath', () => { + const result = client.projectGroupPath('projectValue', 'groupValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectGroupPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectGroupName', () => { + const result = client.matchProjectFromProjectGroupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectGroupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchGroupFromProjectGroupName', () => { + const result = client.matchGroupFromProjectGroupName(fakePath); + assert.strictEqual(result, 'groupValue'); + assert( + (client.pathTemplates.projectGroupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchProjectFromProjectUptimeCheckConfigName', () => { - const result = client.matchProjectFromProjectUptimeCheckConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectUptimeCheckConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + describe('projectNotificationChannel', async () => { + const fakePath = '/rendered/path/projectNotificationChannel'; + const expectedParameters = { + project: 'projectValue', + notification_channel: 'notificationChannelValue', + }; + const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.projectNotificationChannelPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectNotificationChannelPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectNotificationChannelPath', () => { + const result = client.projectNotificationChannelPath( + 'projectValue', + 'notificationChannelValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectNotificationChannelPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectNotificationChannelName', () => { + const result = + client.matchProjectFromProjectNotificationChannelName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectNotificationChannelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchNotificationChannelFromProjectNotificationChannelName', () => { + const result = + client.matchNotificationChannelFromProjectNotificationChannelName( + fakePath, + ); + assert.strictEqual(result, 'notificationChannelValue'); + assert( + ( + client.pathTemplates.projectNotificationChannelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchUptimeCheckConfigFromProjectUptimeCheckConfigName', () => { - const result = client.matchUptimeCheckConfigFromProjectUptimeCheckConfigName(fakePath); - assert.strictEqual(result, "uptimeCheckConfigValue"); - assert((client.pathTemplates.projectUptimeCheckConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('projectService', async () => { + const fakePath = '/rendered/path/projectService'; + const expectedParameters = { + project: 'projectValue', + service: 'serviceValue', + }; + const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.projectServicePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectServicePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectServicePath', () => { + const result = client.projectServicePath( + 'projectValue', + 'serviceValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectServicePathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectServiceName', () => { + const result = client.matchProjectFromProjectServiceName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectServicePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchServiceFromProjectServiceName', () => { + const result = client.matchServiceFromProjectServiceName(fakePath); + assert.strictEqual(result, 'serviceValue'); + assert( + (client.pathTemplates.projectServicePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('snooze', async () => { - const fakePath = "/rendered/path/snooze"; - const expectedParameters = { - project: "projectValue", - snooze: "snoozeValue", - }; - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.snoozePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.snoozePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('snoozePath', () => { - const result = client.snoozePath("projectValue", "snoozeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.snoozePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); + describe('projectServiceServiceLevelObjective', async () => { + const fakePath = '/rendered/path/projectServiceServiceLevelObjective'; + const expectedParameters = { + project: 'projectValue', + service: 'serviceValue', + service_level_objective: 'serviceLevelObjectiveValue', + }; + const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectServiceServiceLevelObjectivePath', () => { + const result = client.projectServiceServiceLevelObjectivePath( + 'projectValue', + 'serviceValue', + 'serviceLevelObjectiveValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectServiceServiceLevelObjectiveName', () => { + const result = + client.matchProjectFromProjectServiceServiceLevelObjectiveName( + fakePath, + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchServiceFromProjectServiceServiceLevelObjectiveName', () => { + const result = + client.matchServiceFromProjectServiceServiceLevelObjectiveName( + fakePath, + ); + assert.strictEqual(result, 'serviceValue'); + assert( + ( + client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchServiceLevelObjectiveFromProjectServiceServiceLevelObjectiveName', () => { + const result = + client.matchServiceLevelObjectiveFromProjectServiceServiceLevelObjectiveName( + fakePath, + ); + assert.strictEqual(result, 'serviceLevelObjectiveValue'); + assert( + ( + client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchProjectFromSnoozeName', () => { - const result = client.matchProjectFromSnoozeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.snoozePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + describe('projectUptimeCheckConfig', async () => { + const fakePath = '/rendered/path/projectUptimeCheckConfig'; + const expectedParameters = { + project: 'projectValue', + uptime_check_config: 'uptimeCheckConfigValue', + }; + const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.projectUptimeCheckConfigPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectUptimeCheckConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectUptimeCheckConfigPath', () => { + const result = client.projectUptimeCheckConfigPath( + 'projectValue', + 'uptimeCheckConfigValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectUptimeCheckConfigPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectUptimeCheckConfigName', () => { + const result = + client.matchProjectFromProjectUptimeCheckConfigName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectUptimeCheckConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchUptimeCheckConfigFromProjectUptimeCheckConfigName', () => { + const result = + client.matchUptimeCheckConfigFromProjectUptimeCheckConfigName( + fakePath, + ); + assert.strictEqual(result, 'uptimeCheckConfigValue'); + assert( + ( + client.pathTemplates.projectUptimeCheckConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchSnoozeFromSnoozeName', () => { - const result = client.matchSnoozeFromSnoozeName(fakePath); - assert.strictEqual(result, "snoozeValue"); - assert((client.pathTemplates.snoozePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('snooze', async () => { + const fakePath = '/rendered/path/snooze'; + const expectedParameters = { + project: 'projectValue', + snooze: 'snoozeValue', + }; + const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.snoozePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.snoozePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('snoozePath', () => { + const result = client.snoozePath('projectValue', 'snoozeValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.snoozePathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromSnoozeName', () => { + const result = client.matchProjectFromSnoozeName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.snoozePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSnoozeFromSnoozeName', () => { + const result = client.matchSnoozeFromSnoozeName(fakePath); + assert.strictEqual(result, 'snoozeValue'); + assert( + (client.pathTemplates.snoozePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); }); + }); }); diff --git a/packages/google-cloud-monitoring/test/gapic_group_service_v3.ts b/packages/google-cloud-monitoring/test/gapic_group_service_v3.ts index 4fdf49646100..ced7ddb99903 100644 --- a/packages/google-cloud-monitoring/test/gapic_group_service_v3.ts +++ b/packages/google-cloud-monitoring/test/gapic_group_service_v3.ts @@ -19,2200 +19,3102 @@ 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 groupserviceModule 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 -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); +const root = protobuf.Root.fromJSON( + require('../protos/protos.json'), +).resolveAll(); // eslint-disable-next-line @typescript-eslint/no-unused-vars function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; } function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; + const filledObject = ( + instance.constructor as typeof protobuf.Message + ).toObject(instance as protobuf.Message, { defaults: true }); + return (instance.constructor as typeof protobuf.Message).fromObject( + filledObject, + ) as T; } function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); + return error + ? sinon.stub().rejects(error) + : sinon.stub().resolves([response]); } -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +function stubSimpleCallWithCallback( + response?: ResponseType, + error?: Error, +) { + return error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); } -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } +function stubPageStreamingCall( + responses?: ResponseType[], + error?: Error, +) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); + } + const transformStub = error + ? sinon.stub().callsArgWith(2, error) + : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { + mockStream.write({}); + }); } - return sinon.stub().returns(mockStream); + setImmediate(() => { + mockStream.end(); + }); + } else { + setImmediate(() => { + mockStream.write({}); + }); + setImmediate(() => { + mockStream.end(); + }); + } + return sinon.stub().returns(mockStream); } -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); +function stubAsyncIterationCall( + responses?: ResponseType[], + error?: Error, +) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({ done: true, value: undefined }); + } + return Promise.resolve({ done: false, value: responses![counter++] }); + }, + }; + }, + }; + return sinon.stub().returns(asyncIterable); } describe('v3.GroupServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new groupserviceModule.v3.GroupServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'monitoring.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new groupserviceModule.v3.GroupServiceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = groupserviceModule.v3.GroupServiceClient.servicePath; - assert.strictEqual(servicePath, 'monitoring.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = groupserviceModule.v3.GroupServiceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'monitoring.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new groupserviceModule.v3.GroupServiceClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'monitoring.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new groupserviceModule.v3.GroupServiceClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'monitoring.example.com'); - }); + describe('Common methods', () => { + it('has apiEndpoint', () => { + const client = new groupserviceModule.v3.GroupServiceClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'monitoring.googleapis.com'); + }); - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new groupserviceModule.v3.GroupServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'monitoring.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new groupserviceModule.v3.GroupServiceClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'monitoring.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new groupserviceModule.v3.GroupServiceClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); + it('has universeDomain', () => { + const client = new groupserviceModule.v3.GroupServiceClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); - it('has port', () => { - const port = groupserviceModule.v3.GroupServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + groupserviceModule.v3.GroupServiceClient.servicePath; + assert.strictEqual(servicePath, 'monitoring.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + groupserviceModule.v3.GroupServiceClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'monitoring.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = new groupserviceModule.v3.GroupServiceClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'monitoring.example.com'); + }); - it('should create a client with no option', () => { - const client = new groupserviceModule.v3.GroupServiceClient(); - assert(client); - }); + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = new groupserviceModule.v3.GroupServiceClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'monitoring.example.com'); + }); - it('should create a client with gRPC fallback', () => { - const client = new groupserviceModule.v3.GroupServiceClient({ - fallback: true, - }); - assert(client); + if (typeof process === 'object' && 'env' in process) { + describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { + it('sets apiEndpoint from environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = new groupserviceModule.v3.GroupServiceClient(); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'monitoring.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } + }); + + it('value configured in code has priority over environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = new groupserviceModule.v3.GroupServiceClient({ + universeDomain: 'configured.example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'monitoring.configured.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } + }); + }); + } + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new groupserviceModule.v3.GroupServiceClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', }); + }); + }); - it('has initialize method and supports deferred initialization', async () => { - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.groupServiceStub, undefined); - await client.initialize(); - assert(client.groupServiceStub); - }); + it('has port', () => { + const port = groupserviceModule.v3.GroupServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); - it('has close method for the initialized client', done => { - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.groupServiceStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); + it('should create a client with no option', () => { + const client = new groupserviceModule.v3.GroupServiceClient(); + assert(client); + }); - it('has close method for the non-initialized client', done => { - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.groupServiceStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); + it('should create a client with gRPC fallback', () => { + const client = new groupserviceModule.v3.GroupServiceClient({ + fallback: true, + }); + assert(client); + }); - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); + it('has initialize method and supports deferred initialization', async () => { + const client = new groupserviceModule.v3.GroupServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.groupServiceStub, undefined); + await client.initialize(); + assert(client.groupServiceStub); + }); - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); + it('has close method for the initialized client', (done) => { + const client = new groupserviceModule.v3.GroupServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.initialize().catch((err) => { + throw err; + }); + assert(client.groupServiceStub); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; }); }); - describe('getGroup', () => { - it('invokes getGroup without error', async () => { - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.GetGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.GetGroupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.monitoring.v3.Group() - ); - client.innerApiCalls.getGroup = stubSimpleCall(expectedResponse); - const [response] = await client.getGroup(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + it('has close method for the non-initialized client', (done) => { + const client = new groupserviceModule.v3.GroupServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.groupServiceStub, undefined); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; }); + }); - it('invokes getGroup without error using callback', async () => { - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.GetGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.GetGroupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.monitoring.v3.Group() - ); - client.innerApiCalls.getGroup = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getGroup( - request, - (err?: Error|null, result?: protos.google.monitoring.v3.IGroup|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new groupserviceModule.v3.GroupServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); - it('invokes getGroup with error', async () => { - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.GetGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.GetGroupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getGroup = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getGroup(request), expectedError); - const actualRequest = (client.innerApiCalls.getGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new groupserviceModule.v3.GroupServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + }); + + describe('getGroup', () => { + it('invokes getGroup without error', async () => { + const client = new groupserviceModule.v3.GroupServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.GetGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.GetGroupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.monitoring.v3.Group(), + ); + client.innerApiCalls.getGroup = stubSimpleCall(expectedResponse); + const [response] = await client.getGroup(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getGroup with closed client', async () => { - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.GetGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.GetGroupRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getGroup(request), expectedError); - }); + it('invokes getGroup without error using callback', async () => { + const client = new groupserviceModule.v3.GroupServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.GetGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.GetGroupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.monitoring.v3.Group(), + ); + client.innerApiCalls.getGroup = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getGroup( + request, + ( + err?: Error | null, + result?: protos.google.monitoring.v3.IGroup | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('createGroup', () => { - it('invokes createGroup without error', async () => { - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.CreateGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.CreateGroupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.monitoring.v3.Group() - ); - client.innerApiCalls.createGroup = stubSimpleCall(expectedResponse); - const [response] = await client.createGroup(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getGroup with error', async () => { + const client = new groupserviceModule.v3.GroupServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.GetGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.GetGroupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getGroup = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getGroup(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createGroup without error using callback', async () => { - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.CreateGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.CreateGroupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.monitoring.v3.Group() - ); - client.innerApiCalls.createGroup = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createGroup( - request, - (err?: Error|null, result?: protos.google.monitoring.v3.IGroup|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getGroup with closed client', async () => { + const client = new groupserviceModule.v3.GroupServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.GetGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.GetGroupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.getGroup(request), expectedError); + }); + }); + + describe('createGroup', () => { + it('invokes createGroup without error', async () => { + const client = new groupserviceModule.v3.GroupServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.CreateGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.CreateGroupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.monitoring.v3.Group(), + ); + client.innerApiCalls.createGroup = stubSimpleCall(expectedResponse); + const [response] = await client.createGroup(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createGroup with error', async () => { - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.CreateGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.CreateGroupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createGroup = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createGroup(request), expectedError); - const actualRequest = (client.innerApiCalls.createGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createGroup without error using callback', async () => { + const client = new groupserviceModule.v3.GroupServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.CreateGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.CreateGroupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.monitoring.v3.Group(), + ); + client.innerApiCalls.createGroup = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createGroup( + request, + ( + err?: Error | null, + result?: protos.google.monitoring.v3.IGroup | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createGroup with closed client', async () => { - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.CreateGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.CreateGroupRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.createGroup(request), expectedError); - }); + it('invokes createGroup with error', async () => { + const client = new groupserviceModule.v3.GroupServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.CreateGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.CreateGroupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createGroup = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.createGroup(request), expectedError); + const actualRequest = ( + client.innerApiCalls.createGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('updateGroup', () => { - it('invokes updateGroup without error', async () => { - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.UpdateGroupRequest() - ); - request.group ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.UpdateGroupRequest', ['group', 'name']); - request.group.name = defaultValue1; - const expectedHeaderRequestParams = `group.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.monitoring.v3.Group() - ); - client.innerApiCalls.updateGroup = stubSimpleCall(expectedResponse); - const [response] = await client.updateGroup(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createGroup with closed client', async () => { + const client = new groupserviceModule.v3.GroupServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.CreateGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.CreateGroupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.createGroup(request), expectedError); + }); + }); + + describe('updateGroup', () => { + it('invokes updateGroup without error', async () => { + const client = new groupserviceModule.v3.GroupServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.UpdateGroupRequest(), + ); + request.group ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.UpdateGroupRequest', + ['group', 'name'], + ); + request.group.name = defaultValue1; + const expectedHeaderRequestParams = `group.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.monitoring.v3.Group(), + ); + client.innerApiCalls.updateGroup = stubSimpleCall(expectedResponse); + const [response] = await client.updateGroup(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateGroup without error using callback', async () => { - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.UpdateGroupRequest() - ); - request.group ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.UpdateGroupRequest', ['group', 'name']); - request.group.name = defaultValue1; - const expectedHeaderRequestParams = `group.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.monitoring.v3.Group() - ); - client.innerApiCalls.updateGroup = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateGroup( - request, - (err?: Error|null, result?: protos.google.monitoring.v3.IGroup|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateGroup without error using callback', async () => { + const client = new groupserviceModule.v3.GroupServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.UpdateGroupRequest(), + ); + request.group ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.UpdateGroupRequest', + ['group', 'name'], + ); + request.group.name = defaultValue1; + const expectedHeaderRequestParams = `group.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.monitoring.v3.Group(), + ); + client.innerApiCalls.updateGroup = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateGroup( + request, + ( + err?: Error | null, + result?: protos.google.monitoring.v3.IGroup | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateGroup with error', async () => { - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.UpdateGroupRequest() - ); - request.group ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.UpdateGroupRequest', ['group', 'name']); - request.group.name = defaultValue1; - const expectedHeaderRequestParams = `group.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateGroup = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateGroup(request), expectedError); - const actualRequest = (client.innerApiCalls.updateGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateGroup with error', async () => { + const client = new groupserviceModule.v3.GroupServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.UpdateGroupRequest(), + ); + request.group ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.UpdateGroupRequest', + ['group', 'name'], + ); + request.group.name = defaultValue1; + const expectedHeaderRequestParams = `group.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateGroup = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.updateGroup(request), expectedError); + const actualRequest = ( + client.innerApiCalls.updateGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateGroup with closed client', async () => { - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.UpdateGroupRequest() - ); - request.group ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.UpdateGroupRequest', ['group', 'name']); - request.group.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.updateGroup(request), expectedError); - }); + it('invokes updateGroup with closed client', async () => { + const client = new groupserviceModule.v3.GroupServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.UpdateGroupRequest(), + ); + request.group ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.UpdateGroupRequest', + ['group', 'name'], + ); + request.group.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.updateGroup(request), expectedError); + }); + }); + + describe('deleteGroup', () => { + it('invokes deleteGroup without error', async () => { + const client = new groupserviceModule.v3.GroupServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.DeleteGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.DeleteGroupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty(), + ); + client.innerApiCalls.deleteGroup = stubSimpleCall(expectedResponse); + const [response] = await client.deleteGroup(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('deleteGroup', () => { - it('invokes deleteGroup without error', async () => { - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.DeleteGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.DeleteGroupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteGroup = stubSimpleCall(expectedResponse); - const [response] = await client.deleteGroup(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteGroup without error using callback', async () => { + const client = new groupserviceModule.v3.GroupServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.DeleteGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.DeleteGroupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty(), + ); + client.innerApiCalls.deleteGroup = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteGroup( + request, + ( + err?: Error | null, + result?: protos.google.protobuf.IEmpty | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteGroup without error using callback', async () => { - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.DeleteGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.DeleteGroupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteGroup = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteGroup( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteGroup with error', async () => { + const client = new groupserviceModule.v3.GroupServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.DeleteGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.DeleteGroupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteGroup = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.deleteGroup(request), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteGroup with error', async () => { - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.DeleteGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.DeleteGroupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteGroup = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteGroup(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteGroup with closed client', async () => { + const client = new groupserviceModule.v3.GroupServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.DeleteGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.DeleteGroupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.deleteGroup(request), expectedError); + }); + }); + + describe('listGroups', () => { + it('invokes listGroups without error', async () => { + const client = new groupserviceModule.v3.GroupServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListGroupsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.ListGroupsRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.monitoring.v3.Group()), + generateSampleMessage(new protos.google.monitoring.v3.Group()), + generateSampleMessage(new protos.google.monitoring.v3.Group()), + ]; + client.innerApiCalls.listGroups = stubSimpleCall(expectedResponse); + const [response] = await client.listGroups(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listGroups as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listGroups as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteGroup with closed client', async () => { - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.DeleteGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.DeleteGroupRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.deleteGroup(request), expectedError); - }); + it('invokes listGroups without error using callback', async () => { + const client = new groupserviceModule.v3.GroupServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListGroupsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.ListGroupsRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.monitoring.v3.Group()), + generateSampleMessage(new protos.google.monitoring.v3.Group()), + generateSampleMessage(new protos.google.monitoring.v3.Group()), + ]; + client.innerApiCalls.listGroups = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listGroups( + request, + ( + err?: Error | null, + result?: protos.google.monitoring.v3.IGroup[] | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listGroups as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listGroups as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('listGroups', () => { - it('invokes listGroups without error', async () => { - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListGroupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListGroupsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.monitoring.v3.Group()), - generateSampleMessage(new protos.google.monitoring.v3.Group()), - generateSampleMessage(new protos.google.monitoring.v3.Group()), - ]; - client.innerApiCalls.listGroups = stubSimpleCall(expectedResponse); - const [response] = await client.listGroups(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listGroups as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listGroups as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listGroups with error', async () => { + const client = new groupserviceModule.v3.GroupServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListGroupsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.ListGroupsRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listGroups = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.listGroups(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listGroups as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listGroups as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes listGroups without error using callback', async () => { - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListGroupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListGroupsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.monitoring.v3.Group()), - generateSampleMessage(new protos.google.monitoring.v3.Group()), - generateSampleMessage(new protos.google.monitoring.v3.Group()), - ]; - client.innerApiCalls.listGroups = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listGroups( - request, - (err?: Error|null, result?: protos.google.monitoring.v3.IGroup[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listGroups as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listGroups as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listGroupsStream without error', async () => { + const client = new groupserviceModule.v3.GroupServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListGroupsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.ListGroupsRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.monitoring.v3.Group()), + generateSampleMessage(new protos.google.monitoring.v3.Group()), + generateSampleMessage(new protos.google.monitoring.v3.Group()), + ]; + client.descriptors.page.listGroups.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listGroupsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.monitoring.v3.Group[] = []; + stream.on('data', (response: protos.google.monitoring.v3.Group) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.listGroups.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listGroups, request), + ); + assert( + (client.descriptors.page.listGroups.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes listGroups with error', async () => { - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListGroupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListGroupsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listGroups = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listGroups(request), expectedError); - const actualRequest = (client.innerApiCalls.listGroups as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listGroups as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listGroupsStream with error', async () => { + const client = new groupserviceModule.v3.GroupServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListGroupsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.ListGroupsRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listGroups.createStream = stubPageStreamingCall( + undefined, + expectedError, + ); + const stream = client.listGroupsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.monitoring.v3.Group[] = []; + stream.on('data', (response: protos.google.monitoring.v3.Group) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listGroups.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listGroups, request), + ); + assert( + (client.descriptors.page.listGroups.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes listGroupsStream without error', async () => { - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListGroupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListGroupsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.monitoring.v3.Group()), - generateSampleMessage(new protos.google.monitoring.v3.Group()), - generateSampleMessage(new protos.google.monitoring.v3.Group()), - ]; - client.descriptors.page.listGroups.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listGroupsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.monitoring.v3.Group[] = []; - stream.on('data', (response: protos.google.monitoring.v3.Group) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listGroups.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listGroups, request)); - assert( - (client.descriptors.page.listGroups.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listGroups without error', async () => { + const client = new groupserviceModule.v3.GroupServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListGroupsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.ListGroupsRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.monitoring.v3.Group()), + generateSampleMessage(new protos.google.monitoring.v3.Group()), + generateSampleMessage(new protos.google.monitoring.v3.Group()), + ]; + client.descriptors.page.listGroups.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.monitoring.v3.IGroup[] = []; + const iterable = client.listGroupsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listGroups.asyncIterate as SinonStub).getCall( + 0, + ).args[1], + request, + ); + assert( + (client.descriptors.page.listGroups.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes listGroupsStream with error', async () => { - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListGroupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListGroupsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listGroups.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listGroupsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.monitoring.v3.Group[] = []; - stream.on('data', (response: protos.google.monitoring.v3.Group) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listGroups.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listGroups, request)); - assert( - (client.descriptors.page.listGroups.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listGroups with error', async () => { + const client = new groupserviceModule.v3.GroupServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListGroupsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.ListGroupsRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listGroups.asyncIterate = stubAsyncIterationCall( + undefined, + expectedError, + ); + const iterable = client.listGroupsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.monitoring.v3.IGroup[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listGroups.asyncIterate as SinonStub).getCall( + 0, + ).args[1], + request, + ); + assert( + (client.descriptors.page.listGroups.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + }); + + describe('listGroupMembers', () => { + it('invokes listGroupMembers without error', async () => { + const client = new groupserviceModule.v3.GroupServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListGroupMembersRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.ListGroupMembersRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.api.MonitoredResource()), + generateSampleMessage(new protos.google.api.MonitoredResource()), + generateSampleMessage(new protos.google.api.MonitoredResource()), + ]; + client.innerApiCalls.listGroupMembers = stubSimpleCall(expectedResponse); + const [response] = await client.listGroupMembers(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listGroupMembers as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listGroupMembers as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('uses async iteration with listGroups without error', async () => { - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListGroupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListGroupsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.monitoring.v3.Group()), - generateSampleMessage(new protos.google.monitoring.v3.Group()), - generateSampleMessage(new protos.google.monitoring.v3.Group()), - ]; - client.descriptors.page.listGroups.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.monitoring.v3.IGroup[] = []; - const iterable = client.listGroupsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); + it('invokes listGroupMembers without error using callback', async () => { + const client = new groupserviceModule.v3.GroupServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListGroupMembersRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.ListGroupMembersRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.api.MonitoredResource()), + generateSampleMessage(new protos.google.api.MonitoredResource()), + generateSampleMessage(new protos.google.api.MonitoredResource()), + ]; + client.innerApiCalls.listGroupMembers = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listGroupMembers( + request, + ( + err?: Error | null, + result?: protos.google.api.IMonitoredResource[] | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listGroups.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listGroups.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listGroups with error', async () => { - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListGroupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListGroupsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listGroups.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listGroupsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.monitoring.v3.IGroup[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listGroups.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listGroups.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listGroupMembers as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listGroupMembers as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('listGroupMembers', () => { - it('invokes listGroupMembers without error', async () => { - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListGroupMembersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListGroupMembersRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.api.MonitoredResource()), - generateSampleMessage(new protos.google.api.MonitoredResource()), - generateSampleMessage(new protos.google.api.MonitoredResource()), - ]; - client.innerApiCalls.listGroupMembers = stubSimpleCall(expectedResponse); - const [response] = await client.listGroupMembers(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listGroupMembers as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listGroupMembers as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listGroupMembers without error using callback', async () => { - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListGroupMembersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListGroupMembersRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.api.MonitoredResource()), - generateSampleMessage(new protos.google.api.MonitoredResource()), - generateSampleMessage(new protos.google.api.MonitoredResource()), - ]; - client.innerApiCalls.listGroupMembers = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listGroupMembers( - request, - (err?: Error|null, result?: protos.google.api.IMonitoredResource[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listGroupMembers as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listGroupMembers as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listGroupMembers with error', async () => { - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListGroupMembersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListGroupMembersRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listGroupMembers = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listGroupMembers(request), expectedError); - const actualRequest = (client.innerApiCalls.listGroupMembers as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listGroupMembers as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listGroupMembersStream without error', async () => { - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListGroupMembersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListGroupMembersRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.api.MonitoredResource()), - generateSampleMessage(new protos.google.api.MonitoredResource()), - generateSampleMessage(new protos.google.api.MonitoredResource()), - ]; - client.descriptors.page.listGroupMembers.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listGroupMembersStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.api.MonitoredResource[] = []; - stream.on('data', (response: protos.google.api.MonitoredResource) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listGroupMembers.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listGroupMembers, request)); - assert( - (client.descriptors.page.listGroupMembers.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('invokes listGroupMembers with error', async () => { + const client = new groupserviceModule.v3.GroupServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListGroupMembersRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.ListGroupMembersRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listGroupMembers = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.listGroupMembers(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listGroupMembers as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listGroupMembers as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes listGroupMembersStream with error', async () => { - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListGroupMembersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListGroupMembersRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listGroupMembers.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listGroupMembersStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.api.MonitoredResource[] = []; - stream.on('data', (response: protos.google.api.MonitoredResource) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listGroupMembers.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listGroupMembers, request)); - assert( - (client.descriptors.page.listGroupMembers.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('invokes listGroupMembersStream without error', async () => { + const client = new groupserviceModule.v3.GroupServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListGroupMembersRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.ListGroupMembersRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.api.MonitoredResource()), + generateSampleMessage(new protos.google.api.MonitoredResource()), + generateSampleMessage(new protos.google.api.MonitoredResource()), + ]; + client.descriptors.page.listGroupMembers.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listGroupMembersStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.api.MonitoredResource[] = []; + stream.on('data', (response: protos.google.api.MonitoredResource) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.listGroupMembers.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listGroupMembers, request), + ); + assert( + (client.descriptors.page.listGroupMembers.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('uses async iteration with listGroupMembers without error', async () => { - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListGroupMembersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListGroupMembersRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.api.MonitoredResource()), - generateSampleMessage(new protos.google.api.MonitoredResource()), - generateSampleMessage(new protos.google.api.MonitoredResource()), - ]; - client.descriptors.page.listGroupMembers.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.api.IMonitoredResource[] = []; - const iterable = client.listGroupMembersAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listGroupMembers.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listGroupMembers.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('invokes listGroupMembersStream with error', async () => { + const client = new groupserviceModule.v3.GroupServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListGroupMembersRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.ListGroupMembersRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listGroupMembers.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listGroupMembersStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.api.MonitoredResource[] = []; + stream.on('data', (response: protos.google.api.MonitoredResource) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listGroupMembers.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listGroupMembers, request), + ); + assert( + (client.descriptors.page.listGroupMembers.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('uses async iteration with listGroupMembers with error', async () => { - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListGroupMembersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListGroupMembersRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listGroupMembers.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listGroupMembersAsync(request); - await assert.rejects(async () => { - const responses: protos.google.api.IMonitoredResource[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listGroupMembers.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listGroupMembers.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listGroupMembers without error', async () => { + const client = new groupserviceModule.v3.GroupServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListGroupMembersRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.ListGroupMembersRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.api.MonitoredResource()), + generateSampleMessage(new protos.google.api.MonitoredResource()), + generateSampleMessage(new protos.google.api.MonitoredResource()), + ]; + client.descriptors.page.listGroupMembers.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.api.IMonitoredResource[] = []; + const iterable = client.listGroupMembersAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listGroupMembers.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listGroupMembers.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); }); - describe('Path templates', () => { - - describe('folderAlertPolicy', async () => { - const fakePath = "/rendered/path/folderAlertPolicy"; - const expectedParameters = { - folder: "folderValue", - alert_policy: "alertPolicyValue", - }; - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.folderAlertPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderAlertPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderAlertPolicyPath', () => { - const result = client.folderAlertPolicyPath("folderValue", "alertPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderAlertPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderAlertPolicyName', () => { - const result = client.matchFolderFromFolderAlertPolicyName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderAlertPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAlertPolicyFromFolderAlertPolicyName', () => { - const result = client.matchAlertPolicyFromFolderAlertPolicyName(fakePath); - assert.strictEqual(result, "alertPolicyValue"); - assert((client.pathTemplates.folderAlertPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + it('uses async iteration with listGroupMembers with error', async () => { + const client = new groupserviceModule.v3.GroupServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListGroupMembersRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.ListGroupMembersRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listGroupMembers.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listGroupMembersAsync(request); + await assert.rejects(async () => { + const responses: protos.google.api.IMonitoredResource[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listGroupMembers.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listGroupMembers.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + }); + + describe('Path templates', () => { + describe('folderAlertPolicy', async () => { + const fakePath = '/rendered/path/folderAlertPolicy'; + const expectedParameters = { + folder: 'folderValue', + alert_policy: 'alertPolicyValue', + }; + const client = new groupserviceModule.v3.GroupServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.folderAlertPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.folderAlertPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('folderAlertPolicyPath', () => { + const result = client.folderAlertPolicyPath( + 'folderValue', + 'alertPolicyValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.folderAlertPolicyPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchFolderFromFolderAlertPolicyName', () => { + const result = client.matchFolderFromFolderAlertPolicyName(fakePath); + assert.strictEqual(result, 'folderValue'); + assert( + ( + client.pathTemplates.folderAlertPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchAlertPolicyFromFolderAlertPolicyName', () => { + const result = + client.matchAlertPolicyFromFolderAlertPolicyName(fakePath); + assert.strictEqual(result, 'alertPolicyValue'); + assert( + ( + client.pathTemplates.folderAlertPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('folderAlertPolicyCondition', async () => { - const fakePath = "/rendered/path/folderAlertPolicyCondition"; - const expectedParameters = { - folder: "folderValue", - alert_policy: "alertPolicyValue", - condition: "conditionValue", - }; - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.folderAlertPolicyConditionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderAlertPolicyConditionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderAlertPolicyConditionPath', () => { - const result = client.folderAlertPolicyConditionPath("folderValue", "alertPolicyValue", "conditionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderAlertPolicyConditionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderAlertPolicyConditionName', () => { - const result = client.matchFolderFromFolderAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAlertPolicyFromFolderAlertPolicyConditionName', () => { - const result = client.matchAlertPolicyFromFolderAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "alertPolicyValue"); - assert((client.pathTemplates.folderAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConditionFromFolderAlertPolicyConditionName', () => { - const result = client.matchConditionFromFolderAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "conditionValue"); - assert((client.pathTemplates.folderAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('folderAlertPolicyCondition', async () => { + const fakePath = '/rendered/path/folderAlertPolicyCondition'; + const expectedParameters = { + folder: 'folderValue', + alert_policy: 'alertPolicyValue', + condition: 'conditionValue', + }; + const client = new groupserviceModule.v3.GroupServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.folderAlertPolicyConditionPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.folderAlertPolicyConditionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('folderAlertPolicyConditionPath', () => { + const result = client.folderAlertPolicyConditionPath( + 'folderValue', + 'alertPolicyValue', + 'conditionValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.folderAlertPolicyConditionPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchFolderFromFolderAlertPolicyConditionName', () => { + const result = + client.matchFolderFromFolderAlertPolicyConditionName(fakePath); + assert.strictEqual(result, 'folderValue'); + assert( + ( + client.pathTemplates.folderAlertPolicyConditionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchAlertPolicyFromFolderAlertPolicyConditionName', () => { + const result = + client.matchAlertPolicyFromFolderAlertPolicyConditionName(fakePath); + assert.strictEqual(result, 'alertPolicyValue'); + assert( + ( + client.pathTemplates.folderAlertPolicyConditionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchConditionFromFolderAlertPolicyConditionName', () => { + const result = + client.matchConditionFromFolderAlertPolicyConditionName(fakePath); + assert.strictEqual(result, 'conditionValue'); + assert( + ( + client.pathTemplates.folderAlertPolicyConditionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('folderChannelDescriptor', async () => { - const fakePath = "/rendered/path/folderChannelDescriptor"; - const expectedParameters = { - folder: "folderValue", - channel_descriptor: "channelDescriptorValue", - }; - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.folderChannelDescriptorPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderChannelDescriptorPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderChannelDescriptorPath', () => { - const result = client.folderChannelDescriptorPath("folderValue", "channelDescriptorValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderChannelDescriptorPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderChannelDescriptorName', () => { - const result = client.matchFolderFromFolderChannelDescriptorName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderChannelDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchChannelDescriptorFromFolderChannelDescriptorName', () => { - const result = client.matchChannelDescriptorFromFolderChannelDescriptorName(fakePath); - assert.strictEqual(result, "channelDescriptorValue"); - assert((client.pathTemplates.folderChannelDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('folderChannelDescriptor', async () => { + const fakePath = '/rendered/path/folderChannelDescriptor'; + const expectedParameters = { + folder: 'folderValue', + channel_descriptor: 'channelDescriptorValue', + }; + const client = new groupserviceModule.v3.GroupServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.folderChannelDescriptorPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.folderChannelDescriptorPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('folderChannelDescriptorPath', () => { + const result = client.folderChannelDescriptorPath( + 'folderValue', + 'channelDescriptorValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.folderChannelDescriptorPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchFolderFromFolderChannelDescriptorName', () => { + const result = + client.matchFolderFromFolderChannelDescriptorName(fakePath); + assert.strictEqual(result, 'folderValue'); + assert( + ( + client.pathTemplates.folderChannelDescriptorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchChannelDescriptorFromFolderChannelDescriptorName', () => { + const result = + client.matchChannelDescriptorFromFolderChannelDescriptorName( + fakePath, + ); + assert.strictEqual(result, 'channelDescriptorValue'); + assert( + ( + client.pathTemplates.folderChannelDescriptorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('folderGroup', async () => { - const fakePath = "/rendered/path/folderGroup"; - const expectedParameters = { - folder: "folderValue", - group: "groupValue", - }; - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.folderGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderGroupPath', () => { - const result = client.folderGroupPath("folderValue", "groupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderGroupName', () => { - const result = client.matchFolderFromFolderGroupName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchGroupFromFolderGroupName', () => { - const result = client.matchGroupFromFolderGroupName(fakePath); - assert.strictEqual(result, "groupValue"); - assert((client.pathTemplates.folderGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('folderGroup', async () => { + const fakePath = '/rendered/path/folderGroup'; + const expectedParameters = { + folder: 'folderValue', + group: 'groupValue', + }; + const client = new groupserviceModule.v3.GroupServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.folderGroupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.folderGroupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('folderGroupPath', () => { + const result = client.folderGroupPath('folderValue', 'groupValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.folderGroupPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchFolderFromFolderGroupName', () => { + const result = client.matchFolderFromFolderGroupName(fakePath); + assert.strictEqual(result, 'folderValue'); + assert( + (client.pathTemplates.folderGroupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchGroupFromFolderGroupName', () => { + const result = client.matchGroupFromFolderGroupName(fakePath); + assert.strictEqual(result, 'groupValue'); + assert( + (client.pathTemplates.folderGroupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('folderNotificationChannel', async () => { - const fakePath = "/rendered/path/folderNotificationChannel"; - const expectedParameters = { - folder: "folderValue", - notification_channel: "notificationChannelValue", - }; - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.folderNotificationChannelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderNotificationChannelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderNotificationChannelPath', () => { - const result = client.folderNotificationChannelPath("folderValue", "notificationChannelValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderNotificationChannelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderNotificationChannelName', () => { - const result = client.matchFolderFromFolderNotificationChannelName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderNotificationChannelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchNotificationChannelFromFolderNotificationChannelName', () => { - const result = client.matchNotificationChannelFromFolderNotificationChannelName(fakePath); - assert.strictEqual(result, "notificationChannelValue"); - assert((client.pathTemplates.folderNotificationChannelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('folderNotificationChannel', async () => { + const fakePath = '/rendered/path/folderNotificationChannel'; + const expectedParameters = { + folder: 'folderValue', + notification_channel: 'notificationChannelValue', + }; + const client = new groupserviceModule.v3.GroupServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.folderNotificationChannelPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.folderNotificationChannelPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('folderNotificationChannelPath', () => { + const result = client.folderNotificationChannelPath( + 'folderValue', + 'notificationChannelValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.folderNotificationChannelPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchFolderFromFolderNotificationChannelName', () => { + const result = + client.matchFolderFromFolderNotificationChannelName(fakePath); + assert.strictEqual(result, 'folderValue'); + assert( + ( + client.pathTemplates.folderNotificationChannelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchNotificationChannelFromFolderNotificationChannelName', () => { + const result = + client.matchNotificationChannelFromFolderNotificationChannelName( + fakePath, + ); + assert.strictEqual(result, 'notificationChannelValue'); + assert( + ( + client.pathTemplates.folderNotificationChannelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('folderService', async () => { - const fakePath = "/rendered/path/folderService"; - const expectedParameters = { - folder: "folderValue", - service: "serviceValue", - }; - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.folderServicePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderServicePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderServicePath', () => { - const result = client.folderServicePath("folderValue", "serviceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderServicePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderServiceName', () => { - const result = client.matchFolderFromFolderServiceName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderServicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromFolderServiceName', () => { - const result = client.matchServiceFromFolderServiceName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.folderServicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('folderService', async () => { + const fakePath = '/rendered/path/folderService'; + const expectedParameters = { + folder: 'folderValue', + service: 'serviceValue', + }; + const client = new groupserviceModule.v3.GroupServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.folderServicePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.folderServicePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('folderServicePath', () => { + const result = client.folderServicePath('folderValue', 'serviceValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.folderServicePathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchFolderFromFolderServiceName', () => { + const result = client.matchFolderFromFolderServiceName(fakePath); + assert.strictEqual(result, 'folderValue'); + assert( + (client.pathTemplates.folderServicePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchServiceFromFolderServiceName', () => { + const result = client.matchServiceFromFolderServiceName(fakePath); + assert.strictEqual(result, 'serviceValue'); + assert( + (client.pathTemplates.folderServicePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('folderServiceServiceLevelObjective', async () => { - const fakePath = "/rendered/path/folderServiceServiceLevelObjective"; - const expectedParameters = { - folder: "folderValue", - service: "serviceValue", - service_level_objective: "serviceLevelObjectiveValue", - }; - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderServiceServiceLevelObjectivePath', () => { - const result = client.folderServiceServiceLevelObjectivePath("folderValue", "serviceValue", "serviceLevelObjectiveValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderServiceServiceLevelObjectiveName', () => { - const result = client.matchFolderFromFolderServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromFolderServiceServiceLevelObjectiveName', () => { - const result = client.matchServiceFromFolderServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceLevelObjectiveFromFolderServiceServiceLevelObjectiveName', () => { - const result = client.matchServiceLevelObjectiveFromFolderServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "serviceLevelObjectiveValue"); - assert((client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('folderServiceServiceLevelObjective', async () => { + const fakePath = '/rendered/path/folderServiceServiceLevelObjective'; + const expectedParameters = { + folder: 'folderValue', + service: 'serviceValue', + service_level_objective: 'serviceLevelObjectiveValue', + }; + const client = new groupserviceModule.v3.GroupServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('folderServiceServiceLevelObjectivePath', () => { + const result = client.folderServiceServiceLevelObjectivePath( + 'folderValue', + 'serviceValue', + 'serviceLevelObjectiveValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchFolderFromFolderServiceServiceLevelObjectiveName', () => { + const result = + client.matchFolderFromFolderServiceServiceLevelObjectiveName( + fakePath, + ); + assert.strictEqual(result, 'folderValue'); + assert( + ( + client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchServiceFromFolderServiceServiceLevelObjectiveName', () => { + const result = + client.matchServiceFromFolderServiceServiceLevelObjectiveName( + fakePath, + ); + assert.strictEqual(result, 'serviceValue'); + assert( + ( + client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchServiceLevelObjectiveFromFolderServiceServiceLevelObjectiveName', () => { + const result = + client.matchServiceLevelObjectiveFromFolderServiceServiceLevelObjectiveName( + fakePath, + ); + assert.strictEqual(result, 'serviceLevelObjectiveValue'); + assert( + ( + client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('folderUptimeCheckConfig', async () => { - const fakePath = "/rendered/path/folderUptimeCheckConfig"; - const expectedParameters = { - folder: "folderValue", - uptime_check_config: "uptimeCheckConfigValue", - }; - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.folderUptimeCheckConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderUptimeCheckConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderUptimeCheckConfigPath', () => { - const result = client.folderUptimeCheckConfigPath("folderValue", "uptimeCheckConfigValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderUptimeCheckConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderUptimeCheckConfigName', () => { - const result = client.matchFolderFromFolderUptimeCheckConfigName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderUptimeCheckConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUptimeCheckConfigFromFolderUptimeCheckConfigName', () => { - const result = client.matchUptimeCheckConfigFromFolderUptimeCheckConfigName(fakePath); - assert.strictEqual(result, "uptimeCheckConfigValue"); - assert((client.pathTemplates.folderUptimeCheckConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('folderUptimeCheckConfig', async () => { + const fakePath = '/rendered/path/folderUptimeCheckConfig'; + const expectedParameters = { + folder: 'folderValue', + uptime_check_config: 'uptimeCheckConfigValue', + }; + const client = new groupserviceModule.v3.GroupServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.folderUptimeCheckConfigPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.folderUptimeCheckConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('folderUptimeCheckConfigPath', () => { + const result = client.folderUptimeCheckConfigPath( + 'folderValue', + 'uptimeCheckConfigValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.folderUptimeCheckConfigPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchFolderFromFolderUptimeCheckConfigName', () => { + const result = + client.matchFolderFromFolderUptimeCheckConfigName(fakePath); + assert.strictEqual(result, 'folderValue'); + assert( + ( + client.pathTemplates.folderUptimeCheckConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchUptimeCheckConfigFromFolderUptimeCheckConfigName', () => { + const result = + client.matchUptimeCheckConfigFromFolderUptimeCheckConfigName( + fakePath, + ); + assert.strictEqual(result, 'uptimeCheckConfigValue'); + assert( + ( + client.pathTemplates.folderUptimeCheckConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('organizationAlertPolicy', async () => { - const fakePath = "/rendered/path/organizationAlertPolicy"; - const expectedParameters = { - organization: "organizationValue", - alert_policy: "alertPolicyValue", - }; - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationAlertPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationAlertPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationAlertPolicyPath', () => { - const result = client.organizationAlertPolicyPath("organizationValue", "alertPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationAlertPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationAlertPolicyName', () => { - const result = client.matchOrganizationFromOrganizationAlertPolicyName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationAlertPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAlertPolicyFromOrganizationAlertPolicyName', () => { - const result = client.matchAlertPolicyFromOrganizationAlertPolicyName(fakePath); - assert.strictEqual(result, "alertPolicyValue"); - assert((client.pathTemplates.organizationAlertPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('organizationAlertPolicy', async () => { + const fakePath = '/rendered/path/organizationAlertPolicy'; + const expectedParameters = { + organization: 'organizationValue', + alert_policy: 'alertPolicyValue', + }; + const client = new groupserviceModule.v3.GroupServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.organizationAlertPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.organizationAlertPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('organizationAlertPolicyPath', () => { + const result = client.organizationAlertPolicyPath( + 'organizationValue', + 'alertPolicyValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationAlertPolicyPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchOrganizationFromOrganizationAlertPolicyName', () => { + const result = + client.matchOrganizationFromOrganizationAlertPolicyName(fakePath); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationAlertPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchAlertPolicyFromOrganizationAlertPolicyName', () => { + const result = + client.matchAlertPolicyFromOrganizationAlertPolicyName(fakePath); + assert.strictEqual(result, 'alertPolicyValue'); + assert( + ( + client.pathTemplates.organizationAlertPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('organizationAlertPolicyCondition', async () => { - const fakePath = "/rendered/path/organizationAlertPolicyCondition"; - const expectedParameters = { - organization: "organizationValue", - alert_policy: "alertPolicyValue", - condition: "conditionValue", - }; - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationAlertPolicyConditionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationAlertPolicyConditionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationAlertPolicyConditionPath', () => { - const result = client.organizationAlertPolicyConditionPath("organizationValue", "alertPolicyValue", "conditionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationAlertPolicyConditionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationAlertPolicyConditionName', () => { - const result = client.matchOrganizationFromOrganizationAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAlertPolicyFromOrganizationAlertPolicyConditionName', () => { - const result = client.matchAlertPolicyFromOrganizationAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "alertPolicyValue"); - assert((client.pathTemplates.organizationAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConditionFromOrganizationAlertPolicyConditionName', () => { - const result = client.matchConditionFromOrganizationAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "conditionValue"); - assert((client.pathTemplates.organizationAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('organizationAlertPolicyCondition', async () => { + const fakePath = '/rendered/path/organizationAlertPolicyCondition'; + const expectedParameters = { + organization: 'organizationValue', + alert_policy: 'alertPolicyValue', + condition: 'conditionValue', + }; + const client = new groupserviceModule.v3.GroupServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.organizationAlertPolicyConditionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationAlertPolicyConditionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationAlertPolicyConditionPath', () => { + const result = client.organizationAlertPolicyConditionPath( + 'organizationValue', + 'alertPolicyValue', + 'conditionValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationAlertPolicyConditionPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchOrganizationFromOrganizationAlertPolicyConditionName', () => { + const result = + client.matchOrganizationFromOrganizationAlertPolicyConditionName( + fakePath, + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationAlertPolicyConditionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchAlertPolicyFromOrganizationAlertPolicyConditionName', () => { + const result = + client.matchAlertPolicyFromOrganizationAlertPolicyConditionName( + fakePath, + ); + assert.strictEqual(result, 'alertPolicyValue'); + assert( + ( + client.pathTemplates.organizationAlertPolicyConditionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchConditionFromOrganizationAlertPolicyConditionName', () => { + const result = + client.matchConditionFromOrganizationAlertPolicyConditionName( + fakePath, + ); + assert.strictEqual(result, 'conditionValue'); + assert( + ( + client.pathTemplates.organizationAlertPolicyConditionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('organizationChannelDescriptor', async () => { - const fakePath = "/rendered/path/organizationChannelDescriptor"; - const expectedParameters = { - organization: "organizationValue", - channel_descriptor: "channelDescriptorValue", - }; - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationChannelDescriptorPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationChannelDescriptorPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationChannelDescriptorPath', () => { - const result = client.organizationChannelDescriptorPath("organizationValue", "channelDescriptorValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationChannelDescriptorPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationChannelDescriptorName', () => { - const result = client.matchOrganizationFromOrganizationChannelDescriptorName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationChannelDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchChannelDescriptorFromOrganizationChannelDescriptorName', () => { - const result = client.matchChannelDescriptorFromOrganizationChannelDescriptorName(fakePath); - assert.strictEqual(result, "channelDescriptorValue"); - assert((client.pathTemplates.organizationChannelDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('organizationChannelDescriptor', async () => { + const fakePath = '/rendered/path/organizationChannelDescriptor'; + const expectedParameters = { + organization: 'organizationValue', + channel_descriptor: 'channelDescriptorValue', + }; + const client = new groupserviceModule.v3.GroupServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.organizationChannelDescriptorPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationChannelDescriptorPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationChannelDescriptorPath', () => { + const result = client.organizationChannelDescriptorPath( + 'organizationValue', + 'channelDescriptorValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationChannelDescriptorPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchOrganizationFromOrganizationChannelDescriptorName', () => { + const result = + client.matchOrganizationFromOrganizationChannelDescriptorName( + fakePath, + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationChannelDescriptorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchChannelDescriptorFromOrganizationChannelDescriptorName', () => { + const result = + client.matchChannelDescriptorFromOrganizationChannelDescriptorName( + fakePath, + ); + assert.strictEqual(result, 'channelDescriptorValue'); + assert( + ( + client.pathTemplates.organizationChannelDescriptorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('organizationGroup', async () => { - const fakePath = "/rendered/path/organizationGroup"; - const expectedParameters = { - organization: "organizationValue", - group: "groupValue", - }; - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationGroupPath', () => { - const result = client.organizationGroupPath("organizationValue", "groupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationGroupName', () => { - const result = client.matchOrganizationFromOrganizationGroupName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchGroupFromOrganizationGroupName', () => { - const result = client.matchGroupFromOrganizationGroupName(fakePath); - assert.strictEqual(result, "groupValue"); - assert((client.pathTemplates.organizationGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('organizationGroup', async () => { + const fakePath = '/rendered/path/organizationGroup'; + const expectedParameters = { + organization: 'organizationValue', + group: 'groupValue', + }; + const client = new groupserviceModule.v3.GroupServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.organizationGroupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.organizationGroupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('organizationGroupPath', () => { + const result = client.organizationGroupPath( + 'organizationValue', + 'groupValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchOrganizationFromOrganizationGroupName', () => { + const result = + client.matchOrganizationFromOrganizationGroupName(fakePath); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchGroupFromOrganizationGroupName', () => { + const result = client.matchGroupFromOrganizationGroupName(fakePath); + assert.strictEqual(result, 'groupValue'); + assert( + ( + client.pathTemplates.organizationGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('organizationNotificationChannel', async () => { - const fakePath = "/rendered/path/organizationNotificationChannel"; - const expectedParameters = { - organization: "organizationValue", - notification_channel: "notificationChannelValue", - }; - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationNotificationChannelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationNotificationChannelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationNotificationChannelPath', () => { - const result = client.organizationNotificationChannelPath("organizationValue", "notificationChannelValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationNotificationChannelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationNotificationChannelName', () => { - const result = client.matchOrganizationFromOrganizationNotificationChannelName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationNotificationChannelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchNotificationChannelFromOrganizationNotificationChannelName', () => { - const result = client.matchNotificationChannelFromOrganizationNotificationChannelName(fakePath); - assert.strictEqual(result, "notificationChannelValue"); - assert((client.pathTemplates.organizationNotificationChannelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('organizationNotificationChannel', async () => { + const fakePath = '/rendered/path/organizationNotificationChannel'; + const expectedParameters = { + organization: 'organizationValue', + notification_channel: 'notificationChannelValue', + }; + const client = new groupserviceModule.v3.GroupServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.organizationNotificationChannelPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationNotificationChannelPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationNotificationChannelPath', () => { + const result = client.organizationNotificationChannelPath( + 'organizationValue', + 'notificationChannelValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationNotificationChannelPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchOrganizationFromOrganizationNotificationChannelName', () => { + const result = + client.matchOrganizationFromOrganizationNotificationChannelName( + fakePath, + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationNotificationChannelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchNotificationChannelFromOrganizationNotificationChannelName', () => { + const result = + client.matchNotificationChannelFromOrganizationNotificationChannelName( + fakePath, + ); + assert.strictEqual(result, 'notificationChannelValue'); + assert( + ( + client.pathTemplates.organizationNotificationChannelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('organizationService', async () => { - const fakePath = "/rendered/path/organizationService"; - const expectedParameters = { - organization: "organizationValue", - service: "serviceValue", - }; - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationServicePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationServicePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationServicePath', () => { - const result = client.organizationServicePath("organizationValue", "serviceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationServicePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationServiceName', () => { - const result = client.matchOrganizationFromOrganizationServiceName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationServicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromOrganizationServiceName', () => { - const result = client.matchServiceFromOrganizationServiceName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.organizationServicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('organizationService', async () => { + const fakePath = '/rendered/path/organizationService'; + const expectedParameters = { + organization: 'organizationValue', + service: 'serviceValue', + }; + const client = new groupserviceModule.v3.GroupServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.organizationServicePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.organizationServicePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('organizationServicePath', () => { + const result = client.organizationServicePath( + 'organizationValue', + 'serviceValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationServicePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchOrganizationFromOrganizationServiceName', () => { + const result = + client.matchOrganizationFromOrganizationServiceName(fakePath); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationServicePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchServiceFromOrganizationServiceName', () => { + const result = client.matchServiceFromOrganizationServiceName(fakePath); + assert.strictEqual(result, 'serviceValue'); + assert( + ( + client.pathTemplates.organizationServicePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('organizationServiceServiceLevelObjective', async () => { - const fakePath = "/rendered/path/organizationServiceServiceLevelObjective"; - const expectedParameters = { - organization: "organizationValue", - service: "serviceValue", - service_level_objective: "serviceLevelObjectiveValue", - }; - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationServiceServiceLevelObjectivePath', () => { - const result = client.organizationServiceServiceLevelObjectivePath("organizationValue", "serviceValue", "serviceLevelObjectiveValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationServiceServiceLevelObjectiveName', () => { - const result = client.matchOrganizationFromOrganizationServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromOrganizationServiceServiceLevelObjectiveName', () => { - const result = client.matchServiceFromOrganizationServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceLevelObjectiveFromOrganizationServiceServiceLevelObjectiveName', () => { - const result = client.matchServiceLevelObjectiveFromOrganizationServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "serviceLevelObjectiveValue"); - assert((client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('organizationServiceServiceLevelObjective', async () => { + const fakePath = + '/rendered/path/organizationServiceServiceLevelObjective'; + const expectedParameters = { + organization: 'organizationValue', + service: 'serviceValue', + service_level_objective: 'serviceLevelObjectiveValue', + }; + const client = new groupserviceModule.v3.GroupServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationServiceServiceLevelObjectivePath', () => { + const result = client.organizationServiceServiceLevelObjectivePath( + 'organizationValue', + 'serviceValue', + 'serviceLevelObjectiveValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .organizationServiceServiceLevelObjectivePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchOrganizationFromOrganizationServiceServiceLevelObjectiveName', () => { + const result = + client.matchOrganizationFromOrganizationServiceServiceLevelObjectiveName( + fakePath, + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates + .organizationServiceServiceLevelObjectivePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchServiceFromOrganizationServiceServiceLevelObjectiveName', () => { + const result = + client.matchServiceFromOrganizationServiceServiceLevelObjectiveName( + fakePath, + ); + assert.strictEqual(result, 'serviceValue'); + assert( + ( + client.pathTemplates + .organizationServiceServiceLevelObjectivePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchServiceLevelObjectiveFromOrganizationServiceServiceLevelObjectiveName', () => { + const result = + client.matchServiceLevelObjectiveFromOrganizationServiceServiceLevelObjectiveName( + fakePath, + ); + assert.strictEqual(result, 'serviceLevelObjectiveValue'); + assert( + ( + client.pathTemplates + .organizationServiceServiceLevelObjectivePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('organizationUptimeCheckConfig', async () => { - const fakePath = "/rendered/path/organizationUptimeCheckConfig"; - const expectedParameters = { - organization: "organizationValue", - uptime_check_config: "uptimeCheckConfigValue", - }; - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationUptimeCheckConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationUptimeCheckConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationUptimeCheckConfigPath', () => { - const result = client.organizationUptimeCheckConfigPath("organizationValue", "uptimeCheckConfigValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationUptimeCheckConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationUptimeCheckConfigName', () => { - const result = client.matchOrganizationFromOrganizationUptimeCheckConfigName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationUptimeCheckConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUptimeCheckConfigFromOrganizationUptimeCheckConfigName', () => { - const result = client.matchUptimeCheckConfigFromOrganizationUptimeCheckConfigName(fakePath); - assert.strictEqual(result, "uptimeCheckConfigValue"); - assert((client.pathTemplates.organizationUptimeCheckConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('organizationUptimeCheckConfig', async () => { + const fakePath = '/rendered/path/organizationUptimeCheckConfig'; + const expectedParameters = { + organization: 'organizationValue', + uptime_check_config: 'uptimeCheckConfigValue', + }; + const client = new groupserviceModule.v3.GroupServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.organizationUptimeCheckConfigPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationUptimeCheckConfigPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationUptimeCheckConfigPath', () => { + const result = client.organizationUptimeCheckConfigPath( + 'organizationValue', + 'uptimeCheckConfigValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationUptimeCheckConfigPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchOrganizationFromOrganizationUptimeCheckConfigName', () => { + const result = + client.matchOrganizationFromOrganizationUptimeCheckConfigName( + fakePath, + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationUptimeCheckConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchUptimeCheckConfigFromOrganizationUptimeCheckConfigName', () => { + const result = + client.matchUptimeCheckConfigFromOrganizationUptimeCheckConfigName( + fakePath, + ); + assert.strictEqual(result, 'uptimeCheckConfigValue'); + assert( + ( + client.pathTemplates.organizationUptimeCheckConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('project', async () => { - const fakePath = "/rendered/path/project"; - const expectedParameters = { - project: "projectValue", - }; - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectPath', () => { - const result = client.projectPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectName', () => { - const result = client.matchProjectFromProjectName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('project', async () => { + const fakePath = '/rendered/path/project'; + const expectedParameters = { + project: 'projectValue', + }; + const client = new groupserviceModule.v3.GroupServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.projectPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectPath', () => { + const result = client.projectPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('projectAlertPolicy', async () => { - const fakePath = "/rendered/path/projectAlertPolicy"; - const expectedParameters = { - project: "projectValue", - alert_policy: "alertPolicyValue", - }; - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectAlertPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAlertPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAlertPolicyPath', () => { - const result = client.projectAlertPolicyPath("projectValue", "alertPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAlertPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAlertPolicyName', () => { - const result = client.matchProjectFromProjectAlertPolicyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAlertPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAlertPolicyFromProjectAlertPolicyName', () => { - const result = client.matchAlertPolicyFromProjectAlertPolicyName(fakePath); - assert.strictEqual(result, "alertPolicyValue"); - assert((client.pathTemplates.projectAlertPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('projectAlertPolicy', async () => { + const fakePath = '/rendered/path/projectAlertPolicy'; + const expectedParameters = { + project: 'projectValue', + alert_policy: 'alertPolicyValue', + }; + const client = new groupserviceModule.v3.GroupServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.projectAlertPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAlertPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAlertPolicyPath', () => { + const result = client.projectAlertPolicyPath( + 'projectValue', + 'alertPolicyValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAlertPolicyPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectAlertPolicyName', () => { + const result = client.matchProjectFromProjectAlertPolicyName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAlertPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchAlertPolicyFromProjectAlertPolicyName', () => { + const result = + client.matchAlertPolicyFromProjectAlertPolicyName(fakePath); + assert.strictEqual(result, 'alertPolicyValue'); + assert( + ( + client.pathTemplates.projectAlertPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('projectAlertPolicyCondition', async () => { - const fakePath = "/rendered/path/projectAlertPolicyCondition"; - const expectedParameters = { - project: "projectValue", - alert_policy: "alertPolicyValue", - condition: "conditionValue", - }; - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectAlertPolicyConditionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAlertPolicyConditionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAlertPolicyConditionPath', () => { - const result = client.projectAlertPolicyConditionPath("projectValue", "alertPolicyValue", "conditionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAlertPolicyConditionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAlertPolicyConditionName', () => { - const result = client.matchProjectFromProjectAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAlertPolicyFromProjectAlertPolicyConditionName', () => { - const result = client.matchAlertPolicyFromProjectAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "alertPolicyValue"); - assert((client.pathTemplates.projectAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConditionFromProjectAlertPolicyConditionName', () => { - const result = client.matchConditionFromProjectAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "conditionValue"); - assert((client.pathTemplates.projectAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('projectAlertPolicyCondition', async () => { + const fakePath = '/rendered/path/projectAlertPolicyCondition'; + const expectedParameters = { + project: 'projectValue', + alert_policy: 'alertPolicyValue', + condition: 'conditionValue', + }; + const client = new groupserviceModule.v3.GroupServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.projectAlertPolicyConditionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAlertPolicyConditionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAlertPolicyConditionPath', () => { + const result = client.projectAlertPolicyConditionPath( + 'projectValue', + 'alertPolicyValue', + 'conditionValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAlertPolicyConditionPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectAlertPolicyConditionName', () => { + const result = + client.matchProjectFromProjectAlertPolicyConditionName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAlertPolicyConditionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchAlertPolicyFromProjectAlertPolicyConditionName', () => { + const result = + client.matchAlertPolicyFromProjectAlertPolicyConditionName(fakePath); + assert.strictEqual(result, 'alertPolicyValue'); + assert( + ( + client.pathTemplates.projectAlertPolicyConditionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchConditionFromProjectAlertPolicyConditionName', () => { + const result = + client.matchConditionFromProjectAlertPolicyConditionName(fakePath); + assert.strictEqual(result, 'conditionValue'); + assert( + ( + client.pathTemplates.projectAlertPolicyConditionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('projectChannelDescriptor', async () => { - const fakePath = "/rendered/path/projectChannelDescriptor"; - const expectedParameters = { - project: "projectValue", - channel_descriptor: "channelDescriptorValue", - }; - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectChannelDescriptorPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectChannelDescriptorPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectChannelDescriptorPath', () => { - const result = client.projectChannelDescriptorPath("projectValue", "channelDescriptorValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectChannelDescriptorPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectChannelDescriptorName', () => { - const result = client.matchProjectFromProjectChannelDescriptorName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectChannelDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchChannelDescriptorFromProjectChannelDescriptorName', () => { - const result = client.matchChannelDescriptorFromProjectChannelDescriptorName(fakePath); - assert.strictEqual(result, "channelDescriptorValue"); - assert((client.pathTemplates.projectChannelDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('projectChannelDescriptor', async () => { + const fakePath = '/rendered/path/projectChannelDescriptor'; + const expectedParameters = { + project: 'projectValue', + channel_descriptor: 'channelDescriptorValue', + }; + const client = new groupserviceModule.v3.GroupServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.projectChannelDescriptorPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectChannelDescriptorPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectChannelDescriptorPath', () => { + const result = client.projectChannelDescriptorPath( + 'projectValue', + 'channelDescriptorValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectChannelDescriptorPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectChannelDescriptorName', () => { + const result = + client.matchProjectFromProjectChannelDescriptorName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectChannelDescriptorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchChannelDescriptorFromProjectChannelDescriptorName', () => { + const result = + client.matchChannelDescriptorFromProjectChannelDescriptorName( + fakePath, + ); + assert.strictEqual(result, 'channelDescriptorValue'); + assert( + ( + client.pathTemplates.projectChannelDescriptorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('projectGroup', async () => { - const fakePath = "/rendered/path/projectGroup"; - const expectedParameters = { - project: "projectValue", - group: "groupValue", - }; - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectGroupPath', () => { - const result = client.projectGroupPath("projectValue", "groupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectGroupName', () => { - const result = client.matchProjectFromProjectGroupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchGroupFromProjectGroupName', () => { - const result = client.matchGroupFromProjectGroupName(fakePath); - assert.strictEqual(result, "groupValue"); - assert((client.pathTemplates.projectGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('projectGroup', async () => { + const fakePath = '/rendered/path/projectGroup'; + const expectedParameters = { + project: 'projectValue', + group: 'groupValue', + }; + const client = new groupserviceModule.v3.GroupServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.projectGroupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectGroupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectGroupPath', () => { + const result = client.projectGroupPath('projectValue', 'groupValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectGroupPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectGroupName', () => { + const result = client.matchProjectFromProjectGroupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectGroupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchGroupFromProjectGroupName', () => { + const result = client.matchGroupFromProjectGroupName(fakePath); + assert.strictEqual(result, 'groupValue'); + assert( + (client.pathTemplates.projectGroupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('projectNotificationChannel', async () => { - const fakePath = "/rendered/path/projectNotificationChannel"; - const expectedParameters = { - project: "projectValue", - notification_channel: "notificationChannelValue", - }; - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectNotificationChannelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectNotificationChannelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectNotificationChannelPath', () => { - const result = client.projectNotificationChannelPath("projectValue", "notificationChannelValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectNotificationChannelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectNotificationChannelName', () => { - const result = client.matchProjectFromProjectNotificationChannelName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectNotificationChannelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchNotificationChannelFromProjectNotificationChannelName', () => { - const result = client.matchNotificationChannelFromProjectNotificationChannelName(fakePath); - assert.strictEqual(result, "notificationChannelValue"); - assert((client.pathTemplates.projectNotificationChannelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('projectNotificationChannel', async () => { + const fakePath = '/rendered/path/projectNotificationChannel'; + const expectedParameters = { + project: 'projectValue', + notification_channel: 'notificationChannelValue', + }; + const client = new groupserviceModule.v3.GroupServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.projectNotificationChannelPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectNotificationChannelPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectNotificationChannelPath', () => { + const result = client.projectNotificationChannelPath( + 'projectValue', + 'notificationChannelValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectNotificationChannelPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectNotificationChannelName', () => { + const result = + client.matchProjectFromProjectNotificationChannelName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectNotificationChannelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchNotificationChannelFromProjectNotificationChannelName', () => { + const result = + client.matchNotificationChannelFromProjectNotificationChannelName( + fakePath, + ); + assert.strictEqual(result, 'notificationChannelValue'); + assert( + ( + client.pathTemplates.projectNotificationChannelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('projectService', async () => { - const fakePath = "/rendered/path/projectService"; - const expectedParameters = { - project: "projectValue", - service: "serviceValue", - }; - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectServicePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectServicePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectServicePath', () => { - const result = client.projectServicePath("projectValue", "serviceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectServicePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectServiceName', () => { - const result = client.matchProjectFromProjectServiceName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectServicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromProjectServiceName', () => { - const result = client.matchServiceFromProjectServiceName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.projectServicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('projectService', async () => { + const fakePath = '/rendered/path/projectService'; + const expectedParameters = { + project: 'projectValue', + service: 'serviceValue', + }; + const client = new groupserviceModule.v3.GroupServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.projectServicePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectServicePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectServicePath', () => { + const result = client.projectServicePath( + 'projectValue', + 'serviceValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectServicePathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectServiceName', () => { + const result = client.matchProjectFromProjectServiceName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectServicePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchServiceFromProjectServiceName', () => { + const result = client.matchServiceFromProjectServiceName(fakePath); + assert.strictEqual(result, 'serviceValue'); + assert( + (client.pathTemplates.projectServicePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('projectServiceServiceLevelObjective', async () => { - const fakePath = "/rendered/path/projectServiceServiceLevelObjective"; - const expectedParameters = { - project: "projectValue", - service: "serviceValue", - service_level_objective: "serviceLevelObjectiveValue", - }; - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectServiceServiceLevelObjectivePath', () => { - const result = client.projectServiceServiceLevelObjectivePath("projectValue", "serviceValue", "serviceLevelObjectiveValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectServiceServiceLevelObjectiveName', () => { - const result = client.matchProjectFromProjectServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromProjectServiceServiceLevelObjectiveName', () => { - const result = client.matchServiceFromProjectServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceLevelObjectiveFromProjectServiceServiceLevelObjectiveName', () => { - const result = client.matchServiceLevelObjectiveFromProjectServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "serviceLevelObjectiveValue"); - assert((client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('projectServiceServiceLevelObjective', async () => { + const fakePath = '/rendered/path/projectServiceServiceLevelObjective'; + const expectedParameters = { + project: 'projectValue', + service: 'serviceValue', + service_level_objective: 'serviceLevelObjectiveValue', + }; + const client = new groupserviceModule.v3.GroupServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectServiceServiceLevelObjectivePath', () => { + const result = client.projectServiceServiceLevelObjectivePath( + 'projectValue', + 'serviceValue', + 'serviceLevelObjectiveValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectServiceServiceLevelObjectiveName', () => { + const result = + client.matchProjectFromProjectServiceServiceLevelObjectiveName( + fakePath, + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchServiceFromProjectServiceServiceLevelObjectiveName', () => { + const result = + client.matchServiceFromProjectServiceServiceLevelObjectiveName( + fakePath, + ); + assert.strictEqual(result, 'serviceValue'); + assert( + ( + client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchServiceLevelObjectiveFromProjectServiceServiceLevelObjectiveName', () => { + const result = + client.matchServiceLevelObjectiveFromProjectServiceServiceLevelObjectiveName( + fakePath, + ); + assert.strictEqual(result, 'serviceLevelObjectiveValue'); + assert( + ( + client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('projectUptimeCheckConfig', async () => { - const fakePath = "/rendered/path/projectUptimeCheckConfig"; - const expectedParameters = { - project: "projectValue", - uptime_check_config: "uptimeCheckConfigValue", - }; - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectUptimeCheckConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectUptimeCheckConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectUptimeCheckConfigPath', () => { - const result = client.projectUptimeCheckConfigPath("projectValue", "uptimeCheckConfigValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectUptimeCheckConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectUptimeCheckConfigName', () => { - const result = client.matchProjectFromProjectUptimeCheckConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectUptimeCheckConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUptimeCheckConfigFromProjectUptimeCheckConfigName', () => { - const result = client.matchUptimeCheckConfigFromProjectUptimeCheckConfigName(fakePath); - assert.strictEqual(result, "uptimeCheckConfigValue"); - assert((client.pathTemplates.projectUptimeCheckConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('projectUptimeCheckConfig', async () => { + const fakePath = '/rendered/path/projectUptimeCheckConfig'; + const expectedParameters = { + project: 'projectValue', + uptime_check_config: 'uptimeCheckConfigValue', + }; + const client = new groupserviceModule.v3.GroupServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.projectUptimeCheckConfigPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectUptimeCheckConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectUptimeCheckConfigPath', () => { + const result = client.projectUptimeCheckConfigPath( + 'projectValue', + 'uptimeCheckConfigValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectUptimeCheckConfigPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectUptimeCheckConfigName', () => { + const result = + client.matchProjectFromProjectUptimeCheckConfigName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectUptimeCheckConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchUptimeCheckConfigFromProjectUptimeCheckConfigName', () => { + const result = + client.matchUptimeCheckConfigFromProjectUptimeCheckConfigName( + fakePath, + ); + assert.strictEqual(result, 'uptimeCheckConfigValue'); + assert( + ( + client.pathTemplates.projectUptimeCheckConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('snooze', async () => { - const fakePath = "/rendered/path/snooze"; - const expectedParameters = { - project: "projectValue", - snooze: "snoozeValue", - }; - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.snoozePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.snoozePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('snoozePath', () => { - const result = client.snoozePath("projectValue", "snoozeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.snoozePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromSnoozeName', () => { - const result = client.matchProjectFromSnoozeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.snoozePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSnoozeFromSnoozeName', () => { - const result = client.matchSnoozeFromSnoozeName(fakePath); - assert.strictEqual(result, "snoozeValue"); - assert((client.pathTemplates.snoozePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('snooze', async () => { + const fakePath = '/rendered/path/snooze'; + const expectedParameters = { + project: 'projectValue', + snooze: 'snoozeValue', + }; + const client = new groupserviceModule.v3.GroupServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.snoozePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.snoozePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('snoozePath', () => { + const result = client.snoozePath('projectValue', 'snoozeValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.snoozePathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromSnoozeName', () => { + const result = client.matchProjectFromSnoozeName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.snoozePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSnoozeFromSnoozeName', () => { + const result = client.matchSnoozeFromSnoozeName(fakePath); + assert.strictEqual(result, 'snoozeValue'); + assert( + (client.pathTemplates.snoozePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); }); + }); }); diff --git a/packages/google-cloud-monitoring/test/gapic_metric_service_v3.ts b/packages/google-cloud-monitoring/test/gapic_metric_service_v3.ts index e6f6296914cb..26e1ccc273c9 100644 --- a/packages/google-cloud-monitoring/test/gapic_metric_service_v3.ts +++ b/packages/google-cloud-monitoring/test/gapic_metric_service_v3.ts @@ -19,2923 +19,4224 @@ 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 metricserviceModule 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 -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); +const root = protobuf.Root.fromJSON( + require('../protos/protos.json'), +).resolveAll(); // eslint-disable-next-line @typescript-eslint/no-unused-vars function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; } function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; + const filledObject = ( + instance.constructor as typeof protobuf.Message + ).toObject(instance as protobuf.Message, { defaults: true }); + return (instance.constructor as typeof protobuf.Message).fromObject( + filledObject, + ) as T; } function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); + return error + ? sinon.stub().rejects(error) + : sinon.stub().resolves([response]); } -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +function stubSimpleCallWithCallback( + response?: ResponseType, + error?: Error, +) { + return error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); } -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } +function stubPageStreamingCall( + responses?: ResponseType[], + error?: Error, +) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); + } + const transformStub = error + ? sinon.stub().callsArgWith(2, error) + : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { + mockStream.write({}); + }); } - return sinon.stub().returns(mockStream); + setImmediate(() => { + mockStream.end(); + }); + } else { + setImmediate(() => { + mockStream.write({}); + }); + setImmediate(() => { + mockStream.end(); + }); + } + return sinon.stub().returns(mockStream); } -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); +function stubAsyncIterationCall( + responses?: ResponseType[], + error?: Error, +) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({ done: true, value: undefined }); + } + return Promise.resolve({ done: false, value: responses![counter++] }); + }, + }; + }, + }; + return sinon.stub().returns(asyncIterable); } describe('v3.MetricServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new metricserviceModule.v3.MetricServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'monitoring.googleapis.com'); - }); + describe('Common methods', () => { + it('has apiEndpoint', () => { + const client = new metricserviceModule.v3.MetricServiceClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'monitoring.googleapis.com'); + }); - it('has universeDomain', () => { - const client = new metricserviceModule.v3.MetricServiceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); + it('has universeDomain', () => { + const client = new metricserviceModule.v3.MetricServiceClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = metricserviceModule.v3.MetricServiceClient.servicePath; - assert.strictEqual(servicePath, 'monitoring.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = metricserviceModule.v3.MetricServiceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'monitoring.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new metricserviceModule.v3.MetricServiceClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'monitoring.example.com'); - }); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + metricserviceModule.v3.MetricServiceClient.servicePath; + assert.strictEqual(servicePath, 'monitoring.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + metricserviceModule.v3.MetricServiceClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'monitoring.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = new metricserviceModule.v3.MetricServiceClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'monitoring.example.com'); + }); - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new metricserviceModule.v3.MetricServiceClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'monitoring.example.com'); - }); + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = new metricserviceModule.v3.MetricServiceClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'monitoring.example.com'); + }); - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new metricserviceModule.v3.MetricServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'monitoring.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new metricserviceModule.v3.MetricServiceClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'monitoring.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new metricserviceModule.v3.MetricServiceClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); + if (typeof process === 'object' && 'env' in process) { + describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { + it('sets apiEndpoint from environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = new metricserviceModule.v3.MetricServiceClient(); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'monitoring.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } }); - it('has port', () => { - const port = metricserviceModule.v3.MetricServiceClient.port; - assert(port); - assert(typeof port === 'number'); + it('value configured in code has priority over environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = new metricserviceModule.v3.MetricServiceClient({ + universeDomain: 'configured.example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'monitoring.configured.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } }); - - it('should create a client with no option', () => { - const client = new metricserviceModule.v3.MetricServiceClient(); - assert(client); + }); + } + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new metricserviceModule.v3.MetricServiceClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', }); + }); + }); - it('should create a client with gRPC fallback', () => { - const client = new metricserviceModule.v3.MetricServiceClient({ - fallback: true, - }); - assert(client); - }); + it('has port', () => { + const port = metricserviceModule.v3.MetricServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); - it('has initialize method and supports deferred initialization', async () => { - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.metricServiceStub, undefined); - await client.initialize(); - assert(client.metricServiceStub); - }); + it('should create a client with no option', () => { + const client = new metricserviceModule.v3.MetricServiceClient(); + assert(client); + }); - it('has close method for the initialized client', done => { - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.metricServiceStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); + it('should create a client with gRPC fallback', () => { + const client = new metricserviceModule.v3.MetricServiceClient({ + fallback: true, + }); + assert(client); + }); - it('has close method for the non-initialized client', done => { - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.metricServiceStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); + it('has initialize method and supports deferred initialization', async () => { + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.metricServiceStub, undefined); + await client.initialize(); + assert(client.metricServiceStub); + }); - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + it('has close method for the initialized client', (done) => { + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.initialize().catch((err) => { + throw err; + }); + assert(client.metricServiceStub); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; }); + }); - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); + it('has close method for the non-initialized client', (done) => { + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.metricServiceStub, undefined); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; }); }); - describe('getMonitoredResourceDescriptor', () => { - it('invokes getMonitoredResourceDescriptor without error', async () => { - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.GetMonitoredResourceDescriptorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.GetMonitoredResourceDescriptorRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.api.MonitoredResourceDescriptor() - ); - client.innerApiCalls.getMonitoredResourceDescriptor = stubSimpleCall(expectedResponse); - const [response] = await client.getMonitoredResourceDescriptor(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getMonitoredResourceDescriptor as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getMonitoredResourceDescriptor as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); - it('invokes getMonitoredResourceDescriptor without error using callback', async () => { - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.GetMonitoredResourceDescriptorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.GetMonitoredResourceDescriptorRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.api.MonitoredResourceDescriptor() - ); - client.innerApiCalls.getMonitoredResourceDescriptor = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getMonitoredResourceDescriptor( - request, - (err?: Error|null, result?: protos.google.api.IMonitoredResourceDescriptor|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getMonitoredResourceDescriptor as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getMonitoredResourceDescriptor as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + }); + + describe('getMonitoredResourceDescriptor', () => { + it('invokes getMonitoredResourceDescriptor without error', async () => { + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.GetMonitoredResourceDescriptorRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.GetMonitoredResourceDescriptorRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.api.MonitoredResourceDescriptor(), + ); + client.innerApiCalls.getMonitoredResourceDescriptor = + stubSimpleCall(expectedResponse); + const [response] = await client.getMonitoredResourceDescriptor(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getMonitoredResourceDescriptor as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getMonitoredResourceDescriptor as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getMonitoredResourceDescriptor with error', async () => { - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.GetMonitoredResourceDescriptorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.GetMonitoredResourceDescriptorRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getMonitoredResourceDescriptor = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getMonitoredResourceDescriptor(request), expectedError); - const actualRequest = (client.innerApiCalls.getMonitoredResourceDescriptor as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getMonitoredResourceDescriptor as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getMonitoredResourceDescriptor without error using callback', async () => { + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.GetMonitoredResourceDescriptorRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.GetMonitoredResourceDescriptorRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.api.MonitoredResourceDescriptor(), + ); + client.innerApiCalls.getMonitoredResourceDescriptor = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getMonitoredResourceDescriptor( + request, + ( + err?: Error | null, + result?: protos.google.api.IMonitoredResourceDescriptor | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getMonitoredResourceDescriptor as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getMonitoredResourceDescriptor as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getMonitoredResourceDescriptor with closed client', async () => { - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.GetMonitoredResourceDescriptorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.GetMonitoredResourceDescriptorRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getMonitoredResourceDescriptor(request), expectedError); - }); + it('invokes getMonitoredResourceDescriptor with error', async () => { + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.GetMonitoredResourceDescriptorRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.GetMonitoredResourceDescriptorRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getMonitoredResourceDescriptor = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.getMonitoredResourceDescriptor(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.getMonitoredResourceDescriptor as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getMonitoredResourceDescriptor as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('getMetricDescriptor', () => { - it('invokes getMetricDescriptor without error', async () => { - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.GetMetricDescriptorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.GetMetricDescriptorRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.api.MetricDescriptor() - ); - client.innerApiCalls.getMetricDescriptor = stubSimpleCall(expectedResponse); - const [response] = await client.getMetricDescriptor(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getMetricDescriptor as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getMetricDescriptor as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getMonitoredResourceDescriptor with closed client', async () => { + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.GetMonitoredResourceDescriptorRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.GetMonitoredResourceDescriptorRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects( + client.getMonitoredResourceDescriptor(request), + expectedError, + ); + }); + }); + + describe('getMetricDescriptor', () => { + it('invokes getMetricDescriptor without error', async () => { + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.GetMetricDescriptorRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.GetMetricDescriptorRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.api.MetricDescriptor(), + ); + client.innerApiCalls.getMetricDescriptor = + stubSimpleCall(expectedResponse); + const [response] = await client.getMetricDescriptor(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getMetricDescriptor as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getMetricDescriptor as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getMetricDescriptor without error using callback', async () => { - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.GetMetricDescriptorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.GetMetricDescriptorRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.api.MetricDescriptor() - ); - client.innerApiCalls.getMetricDescriptor = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getMetricDescriptor( - request, - (err?: Error|null, result?: protos.google.api.IMetricDescriptor|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getMetricDescriptor as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getMetricDescriptor as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getMetricDescriptor without error using callback', async () => { + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.GetMetricDescriptorRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.GetMetricDescriptorRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.api.MetricDescriptor(), + ); + client.innerApiCalls.getMetricDescriptor = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getMetricDescriptor( + request, + ( + err?: Error | null, + result?: protos.google.api.IMetricDescriptor | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getMetricDescriptor as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getMetricDescriptor as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getMetricDescriptor with error', async () => { - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.GetMetricDescriptorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.GetMetricDescriptorRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getMetricDescriptor = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getMetricDescriptor(request), expectedError); - const actualRequest = (client.innerApiCalls.getMetricDescriptor as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getMetricDescriptor as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getMetricDescriptor with error', async () => { + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.GetMetricDescriptorRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.GetMetricDescriptorRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getMetricDescriptor = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.getMetricDescriptor(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getMetricDescriptor as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getMetricDescriptor as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getMetricDescriptor with closed client', async () => { - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.GetMetricDescriptorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.GetMetricDescriptorRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getMetricDescriptor(request), expectedError); - }); + it('invokes getMetricDescriptor with closed client', async () => { + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.GetMetricDescriptorRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.GetMetricDescriptorRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.getMetricDescriptor(request), expectedError); + }); + }); + + describe('createMetricDescriptor', () => { + it('invokes createMetricDescriptor without error', async () => { + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.CreateMetricDescriptorRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.CreateMetricDescriptorRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.api.MetricDescriptor(), + ); + client.innerApiCalls.createMetricDescriptor = + stubSimpleCall(expectedResponse); + const [response] = await client.createMetricDescriptor(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createMetricDescriptor as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createMetricDescriptor as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('createMetricDescriptor', () => { - it('invokes createMetricDescriptor without error', async () => { - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.CreateMetricDescriptorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.CreateMetricDescriptorRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.api.MetricDescriptor() - ); - client.innerApiCalls.createMetricDescriptor = stubSimpleCall(expectedResponse); - const [response] = await client.createMetricDescriptor(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createMetricDescriptor as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createMetricDescriptor as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createMetricDescriptor without error using callback', async () => { + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.CreateMetricDescriptorRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.CreateMetricDescriptorRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.api.MetricDescriptor(), + ); + client.innerApiCalls.createMetricDescriptor = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createMetricDescriptor( + request, + ( + err?: Error | null, + result?: protos.google.api.IMetricDescriptor | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createMetricDescriptor as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createMetricDescriptor as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createMetricDescriptor without error using callback', async () => { - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.CreateMetricDescriptorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.CreateMetricDescriptorRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.api.MetricDescriptor() - ); - client.innerApiCalls.createMetricDescriptor = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createMetricDescriptor( - request, - (err?: Error|null, result?: protos.google.api.IMetricDescriptor|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createMetricDescriptor as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createMetricDescriptor as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createMetricDescriptor with error', async () => { + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.CreateMetricDescriptorRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.CreateMetricDescriptorRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createMetricDescriptor = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.createMetricDescriptor(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.createMetricDescriptor as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createMetricDescriptor as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createMetricDescriptor with error', async () => { - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.CreateMetricDescriptorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.CreateMetricDescriptorRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createMetricDescriptor = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createMetricDescriptor(request), expectedError); - const actualRequest = (client.innerApiCalls.createMetricDescriptor as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createMetricDescriptor as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createMetricDescriptor with closed client', async () => { + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.CreateMetricDescriptorRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.CreateMetricDescriptorRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects( + client.createMetricDescriptor(request), + expectedError, + ); + }); + }); + + describe('deleteMetricDescriptor', () => { + it('invokes deleteMetricDescriptor without error', async () => { + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.DeleteMetricDescriptorRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.DeleteMetricDescriptorRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty(), + ); + client.innerApiCalls.deleteMetricDescriptor = + stubSimpleCall(expectedResponse); + const [response] = await client.deleteMetricDescriptor(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteMetricDescriptor as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteMetricDescriptor as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createMetricDescriptor with closed client', async () => { - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.CreateMetricDescriptorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.CreateMetricDescriptorRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.createMetricDescriptor(request), expectedError); - }); + it('invokes deleteMetricDescriptor without error using callback', async () => { + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.DeleteMetricDescriptorRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.DeleteMetricDescriptorRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty(), + ); + client.innerApiCalls.deleteMetricDescriptor = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteMetricDescriptor( + request, + ( + err?: Error | null, + result?: protos.google.protobuf.IEmpty | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteMetricDescriptor as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteMetricDescriptor as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('deleteMetricDescriptor', () => { - it('invokes deleteMetricDescriptor without error', async () => { - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.DeleteMetricDescriptorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.DeleteMetricDescriptorRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteMetricDescriptor = stubSimpleCall(expectedResponse); - const [response] = await client.deleteMetricDescriptor(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteMetricDescriptor as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteMetricDescriptor as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteMetricDescriptor with error', async () => { + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.DeleteMetricDescriptorRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.DeleteMetricDescriptorRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteMetricDescriptor = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.deleteMetricDescriptor(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.deleteMetricDescriptor as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteMetricDescriptor as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteMetricDescriptor without error using callback', async () => { - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.DeleteMetricDescriptorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.DeleteMetricDescriptorRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteMetricDescriptor = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteMetricDescriptor( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteMetricDescriptor as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteMetricDescriptor as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteMetricDescriptor with closed client', async () => { + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.DeleteMetricDescriptorRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.DeleteMetricDescriptorRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects( + client.deleteMetricDescriptor(request), + expectedError, + ); + }); + }); + + describe('createTimeSeries', () => { + it('invokes createTimeSeries without error', async () => { + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.CreateTimeSeriesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.CreateTimeSeriesRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty(), + ); + client.innerApiCalls.createTimeSeries = stubSimpleCall(expectedResponse); + const [response] = await client.createTimeSeries(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createTimeSeries as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createTimeSeries as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteMetricDescriptor with error', async () => { - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.DeleteMetricDescriptorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.DeleteMetricDescriptorRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteMetricDescriptor = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteMetricDescriptor(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteMetricDescriptor as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteMetricDescriptor as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createTimeSeries without error using callback', async () => { + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.CreateTimeSeriesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.CreateTimeSeriesRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty(), + ); + client.innerApiCalls.createTimeSeries = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createTimeSeries( + request, + ( + err?: Error | null, + result?: protos.google.protobuf.IEmpty | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createTimeSeries as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createTimeSeries as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteMetricDescriptor with closed client', async () => { - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.DeleteMetricDescriptorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.DeleteMetricDescriptorRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.deleteMetricDescriptor(request), expectedError); - }); + it('invokes createTimeSeries with error', async () => { + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.CreateTimeSeriesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.CreateTimeSeriesRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createTimeSeries = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.createTimeSeries(request), expectedError); + const actualRequest = ( + client.innerApiCalls.createTimeSeries as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createTimeSeries as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('createTimeSeries', () => { - it('invokes createTimeSeries without error', async () => { - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.CreateTimeSeriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.CreateTimeSeriesRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.createTimeSeries = stubSimpleCall(expectedResponse); - const [response] = await client.createTimeSeries(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createTimeSeries as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createTimeSeries as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createTimeSeries with closed client', async () => { + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.CreateTimeSeriesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.CreateTimeSeriesRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.createTimeSeries(request), expectedError); + }); + }); + + describe('createServiceTimeSeries', () => { + it('invokes createServiceTimeSeries without error', async () => { + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.CreateTimeSeriesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.CreateTimeSeriesRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty(), + ); + client.innerApiCalls.createServiceTimeSeries = + stubSimpleCall(expectedResponse); + const [response] = await client.createServiceTimeSeries(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createServiceTimeSeries as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createServiceTimeSeries as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createTimeSeries without error using callback', async () => { - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.CreateTimeSeriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.CreateTimeSeriesRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.createTimeSeries = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createTimeSeries( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createTimeSeries as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createTimeSeries as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createServiceTimeSeries without error using callback', async () => { + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.CreateTimeSeriesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.CreateTimeSeriesRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty(), + ); + client.innerApiCalls.createServiceTimeSeries = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createServiceTimeSeries( + request, + ( + err?: Error | null, + result?: protos.google.protobuf.IEmpty | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createServiceTimeSeries as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createServiceTimeSeries as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createTimeSeries with error', async () => { - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.CreateTimeSeriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.CreateTimeSeriesRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createTimeSeries = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createTimeSeries(request), expectedError); - const actualRequest = (client.innerApiCalls.createTimeSeries as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createTimeSeries as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createServiceTimeSeries with error', async () => { + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.CreateTimeSeriesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.CreateTimeSeriesRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createServiceTimeSeries = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.createServiceTimeSeries(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.createServiceTimeSeries as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createServiceTimeSeries as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createTimeSeries with closed client', async () => { - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.CreateTimeSeriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.CreateTimeSeriesRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.createTimeSeries(request), expectedError); - }); + it('invokes createServiceTimeSeries with closed client', async () => { + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.CreateTimeSeriesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.CreateTimeSeriesRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects( + client.createServiceTimeSeries(request), + expectedError, + ); + }); + }); + + describe('listMonitoredResourceDescriptors', () => { + it('invokes listMonitoredResourceDescriptors without error', async () => { + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListMonitoredResourceDescriptorsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.ListMonitoredResourceDescriptorsRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.api.MonitoredResourceDescriptor(), + ), + generateSampleMessage( + new protos.google.api.MonitoredResourceDescriptor(), + ), + generateSampleMessage( + new protos.google.api.MonitoredResourceDescriptor(), + ), + ]; + client.innerApiCalls.listMonitoredResourceDescriptors = + stubSimpleCall(expectedResponse); + const [response] = await client.listMonitoredResourceDescriptors(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listMonitoredResourceDescriptors as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listMonitoredResourceDescriptors as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('createServiceTimeSeries', () => { - it('invokes createServiceTimeSeries without error', async () => { - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.CreateTimeSeriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.CreateTimeSeriesRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.createServiceTimeSeries = stubSimpleCall(expectedResponse); - const [response] = await client.createServiceTimeSeries(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createServiceTimeSeries as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createServiceTimeSeries as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listMonitoredResourceDescriptors without error using callback', async () => { + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListMonitoredResourceDescriptorsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.ListMonitoredResourceDescriptorsRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.api.MonitoredResourceDescriptor(), + ), + generateSampleMessage( + new protos.google.api.MonitoredResourceDescriptor(), + ), + generateSampleMessage( + new protos.google.api.MonitoredResourceDescriptor(), + ), + ]; + client.innerApiCalls.listMonitoredResourceDescriptors = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listMonitoredResourceDescriptors( + request, + ( + err?: Error | null, + result?: protos.google.api.IMonitoredResourceDescriptor[] | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listMonitoredResourceDescriptors as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listMonitoredResourceDescriptors as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createServiceTimeSeries without error using callback', async () => { - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.CreateTimeSeriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.CreateTimeSeriesRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.createServiceTimeSeries = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createServiceTimeSeries( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createServiceTimeSeries as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createServiceTimeSeries as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listMonitoredResourceDescriptors with error', async () => { + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListMonitoredResourceDescriptorsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.ListMonitoredResourceDescriptorsRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listMonitoredResourceDescriptors = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.listMonitoredResourceDescriptors(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.listMonitoredResourceDescriptors as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listMonitoredResourceDescriptors as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createServiceTimeSeries with error', async () => { - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.CreateTimeSeriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.CreateTimeSeriesRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createServiceTimeSeries = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createServiceTimeSeries(request), expectedError); - const actualRequest = (client.innerApiCalls.createServiceTimeSeries as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createServiceTimeSeries as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + it('invokes listMonitoredResourceDescriptorsStream without error', async () => { + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListMonitoredResourceDescriptorsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.ListMonitoredResourceDescriptorsRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.api.MonitoredResourceDescriptor(), + ), + generateSampleMessage( + new protos.google.api.MonitoredResourceDescriptor(), + ), + generateSampleMessage( + new protos.google.api.MonitoredResourceDescriptor(), + ), + ]; + client.descriptors.page.listMonitoredResourceDescriptors.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listMonitoredResourceDescriptorsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.api.MonitoredResourceDescriptor[] = []; + stream.on( + 'data', + (response: protos.google.api.MonitoredResourceDescriptor) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); }); - - it('invokes createServiceTimeSeries with closed client', async () => { - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.CreateTimeSeriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.CreateTimeSeriesRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.createServiceTimeSeries(request), expectedError); + stream.on('error', (err: Error) => { + reject(err); }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + ( + client.descriptors.page.listMonitoredResourceDescriptors + .createStream as SinonStub + ) + .getCall(0) + .calledWith( + client.innerApiCalls.listMonitoredResourceDescriptors, + request, + ), + ); + assert( + ( + client.descriptors.page.listMonitoredResourceDescriptors + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); }); - describe('listMonitoredResourceDescriptors', () => { - it('invokes listMonitoredResourceDescriptors without error', async () => { - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListMonitoredResourceDescriptorsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListMonitoredResourceDescriptorsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.api.MonitoredResourceDescriptor()), - generateSampleMessage(new protos.google.api.MonitoredResourceDescriptor()), - generateSampleMessage(new protos.google.api.MonitoredResourceDescriptor()), - ]; - client.innerApiCalls.listMonitoredResourceDescriptors = stubSimpleCall(expectedResponse); - const [response] = await client.listMonitoredResourceDescriptors(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listMonitoredResourceDescriptors as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listMonitoredResourceDescriptors as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listMonitoredResourceDescriptors without error using callback', async () => { - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListMonitoredResourceDescriptorsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListMonitoredResourceDescriptorsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.api.MonitoredResourceDescriptor()), - generateSampleMessage(new protos.google.api.MonitoredResourceDescriptor()), - generateSampleMessage(new protos.google.api.MonitoredResourceDescriptor()), - ]; - client.innerApiCalls.listMonitoredResourceDescriptors = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listMonitoredResourceDescriptors( - request, - (err?: Error|null, result?: protos.google.api.IMonitoredResourceDescriptor[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listMonitoredResourceDescriptors as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listMonitoredResourceDescriptors as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + it('invokes listMonitoredResourceDescriptorsStream with error', async () => { + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListMonitoredResourceDescriptorsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.ListMonitoredResourceDescriptorsRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listMonitoredResourceDescriptors.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listMonitoredResourceDescriptorsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.api.MonitoredResourceDescriptor[] = []; + stream.on( + 'data', + (response: protos.google.api.MonitoredResourceDescriptor) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); }); - - it('invokes listMonitoredResourceDescriptors with error', async () => { - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListMonitoredResourceDescriptorsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListMonitoredResourceDescriptorsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listMonitoredResourceDescriptors = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listMonitoredResourceDescriptors(request), expectedError); - const actualRequest = (client.innerApiCalls.listMonitoredResourceDescriptors as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listMonitoredResourceDescriptors as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + stream.on('error', (err: Error) => { + reject(err); }); + }); + await assert.rejects(promise, expectedError); + assert( + ( + client.descriptors.page.listMonitoredResourceDescriptors + .createStream as SinonStub + ) + .getCall(0) + .calledWith( + client.innerApiCalls.listMonitoredResourceDescriptors, + request, + ), + ); + assert( + ( + client.descriptors.page.listMonitoredResourceDescriptors + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('invokes listMonitoredResourceDescriptorsStream without error', async () => { - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListMonitoredResourceDescriptorsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListMonitoredResourceDescriptorsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.api.MonitoredResourceDescriptor()), - generateSampleMessage(new protos.google.api.MonitoredResourceDescriptor()), - generateSampleMessage(new protos.google.api.MonitoredResourceDescriptor()), - ]; - client.descriptors.page.listMonitoredResourceDescriptors.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listMonitoredResourceDescriptorsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.api.MonitoredResourceDescriptor[] = []; - stream.on('data', (response: protos.google.api.MonitoredResourceDescriptor) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listMonitoredResourceDescriptors.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listMonitoredResourceDescriptors, request)); - assert( - (client.descriptors.page.listMonitoredResourceDescriptors.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listMonitoredResourceDescriptors without error', async () => { + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListMonitoredResourceDescriptorsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.ListMonitoredResourceDescriptorsRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.api.MonitoredResourceDescriptor(), + ), + generateSampleMessage( + new protos.google.api.MonitoredResourceDescriptor(), + ), + generateSampleMessage( + new protos.google.api.MonitoredResourceDescriptor(), + ), + ]; + client.descriptors.page.listMonitoredResourceDescriptors.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.api.IMonitoredResourceDescriptor[] = []; + const iterable = client.listMonitoredResourceDescriptorsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listMonitoredResourceDescriptors + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.descriptors.page.listMonitoredResourceDescriptors + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('invokes listMonitoredResourceDescriptorsStream with error', async () => { - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListMonitoredResourceDescriptorsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListMonitoredResourceDescriptorsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listMonitoredResourceDescriptors.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listMonitoredResourceDescriptorsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.api.MonitoredResourceDescriptor[] = []; - stream.on('data', (response: protos.google.api.MonitoredResourceDescriptor) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listMonitoredResourceDescriptors.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listMonitoredResourceDescriptors, request)); - assert( - (client.descriptors.page.listMonitoredResourceDescriptors.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listMonitoredResourceDescriptors with error', async () => { + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListMonitoredResourceDescriptorsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.ListMonitoredResourceDescriptorsRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listMonitoredResourceDescriptors.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listMonitoredResourceDescriptorsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.api.IMonitoredResourceDescriptor[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listMonitoredResourceDescriptors + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.descriptors.page.listMonitoredResourceDescriptors + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + }); + + describe('listMetricDescriptors', () => { + it('invokes listMetricDescriptors without error', async () => { + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListMetricDescriptorsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.ListMetricDescriptorsRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.api.MetricDescriptor()), + generateSampleMessage(new protos.google.api.MetricDescriptor()), + generateSampleMessage(new protos.google.api.MetricDescriptor()), + ]; + client.innerApiCalls.listMetricDescriptors = + stubSimpleCall(expectedResponse); + const [response] = await client.listMetricDescriptors(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listMetricDescriptors as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listMetricDescriptors as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('uses async iteration with listMonitoredResourceDescriptors without error', async () => { - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListMonitoredResourceDescriptorsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListMonitoredResourceDescriptorsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.api.MonitoredResourceDescriptor()), - generateSampleMessage(new protos.google.api.MonitoredResourceDescriptor()), - generateSampleMessage(new protos.google.api.MonitoredResourceDescriptor()), - ]; - client.descriptors.page.listMonitoredResourceDescriptors.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.api.IMonitoredResourceDescriptor[] = []; - const iterable = client.listMonitoredResourceDescriptorsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); + it('invokes listMetricDescriptors without error using callback', async () => { + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListMetricDescriptorsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.ListMetricDescriptorsRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.api.MetricDescriptor()), + generateSampleMessage(new protos.google.api.MetricDescriptor()), + generateSampleMessage(new protos.google.api.MetricDescriptor()), + ]; + client.innerApiCalls.listMetricDescriptors = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listMetricDescriptors( + request, + ( + err?: Error | null, + result?: protos.google.api.IMetricDescriptor[] | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listMonitoredResourceDescriptors.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listMonitoredResourceDescriptors.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listMetricDescriptors as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listMetricDescriptors as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('uses async iteration with listMonitoredResourceDescriptors with error', async () => { - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListMonitoredResourceDescriptorsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListMonitoredResourceDescriptorsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listMonitoredResourceDescriptors.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listMonitoredResourceDescriptorsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.api.IMonitoredResourceDescriptor[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listMonitoredResourceDescriptors.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listMonitoredResourceDescriptors.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('invokes listMetricDescriptors with error', async () => { + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListMetricDescriptorsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.ListMetricDescriptorsRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listMetricDescriptors = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.listMetricDescriptors(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.listMetricDescriptors as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listMetricDescriptors as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('listMetricDescriptors', () => { - it('invokes listMetricDescriptors without error', async () => { - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListMetricDescriptorsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListMetricDescriptorsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.api.MetricDescriptor()), - generateSampleMessage(new protos.google.api.MetricDescriptor()), - generateSampleMessage(new protos.google.api.MetricDescriptor()), - ]; - client.innerApiCalls.listMetricDescriptors = stubSimpleCall(expectedResponse); - const [response] = await client.listMetricDescriptors(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listMetricDescriptors as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listMetricDescriptors as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + it('invokes listMetricDescriptorsStream without error', async () => { + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListMetricDescriptorsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.ListMetricDescriptorsRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.api.MetricDescriptor()), + generateSampleMessage(new protos.google.api.MetricDescriptor()), + generateSampleMessage(new protos.google.api.MetricDescriptor()), + ]; + client.descriptors.page.listMetricDescriptors.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listMetricDescriptorsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.api.MetricDescriptor[] = []; + stream.on('data', (response: protos.google.api.MetricDescriptor) => { + responses.push(response); }); - - it('invokes listMetricDescriptors without error using callback', async () => { - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListMetricDescriptorsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListMetricDescriptorsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.api.MetricDescriptor()), - generateSampleMessage(new protos.google.api.MetricDescriptor()), - generateSampleMessage(new protos.google.api.MetricDescriptor()), - ]; - client.innerApiCalls.listMetricDescriptors = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listMetricDescriptors( - request, - (err?: Error|null, result?: protos.google.api.IMetricDescriptor[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listMetricDescriptors as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listMetricDescriptors as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + stream.on('end', () => { + resolve(responses); }); - - it('invokes listMetricDescriptors with error', async () => { - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListMetricDescriptorsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListMetricDescriptorsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listMetricDescriptors = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listMetricDescriptors(request), expectedError); - const actualRequest = (client.innerApiCalls.listMetricDescriptors as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listMetricDescriptors as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + stream.on('error', (err: Error) => { + reject(err); }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + ( + client.descriptors.page.listMetricDescriptors + .createStream as SinonStub + ) + .getCall(0) + .calledWith(client.innerApiCalls.listMetricDescriptors, request), + ); + assert( + ( + client.descriptors.page.listMetricDescriptors + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('invokes listMetricDescriptorsStream without error', async () => { - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListMetricDescriptorsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListMetricDescriptorsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.api.MetricDescriptor()), - generateSampleMessage(new protos.google.api.MetricDescriptor()), - generateSampleMessage(new protos.google.api.MetricDescriptor()), - ]; - client.descriptors.page.listMetricDescriptors.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listMetricDescriptorsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.api.MetricDescriptor[] = []; - stream.on('data', (response: protos.google.api.MetricDescriptor) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listMetricDescriptors.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listMetricDescriptors, request)); - assert( - (client.descriptors.page.listMetricDescriptors.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); + it('invokes listMetricDescriptorsStream with error', async () => { + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListMetricDescriptorsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.ListMetricDescriptorsRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listMetricDescriptors.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listMetricDescriptorsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.api.MetricDescriptor[] = []; + stream.on('data', (response: protos.google.api.MetricDescriptor) => { + responses.push(response); }); - - it('invokes listMetricDescriptorsStream with error', async () => { - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListMetricDescriptorsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListMetricDescriptorsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listMetricDescriptors.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listMetricDescriptorsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.api.MetricDescriptor[] = []; - stream.on('data', (response: protos.google.api.MetricDescriptor) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listMetricDescriptors.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listMetricDescriptors, request)); - assert( - (client.descriptors.page.listMetricDescriptors.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); + stream.on('end', () => { + resolve(responses); }); - - it('uses async iteration with listMetricDescriptors without error', async () => { - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListMetricDescriptorsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListMetricDescriptorsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.api.MetricDescriptor()), - generateSampleMessage(new protos.google.api.MetricDescriptor()), - generateSampleMessage(new protos.google.api.MetricDescriptor()), - ]; - client.descriptors.page.listMetricDescriptors.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.api.IMetricDescriptor[] = []; - const iterable = client.listMetricDescriptorsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listMetricDescriptors.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listMetricDescriptors.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); + stream.on('error', (err: Error) => { + reject(err); }); + }); + await assert.rejects(promise, expectedError); + assert( + ( + client.descriptors.page.listMetricDescriptors + .createStream as SinonStub + ) + .getCall(0) + .calledWith(client.innerApiCalls.listMetricDescriptors, request), + ); + assert( + ( + client.descriptors.page.listMetricDescriptors + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('uses async iteration with listMetricDescriptors with error', async () => { - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListMetricDescriptorsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListMetricDescriptorsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listMetricDescriptors.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listMetricDescriptorsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.api.IMetricDescriptor[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listMetricDescriptors.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listMetricDescriptors.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listMetricDescriptors without error', async () => { + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListMetricDescriptorsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.ListMetricDescriptorsRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.api.MetricDescriptor()), + generateSampleMessage(new protos.google.api.MetricDescriptor()), + generateSampleMessage(new protos.google.api.MetricDescriptor()), + ]; + client.descriptors.page.listMetricDescriptors.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.api.IMetricDescriptor[] = []; + const iterable = client.listMetricDescriptorsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listMetricDescriptors + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.descriptors.page.listMetricDescriptors + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); }); - describe('listTimeSeries', () => { - it('invokes listTimeSeries without error', async () => { - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListTimeSeriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListTimeSeriesRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.monitoring.v3.TimeSeries()), - generateSampleMessage(new protos.google.monitoring.v3.TimeSeries()), - generateSampleMessage(new protos.google.monitoring.v3.TimeSeries()), - ]; - client.innerApiCalls.listTimeSeries = stubSimpleCall(expectedResponse); - const [response] = await client.listTimeSeries(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listTimeSeries as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listTimeSeries as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('uses async iteration with listMetricDescriptors with error', async () => { + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListMetricDescriptorsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.ListMetricDescriptorsRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listMetricDescriptors.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listMetricDescriptorsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.api.IMetricDescriptor[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listMetricDescriptors + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.descriptors.page.listMetricDescriptors + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + }); + + describe('listTimeSeries', () => { + it('invokes listTimeSeries without error', async () => { + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListTimeSeriesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.ListTimeSeriesRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.monitoring.v3.TimeSeries()), + generateSampleMessage(new protos.google.monitoring.v3.TimeSeries()), + generateSampleMessage(new protos.google.monitoring.v3.TimeSeries()), + ]; + client.innerApiCalls.listTimeSeries = stubSimpleCall(expectedResponse); + const [response] = await client.listTimeSeries(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listTimeSeries as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listTimeSeries as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes listTimeSeries without error using callback', async () => { - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListTimeSeriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListTimeSeriesRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.monitoring.v3.TimeSeries()), - generateSampleMessage(new protos.google.monitoring.v3.TimeSeries()), - generateSampleMessage(new protos.google.monitoring.v3.TimeSeries()), - ]; - client.innerApiCalls.listTimeSeries = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listTimeSeries( - request, - (err?: Error|null, result?: protos.google.monitoring.v3.ITimeSeries[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listTimeSeries as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listTimeSeries as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listTimeSeries without error using callback', async () => { + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListTimeSeriesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.ListTimeSeriesRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.monitoring.v3.TimeSeries()), + generateSampleMessage(new protos.google.monitoring.v3.TimeSeries()), + generateSampleMessage(new protos.google.monitoring.v3.TimeSeries()), + ]; + client.innerApiCalls.listTimeSeries = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listTimeSeries( + request, + ( + err?: Error | null, + result?: protos.google.monitoring.v3.ITimeSeries[] | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listTimeSeries as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listTimeSeries as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes listTimeSeries with error', async () => { - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListTimeSeriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListTimeSeriesRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listTimeSeries = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listTimeSeries(request), expectedError); - const actualRequest = (client.innerApiCalls.listTimeSeries as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listTimeSeries as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listTimeSeries with error', async () => { + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListTimeSeriesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.ListTimeSeriesRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listTimeSeries = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.listTimeSeries(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listTimeSeries as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listTimeSeries as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes listTimeSeriesStream without error', async () => { - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListTimeSeriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListTimeSeriesRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.monitoring.v3.TimeSeries()), - generateSampleMessage(new protos.google.monitoring.v3.TimeSeries()), - generateSampleMessage(new protos.google.monitoring.v3.TimeSeries()), - ]; - client.descriptors.page.listTimeSeries.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listTimeSeriesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.monitoring.v3.TimeSeries[] = []; - stream.on('data', (response: protos.google.monitoring.v3.TimeSeries) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listTimeSeries.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listTimeSeries, request)); - assert( - (client.descriptors.page.listTimeSeries.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); + it('invokes listTimeSeriesStream without error', async () => { + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListTimeSeriesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.ListTimeSeriesRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.monitoring.v3.TimeSeries()), + generateSampleMessage(new protos.google.monitoring.v3.TimeSeries()), + generateSampleMessage(new protos.google.monitoring.v3.TimeSeries()), + ]; + client.descriptors.page.listTimeSeries.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listTimeSeriesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.monitoring.v3.TimeSeries[] = []; + stream.on( + 'data', + (response: protos.google.monitoring.v3.TimeSeries) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); }); - - it('invokes listTimeSeriesStream with error', async () => { - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListTimeSeriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListTimeSeriesRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listTimeSeries.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listTimeSeriesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.monitoring.v3.TimeSeries[] = []; - stream.on('data', (response: protos.google.monitoring.v3.TimeSeries) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listTimeSeries.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listTimeSeries, request)); - assert( - (client.descriptors.page.listTimeSeries.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); + stream.on('error', (err: Error) => { + reject(err); }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.listTimeSeries.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listTimeSeries, request), + ); + assert( + (client.descriptors.page.listTimeSeries.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('uses async iteration with listTimeSeries without error', async () => { - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListTimeSeriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListTimeSeriesRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.monitoring.v3.TimeSeries()), - generateSampleMessage(new protos.google.monitoring.v3.TimeSeries()), - generateSampleMessage(new protos.google.monitoring.v3.TimeSeries()), - ]; - client.descriptors.page.listTimeSeries.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.monitoring.v3.ITimeSeries[] = []; - const iterable = client.listTimeSeriesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listTimeSeries.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listTimeSeries.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); + it('invokes listTimeSeriesStream with error', async () => { + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListTimeSeriesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.ListTimeSeriesRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listTimeSeries.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listTimeSeriesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.monitoring.v3.TimeSeries[] = []; + stream.on( + 'data', + (response: protos.google.monitoring.v3.TimeSeries) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); }); - - it('uses async iteration with listTimeSeries with error', async () => { - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListTimeSeriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListTimeSeriesRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listTimeSeries.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listTimeSeriesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.monitoring.v3.ITimeSeries[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listTimeSeries.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listTimeSeries.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); + stream.on('error', (err: Error) => { + reject(err); }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listTimeSeries.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listTimeSeries, request), + ); + assert( + (client.descriptors.page.listTimeSeries.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); }); - describe('Path templates', () => { - - describe('folderAlertPolicy', async () => { - const fakePath = "/rendered/path/folderAlertPolicy"; - const expectedParameters = { - folder: "folderValue", - alert_policy: "alertPolicyValue", - }; - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.folderAlertPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderAlertPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderAlertPolicyPath', () => { - const result = client.folderAlertPolicyPath("folderValue", "alertPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderAlertPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderAlertPolicyName', () => { - const result = client.matchFolderFromFolderAlertPolicyName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderAlertPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAlertPolicyFromFolderAlertPolicyName', () => { - const result = client.matchAlertPolicyFromFolderAlertPolicyName(fakePath); - assert.strictEqual(result, "alertPolicyValue"); - assert((client.pathTemplates.folderAlertPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + it('uses async iteration with listTimeSeries without error', async () => { + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListTimeSeriesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.ListTimeSeriesRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.monitoring.v3.TimeSeries()), + generateSampleMessage(new protos.google.monitoring.v3.TimeSeries()), + generateSampleMessage(new protos.google.monitoring.v3.TimeSeries()), + ]; + client.descriptors.page.listTimeSeries.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.monitoring.v3.ITimeSeries[] = []; + const iterable = client.listTimeSeriesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listTimeSeries.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listTimeSeries.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - describe('folderAlertPolicyCondition', async () => { - const fakePath = "/rendered/path/folderAlertPolicyCondition"; - const expectedParameters = { - folder: "folderValue", - alert_policy: "alertPolicyValue", - condition: "conditionValue", - }; - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.folderAlertPolicyConditionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderAlertPolicyConditionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderAlertPolicyConditionPath', () => { - const result = client.folderAlertPolicyConditionPath("folderValue", "alertPolicyValue", "conditionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderAlertPolicyConditionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderAlertPolicyConditionName', () => { - const result = client.matchFolderFromFolderAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAlertPolicyFromFolderAlertPolicyConditionName', () => { - const result = client.matchAlertPolicyFromFolderAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "alertPolicyValue"); - assert((client.pathTemplates.folderAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConditionFromFolderAlertPolicyConditionName', () => { - const result = client.matchConditionFromFolderAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "conditionValue"); - assert((client.pathTemplates.folderAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + it('uses async iteration with listTimeSeries with error', async () => { + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListTimeSeriesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.ListTimeSeriesRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listTimeSeries.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listTimeSeriesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.monitoring.v3.ITimeSeries[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listTimeSeries.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listTimeSeries.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + }); + + describe('Path templates', () => { + describe('folderAlertPolicy', async () => { + const fakePath = '/rendered/path/folderAlertPolicy'; + const expectedParameters = { + folder: 'folderValue', + alert_policy: 'alertPolicyValue', + }; + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.folderAlertPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.folderAlertPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('folderAlertPolicyPath', () => { + const result = client.folderAlertPolicyPath( + 'folderValue', + 'alertPolicyValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.folderAlertPolicyPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchFolderFromFolderAlertPolicyName', () => { + const result = client.matchFolderFromFolderAlertPolicyName(fakePath); + assert.strictEqual(result, 'folderValue'); + assert( + ( + client.pathTemplates.folderAlertPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchAlertPolicyFromFolderAlertPolicyName', () => { + const result = + client.matchAlertPolicyFromFolderAlertPolicyName(fakePath); + assert.strictEqual(result, 'alertPolicyValue'); + assert( + ( + client.pathTemplates.folderAlertPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('folderChannelDescriptor', async () => { - const fakePath = "/rendered/path/folderChannelDescriptor"; - const expectedParameters = { - folder: "folderValue", - channel_descriptor: "channelDescriptorValue", - }; - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.folderChannelDescriptorPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderChannelDescriptorPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderChannelDescriptorPath', () => { - const result = client.folderChannelDescriptorPath("folderValue", "channelDescriptorValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderChannelDescriptorPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderChannelDescriptorName', () => { - const result = client.matchFolderFromFolderChannelDescriptorName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderChannelDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchChannelDescriptorFromFolderChannelDescriptorName', () => { - const result = client.matchChannelDescriptorFromFolderChannelDescriptorName(fakePath); - assert.strictEqual(result, "channelDescriptorValue"); - assert((client.pathTemplates.folderChannelDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('folderAlertPolicyCondition', async () => { + const fakePath = '/rendered/path/folderAlertPolicyCondition'; + const expectedParameters = { + folder: 'folderValue', + alert_policy: 'alertPolicyValue', + condition: 'conditionValue', + }; + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.folderAlertPolicyConditionPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.folderAlertPolicyConditionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('folderAlertPolicyConditionPath', () => { + const result = client.folderAlertPolicyConditionPath( + 'folderValue', + 'alertPolicyValue', + 'conditionValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.folderAlertPolicyConditionPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchFolderFromFolderAlertPolicyConditionName', () => { + const result = + client.matchFolderFromFolderAlertPolicyConditionName(fakePath); + assert.strictEqual(result, 'folderValue'); + assert( + ( + client.pathTemplates.folderAlertPolicyConditionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchAlertPolicyFromFolderAlertPolicyConditionName', () => { + const result = + client.matchAlertPolicyFromFolderAlertPolicyConditionName(fakePath); + assert.strictEqual(result, 'alertPolicyValue'); + assert( + ( + client.pathTemplates.folderAlertPolicyConditionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchConditionFromFolderAlertPolicyConditionName', () => { + const result = + client.matchConditionFromFolderAlertPolicyConditionName(fakePath); + assert.strictEqual(result, 'conditionValue'); + assert( + ( + client.pathTemplates.folderAlertPolicyConditionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('folderGroup', async () => { - const fakePath = "/rendered/path/folderGroup"; - const expectedParameters = { - folder: "folderValue", - group: "groupValue", - }; - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.folderGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderGroupPath', () => { - const result = client.folderGroupPath("folderValue", "groupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderGroupName', () => { - const result = client.matchFolderFromFolderGroupName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchGroupFromFolderGroupName', () => { - const result = client.matchGroupFromFolderGroupName(fakePath); - assert.strictEqual(result, "groupValue"); - assert((client.pathTemplates.folderGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('folderChannelDescriptor', async () => { + const fakePath = '/rendered/path/folderChannelDescriptor'; + const expectedParameters = { + folder: 'folderValue', + channel_descriptor: 'channelDescriptorValue', + }; + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.folderChannelDescriptorPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.folderChannelDescriptorPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('folderChannelDescriptorPath', () => { + const result = client.folderChannelDescriptorPath( + 'folderValue', + 'channelDescriptorValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.folderChannelDescriptorPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchFolderFromFolderChannelDescriptorName', () => { + const result = + client.matchFolderFromFolderChannelDescriptorName(fakePath); + assert.strictEqual(result, 'folderValue'); + assert( + ( + client.pathTemplates.folderChannelDescriptorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchChannelDescriptorFromFolderChannelDescriptorName', () => { + const result = + client.matchChannelDescriptorFromFolderChannelDescriptorName( + fakePath, + ); + assert.strictEqual(result, 'channelDescriptorValue'); + assert( + ( + client.pathTemplates.folderChannelDescriptorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('folderMetricDescriptor', async () => { - const fakePath = "/rendered/path/folderMetricDescriptor"; - const expectedParameters = { - folder: "folderValue", - metric_descriptor: "metricDescriptorValue", - }; - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.folderMetricDescriptorPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderMetricDescriptorPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderMetricDescriptorPath', () => { - const result = client.folderMetricDescriptorPath("folderValue", "metricDescriptorValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderMetricDescriptorPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderMetricDescriptorName', () => { - const result = client.matchFolderFromFolderMetricDescriptorName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderMetricDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMetricDescriptorFromFolderMetricDescriptorName', () => { - const result = client.matchMetricDescriptorFromFolderMetricDescriptorName(fakePath); - assert.strictEqual(result, "metricDescriptorValue"); - assert((client.pathTemplates.folderMetricDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('folderGroup', async () => { + const fakePath = '/rendered/path/folderGroup'; + const expectedParameters = { + folder: 'folderValue', + group: 'groupValue', + }; + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.folderGroupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.folderGroupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('folderGroupPath', () => { + const result = client.folderGroupPath('folderValue', 'groupValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.folderGroupPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchFolderFromFolderGroupName', () => { + const result = client.matchFolderFromFolderGroupName(fakePath); + assert.strictEqual(result, 'folderValue'); + assert( + (client.pathTemplates.folderGroupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchGroupFromFolderGroupName', () => { + const result = client.matchGroupFromFolderGroupName(fakePath); + assert.strictEqual(result, 'groupValue'); + assert( + (client.pathTemplates.folderGroupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('folderMonitoredResourceDescriptor', async () => { - const fakePath = "/rendered/path/folderMonitoredResourceDescriptor"; - const expectedParameters = { - folder: "folderValue", - monitored_resource_descriptor: "monitoredResourceDescriptorValue", - }; - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.folderMonitoredResourceDescriptorPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderMonitoredResourceDescriptorPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderMonitoredResourceDescriptorPath', () => { - const result = client.folderMonitoredResourceDescriptorPath("folderValue", "monitoredResourceDescriptorValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderMonitoredResourceDescriptorPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderMonitoredResourceDescriptorName', () => { - const result = client.matchFolderFromFolderMonitoredResourceDescriptorName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderMonitoredResourceDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMonitoredResourceDescriptorFromFolderMonitoredResourceDescriptorName', () => { - const result = client.matchMonitoredResourceDescriptorFromFolderMonitoredResourceDescriptorName(fakePath); - assert.strictEqual(result, "monitoredResourceDescriptorValue"); - assert((client.pathTemplates.folderMonitoredResourceDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('folderMetricDescriptor', async () => { + const fakePath = '/rendered/path/folderMetricDescriptor'; + const expectedParameters = { + folder: 'folderValue', + metric_descriptor: 'metricDescriptorValue', + }; + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.folderMetricDescriptorPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.folderMetricDescriptorPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('folderMetricDescriptorPath', () => { + const result = client.folderMetricDescriptorPath( + 'folderValue', + 'metricDescriptorValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.folderMetricDescriptorPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchFolderFromFolderMetricDescriptorName', () => { + const result = + client.matchFolderFromFolderMetricDescriptorName(fakePath); + assert.strictEqual(result, 'folderValue'); + assert( + ( + client.pathTemplates.folderMetricDescriptorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchMetricDescriptorFromFolderMetricDescriptorName', () => { + const result = + client.matchMetricDescriptorFromFolderMetricDescriptorName(fakePath); + assert.strictEqual(result, 'metricDescriptorValue'); + assert( + ( + client.pathTemplates.folderMetricDescriptorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('folderNotificationChannel', async () => { - const fakePath = "/rendered/path/folderNotificationChannel"; - const expectedParameters = { - folder: "folderValue", - notification_channel: "notificationChannelValue", - }; - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.folderNotificationChannelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderNotificationChannelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderNotificationChannelPath', () => { - const result = client.folderNotificationChannelPath("folderValue", "notificationChannelValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderNotificationChannelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderNotificationChannelName', () => { - const result = client.matchFolderFromFolderNotificationChannelName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderNotificationChannelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchNotificationChannelFromFolderNotificationChannelName', () => { - const result = client.matchNotificationChannelFromFolderNotificationChannelName(fakePath); - assert.strictEqual(result, "notificationChannelValue"); - assert((client.pathTemplates.folderNotificationChannelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('folderMonitoredResourceDescriptor', async () => { + const fakePath = '/rendered/path/folderMonitoredResourceDescriptor'; + const expectedParameters = { + folder: 'folderValue', + monitored_resource_descriptor: 'monitoredResourceDescriptorValue', + }; + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.folderMonitoredResourceDescriptorPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.folderMonitoredResourceDescriptorPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('folderMonitoredResourceDescriptorPath', () => { + const result = client.folderMonitoredResourceDescriptorPath( + 'folderValue', + 'monitoredResourceDescriptorValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.folderMonitoredResourceDescriptorPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchFolderFromFolderMonitoredResourceDescriptorName', () => { + const result = + client.matchFolderFromFolderMonitoredResourceDescriptorName(fakePath); + assert.strictEqual(result, 'folderValue'); + assert( + ( + client.pathTemplates.folderMonitoredResourceDescriptorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchMonitoredResourceDescriptorFromFolderMonitoredResourceDescriptorName', () => { + const result = + client.matchMonitoredResourceDescriptorFromFolderMonitoredResourceDescriptorName( + fakePath, + ); + assert.strictEqual(result, 'monitoredResourceDescriptorValue'); + assert( + ( + client.pathTemplates.folderMonitoredResourceDescriptorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('folderService', async () => { - const fakePath = "/rendered/path/folderService"; - const expectedParameters = { - folder: "folderValue", - service: "serviceValue", - }; - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.folderServicePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderServicePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderServicePath', () => { - const result = client.folderServicePath("folderValue", "serviceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderServicePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderServiceName', () => { - const result = client.matchFolderFromFolderServiceName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderServicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromFolderServiceName', () => { - const result = client.matchServiceFromFolderServiceName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.folderServicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('folderNotificationChannel', async () => { + const fakePath = '/rendered/path/folderNotificationChannel'; + const expectedParameters = { + folder: 'folderValue', + notification_channel: 'notificationChannelValue', + }; + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.folderNotificationChannelPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.folderNotificationChannelPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('folderNotificationChannelPath', () => { + const result = client.folderNotificationChannelPath( + 'folderValue', + 'notificationChannelValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.folderNotificationChannelPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchFolderFromFolderNotificationChannelName', () => { + const result = + client.matchFolderFromFolderNotificationChannelName(fakePath); + assert.strictEqual(result, 'folderValue'); + assert( + ( + client.pathTemplates.folderNotificationChannelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchNotificationChannelFromFolderNotificationChannelName', () => { + const result = + client.matchNotificationChannelFromFolderNotificationChannelName( + fakePath, + ); + assert.strictEqual(result, 'notificationChannelValue'); + assert( + ( + client.pathTemplates.folderNotificationChannelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('folderServiceServiceLevelObjective', async () => { - const fakePath = "/rendered/path/folderServiceServiceLevelObjective"; - const expectedParameters = { - folder: "folderValue", - service: "serviceValue", - service_level_objective: "serviceLevelObjectiveValue", - }; - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderServiceServiceLevelObjectivePath', () => { - const result = client.folderServiceServiceLevelObjectivePath("folderValue", "serviceValue", "serviceLevelObjectiveValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderServiceServiceLevelObjectiveName', () => { - const result = client.matchFolderFromFolderServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromFolderServiceServiceLevelObjectiveName', () => { - const result = client.matchServiceFromFolderServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceLevelObjectiveFromFolderServiceServiceLevelObjectiveName', () => { - const result = client.matchServiceLevelObjectiveFromFolderServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "serviceLevelObjectiveValue"); - assert((client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('folderService', async () => { + const fakePath = '/rendered/path/folderService'; + const expectedParameters = { + folder: 'folderValue', + service: 'serviceValue', + }; + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.folderServicePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.folderServicePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('folderServicePath', () => { + const result = client.folderServicePath('folderValue', 'serviceValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.folderServicePathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchFolderFromFolderServiceName', () => { + const result = client.matchFolderFromFolderServiceName(fakePath); + assert.strictEqual(result, 'folderValue'); + assert( + (client.pathTemplates.folderServicePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchServiceFromFolderServiceName', () => { + const result = client.matchServiceFromFolderServiceName(fakePath); + assert.strictEqual(result, 'serviceValue'); + assert( + (client.pathTemplates.folderServicePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('folderUptimeCheckConfig', async () => { - const fakePath = "/rendered/path/folderUptimeCheckConfig"; - const expectedParameters = { - folder: "folderValue", - uptime_check_config: "uptimeCheckConfigValue", - }; - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.folderUptimeCheckConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderUptimeCheckConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderUptimeCheckConfigPath', () => { - const result = client.folderUptimeCheckConfigPath("folderValue", "uptimeCheckConfigValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderUptimeCheckConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderUptimeCheckConfigName', () => { - const result = client.matchFolderFromFolderUptimeCheckConfigName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderUptimeCheckConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUptimeCheckConfigFromFolderUptimeCheckConfigName', () => { - const result = client.matchUptimeCheckConfigFromFolderUptimeCheckConfigName(fakePath); - assert.strictEqual(result, "uptimeCheckConfigValue"); - assert((client.pathTemplates.folderUptimeCheckConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('folderServiceServiceLevelObjective', async () => { + const fakePath = '/rendered/path/folderServiceServiceLevelObjective'; + const expectedParameters = { + folder: 'folderValue', + service: 'serviceValue', + service_level_objective: 'serviceLevelObjectiveValue', + }; + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('folderServiceServiceLevelObjectivePath', () => { + const result = client.folderServiceServiceLevelObjectivePath( + 'folderValue', + 'serviceValue', + 'serviceLevelObjectiveValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchFolderFromFolderServiceServiceLevelObjectiveName', () => { + const result = + client.matchFolderFromFolderServiceServiceLevelObjectiveName( + fakePath, + ); + assert.strictEqual(result, 'folderValue'); + assert( + ( + client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchServiceFromFolderServiceServiceLevelObjectiveName', () => { + const result = + client.matchServiceFromFolderServiceServiceLevelObjectiveName( + fakePath, + ); + assert.strictEqual(result, 'serviceValue'); + assert( + ( + client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchServiceLevelObjectiveFromFolderServiceServiceLevelObjectiveName', () => { + const result = + client.matchServiceLevelObjectiveFromFolderServiceServiceLevelObjectiveName( + fakePath, + ); + assert.strictEqual(result, 'serviceLevelObjectiveValue'); + assert( + ( + client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('organizationAlertPolicy', async () => { - const fakePath = "/rendered/path/organizationAlertPolicy"; - const expectedParameters = { - organization: "organizationValue", - alert_policy: "alertPolicyValue", - }; - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationAlertPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationAlertPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationAlertPolicyPath', () => { - const result = client.organizationAlertPolicyPath("organizationValue", "alertPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationAlertPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationAlertPolicyName', () => { - const result = client.matchOrganizationFromOrganizationAlertPolicyName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationAlertPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAlertPolicyFromOrganizationAlertPolicyName', () => { - const result = client.matchAlertPolicyFromOrganizationAlertPolicyName(fakePath); - assert.strictEqual(result, "alertPolicyValue"); - assert((client.pathTemplates.organizationAlertPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('folderUptimeCheckConfig', async () => { + const fakePath = '/rendered/path/folderUptimeCheckConfig'; + const expectedParameters = { + folder: 'folderValue', + uptime_check_config: 'uptimeCheckConfigValue', + }; + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.folderUptimeCheckConfigPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.folderUptimeCheckConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('folderUptimeCheckConfigPath', () => { + const result = client.folderUptimeCheckConfigPath( + 'folderValue', + 'uptimeCheckConfigValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.folderUptimeCheckConfigPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchFolderFromFolderUptimeCheckConfigName', () => { + const result = + client.matchFolderFromFolderUptimeCheckConfigName(fakePath); + assert.strictEqual(result, 'folderValue'); + assert( + ( + client.pathTemplates.folderUptimeCheckConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchUptimeCheckConfigFromFolderUptimeCheckConfigName', () => { + const result = + client.matchUptimeCheckConfigFromFolderUptimeCheckConfigName( + fakePath, + ); + assert.strictEqual(result, 'uptimeCheckConfigValue'); + assert( + ( + client.pathTemplates.folderUptimeCheckConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('organizationAlertPolicyCondition', async () => { - const fakePath = "/rendered/path/organizationAlertPolicyCondition"; - const expectedParameters = { - organization: "organizationValue", - alert_policy: "alertPolicyValue", - condition: "conditionValue", - }; - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationAlertPolicyConditionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationAlertPolicyConditionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationAlertPolicyConditionPath', () => { - const result = client.organizationAlertPolicyConditionPath("organizationValue", "alertPolicyValue", "conditionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationAlertPolicyConditionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationAlertPolicyConditionName', () => { - const result = client.matchOrganizationFromOrganizationAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAlertPolicyFromOrganizationAlertPolicyConditionName', () => { - const result = client.matchAlertPolicyFromOrganizationAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "alertPolicyValue"); - assert((client.pathTemplates.organizationAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConditionFromOrganizationAlertPolicyConditionName', () => { - const result = client.matchConditionFromOrganizationAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "conditionValue"); - assert((client.pathTemplates.organizationAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('organizationAlertPolicy', async () => { + const fakePath = '/rendered/path/organizationAlertPolicy'; + const expectedParameters = { + organization: 'organizationValue', + alert_policy: 'alertPolicyValue', + }; + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.organizationAlertPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.organizationAlertPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('organizationAlertPolicyPath', () => { + const result = client.organizationAlertPolicyPath( + 'organizationValue', + 'alertPolicyValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationAlertPolicyPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchOrganizationFromOrganizationAlertPolicyName', () => { + const result = + client.matchOrganizationFromOrganizationAlertPolicyName(fakePath); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationAlertPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchAlertPolicyFromOrganizationAlertPolicyName', () => { + const result = + client.matchAlertPolicyFromOrganizationAlertPolicyName(fakePath); + assert.strictEqual(result, 'alertPolicyValue'); + assert( + ( + client.pathTemplates.organizationAlertPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('organizationChannelDescriptor', async () => { - const fakePath = "/rendered/path/organizationChannelDescriptor"; - const expectedParameters = { - organization: "organizationValue", - channel_descriptor: "channelDescriptorValue", - }; - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationChannelDescriptorPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationChannelDescriptorPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationChannelDescriptorPath', () => { - const result = client.organizationChannelDescriptorPath("organizationValue", "channelDescriptorValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationChannelDescriptorPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationChannelDescriptorName', () => { - const result = client.matchOrganizationFromOrganizationChannelDescriptorName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationChannelDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchChannelDescriptorFromOrganizationChannelDescriptorName', () => { - const result = client.matchChannelDescriptorFromOrganizationChannelDescriptorName(fakePath); - assert.strictEqual(result, "channelDescriptorValue"); - assert((client.pathTemplates.organizationChannelDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('organizationAlertPolicyCondition', async () => { + const fakePath = '/rendered/path/organizationAlertPolicyCondition'; + const expectedParameters = { + organization: 'organizationValue', + alert_policy: 'alertPolicyValue', + condition: 'conditionValue', + }; + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.organizationAlertPolicyConditionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationAlertPolicyConditionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationAlertPolicyConditionPath', () => { + const result = client.organizationAlertPolicyConditionPath( + 'organizationValue', + 'alertPolicyValue', + 'conditionValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationAlertPolicyConditionPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchOrganizationFromOrganizationAlertPolicyConditionName', () => { + const result = + client.matchOrganizationFromOrganizationAlertPolicyConditionName( + fakePath, + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationAlertPolicyConditionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchAlertPolicyFromOrganizationAlertPolicyConditionName', () => { + const result = + client.matchAlertPolicyFromOrganizationAlertPolicyConditionName( + fakePath, + ); + assert.strictEqual(result, 'alertPolicyValue'); + assert( + ( + client.pathTemplates.organizationAlertPolicyConditionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchConditionFromOrganizationAlertPolicyConditionName', () => { + const result = + client.matchConditionFromOrganizationAlertPolicyConditionName( + fakePath, + ); + assert.strictEqual(result, 'conditionValue'); + assert( + ( + client.pathTemplates.organizationAlertPolicyConditionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('organizationGroup', async () => { - const fakePath = "/rendered/path/organizationGroup"; - const expectedParameters = { - organization: "organizationValue", - group: "groupValue", - }; - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationGroupPath', () => { - const result = client.organizationGroupPath("organizationValue", "groupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationGroupName', () => { - const result = client.matchOrganizationFromOrganizationGroupName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchGroupFromOrganizationGroupName', () => { - const result = client.matchGroupFromOrganizationGroupName(fakePath); - assert.strictEqual(result, "groupValue"); - assert((client.pathTemplates.organizationGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('organizationChannelDescriptor', async () => { + const fakePath = '/rendered/path/organizationChannelDescriptor'; + const expectedParameters = { + organization: 'organizationValue', + channel_descriptor: 'channelDescriptorValue', + }; + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.organizationChannelDescriptorPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationChannelDescriptorPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationChannelDescriptorPath', () => { + const result = client.organizationChannelDescriptorPath( + 'organizationValue', + 'channelDescriptorValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationChannelDescriptorPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchOrganizationFromOrganizationChannelDescriptorName', () => { + const result = + client.matchOrganizationFromOrganizationChannelDescriptorName( + fakePath, + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationChannelDescriptorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchChannelDescriptorFromOrganizationChannelDescriptorName', () => { + const result = + client.matchChannelDescriptorFromOrganizationChannelDescriptorName( + fakePath, + ); + assert.strictEqual(result, 'channelDescriptorValue'); + assert( + ( + client.pathTemplates.organizationChannelDescriptorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('organizationMetricDescriptor', async () => { - const fakePath = "/rendered/path/organizationMetricDescriptor"; - const expectedParameters = { - organization: "organizationValue", - metric_descriptor: "metricDescriptorValue", - }; - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationMetricDescriptorPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationMetricDescriptorPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationMetricDescriptorPath', () => { - const result = client.organizationMetricDescriptorPath("organizationValue", "metricDescriptorValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationMetricDescriptorPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationMetricDescriptorName', () => { - const result = client.matchOrganizationFromOrganizationMetricDescriptorName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationMetricDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMetricDescriptorFromOrganizationMetricDescriptorName', () => { - const result = client.matchMetricDescriptorFromOrganizationMetricDescriptorName(fakePath); - assert.strictEqual(result, "metricDescriptorValue"); - assert((client.pathTemplates.organizationMetricDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('organizationGroup', async () => { + const fakePath = '/rendered/path/organizationGroup'; + const expectedParameters = { + organization: 'organizationValue', + group: 'groupValue', + }; + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.organizationGroupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.organizationGroupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('organizationGroupPath', () => { + const result = client.organizationGroupPath( + 'organizationValue', + 'groupValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchOrganizationFromOrganizationGroupName', () => { + const result = + client.matchOrganizationFromOrganizationGroupName(fakePath); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchGroupFromOrganizationGroupName', () => { + const result = client.matchGroupFromOrganizationGroupName(fakePath); + assert.strictEqual(result, 'groupValue'); + assert( + ( + client.pathTemplates.organizationGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('organizationMonitoredResourceDescriptor', async () => { - const fakePath = "/rendered/path/organizationMonitoredResourceDescriptor"; - const expectedParameters = { - organization: "organizationValue", - monitored_resource_descriptor: "monitoredResourceDescriptorValue", - }; - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationMonitoredResourceDescriptorPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationMonitoredResourceDescriptorPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationMonitoredResourceDescriptorPath', () => { - const result = client.organizationMonitoredResourceDescriptorPath("organizationValue", "monitoredResourceDescriptorValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationMonitoredResourceDescriptorPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationMonitoredResourceDescriptorName', () => { - const result = client.matchOrganizationFromOrganizationMonitoredResourceDescriptorName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationMonitoredResourceDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMonitoredResourceDescriptorFromOrganizationMonitoredResourceDescriptorName', () => { - const result = client.matchMonitoredResourceDescriptorFromOrganizationMonitoredResourceDescriptorName(fakePath); - assert.strictEqual(result, "monitoredResourceDescriptorValue"); - assert((client.pathTemplates.organizationMonitoredResourceDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('organizationMetricDescriptor', async () => { + const fakePath = '/rendered/path/organizationMetricDescriptor'; + const expectedParameters = { + organization: 'organizationValue', + metric_descriptor: 'metricDescriptorValue', + }; + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.organizationMetricDescriptorPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationMetricDescriptorPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationMetricDescriptorPath', () => { + const result = client.organizationMetricDescriptorPath( + 'organizationValue', + 'metricDescriptorValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationMetricDescriptorPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchOrganizationFromOrganizationMetricDescriptorName', () => { + const result = + client.matchOrganizationFromOrganizationMetricDescriptorName( + fakePath, + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationMetricDescriptorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchMetricDescriptorFromOrganizationMetricDescriptorName', () => { + const result = + client.matchMetricDescriptorFromOrganizationMetricDescriptorName( + fakePath, + ); + assert.strictEqual(result, 'metricDescriptorValue'); + assert( + ( + client.pathTemplates.organizationMetricDescriptorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('organizationNotificationChannel', async () => { - const fakePath = "/rendered/path/organizationNotificationChannel"; - const expectedParameters = { - organization: "organizationValue", - notification_channel: "notificationChannelValue", - }; - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationNotificationChannelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationNotificationChannelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationNotificationChannelPath', () => { - const result = client.organizationNotificationChannelPath("organizationValue", "notificationChannelValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationNotificationChannelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationNotificationChannelName', () => { - const result = client.matchOrganizationFromOrganizationNotificationChannelName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationNotificationChannelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchNotificationChannelFromOrganizationNotificationChannelName', () => { - const result = client.matchNotificationChannelFromOrganizationNotificationChannelName(fakePath); - assert.strictEqual(result, "notificationChannelValue"); - assert((client.pathTemplates.organizationNotificationChannelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('organizationMonitoredResourceDescriptor', async () => { + const fakePath = '/rendered/path/organizationMonitoredResourceDescriptor'; + const expectedParameters = { + organization: 'organizationValue', + monitored_resource_descriptor: 'monitoredResourceDescriptorValue', + }; + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.organizationMonitoredResourceDescriptorPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationMonitoredResourceDescriptorPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationMonitoredResourceDescriptorPath', () => { + const result = client.organizationMonitoredResourceDescriptorPath( + 'organizationValue', + 'monitoredResourceDescriptorValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .organizationMonitoredResourceDescriptorPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchOrganizationFromOrganizationMonitoredResourceDescriptorName', () => { + const result = + client.matchOrganizationFromOrganizationMonitoredResourceDescriptorName( + fakePath, + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates + .organizationMonitoredResourceDescriptorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchMonitoredResourceDescriptorFromOrganizationMonitoredResourceDescriptorName', () => { + const result = + client.matchMonitoredResourceDescriptorFromOrganizationMonitoredResourceDescriptorName( + fakePath, + ); + assert.strictEqual(result, 'monitoredResourceDescriptorValue'); + assert( + ( + client.pathTemplates + .organizationMonitoredResourceDescriptorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('organizationService', async () => { - const fakePath = "/rendered/path/organizationService"; - const expectedParameters = { - organization: "organizationValue", - service: "serviceValue", - }; - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationServicePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationServicePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationServicePath', () => { - const result = client.organizationServicePath("organizationValue", "serviceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationServicePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationServiceName', () => { - const result = client.matchOrganizationFromOrganizationServiceName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationServicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromOrganizationServiceName', () => { - const result = client.matchServiceFromOrganizationServiceName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.organizationServicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('organizationNotificationChannel', async () => { + const fakePath = '/rendered/path/organizationNotificationChannel'; + const expectedParameters = { + organization: 'organizationValue', + notification_channel: 'notificationChannelValue', + }; + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.organizationNotificationChannelPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationNotificationChannelPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationNotificationChannelPath', () => { + const result = client.organizationNotificationChannelPath( + 'organizationValue', + 'notificationChannelValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationNotificationChannelPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchOrganizationFromOrganizationNotificationChannelName', () => { + const result = + client.matchOrganizationFromOrganizationNotificationChannelName( + fakePath, + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationNotificationChannelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchNotificationChannelFromOrganizationNotificationChannelName', () => { + const result = + client.matchNotificationChannelFromOrganizationNotificationChannelName( + fakePath, + ); + assert.strictEqual(result, 'notificationChannelValue'); + assert( + ( + client.pathTemplates.organizationNotificationChannelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('organizationServiceServiceLevelObjective', async () => { - const fakePath = "/rendered/path/organizationServiceServiceLevelObjective"; - const expectedParameters = { - organization: "organizationValue", - service: "serviceValue", - service_level_objective: "serviceLevelObjectiveValue", - }; - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationServiceServiceLevelObjectivePath', () => { - const result = client.organizationServiceServiceLevelObjectivePath("organizationValue", "serviceValue", "serviceLevelObjectiveValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationServiceServiceLevelObjectiveName', () => { - const result = client.matchOrganizationFromOrganizationServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromOrganizationServiceServiceLevelObjectiveName', () => { - const result = client.matchServiceFromOrganizationServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceLevelObjectiveFromOrganizationServiceServiceLevelObjectiveName', () => { - const result = client.matchServiceLevelObjectiveFromOrganizationServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "serviceLevelObjectiveValue"); - assert((client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('organizationService', async () => { + const fakePath = '/rendered/path/organizationService'; + const expectedParameters = { + organization: 'organizationValue', + service: 'serviceValue', + }; + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.organizationServicePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.organizationServicePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('organizationServicePath', () => { + const result = client.organizationServicePath( + 'organizationValue', + 'serviceValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationServicePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchOrganizationFromOrganizationServiceName', () => { + const result = + client.matchOrganizationFromOrganizationServiceName(fakePath); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationServicePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchServiceFromOrganizationServiceName', () => { + const result = client.matchServiceFromOrganizationServiceName(fakePath); + assert.strictEqual(result, 'serviceValue'); + assert( + ( + client.pathTemplates.organizationServicePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('organizationUptimeCheckConfig', async () => { - const fakePath = "/rendered/path/organizationUptimeCheckConfig"; - const expectedParameters = { - organization: "organizationValue", - uptime_check_config: "uptimeCheckConfigValue", - }; - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationUptimeCheckConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationUptimeCheckConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationUptimeCheckConfigPath', () => { - const result = client.organizationUptimeCheckConfigPath("organizationValue", "uptimeCheckConfigValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationUptimeCheckConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationUptimeCheckConfigName', () => { - const result = client.matchOrganizationFromOrganizationUptimeCheckConfigName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationUptimeCheckConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUptimeCheckConfigFromOrganizationUptimeCheckConfigName', () => { - const result = client.matchUptimeCheckConfigFromOrganizationUptimeCheckConfigName(fakePath); - assert.strictEqual(result, "uptimeCheckConfigValue"); - assert((client.pathTemplates.organizationUptimeCheckConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('organizationServiceServiceLevelObjective', async () => { + const fakePath = + '/rendered/path/organizationServiceServiceLevelObjective'; + const expectedParameters = { + organization: 'organizationValue', + service: 'serviceValue', + service_level_objective: 'serviceLevelObjectiveValue', + }; + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationServiceServiceLevelObjectivePath', () => { + const result = client.organizationServiceServiceLevelObjectivePath( + 'organizationValue', + 'serviceValue', + 'serviceLevelObjectiveValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .organizationServiceServiceLevelObjectivePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchOrganizationFromOrganizationServiceServiceLevelObjectiveName', () => { + const result = + client.matchOrganizationFromOrganizationServiceServiceLevelObjectiveName( + fakePath, + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates + .organizationServiceServiceLevelObjectivePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchServiceFromOrganizationServiceServiceLevelObjectiveName', () => { + const result = + client.matchServiceFromOrganizationServiceServiceLevelObjectiveName( + fakePath, + ); + assert.strictEqual(result, 'serviceValue'); + assert( + ( + client.pathTemplates + .organizationServiceServiceLevelObjectivePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchServiceLevelObjectiveFromOrganizationServiceServiceLevelObjectiveName', () => { + const result = + client.matchServiceLevelObjectiveFromOrganizationServiceServiceLevelObjectiveName( + fakePath, + ); + assert.strictEqual(result, 'serviceLevelObjectiveValue'); + assert( + ( + client.pathTemplates + .organizationServiceServiceLevelObjectivePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('project', async () => { - const fakePath = "/rendered/path/project"; - const expectedParameters = { - project: "projectValue", - }; - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectPath', () => { - const result = client.projectPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectName', () => { - const result = client.matchProjectFromProjectName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('organizationUptimeCheckConfig', async () => { + const fakePath = '/rendered/path/organizationUptimeCheckConfig'; + const expectedParameters = { + organization: 'organizationValue', + uptime_check_config: 'uptimeCheckConfigValue', + }; + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.organizationUptimeCheckConfigPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationUptimeCheckConfigPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationUptimeCheckConfigPath', () => { + const result = client.organizationUptimeCheckConfigPath( + 'organizationValue', + 'uptimeCheckConfigValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationUptimeCheckConfigPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchOrganizationFromOrganizationUptimeCheckConfigName', () => { + const result = + client.matchOrganizationFromOrganizationUptimeCheckConfigName( + fakePath, + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationUptimeCheckConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchUptimeCheckConfigFromOrganizationUptimeCheckConfigName', () => { + const result = + client.matchUptimeCheckConfigFromOrganizationUptimeCheckConfigName( + fakePath, + ); + assert.strictEqual(result, 'uptimeCheckConfigValue'); + assert( + ( + client.pathTemplates.organizationUptimeCheckConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('projectAlertPolicy', async () => { - const fakePath = "/rendered/path/projectAlertPolicy"; - const expectedParameters = { - project: "projectValue", - alert_policy: "alertPolicyValue", - }; - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectAlertPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAlertPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAlertPolicyPath', () => { - const result = client.projectAlertPolicyPath("projectValue", "alertPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAlertPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAlertPolicyName', () => { - const result = client.matchProjectFromProjectAlertPolicyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAlertPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAlertPolicyFromProjectAlertPolicyName', () => { - const result = client.matchAlertPolicyFromProjectAlertPolicyName(fakePath); - assert.strictEqual(result, "alertPolicyValue"); - assert((client.pathTemplates.projectAlertPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('project', async () => { + const fakePath = '/rendered/path/project'; + const expectedParameters = { + project: 'projectValue', + }; + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.projectPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectPath', () => { + const result = client.projectPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('projectAlertPolicyCondition', async () => { - const fakePath = "/rendered/path/projectAlertPolicyCondition"; - const expectedParameters = { - project: "projectValue", - alert_policy: "alertPolicyValue", - condition: "conditionValue", - }; - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectAlertPolicyConditionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAlertPolicyConditionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAlertPolicyConditionPath', () => { - const result = client.projectAlertPolicyConditionPath("projectValue", "alertPolicyValue", "conditionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAlertPolicyConditionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAlertPolicyConditionName', () => { - const result = client.matchProjectFromProjectAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAlertPolicyFromProjectAlertPolicyConditionName', () => { - const result = client.matchAlertPolicyFromProjectAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "alertPolicyValue"); - assert((client.pathTemplates.projectAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConditionFromProjectAlertPolicyConditionName', () => { - const result = client.matchConditionFromProjectAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "conditionValue"); - assert((client.pathTemplates.projectAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('projectAlertPolicy', async () => { + const fakePath = '/rendered/path/projectAlertPolicy'; + const expectedParameters = { + project: 'projectValue', + alert_policy: 'alertPolicyValue', + }; + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.projectAlertPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAlertPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAlertPolicyPath', () => { + const result = client.projectAlertPolicyPath( + 'projectValue', + 'alertPolicyValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAlertPolicyPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectAlertPolicyName', () => { + const result = client.matchProjectFromProjectAlertPolicyName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAlertPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchAlertPolicyFromProjectAlertPolicyName', () => { + const result = + client.matchAlertPolicyFromProjectAlertPolicyName(fakePath); + assert.strictEqual(result, 'alertPolicyValue'); + assert( + ( + client.pathTemplates.projectAlertPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('projectChannelDescriptor', async () => { - const fakePath = "/rendered/path/projectChannelDescriptor"; - const expectedParameters = { - project: "projectValue", - channel_descriptor: "channelDescriptorValue", - }; - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectChannelDescriptorPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectChannelDescriptorPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectChannelDescriptorPath', () => { - const result = client.projectChannelDescriptorPath("projectValue", "channelDescriptorValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectChannelDescriptorPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectChannelDescriptorName', () => { - const result = client.matchProjectFromProjectChannelDescriptorName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectChannelDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchChannelDescriptorFromProjectChannelDescriptorName', () => { - const result = client.matchChannelDescriptorFromProjectChannelDescriptorName(fakePath); - assert.strictEqual(result, "channelDescriptorValue"); - assert((client.pathTemplates.projectChannelDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('projectAlertPolicyCondition', async () => { + const fakePath = '/rendered/path/projectAlertPolicyCondition'; + const expectedParameters = { + project: 'projectValue', + alert_policy: 'alertPolicyValue', + condition: 'conditionValue', + }; + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.projectAlertPolicyConditionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAlertPolicyConditionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAlertPolicyConditionPath', () => { + const result = client.projectAlertPolicyConditionPath( + 'projectValue', + 'alertPolicyValue', + 'conditionValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAlertPolicyConditionPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectAlertPolicyConditionName', () => { + const result = + client.matchProjectFromProjectAlertPolicyConditionName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAlertPolicyConditionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchAlertPolicyFromProjectAlertPolicyConditionName', () => { + const result = + client.matchAlertPolicyFromProjectAlertPolicyConditionName(fakePath); + assert.strictEqual(result, 'alertPolicyValue'); + assert( + ( + client.pathTemplates.projectAlertPolicyConditionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchConditionFromProjectAlertPolicyConditionName', () => { + const result = + client.matchConditionFromProjectAlertPolicyConditionName(fakePath); + assert.strictEqual(result, 'conditionValue'); + assert( + ( + client.pathTemplates.projectAlertPolicyConditionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('projectGroup', async () => { - const fakePath = "/rendered/path/projectGroup"; - const expectedParameters = { - project: "projectValue", - group: "groupValue", - }; - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectGroupPath', () => { - const result = client.projectGroupPath("projectValue", "groupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectGroupName', () => { - const result = client.matchProjectFromProjectGroupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchGroupFromProjectGroupName', () => { - const result = client.matchGroupFromProjectGroupName(fakePath); - assert.strictEqual(result, "groupValue"); - assert((client.pathTemplates.projectGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('projectChannelDescriptor', async () => { + const fakePath = '/rendered/path/projectChannelDescriptor'; + const expectedParameters = { + project: 'projectValue', + channel_descriptor: 'channelDescriptorValue', + }; + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.projectChannelDescriptorPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectChannelDescriptorPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectChannelDescriptorPath', () => { + const result = client.projectChannelDescriptorPath( + 'projectValue', + 'channelDescriptorValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectChannelDescriptorPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectChannelDescriptorName', () => { + const result = + client.matchProjectFromProjectChannelDescriptorName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectChannelDescriptorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchChannelDescriptorFromProjectChannelDescriptorName', () => { + const result = + client.matchChannelDescriptorFromProjectChannelDescriptorName( + fakePath, + ); + assert.strictEqual(result, 'channelDescriptorValue'); + assert( + ( + client.pathTemplates.projectChannelDescriptorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('projectMetricDescriptor', async () => { - const fakePath = "/rendered/path/projectMetricDescriptor"; - const expectedParameters = { - project: "projectValue", - metric_descriptor: "metricDescriptorValue", - }; - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectMetricDescriptorPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectMetricDescriptorPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectMetricDescriptorPath', () => { - const result = client.projectMetricDescriptorPath("projectValue", "metricDescriptorValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectMetricDescriptorPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectMetricDescriptorName', () => { - const result = client.matchProjectFromProjectMetricDescriptorName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectMetricDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMetricDescriptorFromProjectMetricDescriptorName', () => { - const result = client.matchMetricDescriptorFromProjectMetricDescriptorName(fakePath); - assert.strictEqual(result, "metricDescriptorValue"); - assert((client.pathTemplates.projectMetricDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('projectGroup', async () => { + const fakePath = '/rendered/path/projectGroup'; + const expectedParameters = { + project: 'projectValue', + group: 'groupValue', + }; + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.projectGroupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectGroupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectGroupPath', () => { + const result = client.projectGroupPath('projectValue', 'groupValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectGroupPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectGroupName', () => { + const result = client.matchProjectFromProjectGroupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectGroupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchGroupFromProjectGroupName', () => { + const result = client.matchGroupFromProjectGroupName(fakePath); + assert.strictEqual(result, 'groupValue'); + assert( + (client.pathTemplates.projectGroupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('projectMonitoredResourceDescriptor', async () => { - const fakePath = "/rendered/path/projectMonitoredResourceDescriptor"; - const expectedParameters = { - project: "projectValue", - monitored_resource_descriptor: "monitoredResourceDescriptorValue", - }; - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectMonitoredResourceDescriptorPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectMonitoredResourceDescriptorPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectMonitoredResourceDescriptorPath', () => { - const result = client.projectMonitoredResourceDescriptorPath("projectValue", "monitoredResourceDescriptorValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectMonitoredResourceDescriptorPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectMonitoredResourceDescriptorName', () => { - const result = client.matchProjectFromProjectMonitoredResourceDescriptorName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectMonitoredResourceDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMonitoredResourceDescriptorFromProjectMonitoredResourceDescriptorName', () => { - const result = client.matchMonitoredResourceDescriptorFromProjectMonitoredResourceDescriptorName(fakePath); - assert.strictEqual(result, "monitoredResourceDescriptorValue"); - assert((client.pathTemplates.projectMonitoredResourceDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('projectMetricDescriptor', async () => { + const fakePath = '/rendered/path/projectMetricDescriptor'; + const expectedParameters = { + project: 'projectValue', + metric_descriptor: 'metricDescriptorValue', + }; + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.projectMetricDescriptorPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectMetricDescriptorPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectMetricDescriptorPath', () => { + const result = client.projectMetricDescriptorPath( + 'projectValue', + 'metricDescriptorValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectMetricDescriptorPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectMetricDescriptorName', () => { + const result = + client.matchProjectFromProjectMetricDescriptorName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectMetricDescriptorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchMetricDescriptorFromProjectMetricDescriptorName', () => { + const result = + client.matchMetricDescriptorFromProjectMetricDescriptorName(fakePath); + assert.strictEqual(result, 'metricDescriptorValue'); + assert( + ( + client.pathTemplates.projectMetricDescriptorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('projectNotificationChannel', async () => { - const fakePath = "/rendered/path/projectNotificationChannel"; - const expectedParameters = { - project: "projectValue", - notification_channel: "notificationChannelValue", - }; - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectNotificationChannelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectNotificationChannelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectNotificationChannelPath', () => { - const result = client.projectNotificationChannelPath("projectValue", "notificationChannelValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectNotificationChannelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectNotificationChannelName', () => { - const result = client.matchProjectFromProjectNotificationChannelName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectNotificationChannelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchNotificationChannelFromProjectNotificationChannelName', () => { - const result = client.matchNotificationChannelFromProjectNotificationChannelName(fakePath); - assert.strictEqual(result, "notificationChannelValue"); - assert((client.pathTemplates.projectNotificationChannelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('projectMonitoredResourceDescriptor', async () => { + const fakePath = '/rendered/path/projectMonitoredResourceDescriptor'; + const expectedParameters = { + project: 'projectValue', + monitored_resource_descriptor: 'monitoredResourceDescriptorValue', + }; + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.projectMonitoredResourceDescriptorPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectMonitoredResourceDescriptorPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectMonitoredResourceDescriptorPath', () => { + const result = client.projectMonitoredResourceDescriptorPath( + 'projectValue', + 'monitoredResourceDescriptorValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectMonitoredResourceDescriptorPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectMonitoredResourceDescriptorName', () => { + const result = + client.matchProjectFromProjectMonitoredResourceDescriptorName( + fakePath, + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectMonitoredResourceDescriptorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchMonitoredResourceDescriptorFromProjectMonitoredResourceDescriptorName', () => { + const result = + client.matchMonitoredResourceDescriptorFromProjectMonitoredResourceDescriptorName( + fakePath, + ); + assert.strictEqual(result, 'monitoredResourceDescriptorValue'); + assert( + ( + client.pathTemplates.projectMonitoredResourceDescriptorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('projectService', async () => { - const fakePath = "/rendered/path/projectService"; - const expectedParameters = { - project: "projectValue", - service: "serviceValue", - }; - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectServicePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectServicePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectServicePath', () => { - const result = client.projectServicePath("projectValue", "serviceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectServicePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectServiceName', () => { - const result = client.matchProjectFromProjectServiceName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectServicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromProjectServiceName', () => { - const result = client.matchServiceFromProjectServiceName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.projectServicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('projectNotificationChannel', async () => { + const fakePath = '/rendered/path/projectNotificationChannel'; + const expectedParameters = { + project: 'projectValue', + notification_channel: 'notificationChannelValue', + }; + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.projectNotificationChannelPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectNotificationChannelPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectNotificationChannelPath', () => { + const result = client.projectNotificationChannelPath( + 'projectValue', + 'notificationChannelValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectNotificationChannelPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectNotificationChannelName', () => { + const result = + client.matchProjectFromProjectNotificationChannelName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectNotificationChannelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchNotificationChannelFromProjectNotificationChannelName', () => { + const result = + client.matchNotificationChannelFromProjectNotificationChannelName( + fakePath, + ); + assert.strictEqual(result, 'notificationChannelValue'); + assert( + ( + client.pathTemplates.projectNotificationChannelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('projectServiceServiceLevelObjective', async () => { - const fakePath = "/rendered/path/projectServiceServiceLevelObjective"; - const expectedParameters = { - project: "projectValue", - service: "serviceValue", - service_level_objective: "serviceLevelObjectiveValue", - }; - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectServiceServiceLevelObjectivePath', () => { - const result = client.projectServiceServiceLevelObjectivePath("projectValue", "serviceValue", "serviceLevelObjectiveValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectServiceServiceLevelObjectiveName', () => { - const result = client.matchProjectFromProjectServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromProjectServiceServiceLevelObjectiveName', () => { - const result = client.matchServiceFromProjectServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceLevelObjectiveFromProjectServiceServiceLevelObjectiveName', () => { - const result = client.matchServiceLevelObjectiveFromProjectServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "serviceLevelObjectiveValue"); - assert((client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('projectService', async () => { + const fakePath = '/rendered/path/projectService'; + const expectedParameters = { + project: 'projectValue', + service: 'serviceValue', + }; + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.projectServicePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectServicePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectServicePath', () => { + const result = client.projectServicePath( + 'projectValue', + 'serviceValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectServicePathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectServiceName', () => { + const result = client.matchProjectFromProjectServiceName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectServicePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchServiceFromProjectServiceName', () => { + const result = client.matchServiceFromProjectServiceName(fakePath); + assert.strictEqual(result, 'serviceValue'); + assert( + (client.pathTemplates.projectServicePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('projectTimeSeries', async () => { - const fakePath = "/rendered/path/projectTimeSeries"; - const expectedParameters = { - project: "projectValue", - time_series: "timeSeriesValue", - }; - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectTimeSeriesPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectTimeSeriesPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectTimeSeriesPath', () => { - const result = client.projectTimeSeriesPath("projectValue", "timeSeriesValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectTimeSeriesPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectTimeSeriesName', () => { - const result = client.matchProjectFromProjectTimeSeriesName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectTimeSeriesPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchTimeSeriesFromProjectTimeSeriesName', () => { - const result = client.matchTimeSeriesFromProjectTimeSeriesName(fakePath); - assert.strictEqual(result, "timeSeriesValue"); - assert((client.pathTemplates.projectTimeSeriesPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('projectServiceServiceLevelObjective', async () => { + const fakePath = '/rendered/path/projectServiceServiceLevelObjective'; + const expectedParameters = { + project: 'projectValue', + service: 'serviceValue', + service_level_objective: 'serviceLevelObjectiveValue', + }; + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectServiceServiceLevelObjectivePath', () => { + const result = client.projectServiceServiceLevelObjectivePath( + 'projectValue', + 'serviceValue', + 'serviceLevelObjectiveValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectServiceServiceLevelObjectiveName', () => { + const result = + client.matchProjectFromProjectServiceServiceLevelObjectiveName( + fakePath, + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchServiceFromProjectServiceServiceLevelObjectiveName', () => { + const result = + client.matchServiceFromProjectServiceServiceLevelObjectiveName( + fakePath, + ); + assert.strictEqual(result, 'serviceValue'); + assert( + ( + client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchServiceLevelObjectiveFromProjectServiceServiceLevelObjectiveName', () => { + const result = + client.matchServiceLevelObjectiveFromProjectServiceServiceLevelObjectiveName( + fakePath, + ); + assert.strictEqual(result, 'serviceLevelObjectiveValue'); + assert( + ( + client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('projectUptimeCheckConfig', async () => { - const fakePath = "/rendered/path/projectUptimeCheckConfig"; - const expectedParameters = { - project: "projectValue", - uptime_check_config: "uptimeCheckConfigValue", - }; - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectUptimeCheckConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectUptimeCheckConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectUptimeCheckConfigPath', () => { - const result = client.projectUptimeCheckConfigPath("projectValue", "uptimeCheckConfigValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectUptimeCheckConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectUptimeCheckConfigName', () => { - const result = client.matchProjectFromProjectUptimeCheckConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectUptimeCheckConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUptimeCheckConfigFromProjectUptimeCheckConfigName', () => { - const result = client.matchUptimeCheckConfigFromProjectUptimeCheckConfigName(fakePath); - assert.strictEqual(result, "uptimeCheckConfigValue"); - assert((client.pathTemplates.projectUptimeCheckConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('projectTimeSeries', async () => { + const fakePath = '/rendered/path/projectTimeSeries'; + const expectedParameters = { + project: 'projectValue', + time_series: 'timeSeriesValue', + }; + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.projectTimeSeriesPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectTimeSeriesPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectTimeSeriesPath', () => { + const result = client.projectTimeSeriesPath( + 'projectValue', + 'timeSeriesValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectTimeSeriesPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectTimeSeriesName', () => { + const result = client.matchProjectFromProjectTimeSeriesName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectTimeSeriesPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchTimeSeriesFromProjectTimeSeriesName', () => { + const result = + client.matchTimeSeriesFromProjectTimeSeriesName(fakePath); + assert.strictEqual(result, 'timeSeriesValue'); + assert( + ( + client.pathTemplates.projectTimeSeriesPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('snooze', async () => { - const fakePath = "/rendered/path/snooze"; - const expectedParameters = { - project: "projectValue", - snooze: "snoozeValue", - }; - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.snoozePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.snoozePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('snoozePath', () => { - const result = client.snoozePath("projectValue", "snoozeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.snoozePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromSnoozeName', () => { - const result = client.matchProjectFromSnoozeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.snoozePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSnoozeFromSnoozeName', () => { - const result = client.matchSnoozeFromSnoozeName(fakePath); - assert.strictEqual(result, "snoozeValue"); - assert((client.pathTemplates.snoozePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('projectUptimeCheckConfig', async () => { + const fakePath = '/rendered/path/projectUptimeCheckConfig'; + const expectedParameters = { + project: 'projectValue', + uptime_check_config: 'uptimeCheckConfigValue', + }; + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.projectUptimeCheckConfigPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectUptimeCheckConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectUptimeCheckConfigPath', () => { + const result = client.projectUptimeCheckConfigPath( + 'projectValue', + 'uptimeCheckConfigValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectUptimeCheckConfigPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectUptimeCheckConfigName', () => { + const result = + client.matchProjectFromProjectUptimeCheckConfigName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectUptimeCheckConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchUptimeCheckConfigFromProjectUptimeCheckConfigName', () => { + const result = + client.matchUptimeCheckConfigFromProjectUptimeCheckConfigName( + fakePath, + ); + assert.strictEqual(result, 'uptimeCheckConfigValue'); + assert( + ( + client.pathTemplates.projectUptimeCheckConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('snooze', async () => { + const fakePath = '/rendered/path/snooze'; + const expectedParameters = { + project: 'projectValue', + snooze: 'snoozeValue', + }; + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.snoozePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.snoozePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('snoozePath', () => { + const result = client.snoozePath('projectValue', 'snoozeValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.snoozePathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromSnoozeName', () => { + const result = client.matchProjectFromSnoozeName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.snoozePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSnoozeFromSnoozeName', () => { + const result = client.matchSnoozeFromSnoozeName(fakePath); + assert.strictEqual(result, 'snoozeValue'); + assert( + (client.pathTemplates.snoozePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); }); + }); }); diff --git a/packages/google-cloud-monitoring/test/gapic_notification_channel_service_v3.ts b/packages/google-cloud-monitoring/test/gapic_notification_channel_service_v3.ts index d21f2d41032b..365476fdb8b0 100644 --- a/packages/google-cloud-monitoring/test/gapic_notification_channel_service_v3.ts +++ b/packages/google-cloud-monitoring/test/gapic_notification_channel_service_v3.ts @@ -19,2632 +19,4059 @@ 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 notificationchannelserviceModule 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 -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); +const root = protobuf.Root.fromJSON( + require('../protos/protos.json'), +).resolveAll(); // eslint-disable-next-line @typescript-eslint/no-unused-vars function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; } function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; + const filledObject = ( + instance.constructor as typeof protobuf.Message + ).toObject(instance as protobuf.Message, { defaults: true }); + return (instance.constructor as typeof protobuf.Message).fromObject( + filledObject, + ) as T; } function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); + return error + ? sinon.stub().rejects(error) + : sinon.stub().resolves([response]); } -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +function stubSimpleCallWithCallback( + response?: ResponseType, + error?: Error, +) { + return error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); } -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } +function stubPageStreamingCall( + responses?: ResponseType[], + error?: Error, +) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); + } + const transformStub = error + ? sinon.stub().callsArgWith(2, error) + : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { + mockStream.write({}); + }); } - return sinon.stub().returns(mockStream); + setImmediate(() => { + mockStream.end(); + }); + } else { + setImmediate(() => { + mockStream.write({}); + }); + setImmediate(() => { + mockStream.end(); + }); + } + return sinon.stub().returns(mockStream); } -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); +function stubAsyncIterationCall( + responses?: ResponseType[], + error?: Error, +) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({ done: true, value: undefined }); + } + return Promise.resolve({ done: false, value: responses![counter++] }); + }, + }; + }, + }; + return sinon.stub().returns(asyncIterable); } describe('v3.NotificationChannelServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'monitoring.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = notificationchannelserviceModule.v3.NotificationChannelServiceClient.servicePath; - assert.strictEqual(servicePath, 'monitoring.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = notificationchannelserviceModule.v3.NotificationChannelServiceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'monitoring.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'monitoring.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'monitoring.example.com'); - }); - - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'monitoring.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'monitoring.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new notificationchannelserviceModule.v3.NotificationChannelServiceClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); - - it('has port', () => { - const port = notificationchannelserviceModule.v3.NotificationChannelServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - fallback: true, - }); - assert(client); - }); + describe('Common methods', () => { + it('has apiEndpoint', () => { + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'monitoring.googleapis.com'); + }); - it('has initialize method and supports deferred initialization', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.notificationChannelServiceStub, undefined); - await client.initialize(); - assert(client.notificationChannelServiceStub); - }); + it('has universeDomain', () => { + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); - it('has close method for the initialized client', done => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.notificationChannelServiceStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + notificationchannelserviceModule.v3.NotificationChannelServiceClient + .servicePath; + assert.strictEqual(servicePath, 'monitoring.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + notificationchannelserviceModule.v3.NotificationChannelServiceClient + .apiEndpoint; + assert.strictEqual(apiEndpoint, 'monitoring.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { universeDomain: 'example.com' }, + ); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'monitoring.example.com'); + }); - it('has close method for the non-initialized client', done => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.notificationChannelServiceStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { universe_domain: 'example.com' }, + ); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'monitoring.example.com'); + }); - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); + if (typeof process === 'object' && 'env' in process) { + describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { + it('sets apiEndpoint from environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient(); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'monitoring.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } + }); + + it('value configured in code has priority over environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { universeDomain: 'configured.example.com' }, + ); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'monitoring.configured.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } + }); + }); + } + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { universe_domain: 'example.com', universeDomain: 'example.net' }, + ); + }); + }); - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); + it('has port', () => { + const port = + notificationchannelserviceModule.v3.NotificationChannelServiceClient + .port; + assert(port); + assert(typeof port === 'number'); }); - describe('getNotificationChannelDescriptor', () => { - it('invokes getNotificationChannelDescriptor without error', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.GetNotificationChannelDescriptorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.GetNotificationChannelDescriptorRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.monitoring.v3.NotificationChannelDescriptor() - ); - client.innerApiCalls.getNotificationChannelDescriptor = stubSimpleCall(expectedResponse); - const [response] = await client.getNotificationChannelDescriptor(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getNotificationChannelDescriptor as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getNotificationChannelDescriptor as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('should create a client with no option', () => { + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient(); + assert(client); + }); - it('invokes getNotificationChannelDescriptor without error using callback', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.GetNotificationChannelDescriptorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.GetNotificationChannelDescriptorRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.monitoring.v3.NotificationChannelDescriptor() - ); - client.innerApiCalls.getNotificationChannelDescriptor = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getNotificationChannelDescriptor( - request, - (err?: Error|null, result?: protos.google.monitoring.v3.INotificationChannelDescriptor|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getNotificationChannelDescriptor as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getNotificationChannelDescriptor as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('should create a client with gRPC fallback', () => { + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + fallback: true, + }, + ); + assert(client); + }); - it('invokes getNotificationChannelDescriptor with error', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.GetNotificationChannelDescriptorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.GetNotificationChannelDescriptorRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getNotificationChannelDescriptor = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getNotificationChannelDescriptor(request), expectedError); - const actualRequest = (client.innerApiCalls.getNotificationChannelDescriptor as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getNotificationChannelDescriptor as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('has initialize method and supports deferred initialization', async () => { + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + assert.strictEqual(client.notificationChannelServiceStub, undefined); + await client.initialize(); + assert(client.notificationChannelServiceStub); + }); - it('invokes getNotificationChannelDescriptor with closed client', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.GetNotificationChannelDescriptorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.GetNotificationChannelDescriptorRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getNotificationChannelDescriptor(request), expectedError); + it('has close method for the initialized client', (done) => { + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + client.initialize().catch((err) => { + throw err; + }); + assert(client.notificationChannelServiceStub); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; }); }); - describe('getNotificationChannel', () => { - it('invokes getNotificationChannel without error', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.GetNotificationChannelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.GetNotificationChannelRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.monitoring.v3.NotificationChannel() - ); - client.innerApiCalls.getNotificationChannel = stubSimpleCall(expectedResponse); - const [response] = await client.getNotificationChannel(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getNotificationChannel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getNotificationChannel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + it('has close method for the non-initialized client', (done) => { + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + assert.strictEqual(client.notificationChannelServiceStub, undefined); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; }); + }); - it('invokes getNotificationChannel without error using callback', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.GetNotificationChannelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.GetNotificationChannelRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.monitoring.v3.NotificationChannel() - ); - client.innerApiCalls.getNotificationChannel = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getNotificationChannel( - request, - (err?: Error|null, result?: protos.google.monitoring.v3.INotificationChannel|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getNotificationChannel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getNotificationChannel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); - it('invokes getNotificationChannel with error', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.GetNotificationChannelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.GetNotificationChannelRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getNotificationChannel = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getNotificationChannel(request), expectedError); - const actualRequest = (client.innerApiCalls.getNotificationChannel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getNotificationChannel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + }); + + describe('getNotificationChannelDescriptor', () => { + it('invokes getNotificationChannelDescriptor without error', async () => { + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.GetNotificationChannelDescriptorRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.GetNotificationChannelDescriptorRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.monitoring.v3.NotificationChannelDescriptor(), + ); + client.innerApiCalls.getNotificationChannelDescriptor = + stubSimpleCall(expectedResponse); + const [response] = await client.getNotificationChannelDescriptor(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getNotificationChannelDescriptor as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getNotificationChannelDescriptor as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getNotificationChannel with closed client', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.GetNotificationChannelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.GetNotificationChannelRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getNotificationChannel(request), expectedError); - }); + it('invokes getNotificationChannelDescriptor without error using callback', async () => { + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.GetNotificationChannelDescriptorRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.GetNotificationChannelDescriptorRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.monitoring.v3.NotificationChannelDescriptor(), + ); + client.innerApiCalls.getNotificationChannelDescriptor = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getNotificationChannelDescriptor( + request, + ( + err?: Error | null, + result?: protos.google.monitoring.v3.INotificationChannelDescriptor | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getNotificationChannelDescriptor as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getNotificationChannelDescriptor as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('createNotificationChannel', () => { - it('invokes createNotificationChannel without error', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.CreateNotificationChannelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.CreateNotificationChannelRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.monitoring.v3.NotificationChannel() - ); - client.innerApiCalls.createNotificationChannel = stubSimpleCall(expectedResponse); - const [response] = await client.createNotificationChannel(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createNotificationChannel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createNotificationChannel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getNotificationChannelDescriptor with error', async () => { + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.GetNotificationChannelDescriptorRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.GetNotificationChannelDescriptorRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getNotificationChannelDescriptor = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.getNotificationChannelDescriptor(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.getNotificationChannelDescriptor as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getNotificationChannelDescriptor as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createNotificationChannel without error using callback', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.CreateNotificationChannelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.CreateNotificationChannelRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.monitoring.v3.NotificationChannel() - ); - client.innerApiCalls.createNotificationChannel = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createNotificationChannel( - request, - (err?: Error|null, result?: protos.google.monitoring.v3.INotificationChannel|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createNotificationChannel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createNotificationChannel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getNotificationChannelDescriptor with closed client', async () => { + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.GetNotificationChannelDescriptorRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.GetNotificationChannelDescriptorRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects( + client.getNotificationChannelDescriptor(request), + expectedError, + ); + }); + }); + + describe('getNotificationChannel', () => { + it('invokes getNotificationChannel without error', async () => { + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.GetNotificationChannelRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.GetNotificationChannelRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.monitoring.v3.NotificationChannel(), + ); + client.innerApiCalls.getNotificationChannel = + stubSimpleCall(expectedResponse); + const [response] = await client.getNotificationChannel(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getNotificationChannel as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getNotificationChannel as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createNotificationChannel with error', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.CreateNotificationChannelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.CreateNotificationChannelRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createNotificationChannel = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createNotificationChannel(request), expectedError); - const actualRequest = (client.innerApiCalls.createNotificationChannel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createNotificationChannel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getNotificationChannel without error using callback', async () => { + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.GetNotificationChannelRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.GetNotificationChannelRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.monitoring.v3.NotificationChannel(), + ); + client.innerApiCalls.getNotificationChannel = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getNotificationChannel( + request, + ( + err?: Error | null, + result?: protos.google.monitoring.v3.INotificationChannel | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getNotificationChannel as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getNotificationChannel as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createNotificationChannel with closed client', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.CreateNotificationChannelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.CreateNotificationChannelRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.createNotificationChannel(request), expectedError); - }); + it('invokes getNotificationChannel with error', async () => { + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.GetNotificationChannelRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.GetNotificationChannelRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getNotificationChannel = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.getNotificationChannel(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.getNotificationChannel as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getNotificationChannel as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('updateNotificationChannel', () => { - it('invokes updateNotificationChannel without error', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.UpdateNotificationChannelRequest() - ); - request.notificationChannel ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.UpdateNotificationChannelRequest', ['notificationChannel', 'name']); - request.notificationChannel.name = defaultValue1; - const expectedHeaderRequestParams = `notification_channel.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.monitoring.v3.NotificationChannel() - ); - client.innerApiCalls.updateNotificationChannel = stubSimpleCall(expectedResponse); - const [response] = await client.updateNotificationChannel(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateNotificationChannel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateNotificationChannel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getNotificationChannel with closed client', async () => { + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.GetNotificationChannelRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.GetNotificationChannelRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects( + client.getNotificationChannel(request), + expectedError, + ); + }); + }); + + describe('createNotificationChannel', () => { + it('invokes createNotificationChannel without error', async () => { + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.CreateNotificationChannelRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.CreateNotificationChannelRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.monitoring.v3.NotificationChannel(), + ); + client.innerApiCalls.createNotificationChannel = + stubSimpleCall(expectedResponse); + const [response] = await client.createNotificationChannel(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createNotificationChannel as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createNotificationChannel as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateNotificationChannel without error using callback', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.UpdateNotificationChannelRequest() - ); - request.notificationChannel ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.UpdateNotificationChannelRequest', ['notificationChannel', 'name']); - request.notificationChannel.name = defaultValue1; - const expectedHeaderRequestParams = `notification_channel.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.monitoring.v3.NotificationChannel() - ); - client.innerApiCalls.updateNotificationChannel = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateNotificationChannel( - request, - (err?: Error|null, result?: protos.google.monitoring.v3.INotificationChannel|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateNotificationChannel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateNotificationChannel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createNotificationChannel without error using callback', async () => { + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.CreateNotificationChannelRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.CreateNotificationChannelRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.monitoring.v3.NotificationChannel(), + ); + client.innerApiCalls.createNotificationChannel = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createNotificationChannel( + request, + ( + err?: Error | null, + result?: protos.google.monitoring.v3.INotificationChannel | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createNotificationChannel as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createNotificationChannel as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateNotificationChannel with error', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.UpdateNotificationChannelRequest() - ); - request.notificationChannel ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.UpdateNotificationChannelRequest', ['notificationChannel', 'name']); - request.notificationChannel.name = defaultValue1; - const expectedHeaderRequestParams = `notification_channel.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateNotificationChannel = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateNotificationChannel(request), expectedError); - const actualRequest = (client.innerApiCalls.updateNotificationChannel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateNotificationChannel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createNotificationChannel with error', async () => { + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.CreateNotificationChannelRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.CreateNotificationChannelRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createNotificationChannel = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.createNotificationChannel(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.createNotificationChannel as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createNotificationChannel as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateNotificationChannel with closed client', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.UpdateNotificationChannelRequest() - ); - request.notificationChannel ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.UpdateNotificationChannelRequest', ['notificationChannel', 'name']); - request.notificationChannel.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.updateNotificationChannel(request), expectedError); - }); + it('invokes createNotificationChannel with closed client', async () => { + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.CreateNotificationChannelRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.CreateNotificationChannelRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects( + client.createNotificationChannel(request), + expectedError, + ); + }); + }); + + describe('updateNotificationChannel', () => { + it('invokes updateNotificationChannel without error', async () => { + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.UpdateNotificationChannelRequest(), + ); + request.notificationChannel ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.UpdateNotificationChannelRequest', + ['notificationChannel', 'name'], + ); + request.notificationChannel.name = defaultValue1; + const expectedHeaderRequestParams = `notification_channel.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.monitoring.v3.NotificationChannel(), + ); + client.innerApiCalls.updateNotificationChannel = + stubSimpleCall(expectedResponse); + const [response] = await client.updateNotificationChannel(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateNotificationChannel as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateNotificationChannel as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('deleteNotificationChannel', () => { - it('invokes deleteNotificationChannel without error', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.DeleteNotificationChannelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.DeleteNotificationChannelRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteNotificationChannel = stubSimpleCall(expectedResponse); - const [response] = await client.deleteNotificationChannel(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteNotificationChannel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteNotificationChannel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateNotificationChannel without error using callback', async () => { + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.UpdateNotificationChannelRequest(), + ); + request.notificationChannel ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.UpdateNotificationChannelRequest', + ['notificationChannel', 'name'], + ); + request.notificationChannel.name = defaultValue1; + const expectedHeaderRequestParams = `notification_channel.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.monitoring.v3.NotificationChannel(), + ); + client.innerApiCalls.updateNotificationChannel = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateNotificationChannel( + request, + ( + err?: Error | null, + result?: protos.google.monitoring.v3.INotificationChannel | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateNotificationChannel as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateNotificationChannel as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteNotificationChannel without error using callback', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.DeleteNotificationChannelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.DeleteNotificationChannelRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteNotificationChannel = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteNotificationChannel( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteNotificationChannel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteNotificationChannel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateNotificationChannel with error', async () => { + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.UpdateNotificationChannelRequest(), + ); + request.notificationChannel ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.UpdateNotificationChannelRequest', + ['notificationChannel', 'name'], + ); + request.notificationChannel.name = defaultValue1; + const expectedHeaderRequestParams = `notification_channel.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateNotificationChannel = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.updateNotificationChannel(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.updateNotificationChannel as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateNotificationChannel as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteNotificationChannel with error', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.DeleteNotificationChannelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.DeleteNotificationChannelRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteNotificationChannel = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteNotificationChannel(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteNotificationChannel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteNotificationChannel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateNotificationChannel with closed client', async () => { + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.UpdateNotificationChannelRequest(), + ); + request.notificationChannel ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.UpdateNotificationChannelRequest', + ['notificationChannel', 'name'], + ); + request.notificationChannel.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects( + client.updateNotificationChannel(request), + expectedError, + ); + }); + }); + + describe('deleteNotificationChannel', () => { + it('invokes deleteNotificationChannel without error', async () => { + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.DeleteNotificationChannelRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.DeleteNotificationChannelRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty(), + ); + client.innerApiCalls.deleteNotificationChannel = + stubSimpleCall(expectedResponse); + const [response] = await client.deleteNotificationChannel(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteNotificationChannel as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteNotificationChannel as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteNotificationChannel with closed client', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.DeleteNotificationChannelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.DeleteNotificationChannelRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.deleteNotificationChannel(request), expectedError); - }); + it('invokes deleteNotificationChannel without error using callback', async () => { + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.DeleteNotificationChannelRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.DeleteNotificationChannelRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty(), + ); + client.innerApiCalls.deleteNotificationChannel = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteNotificationChannel( + request, + ( + err?: Error | null, + result?: protos.google.protobuf.IEmpty | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteNotificationChannel as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteNotificationChannel as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('sendNotificationChannelVerificationCode', () => { - it('invokes sendNotificationChannelVerificationCode without error', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.SendNotificationChannelVerificationCodeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.SendNotificationChannelVerificationCodeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.sendNotificationChannelVerificationCode = stubSimpleCall(expectedResponse); - const [response] = await client.sendNotificationChannelVerificationCode(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.sendNotificationChannelVerificationCode as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.sendNotificationChannelVerificationCode as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteNotificationChannel with error', async () => { + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.DeleteNotificationChannelRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.DeleteNotificationChannelRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteNotificationChannel = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.deleteNotificationChannel(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.deleteNotificationChannel as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteNotificationChannel as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes sendNotificationChannelVerificationCode without error using callback', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.SendNotificationChannelVerificationCodeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.SendNotificationChannelVerificationCodeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.sendNotificationChannelVerificationCode = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.sendNotificationChannelVerificationCode( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.sendNotificationChannelVerificationCode as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.sendNotificationChannelVerificationCode as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteNotificationChannel with closed client', async () => { + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.DeleteNotificationChannelRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.DeleteNotificationChannelRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects( + client.deleteNotificationChannel(request), + expectedError, + ); + }); + }); + + describe('sendNotificationChannelVerificationCode', () => { + it('invokes sendNotificationChannelVerificationCode without error', async () => { + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.SendNotificationChannelVerificationCodeRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.SendNotificationChannelVerificationCodeRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty(), + ); + client.innerApiCalls.sendNotificationChannelVerificationCode = + stubSimpleCall(expectedResponse); + const [response] = + await client.sendNotificationChannelVerificationCode(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls + .sendNotificationChannelVerificationCode as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls + .sendNotificationChannelVerificationCode as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes sendNotificationChannelVerificationCode with error', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.SendNotificationChannelVerificationCodeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.SendNotificationChannelVerificationCodeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.sendNotificationChannelVerificationCode = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.sendNotificationChannelVerificationCode(request), expectedError); - const actualRequest = (client.innerApiCalls.sendNotificationChannelVerificationCode as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.sendNotificationChannelVerificationCode as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes sendNotificationChannelVerificationCode without error using callback', async () => { + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.SendNotificationChannelVerificationCodeRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.SendNotificationChannelVerificationCodeRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty(), + ); + client.innerApiCalls.sendNotificationChannelVerificationCode = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.sendNotificationChannelVerificationCode( + request, + ( + err?: Error | null, + result?: protos.google.protobuf.IEmpty | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls + .sendNotificationChannelVerificationCode as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls + .sendNotificationChannelVerificationCode as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes sendNotificationChannelVerificationCode with closed client', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.SendNotificationChannelVerificationCodeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.SendNotificationChannelVerificationCodeRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.sendNotificationChannelVerificationCode(request), expectedError); - }); + it('invokes sendNotificationChannelVerificationCode with error', async () => { + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.SendNotificationChannelVerificationCodeRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.SendNotificationChannelVerificationCodeRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.sendNotificationChannelVerificationCode = + stubSimpleCall(undefined, expectedError); + await assert.rejects( + client.sendNotificationChannelVerificationCode(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls + .sendNotificationChannelVerificationCode as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls + .sendNotificationChannelVerificationCode as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('getNotificationChannelVerificationCode', () => { - it('invokes getNotificationChannelVerificationCode without error', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.GetNotificationChannelVerificationCodeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.GetNotificationChannelVerificationCodeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.monitoring.v3.GetNotificationChannelVerificationCodeResponse() - ); - client.innerApiCalls.getNotificationChannelVerificationCode = stubSimpleCall(expectedResponse); - const [response] = await client.getNotificationChannelVerificationCode(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getNotificationChannelVerificationCode as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getNotificationChannelVerificationCode as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes sendNotificationChannelVerificationCode with closed client', async () => { + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.SendNotificationChannelVerificationCodeRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.SendNotificationChannelVerificationCodeRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects( + client.sendNotificationChannelVerificationCode(request), + expectedError, + ); + }); + }); + + describe('getNotificationChannelVerificationCode', () => { + it('invokes getNotificationChannelVerificationCode without error', async () => { + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.GetNotificationChannelVerificationCodeRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.GetNotificationChannelVerificationCodeRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.monitoring.v3.GetNotificationChannelVerificationCodeResponse(), + ); + client.innerApiCalls.getNotificationChannelVerificationCode = + stubSimpleCall(expectedResponse); + const [response] = + await client.getNotificationChannelVerificationCode(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getNotificationChannelVerificationCode as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getNotificationChannelVerificationCode as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getNotificationChannelVerificationCode without error using callback', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.GetNotificationChannelVerificationCodeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.GetNotificationChannelVerificationCodeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.monitoring.v3.GetNotificationChannelVerificationCodeResponse() - ); - client.innerApiCalls.getNotificationChannelVerificationCode = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getNotificationChannelVerificationCode( - request, - (err?: Error|null, result?: protos.google.monitoring.v3.IGetNotificationChannelVerificationCodeResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getNotificationChannelVerificationCode as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getNotificationChannelVerificationCode as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getNotificationChannelVerificationCode without error using callback', async () => { + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.GetNotificationChannelVerificationCodeRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.GetNotificationChannelVerificationCodeRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.monitoring.v3.GetNotificationChannelVerificationCodeResponse(), + ); + client.innerApiCalls.getNotificationChannelVerificationCode = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getNotificationChannelVerificationCode( + request, + ( + err?: Error | null, + result?: protos.google.monitoring.v3.IGetNotificationChannelVerificationCodeResponse | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getNotificationChannelVerificationCode as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getNotificationChannelVerificationCode as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getNotificationChannelVerificationCode with error', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.GetNotificationChannelVerificationCodeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.GetNotificationChannelVerificationCodeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getNotificationChannelVerificationCode = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getNotificationChannelVerificationCode(request), expectedError); - const actualRequest = (client.innerApiCalls.getNotificationChannelVerificationCode as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getNotificationChannelVerificationCode as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getNotificationChannelVerificationCode with error', async () => { + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.GetNotificationChannelVerificationCodeRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.GetNotificationChannelVerificationCodeRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getNotificationChannelVerificationCode = + stubSimpleCall(undefined, expectedError); + await assert.rejects( + client.getNotificationChannelVerificationCode(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.getNotificationChannelVerificationCode as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getNotificationChannelVerificationCode as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getNotificationChannelVerificationCode with closed client', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.GetNotificationChannelVerificationCodeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.GetNotificationChannelVerificationCodeRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getNotificationChannelVerificationCode(request), expectedError); - }); + it('invokes getNotificationChannelVerificationCode with closed client', async () => { + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.GetNotificationChannelVerificationCodeRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.GetNotificationChannelVerificationCodeRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects( + client.getNotificationChannelVerificationCode(request), + expectedError, + ); + }); + }); + + describe('verifyNotificationChannel', () => { + it('invokes verifyNotificationChannel without error', async () => { + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.VerifyNotificationChannelRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.VerifyNotificationChannelRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.monitoring.v3.NotificationChannel(), + ); + client.innerApiCalls.verifyNotificationChannel = + stubSimpleCall(expectedResponse); + const [response] = await client.verifyNotificationChannel(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.verifyNotificationChannel as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.verifyNotificationChannel as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('verifyNotificationChannel', () => { - it('invokes verifyNotificationChannel without error', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.VerifyNotificationChannelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.VerifyNotificationChannelRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.monitoring.v3.NotificationChannel() - ); - client.innerApiCalls.verifyNotificationChannel = stubSimpleCall(expectedResponse); - const [response] = await client.verifyNotificationChannel(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.verifyNotificationChannel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.verifyNotificationChannel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes verifyNotificationChannel without error using callback', async () => { + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.VerifyNotificationChannelRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.VerifyNotificationChannelRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.monitoring.v3.NotificationChannel(), + ); + client.innerApiCalls.verifyNotificationChannel = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.verifyNotificationChannel( + request, + ( + err?: Error | null, + result?: protos.google.monitoring.v3.INotificationChannel | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.verifyNotificationChannel as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.verifyNotificationChannel as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes verifyNotificationChannel without error using callback', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.VerifyNotificationChannelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.VerifyNotificationChannelRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.monitoring.v3.NotificationChannel() - ); - client.innerApiCalls.verifyNotificationChannel = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.verifyNotificationChannel( - request, - (err?: Error|null, result?: protos.google.monitoring.v3.INotificationChannel|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.verifyNotificationChannel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.verifyNotificationChannel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes verifyNotificationChannel with error', async () => { + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.VerifyNotificationChannelRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.VerifyNotificationChannelRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.verifyNotificationChannel = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.verifyNotificationChannel(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.verifyNotificationChannel as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.verifyNotificationChannel as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes verifyNotificationChannel with error', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.VerifyNotificationChannelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.VerifyNotificationChannelRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.verifyNotificationChannel = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.verifyNotificationChannel(request), expectedError); - const actualRequest = (client.innerApiCalls.verifyNotificationChannel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.verifyNotificationChannel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes verifyNotificationChannel with closed client', async () => { + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.VerifyNotificationChannelRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.VerifyNotificationChannelRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects( + client.verifyNotificationChannel(request), + expectedError, + ); + }); + }); + + describe('listNotificationChannelDescriptors', () => { + it('invokes listNotificationChannelDescriptors without error', async () => { + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListNotificationChannelDescriptorsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.ListNotificationChannelDescriptorsRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.monitoring.v3.NotificationChannelDescriptor(), + ), + generateSampleMessage( + new protos.google.monitoring.v3.NotificationChannelDescriptor(), + ), + generateSampleMessage( + new protos.google.monitoring.v3.NotificationChannelDescriptor(), + ), + ]; + client.innerApiCalls.listNotificationChannelDescriptors = + stubSimpleCall(expectedResponse); + const [response] = + await client.listNotificationChannelDescriptors(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listNotificationChannelDescriptors as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listNotificationChannelDescriptors as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes verifyNotificationChannel with closed client', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.VerifyNotificationChannelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.VerifyNotificationChannelRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.verifyNotificationChannel(request), expectedError); - }); + it('invokes listNotificationChannelDescriptors without error using callback', async () => { + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListNotificationChannelDescriptorsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.ListNotificationChannelDescriptorsRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.monitoring.v3.NotificationChannelDescriptor(), + ), + generateSampleMessage( + new protos.google.monitoring.v3.NotificationChannelDescriptor(), + ), + generateSampleMessage( + new protos.google.monitoring.v3.NotificationChannelDescriptor(), + ), + ]; + client.innerApiCalls.listNotificationChannelDescriptors = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listNotificationChannelDescriptors( + request, + ( + err?: Error | null, + result?: + | protos.google.monitoring.v3.INotificationChannelDescriptor[] + | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listNotificationChannelDescriptors as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listNotificationChannelDescriptors as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('listNotificationChannelDescriptors', () => { - it('invokes listNotificationChannelDescriptors without error', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListNotificationChannelDescriptorsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListNotificationChannelDescriptorsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.monitoring.v3.NotificationChannelDescriptor()), - generateSampleMessage(new protos.google.monitoring.v3.NotificationChannelDescriptor()), - generateSampleMessage(new protos.google.monitoring.v3.NotificationChannelDescriptor()), - ]; - client.innerApiCalls.listNotificationChannelDescriptors = stubSimpleCall(expectedResponse); - const [response] = await client.listNotificationChannelDescriptors(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listNotificationChannelDescriptors as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listNotificationChannelDescriptors as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listNotificationChannelDescriptors with error', async () => { + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListNotificationChannelDescriptorsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.ListNotificationChannelDescriptorsRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listNotificationChannelDescriptors = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.listNotificationChannelDescriptors(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.listNotificationChannelDescriptors as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listNotificationChannelDescriptors as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes listNotificationChannelDescriptors without error using callback', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListNotificationChannelDescriptorsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListNotificationChannelDescriptorsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.monitoring.v3.NotificationChannelDescriptor()), - generateSampleMessage(new protos.google.monitoring.v3.NotificationChannelDescriptor()), - generateSampleMessage(new protos.google.monitoring.v3.NotificationChannelDescriptor()), - ]; - client.innerApiCalls.listNotificationChannelDescriptors = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listNotificationChannelDescriptors( - request, - (err?: Error|null, result?: protos.google.monitoring.v3.INotificationChannelDescriptor[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listNotificationChannelDescriptors as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listNotificationChannelDescriptors as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listNotificationChannelDescriptorsStream without error', async () => { + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListNotificationChannelDescriptorsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.ListNotificationChannelDescriptorsRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.monitoring.v3.NotificationChannelDescriptor(), + ), + generateSampleMessage( + new protos.google.monitoring.v3.NotificationChannelDescriptor(), + ), + generateSampleMessage( + new protos.google.monitoring.v3.NotificationChannelDescriptor(), + ), + ]; + client.descriptors.page.listNotificationChannelDescriptors.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listNotificationChannelDescriptorsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.monitoring.v3.NotificationChannelDescriptor[] = + []; + stream.on( + 'data', + ( + response: protos.google.monitoring.v3.NotificationChannelDescriptor, + ) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + ( + client.descriptors.page.listNotificationChannelDescriptors + .createStream as SinonStub + ) + .getCall(0) + .calledWith( + client.innerApiCalls.listNotificationChannelDescriptors, + request, + ), + ); + assert( + ( + client.descriptors.page.listNotificationChannelDescriptors + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('invokes listNotificationChannelDescriptors with error', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListNotificationChannelDescriptorsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListNotificationChannelDescriptorsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listNotificationChannelDescriptors = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listNotificationChannelDescriptors(request), expectedError); - const actualRequest = (client.innerApiCalls.listNotificationChannelDescriptors as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listNotificationChannelDescriptors as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listNotificationChannelDescriptorsStream with error', async () => { + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListNotificationChannelDescriptorsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.ListNotificationChannelDescriptorsRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listNotificationChannelDescriptors.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listNotificationChannelDescriptorsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.monitoring.v3.NotificationChannelDescriptor[] = + []; + stream.on( + 'data', + ( + response: protos.google.monitoring.v3.NotificationChannelDescriptor, + ) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + ( + client.descriptors.page.listNotificationChannelDescriptors + .createStream as SinonStub + ) + .getCall(0) + .calledWith( + client.innerApiCalls.listNotificationChannelDescriptors, + request, + ), + ); + assert( + ( + client.descriptors.page.listNotificationChannelDescriptors + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('invokes listNotificationChannelDescriptorsStream without error', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListNotificationChannelDescriptorsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListNotificationChannelDescriptorsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.monitoring.v3.NotificationChannelDescriptor()), - generateSampleMessage(new protos.google.monitoring.v3.NotificationChannelDescriptor()), - generateSampleMessage(new protos.google.monitoring.v3.NotificationChannelDescriptor()), - ]; - client.descriptors.page.listNotificationChannelDescriptors.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listNotificationChannelDescriptorsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.monitoring.v3.NotificationChannelDescriptor[] = []; - stream.on('data', (response: protos.google.monitoring.v3.NotificationChannelDescriptor) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listNotificationChannelDescriptors.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listNotificationChannelDescriptors, request)); - assert( - (client.descriptors.page.listNotificationChannelDescriptors.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listNotificationChannelDescriptors without error', async () => { + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListNotificationChannelDescriptorsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.ListNotificationChannelDescriptorsRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.monitoring.v3.NotificationChannelDescriptor(), + ), + generateSampleMessage( + new protos.google.monitoring.v3.NotificationChannelDescriptor(), + ), + generateSampleMessage( + new protos.google.monitoring.v3.NotificationChannelDescriptor(), + ), + ]; + client.descriptors.page.listNotificationChannelDescriptors.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.monitoring.v3.INotificationChannelDescriptor[] = + []; + const iterable = client.listNotificationChannelDescriptorsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listNotificationChannelDescriptors + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.descriptors.page.listNotificationChannelDescriptors + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('invokes listNotificationChannelDescriptorsStream with error', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListNotificationChannelDescriptorsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListNotificationChannelDescriptorsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listNotificationChannelDescriptors.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listNotificationChannelDescriptorsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.monitoring.v3.NotificationChannelDescriptor[] = []; - stream.on('data', (response: protos.google.monitoring.v3.NotificationChannelDescriptor) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listNotificationChannelDescriptors.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listNotificationChannelDescriptors, request)); - assert( - (client.descriptors.page.listNotificationChannelDescriptors.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listNotificationChannelDescriptors with error', async () => { + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListNotificationChannelDescriptorsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.ListNotificationChannelDescriptorsRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listNotificationChannelDescriptors.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listNotificationChannelDescriptorsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.monitoring.v3.INotificationChannelDescriptor[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listNotificationChannelDescriptors + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.descriptors.page.listNotificationChannelDescriptors + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + }); + + describe('listNotificationChannels', () => { + it('invokes listNotificationChannels without error', async () => { + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListNotificationChannelsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.ListNotificationChannelsRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.monitoring.v3.NotificationChannel(), + ), + generateSampleMessage( + new protos.google.monitoring.v3.NotificationChannel(), + ), + generateSampleMessage( + new protos.google.monitoring.v3.NotificationChannel(), + ), + ]; + client.innerApiCalls.listNotificationChannels = + stubSimpleCall(expectedResponse); + const [response] = await client.listNotificationChannels(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listNotificationChannels as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listNotificationChannels as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('uses async iteration with listNotificationChannelDescriptors without error', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListNotificationChannelDescriptorsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListNotificationChannelDescriptorsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.monitoring.v3.NotificationChannelDescriptor()), - generateSampleMessage(new protos.google.monitoring.v3.NotificationChannelDescriptor()), - generateSampleMessage(new protos.google.monitoring.v3.NotificationChannelDescriptor()), - ]; - client.descriptors.page.listNotificationChannelDescriptors.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.monitoring.v3.INotificationChannelDescriptor[] = []; - const iterable = client.listNotificationChannelDescriptorsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); + it('invokes listNotificationChannels without error using callback', async () => { + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListNotificationChannelsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.ListNotificationChannelsRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.monitoring.v3.NotificationChannel(), + ), + generateSampleMessage( + new protos.google.monitoring.v3.NotificationChannel(), + ), + generateSampleMessage( + new protos.google.monitoring.v3.NotificationChannel(), + ), + ]; + client.innerApiCalls.listNotificationChannels = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listNotificationChannels( + request, + ( + err?: Error | null, + result?: protos.google.monitoring.v3.INotificationChannel[] | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listNotificationChannelDescriptors.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listNotificationChannelDescriptors.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listNotificationChannelDescriptors with error', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListNotificationChannelDescriptorsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListNotificationChannelDescriptorsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listNotificationChannelDescriptors.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listNotificationChannelDescriptorsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.monitoring.v3.INotificationChannelDescriptor[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listNotificationChannelDescriptors.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listNotificationChannelDescriptors.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listNotificationChannels as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listNotificationChannels as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('listNotificationChannels', () => { - it('invokes listNotificationChannels without error', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListNotificationChannelsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListNotificationChannelsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.monitoring.v3.NotificationChannel()), - generateSampleMessage(new protos.google.monitoring.v3.NotificationChannel()), - generateSampleMessage(new protos.google.monitoring.v3.NotificationChannel()), - ]; - client.innerApiCalls.listNotificationChannels = stubSimpleCall(expectedResponse); - const [response] = await client.listNotificationChannels(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listNotificationChannels as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listNotificationChannels as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listNotificationChannels without error using callback', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListNotificationChannelsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListNotificationChannelsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.monitoring.v3.NotificationChannel()), - generateSampleMessage(new protos.google.monitoring.v3.NotificationChannel()), - generateSampleMessage(new protos.google.monitoring.v3.NotificationChannel()), - ]; - client.innerApiCalls.listNotificationChannels = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listNotificationChannels( - request, - (err?: Error|null, result?: protos.google.monitoring.v3.INotificationChannel[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listNotificationChannels as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listNotificationChannels as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listNotificationChannels with error', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListNotificationChannelsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListNotificationChannelsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listNotificationChannels = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listNotificationChannels(request), expectedError); - const actualRequest = (client.innerApiCalls.listNotificationChannels as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listNotificationChannels as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listNotificationChannelsStream without error', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListNotificationChannelsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListNotificationChannelsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.monitoring.v3.NotificationChannel()), - generateSampleMessage(new protos.google.monitoring.v3.NotificationChannel()), - generateSampleMessage(new protos.google.monitoring.v3.NotificationChannel()), - ]; - client.descriptors.page.listNotificationChannels.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listNotificationChannelsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.monitoring.v3.NotificationChannel[] = []; - stream.on('data', (response: protos.google.monitoring.v3.NotificationChannel) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listNotificationChannels.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listNotificationChannels, request)); - assert( - (client.descriptors.page.listNotificationChannels.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('invokes listNotificationChannels with error', async () => { + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListNotificationChannelsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.ListNotificationChannelsRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listNotificationChannels = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.listNotificationChannels(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.listNotificationChannels as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listNotificationChannels as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes listNotificationChannelsStream with error', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListNotificationChannelsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListNotificationChannelsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listNotificationChannels.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listNotificationChannelsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.monitoring.v3.NotificationChannel[] = []; - stream.on('data', (response: protos.google.monitoring.v3.NotificationChannel) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listNotificationChannels.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listNotificationChannels, request)); - assert( - (client.descriptors.page.listNotificationChannels.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('invokes listNotificationChannelsStream without error', async () => { + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListNotificationChannelsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.ListNotificationChannelsRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.monitoring.v3.NotificationChannel(), + ), + generateSampleMessage( + new protos.google.monitoring.v3.NotificationChannel(), + ), + generateSampleMessage( + new protos.google.monitoring.v3.NotificationChannel(), + ), + ]; + client.descriptors.page.listNotificationChannels.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listNotificationChannelsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.monitoring.v3.NotificationChannel[] = []; + stream.on( + 'data', + (response: protos.google.monitoring.v3.NotificationChannel) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + ( + client.descriptors.page.listNotificationChannels + .createStream as SinonStub + ) + .getCall(0) + .calledWith(client.innerApiCalls.listNotificationChannels, request), + ); + assert( + ( + client.descriptors.page.listNotificationChannels + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('uses async iteration with listNotificationChannels without error', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListNotificationChannelsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListNotificationChannelsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.monitoring.v3.NotificationChannel()), - generateSampleMessage(new protos.google.monitoring.v3.NotificationChannel()), - generateSampleMessage(new protos.google.monitoring.v3.NotificationChannel()), - ]; - client.descriptors.page.listNotificationChannels.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.monitoring.v3.INotificationChannel[] = []; - const iterable = client.listNotificationChannelsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listNotificationChannels.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listNotificationChannels.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('invokes listNotificationChannelsStream with error', async () => { + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListNotificationChannelsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.ListNotificationChannelsRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listNotificationChannels.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listNotificationChannelsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.monitoring.v3.NotificationChannel[] = []; + stream.on( + 'data', + (response: protos.google.monitoring.v3.NotificationChannel) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + ( + client.descriptors.page.listNotificationChannels + .createStream as SinonStub + ) + .getCall(0) + .calledWith(client.innerApiCalls.listNotificationChannels, request), + ); + assert( + ( + client.descriptors.page.listNotificationChannels + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('uses async iteration with listNotificationChannels with error', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListNotificationChannelsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListNotificationChannelsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listNotificationChannels.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listNotificationChannelsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.monitoring.v3.INotificationChannel[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listNotificationChannels.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listNotificationChannels.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listNotificationChannels without error', async () => { + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListNotificationChannelsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.ListNotificationChannelsRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.monitoring.v3.NotificationChannel(), + ), + generateSampleMessage( + new protos.google.monitoring.v3.NotificationChannel(), + ), + generateSampleMessage( + new protos.google.monitoring.v3.NotificationChannel(), + ), + ]; + client.descriptors.page.listNotificationChannels.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.monitoring.v3.INotificationChannel[] = []; + const iterable = client.listNotificationChannelsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listNotificationChannels + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.descriptors.page.listNotificationChannels + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); }); - describe('Path templates', () => { - - describe('folderAlertPolicy', async () => { - const fakePath = "/rendered/path/folderAlertPolicy"; - const expectedParameters = { - folder: "folderValue", - alert_policy: "alertPolicyValue", - }; - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.folderAlertPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderAlertPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderAlertPolicyPath', () => { - const result = client.folderAlertPolicyPath("folderValue", "alertPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderAlertPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderAlertPolicyName', () => { - const result = client.matchFolderFromFolderAlertPolicyName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderAlertPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAlertPolicyFromFolderAlertPolicyName', () => { - const result = client.matchAlertPolicyFromFolderAlertPolicyName(fakePath); - assert.strictEqual(result, "alertPolicyValue"); - assert((client.pathTemplates.folderAlertPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + it('uses async iteration with listNotificationChannels with error', async () => { + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListNotificationChannelsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.ListNotificationChannelsRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listNotificationChannels.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listNotificationChannelsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.monitoring.v3.INotificationChannel[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listNotificationChannels + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.descriptors.page.listNotificationChannels + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + }); + + describe('Path templates', () => { + describe('folderAlertPolicy', async () => { + const fakePath = '/rendered/path/folderAlertPolicy'; + const expectedParameters = { + folder: 'folderValue', + alert_policy: 'alertPolicyValue', + }; + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.folderAlertPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.folderAlertPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('folderAlertPolicyPath', () => { + const result = client.folderAlertPolicyPath( + 'folderValue', + 'alertPolicyValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.folderAlertPolicyPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchFolderFromFolderAlertPolicyName', () => { + const result = client.matchFolderFromFolderAlertPolicyName(fakePath); + assert.strictEqual(result, 'folderValue'); + assert( + ( + client.pathTemplates.folderAlertPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchAlertPolicyFromFolderAlertPolicyName', () => { + const result = + client.matchAlertPolicyFromFolderAlertPolicyName(fakePath); + assert.strictEqual(result, 'alertPolicyValue'); + assert( + ( + client.pathTemplates.folderAlertPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('folderAlertPolicyCondition', async () => { - const fakePath = "/rendered/path/folderAlertPolicyCondition"; - const expectedParameters = { - folder: "folderValue", - alert_policy: "alertPolicyValue", - condition: "conditionValue", - }; - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.folderAlertPolicyConditionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderAlertPolicyConditionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderAlertPolicyConditionPath', () => { - const result = client.folderAlertPolicyConditionPath("folderValue", "alertPolicyValue", "conditionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderAlertPolicyConditionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderAlertPolicyConditionName', () => { - const result = client.matchFolderFromFolderAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAlertPolicyFromFolderAlertPolicyConditionName', () => { - const result = client.matchAlertPolicyFromFolderAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "alertPolicyValue"); - assert((client.pathTemplates.folderAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConditionFromFolderAlertPolicyConditionName', () => { - const result = client.matchConditionFromFolderAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "conditionValue"); - assert((client.pathTemplates.folderAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('folderAlertPolicyCondition', async () => { + const fakePath = '/rendered/path/folderAlertPolicyCondition'; + const expectedParameters = { + folder: 'folderValue', + alert_policy: 'alertPolicyValue', + condition: 'conditionValue', + }; + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.folderAlertPolicyConditionPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.folderAlertPolicyConditionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('folderAlertPolicyConditionPath', () => { + const result = client.folderAlertPolicyConditionPath( + 'folderValue', + 'alertPolicyValue', + 'conditionValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.folderAlertPolicyConditionPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchFolderFromFolderAlertPolicyConditionName', () => { + const result = + client.matchFolderFromFolderAlertPolicyConditionName(fakePath); + assert.strictEqual(result, 'folderValue'); + assert( + ( + client.pathTemplates.folderAlertPolicyConditionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchAlertPolicyFromFolderAlertPolicyConditionName', () => { + const result = + client.matchAlertPolicyFromFolderAlertPolicyConditionName(fakePath); + assert.strictEqual(result, 'alertPolicyValue'); + assert( + ( + client.pathTemplates.folderAlertPolicyConditionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchConditionFromFolderAlertPolicyConditionName', () => { + const result = + client.matchConditionFromFolderAlertPolicyConditionName(fakePath); + assert.strictEqual(result, 'conditionValue'); + assert( + ( + client.pathTemplates.folderAlertPolicyConditionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('folderChannelDescriptor', async () => { - const fakePath = "/rendered/path/folderChannelDescriptor"; - const expectedParameters = { - folder: "folderValue", - channel_descriptor: "channelDescriptorValue", - }; - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.folderChannelDescriptorPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderChannelDescriptorPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderChannelDescriptorPath', () => { - const result = client.folderChannelDescriptorPath("folderValue", "channelDescriptorValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderChannelDescriptorPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderChannelDescriptorName', () => { - const result = client.matchFolderFromFolderChannelDescriptorName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderChannelDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchChannelDescriptorFromFolderChannelDescriptorName', () => { - const result = client.matchChannelDescriptorFromFolderChannelDescriptorName(fakePath); - assert.strictEqual(result, "channelDescriptorValue"); - assert((client.pathTemplates.folderChannelDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('folderChannelDescriptor', async () => { + const fakePath = '/rendered/path/folderChannelDescriptor'; + const expectedParameters = { + folder: 'folderValue', + channel_descriptor: 'channelDescriptorValue', + }; + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.folderChannelDescriptorPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.folderChannelDescriptorPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('folderChannelDescriptorPath', () => { + const result = client.folderChannelDescriptorPath( + 'folderValue', + 'channelDescriptorValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.folderChannelDescriptorPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchFolderFromFolderChannelDescriptorName', () => { + const result = + client.matchFolderFromFolderChannelDescriptorName(fakePath); + assert.strictEqual(result, 'folderValue'); + assert( + ( + client.pathTemplates.folderChannelDescriptorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchChannelDescriptorFromFolderChannelDescriptorName', () => { + const result = + client.matchChannelDescriptorFromFolderChannelDescriptorName( + fakePath, + ); + assert.strictEqual(result, 'channelDescriptorValue'); + assert( + ( + client.pathTemplates.folderChannelDescriptorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('folderGroup', async () => { - const fakePath = "/rendered/path/folderGroup"; - const expectedParameters = { - folder: "folderValue", - group: "groupValue", - }; - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.folderGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderGroupPath', () => { - const result = client.folderGroupPath("folderValue", "groupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderGroupName', () => { - const result = client.matchFolderFromFolderGroupName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchGroupFromFolderGroupName', () => { - const result = client.matchGroupFromFolderGroupName(fakePath); - assert.strictEqual(result, "groupValue"); - assert((client.pathTemplates.folderGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('folderGroup', async () => { + const fakePath = '/rendered/path/folderGroup'; + const expectedParameters = { + folder: 'folderValue', + group: 'groupValue', + }; + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.folderGroupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.folderGroupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('folderGroupPath', () => { + const result = client.folderGroupPath('folderValue', 'groupValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.folderGroupPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchFolderFromFolderGroupName', () => { + const result = client.matchFolderFromFolderGroupName(fakePath); + assert.strictEqual(result, 'folderValue'); + assert( + (client.pathTemplates.folderGroupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchGroupFromFolderGroupName', () => { + const result = client.matchGroupFromFolderGroupName(fakePath); + assert.strictEqual(result, 'groupValue'); + assert( + (client.pathTemplates.folderGroupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('folderNotificationChannel', async () => { - const fakePath = "/rendered/path/folderNotificationChannel"; - const expectedParameters = { - folder: "folderValue", - notification_channel: "notificationChannelValue", - }; - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.folderNotificationChannelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderNotificationChannelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderNotificationChannelPath', () => { - const result = client.folderNotificationChannelPath("folderValue", "notificationChannelValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderNotificationChannelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderNotificationChannelName', () => { - const result = client.matchFolderFromFolderNotificationChannelName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderNotificationChannelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchNotificationChannelFromFolderNotificationChannelName', () => { - const result = client.matchNotificationChannelFromFolderNotificationChannelName(fakePath); - assert.strictEqual(result, "notificationChannelValue"); - assert((client.pathTemplates.folderNotificationChannelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('folderNotificationChannel', async () => { + const fakePath = '/rendered/path/folderNotificationChannel'; + const expectedParameters = { + folder: 'folderValue', + notification_channel: 'notificationChannelValue', + }; + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.folderNotificationChannelPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.folderNotificationChannelPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('folderNotificationChannelPath', () => { + const result = client.folderNotificationChannelPath( + 'folderValue', + 'notificationChannelValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.folderNotificationChannelPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchFolderFromFolderNotificationChannelName', () => { + const result = + client.matchFolderFromFolderNotificationChannelName(fakePath); + assert.strictEqual(result, 'folderValue'); + assert( + ( + client.pathTemplates.folderNotificationChannelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchNotificationChannelFromFolderNotificationChannelName', () => { + const result = + client.matchNotificationChannelFromFolderNotificationChannelName( + fakePath, + ); + assert.strictEqual(result, 'notificationChannelValue'); + assert( + ( + client.pathTemplates.folderNotificationChannelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('folderService', async () => { - const fakePath = "/rendered/path/folderService"; - const expectedParameters = { - folder: "folderValue", - service: "serviceValue", - }; - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.folderServicePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderServicePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderServicePath', () => { - const result = client.folderServicePath("folderValue", "serviceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderServicePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderServiceName', () => { - const result = client.matchFolderFromFolderServiceName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderServicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromFolderServiceName', () => { - const result = client.matchServiceFromFolderServiceName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.folderServicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('folderService', async () => { + const fakePath = '/rendered/path/folderService'; + const expectedParameters = { + folder: 'folderValue', + service: 'serviceValue', + }; + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.folderServicePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.folderServicePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('folderServicePath', () => { + const result = client.folderServicePath('folderValue', 'serviceValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.folderServicePathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchFolderFromFolderServiceName', () => { + const result = client.matchFolderFromFolderServiceName(fakePath); + assert.strictEqual(result, 'folderValue'); + assert( + (client.pathTemplates.folderServicePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchServiceFromFolderServiceName', () => { + const result = client.matchServiceFromFolderServiceName(fakePath); + assert.strictEqual(result, 'serviceValue'); + assert( + (client.pathTemplates.folderServicePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('folderServiceServiceLevelObjective', async () => { - const fakePath = "/rendered/path/folderServiceServiceLevelObjective"; - const expectedParameters = { - folder: "folderValue", - service: "serviceValue", - service_level_objective: "serviceLevelObjectiveValue", - }; - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderServiceServiceLevelObjectivePath', () => { - const result = client.folderServiceServiceLevelObjectivePath("folderValue", "serviceValue", "serviceLevelObjectiveValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderServiceServiceLevelObjectiveName', () => { - const result = client.matchFolderFromFolderServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromFolderServiceServiceLevelObjectiveName', () => { - const result = client.matchServiceFromFolderServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceLevelObjectiveFromFolderServiceServiceLevelObjectiveName', () => { - const result = client.matchServiceLevelObjectiveFromFolderServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "serviceLevelObjectiveValue"); - assert((client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('folderServiceServiceLevelObjective', async () => { + const fakePath = '/rendered/path/folderServiceServiceLevelObjective'; + const expectedParameters = { + folder: 'folderValue', + service: 'serviceValue', + service_level_objective: 'serviceLevelObjectiveValue', + }; + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('folderServiceServiceLevelObjectivePath', () => { + const result = client.folderServiceServiceLevelObjectivePath( + 'folderValue', + 'serviceValue', + 'serviceLevelObjectiveValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchFolderFromFolderServiceServiceLevelObjectiveName', () => { + const result = + client.matchFolderFromFolderServiceServiceLevelObjectiveName( + fakePath, + ); + assert.strictEqual(result, 'folderValue'); + assert( + ( + client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchServiceFromFolderServiceServiceLevelObjectiveName', () => { + const result = + client.matchServiceFromFolderServiceServiceLevelObjectiveName( + fakePath, + ); + assert.strictEqual(result, 'serviceValue'); + assert( + ( + client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchServiceLevelObjectiveFromFolderServiceServiceLevelObjectiveName', () => { + const result = + client.matchServiceLevelObjectiveFromFolderServiceServiceLevelObjectiveName( + fakePath, + ); + assert.strictEqual(result, 'serviceLevelObjectiveValue'); + assert( + ( + client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('folderUptimeCheckConfig', async () => { - const fakePath = "/rendered/path/folderUptimeCheckConfig"; - const expectedParameters = { - folder: "folderValue", - uptime_check_config: "uptimeCheckConfigValue", - }; - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.folderUptimeCheckConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderUptimeCheckConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderUptimeCheckConfigPath', () => { - const result = client.folderUptimeCheckConfigPath("folderValue", "uptimeCheckConfigValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderUptimeCheckConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderUptimeCheckConfigName', () => { - const result = client.matchFolderFromFolderUptimeCheckConfigName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderUptimeCheckConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUptimeCheckConfigFromFolderUptimeCheckConfigName', () => { - const result = client.matchUptimeCheckConfigFromFolderUptimeCheckConfigName(fakePath); - assert.strictEqual(result, "uptimeCheckConfigValue"); - assert((client.pathTemplates.folderUptimeCheckConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('folderUptimeCheckConfig', async () => { + const fakePath = '/rendered/path/folderUptimeCheckConfig'; + const expectedParameters = { + folder: 'folderValue', + uptime_check_config: 'uptimeCheckConfigValue', + }; + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.folderUptimeCheckConfigPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.folderUptimeCheckConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('folderUptimeCheckConfigPath', () => { + const result = client.folderUptimeCheckConfigPath( + 'folderValue', + 'uptimeCheckConfigValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.folderUptimeCheckConfigPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchFolderFromFolderUptimeCheckConfigName', () => { + const result = + client.matchFolderFromFolderUptimeCheckConfigName(fakePath); + assert.strictEqual(result, 'folderValue'); + assert( + ( + client.pathTemplates.folderUptimeCheckConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchUptimeCheckConfigFromFolderUptimeCheckConfigName', () => { + const result = + client.matchUptimeCheckConfigFromFolderUptimeCheckConfigName( + fakePath, + ); + assert.strictEqual(result, 'uptimeCheckConfigValue'); + assert( + ( + client.pathTemplates.folderUptimeCheckConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('organizationAlertPolicy', async () => { - const fakePath = "/rendered/path/organizationAlertPolicy"; - const expectedParameters = { - organization: "organizationValue", - alert_policy: "alertPolicyValue", - }; - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationAlertPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationAlertPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationAlertPolicyPath', () => { - const result = client.organizationAlertPolicyPath("organizationValue", "alertPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationAlertPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationAlertPolicyName', () => { - const result = client.matchOrganizationFromOrganizationAlertPolicyName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationAlertPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAlertPolicyFromOrganizationAlertPolicyName', () => { - const result = client.matchAlertPolicyFromOrganizationAlertPolicyName(fakePath); - assert.strictEqual(result, "alertPolicyValue"); - assert((client.pathTemplates.organizationAlertPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('organizationAlertPolicy', async () => { + const fakePath = '/rendered/path/organizationAlertPolicy'; + const expectedParameters = { + organization: 'organizationValue', + alert_policy: 'alertPolicyValue', + }; + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.organizationAlertPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.organizationAlertPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('organizationAlertPolicyPath', () => { + const result = client.organizationAlertPolicyPath( + 'organizationValue', + 'alertPolicyValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationAlertPolicyPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchOrganizationFromOrganizationAlertPolicyName', () => { + const result = + client.matchOrganizationFromOrganizationAlertPolicyName(fakePath); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationAlertPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchAlertPolicyFromOrganizationAlertPolicyName', () => { + const result = + client.matchAlertPolicyFromOrganizationAlertPolicyName(fakePath); + assert.strictEqual(result, 'alertPolicyValue'); + assert( + ( + client.pathTemplates.organizationAlertPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('organizationAlertPolicyCondition', async () => { - const fakePath = "/rendered/path/organizationAlertPolicyCondition"; - const expectedParameters = { - organization: "organizationValue", - alert_policy: "alertPolicyValue", - condition: "conditionValue", - }; - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationAlertPolicyConditionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationAlertPolicyConditionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationAlertPolicyConditionPath', () => { - const result = client.organizationAlertPolicyConditionPath("organizationValue", "alertPolicyValue", "conditionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationAlertPolicyConditionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationAlertPolicyConditionName', () => { - const result = client.matchOrganizationFromOrganizationAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAlertPolicyFromOrganizationAlertPolicyConditionName', () => { - const result = client.matchAlertPolicyFromOrganizationAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "alertPolicyValue"); - assert((client.pathTemplates.organizationAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConditionFromOrganizationAlertPolicyConditionName', () => { - const result = client.matchConditionFromOrganizationAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "conditionValue"); - assert((client.pathTemplates.organizationAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('organizationAlertPolicyCondition', async () => { + const fakePath = '/rendered/path/organizationAlertPolicyCondition'; + const expectedParameters = { + organization: 'organizationValue', + alert_policy: 'alertPolicyValue', + condition: 'conditionValue', + }; + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.organizationAlertPolicyConditionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationAlertPolicyConditionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationAlertPolicyConditionPath', () => { + const result = client.organizationAlertPolicyConditionPath( + 'organizationValue', + 'alertPolicyValue', + 'conditionValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationAlertPolicyConditionPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchOrganizationFromOrganizationAlertPolicyConditionName', () => { + const result = + client.matchOrganizationFromOrganizationAlertPolicyConditionName( + fakePath, + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationAlertPolicyConditionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchAlertPolicyFromOrganizationAlertPolicyConditionName', () => { + const result = + client.matchAlertPolicyFromOrganizationAlertPolicyConditionName( + fakePath, + ); + assert.strictEqual(result, 'alertPolicyValue'); + assert( + ( + client.pathTemplates.organizationAlertPolicyConditionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchConditionFromOrganizationAlertPolicyConditionName', () => { + const result = + client.matchConditionFromOrganizationAlertPolicyConditionName( + fakePath, + ); + assert.strictEqual(result, 'conditionValue'); + assert( + ( + client.pathTemplates.organizationAlertPolicyConditionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('organizationChannelDescriptor', async () => { - const fakePath = "/rendered/path/organizationChannelDescriptor"; - const expectedParameters = { - organization: "organizationValue", - channel_descriptor: "channelDescriptorValue", - }; - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationChannelDescriptorPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationChannelDescriptorPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationChannelDescriptorPath', () => { - const result = client.organizationChannelDescriptorPath("organizationValue", "channelDescriptorValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationChannelDescriptorPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationChannelDescriptorName', () => { - const result = client.matchOrganizationFromOrganizationChannelDescriptorName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationChannelDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchChannelDescriptorFromOrganizationChannelDescriptorName', () => { - const result = client.matchChannelDescriptorFromOrganizationChannelDescriptorName(fakePath); - assert.strictEqual(result, "channelDescriptorValue"); - assert((client.pathTemplates.organizationChannelDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('organizationChannelDescriptor', async () => { + const fakePath = '/rendered/path/organizationChannelDescriptor'; + const expectedParameters = { + organization: 'organizationValue', + channel_descriptor: 'channelDescriptorValue', + }; + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.organizationChannelDescriptorPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationChannelDescriptorPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationChannelDescriptorPath', () => { + const result = client.organizationChannelDescriptorPath( + 'organizationValue', + 'channelDescriptorValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationChannelDescriptorPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchOrganizationFromOrganizationChannelDescriptorName', () => { + const result = + client.matchOrganizationFromOrganizationChannelDescriptorName( + fakePath, + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationChannelDescriptorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchChannelDescriptorFromOrganizationChannelDescriptorName', () => { + const result = + client.matchChannelDescriptorFromOrganizationChannelDescriptorName( + fakePath, + ); + assert.strictEqual(result, 'channelDescriptorValue'); + assert( + ( + client.pathTemplates.organizationChannelDescriptorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('organizationGroup', async () => { - const fakePath = "/rendered/path/organizationGroup"; - const expectedParameters = { - organization: "organizationValue", - group: "groupValue", - }; - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationGroupPath', () => { - const result = client.organizationGroupPath("organizationValue", "groupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationGroupName', () => { - const result = client.matchOrganizationFromOrganizationGroupName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchGroupFromOrganizationGroupName', () => { - const result = client.matchGroupFromOrganizationGroupName(fakePath); - assert.strictEqual(result, "groupValue"); - assert((client.pathTemplates.organizationGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('organizationGroup', async () => { + const fakePath = '/rendered/path/organizationGroup'; + const expectedParameters = { + organization: 'organizationValue', + group: 'groupValue', + }; + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.organizationGroupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.organizationGroupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('organizationGroupPath', () => { + const result = client.organizationGroupPath( + 'organizationValue', + 'groupValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchOrganizationFromOrganizationGroupName', () => { + const result = + client.matchOrganizationFromOrganizationGroupName(fakePath); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchGroupFromOrganizationGroupName', () => { + const result = client.matchGroupFromOrganizationGroupName(fakePath); + assert.strictEqual(result, 'groupValue'); + assert( + ( + client.pathTemplates.organizationGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('organizationNotificationChannel', async () => { - const fakePath = "/rendered/path/organizationNotificationChannel"; - const expectedParameters = { - organization: "organizationValue", - notification_channel: "notificationChannelValue", - }; - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationNotificationChannelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationNotificationChannelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationNotificationChannelPath', () => { - const result = client.organizationNotificationChannelPath("organizationValue", "notificationChannelValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationNotificationChannelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationNotificationChannelName', () => { - const result = client.matchOrganizationFromOrganizationNotificationChannelName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationNotificationChannelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchNotificationChannelFromOrganizationNotificationChannelName', () => { - const result = client.matchNotificationChannelFromOrganizationNotificationChannelName(fakePath); - assert.strictEqual(result, "notificationChannelValue"); - assert((client.pathTemplates.organizationNotificationChannelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('organizationNotificationChannel', async () => { + const fakePath = '/rendered/path/organizationNotificationChannel'; + const expectedParameters = { + organization: 'organizationValue', + notification_channel: 'notificationChannelValue', + }; + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.organizationNotificationChannelPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationNotificationChannelPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationNotificationChannelPath', () => { + const result = client.organizationNotificationChannelPath( + 'organizationValue', + 'notificationChannelValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationNotificationChannelPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchOrganizationFromOrganizationNotificationChannelName', () => { + const result = + client.matchOrganizationFromOrganizationNotificationChannelName( + fakePath, + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationNotificationChannelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchNotificationChannelFromOrganizationNotificationChannelName', () => { + const result = + client.matchNotificationChannelFromOrganizationNotificationChannelName( + fakePath, + ); + assert.strictEqual(result, 'notificationChannelValue'); + assert( + ( + client.pathTemplates.organizationNotificationChannelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('organizationService', async () => { - const fakePath = "/rendered/path/organizationService"; - const expectedParameters = { - organization: "organizationValue", - service: "serviceValue", - }; - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationServicePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationServicePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationServicePath', () => { - const result = client.organizationServicePath("organizationValue", "serviceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationServicePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationServiceName', () => { - const result = client.matchOrganizationFromOrganizationServiceName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationServicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromOrganizationServiceName', () => { - const result = client.matchServiceFromOrganizationServiceName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.organizationServicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('organizationService', async () => { + const fakePath = '/rendered/path/organizationService'; + const expectedParameters = { + organization: 'organizationValue', + service: 'serviceValue', + }; + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.organizationServicePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.organizationServicePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('organizationServicePath', () => { + const result = client.organizationServicePath( + 'organizationValue', + 'serviceValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationServicePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchOrganizationFromOrganizationServiceName', () => { + const result = + client.matchOrganizationFromOrganizationServiceName(fakePath); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationServicePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchServiceFromOrganizationServiceName', () => { + const result = client.matchServiceFromOrganizationServiceName(fakePath); + assert.strictEqual(result, 'serviceValue'); + assert( + ( + client.pathTemplates.organizationServicePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('organizationServiceServiceLevelObjective', async () => { - const fakePath = "/rendered/path/organizationServiceServiceLevelObjective"; - const expectedParameters = { - organization: "organizationValue", - service: "serviceValue", - service_level_objective: "serviceLevelObjectiveValue", - }; - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationServiceServiceLevelObjectivePath', () => { - const result = client.organizationServiceServiceLevelObjectivePath("organizationValue", "serviceValue", "serviceLevelObjectiveValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationServiceServiceLevelObjectiveName', () => { - const result = client.matchOrganizationFromOrganizationServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromOrganizationServiceServiceLevelObjectiveName', () => { - const result = client.matchServiceFromOrganizationServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceLevelObjectiveFromOrganizationServiceServiceLevelObjectiveName', () => { - const result = client.matchServiceLevelObjectiveFromOrganizationServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "serviceLevelObjectiveValue"); - assert((client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('organizationServiceServiceLevelObjective', async () => { + const fakePath = + '/rendered/path/organizationServiceServiceLevelObjective'; + const expectedParameters = { + organization: 'organizationValue', + service: 'serviceValue', + service_level_objective: 'serviceLevelObjectiveValue', + }; + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationServiceServiceLevelObjectivePath', () => { + const result = client.organizationServiceServiceLevelObjectivePath( + 'organizationValue', + 'serviceValue', + 'serviceLevelObjectiveValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .organizationServiceServiceLevelObjectivePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchOrganizationFromOrganizationServiceServiceLevelObjectiveName', () => { + const result = + client.matchOrganizationFromOrganizationServiceServiceLevelObjectiveName( + fakePath, + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates + .organizationServiceServiceLevelObjectivePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchServiceFromOrganizationServiceServiceLevelObjectiveName', () => { + const result = + client.matchServiceFromOrganizationServiceServiceLevelObjectiveName( + fakePath, + ); + assert.strictEqual(result, 'serviceValue'); + assert( + ( + client.pathTemplates + .organizationServiceServiceLevelObjectivePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchServiceLevelObjectiveFromOrganizationServiceServiceLevelObjectiveName', () => { + const result = + client.matchServiceLevelObjectiveFromOrganizationServiceServiceLevelObjectiveName( + fakePath, + ); + assert.strictEqual(result, 'serviceLevelObjectiveValue'); + assert( + ( + client.pathTemplates + .organizationServiceServiceLevelObjectivePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('organizationUptimeCheckConfig', async () => { - const fakePath = "/rendered/path/organizationUptimeCheckConfig"; - const expectedParameters = { - organization: "organizationValue", - uptime_check_config: "uptimeCheckConfigValue", - }; - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationUptimeCheckConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationUptimeCheckConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationUptimeCheckConfigPath', () => { - const result = client.organizationUptimeCheckConfigPath("organizationValue", "uptimeCheckConfigValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationUptimeCheckConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationUptimeCheckConfigName', () => { - const result = client.matchOrganizationFromOrganizationUptimeCheckConfigName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationUptimeCheckConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUptimeCheckConfigFromOrganizationUptimeCheckConfigName', () => { - const result = client.matchUptimeCheckConfigFromOrganizationUptimeCheckConfigName(fakePath); - assert.strictEqual(result, "uptimeCheckConfigValue"); - assert((client.pathTemplates.organizationUptimeCheckConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('organizationUptimeCheckConfig', async () => { + const fakePath = '/rendered/path/organizationUptimeCheckConfig'; + const expectedParameters = { + organization: 'organizationValue', + uptime_check_config: 'uptimeCheckConfigValue', + }; + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.organizationUptimeCheckConfigPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationUptimeCheckConfigPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationUptimeCheckConfigPath', () => { + const result = client.organizationUptimeCheckConfigPath( + 'organizationValue', + 'uptimeCheckConfigValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationUptimeCheckConfigPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchOrganizationFromOrganizationUptimeCheckConfigName', () => { + const result = + client.matchOrganizationFromOrganizationUptimeCheckConfigName( + fakePath, + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationUptimeCheckConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchUptimeCheckConfigFromOrganizationUptimeCheckConfigName', () => { + const result = + client.matchUptimeCheckConfigFromOrganizationUptimeCheckConfigName( + fakePath, + ); + assert.strictEqual(result, 'uptimeCheckConfigValue'); + assert( + ( + client.pathTemplates.organizationUptimeCheckConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('project', async () => { - const fakePath = "/rendered/path/project"; - const expectedParameters = { - project: "projectValue", - }; - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectPath', () => { - const result = client.projectPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectName', () => { - const result = client.matchProjectFromProjectName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('project', async () => { + const fakePath = '/rendered/path/project'; + const expectedParameters = { + project: 'projectValue', + }; + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.projectPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectPath', () => { + const result = client.projectPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('projectAlertPolicy', async () => { - const fakePath = "/rendered/path/projectAlertPolicy"; - const expectedParameters = { - project: "projectValue", - alert_policy: "alertPolicyValue", - }; - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectAlertPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAlertPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAlertPolicyPath', () => { - const result = client.projectAlertPolicyPath("projectValue", "alertPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAlertPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAlertPolicyName', () => { - const result = client.matchProjectFromProjectAlertPolicyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAlertPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAlertPolicyFromProjectAlertPolicyName', () => { - const result = client.matchAlertPolicyFromProjectAlertPolicyName(fakePath); - assert.strictEqual(result, "alertPolicyValue"); - assert((client.pathTemplates.projectAlertPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('projectAlertPolicy', async () => { + const fakePath = '/rendered/path/projectAlertPolicy'; + const expectedParameters = { + project: 'projectValue', + alert_policy: 'alertPolicyValue', + }; + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.projectAlertPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAlertPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAlertPolicyPath', () => { + const result = client.projectAlertPolicyPath( + 'projectValue', + 'alertPolicyValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAlertPolicyPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectAlertPolicyName', () => { + const result = client.matchProjectFromProjectAlertPolicyName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAlertPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchAlertPolicyFromProjectAlertPolicyName', () => { + const result = + client.matchAlertPolicyFromProjectAlertPolicyName(fakePath); + assert.strictEqual(result, 'alertPolicyValue'); + assert( + ( + client.pathTemplates.projectAlertPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('projectAlertPolicyCondition', async () => { - const fakePath = "/rendered/path/projectAlertPolicyCondition"; - const expectedParameters = { - project: "projectValue", - alert_policy: "alertPolicyValue", - condition: "conditionValue", - }; - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectAlertPolicyConditionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAlertPolicyConditionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAlertPolicyConditionPath', () => { - const result = client.projectAlertPolicyConditionPath("projectValue", "alertPolicyValue", "conditionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAlertPolicyConditionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAlertPolicyConditionName', () => { - const result = client.matchProjectFromProjectAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAlertPolicyFromProjectAlertPolicyConditionName', () => { - const result = client.matchAlertPolicyFromProjectAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "alertPolicyValue"); - assert((client.pathTemplates.projectAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConditionFromProjectAlertPolicyConditionName', () => { - const result = client.matchConditionFromProjectAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "conditionValue"); - assert((client.pathTemplates.projectAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('projectAlertPolicyCondition', async () => { + const fakePath = '/rendered/path/projectAlertPolicyCondition'; + const expectedParameters = { + project: 'projectValue', + alert_policy: 'alertPolicyValue', + condition: 'conditionValue', + }; + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.projectAlertPolicyConditionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAlertPolicyConditionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAlertPolicyConditionPath', () => { + const result = client.projectAlertPolicyConditionPath( + 'projectValue', + 'alertPolicyValue', + 'conditionValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAlertPolicyConditionPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectAlertPolicyConditionName', () => { + const result = + client.matchProjectFromProjectAlertPolicyConditionName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAlertPolicyConditionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchAlertPolicyFromProjectAlertPolicyConditionName', () => { + const result = + client.matchAlertPolicyFromProjectAlertPolicyConditionName(fakePath); + assert.strictEqual(result, 'alertPolicyValue'); + assert( + ( + client.pathTemplates.projectAlertPolicyConditionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchConditionFromProjectAlertPolicyConditionName', () => { + const result = + client.matchConditionFromProjectAlertPolicyConditionName(fakePath); + assert.strictEqual(result, 'conditionValue'); + assert( + ( + client.pathTemplates.projectAlertPolicyConditionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('projectChannelDescriptor', async () => { - const fakePath = "/rendered/path/projectChannelDescriptor"; - const expectedParameters = { - project: "projectValue", - channel_descriptor: "channelDescriptorValue", - }; - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectChannelDescriptorPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectChannelDescriptorPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectChannelDescriptorPath', () => { - const result = client.projectChannelDescriptorPath("projectValue", "channelDescriptorValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectChannelDescriptorPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectChannelDescriptorName', () => { - const result = client.matchProjectFromProjectChannelDescriptorName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectChannelDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchChannelDescriptorFromProjectChannelDescriptorName', () => { - const result = client.matchChannelDescriptorFromProjectChannelDescriptorName(fakePath); - assert.strictEqual(result, "channelDescriptorValue"); - assert((client.pathTemplates.projectChannelDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('projectChannelDescriptor', async () => { + const fakePath = '/rendered/path/projectChannelDescriptor'; + const expectedParameters = { + project: 'projectValue', + channel_descriptor: 'channelDescriptorValue', + }; + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.projectChannelDescriptorPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectChannelDescriptorPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectChannelDescriptorPath', () => { + const result = client.projectChannelDescriptorPath( + 'projectValue', + 'channelDescriptorValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectChannelDescriptorPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectChannelDescriptorName', () => { + const result = + client.matchProjectFromProjectChannelDescriptorName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectChannelDescriptorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchChannelDescriptorFromProjectChannelDescriptorName', () => { + const result = + client.matchChannelDescriptorFromProjectChannelDescriptorName( + fakePath, + ); + assert.strictEqual(result, 'channelDescriptorValue'); + assert( + ( + client.pathTemplates.projectChannelDescriptorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('projectGroup', async () => { - const fakePath = "/rendered/path/projectGroup"; - const expectedParameters = { - project: "projectValue", - group: "groupValue", - }; - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectGroupPath', () => { - const result = client.projectGroupPath("projectValue", "groupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectGroupName', () => { - const result = client.matchProjectFromProjectGroupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchGroupFromProjectGroupName', () => { - const result = client.matchGroupFromProjectGroupName(fakePath); - assert.strictEqual(result, "groupValue"); - assert((client.pathTemplates.projectGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('projectGroup', async () => { + const fakePath = '/rendered/path/projectGroup'; + const expectedParameters = { + project: 'projectValue', + group: 'groupValue', + }; + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.projectGroupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectGroupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectGroupPath', () => { + const result = client.projectGroupPath('projectValue', 'groupValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectGroupPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectGroupName', () => { + const result = client.matchProjectFromProjectGroupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectGroupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchGroupFromProjectGroupName', () => { + const result = client.matchGroupFromProjectGroupName(fakePath); + assert.strictEqual(result, 'groupValue'); + assert( + (client.pathTemplates.projectGroupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('projectNotificationChannel', async () => { - const fakePath = "/rendered/path/projectNotificationChannel"; - const expectedParameters = { - project: "projectValue", - notification_channel: "notificationChannelValue", - }; - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectNotificationChannelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectNotificationChannelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectNotificationChannelPath', () => { - const result = client.projectNotificationChannelPath("projectValue", "notificationChannelValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectNotificationChannelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectNotificationChannelName', () => { - const result = client.matchProjectFromProjectNotificationChannelName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectNotificationChannelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchNotificationChannelFromProjectNotificationChannelName', () => { - const result = client.matchNotificationChannelFromProjectNotificationChannelName(fakePath); - assert.strictEqual(result, "notificationChannelValue"); - assert((client.pathTemplates.projectNotificationChannelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('projectNotificationChannel', async () => { + const fakePath = '/rendered/path/projectNotificationChannel'; + const expectedParameters = { + project: 'projectValue', + notification_channel: 'notificationChannelValue', + }; + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.projectNotificationChannelPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectNotificationChannelPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectNotificationChannelPath', () => { + const result = client.projectNotificationChannelPath( + 'projectValue', + 'notificationChannelValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectNotificationChannelPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectNotificationChannelName', () => { + const result = + client.matchProjectFromProjectNotificationChannelName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectNotificationChannelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchNotificationChannelFromProjectNotificationChannelName', () => { + const result = + client.matchNotificationChannelFromProjectNotificationChannelName( + fakePath, + ); + assert.strictEqual(result, 'notificationChannelValue'); + assert( + ( + client.pathTemplates.projectNotificationChannelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('projectService', async () => { - const fakePath = "/rendered/path/projectService"; - const expectedParameters = { - project: "projectValue", - service: "serviceValue", - }; - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectServicePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectServicePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectServicePath', () => { - const result = client.projectServicePath("projectValue", "serviceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectServicePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectServiceName', () => { - const result = client.matchProjectFromProjectServiceName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectServicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromProjectServiceName', () => { - const result = client.matchServiceFromProjectServiceName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.projectServicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('projectService', async () => { + const fakePath = '/rendered/path/projectService'; + const expectedParameters = { + project: 'projectValue', + service: 'serviceValue', + }; + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.projectServicePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectServicePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectServicePath', () => { + const result = client.projectServicePath( + 'projectValue', + 'serviceValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectServicePathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectServiceName', () => { + const result = client.matchProjectFromProjectServiceName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectServicePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchServiceFromProjectServiceName', () => { + const result = client.matchServiceFromProjectServiceName(fakePath); + assert.strictEqual(result, 'serviceValue'); + assert( + (client.pathTemplates.projectServicePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('projectServiceServiceLevelObjective', async () => { - const fakePath = "/rendered/path/projectServiceServiceLevelObjective"; - const expectedParameters = { - project: "projectValue", - service: "serviceValue", - service_level_objective: "serviceLevelObjectiveValue", - }; - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectServiceServiceLevelObjectivePath', () => { - const result = client.projectServiceServiceLevelObjectivePath("projectValue", "serviceValue", "serviceLevelObjectiveValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectServiceServiceLevelObjectiveName', () => { - const result = client.matchProjectFromProjectServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromProjectServiceServiceLevelObjectiveName', () => { - const result = client.matchServiceFromProjectServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceLevelObjectiveFromProjectServiceServiceLevelObjectiveName', () => { - const result = client.matchServiceLevelObjectiveFromProjectServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "serviceLevelObjectiveValue"); - assert((client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('projectServiceServiceLevelObjective', async () => { + const fakePath = '/rendered/path/projectServiceServiceLevelObjective'; + const expectedParameters = { + project: 'projectValue', + service: 'serviceValue', + service_level_objective: 'serviceLevelObjectiveValue', + }; + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectServiceServiceLevelObjectivePath', () => { + const result = client.projectServiceServiceLevelObjectivePath( + 'projectValue', + 'serviceValue', + 'serviceLevelObjectiveValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectServiceServiceLevelObjectiveName', () => { + const result = + client.matchProjectFromProjectServiceServiceLevelObjectiveName( + fakePath, + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchServiceFromProjectServiceServiceLevelObjectiveName', () => { + const result = + client.matchServiceFromProjectServiceServiceLevelObjectiveName( + fakePath, + ); + assert.strictEqual(result, 'serviceValue'); + assert( + ( + client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchServiceLevelObjectiveFromProjectServiceServiceLevelObjectiveName', () => { + const result = + client.matchServiceLevelObjectiveFromProjectServiceServiceLevelObjectiveName( + fakePath, + ); + assert.strictEqual(result, 'serviceLevelObjectiveValue'); + assert( + ( + client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('projectUptimeCheckConfig', async () => { - const fakePath = "/rendered/path/projectUptimeCheckConfig"; - const expectedParameters = { - project: "projectValue", - uptime_check_config: "uptimeCheckConfigValue", - }; - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectUptimeCheckConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectUptimeCheckConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectUptimeCheckConfigPath', () => { - const result = client.projectUptimeCheckConfigPath("projectValue", "uptimeCheckConfigValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectUptimeCheckConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectUptimeCheckConfigName', () => { - const result = client.matchProjectFromProjectUptimeCheckConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectUptimeCheckConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUptimeCheckConfigFromProjectUptimeCheckConfigName', () => { - const result = client.matchUptimeCheckConfigFromProjectUptimeCheckConfigName(fakePath); - assert.strictEqual(result, "uptimeCheckConfigValue"); - assert((client.pathTemplates.projectUptimeCheckConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('projectUptimeCheckConfig', async () => { + const fakePath = '/rendered/path/projectUptimeCheckConfig'; + const expectedParameters = { + project: 'projectValue', + uptime_check_config: 'uptimeCheckConfigValue', + }; + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.projectUptimeCheckConfigPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectUptimeCheckConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectUptimeCheckConfigPath', () => { + const result = client.projectUptimeCheckConfigPath( + 'projectValue', + 'uptimeCheckConfigValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectUptimeCheckConfigPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectUptimeCheckConfigName', () => { + const result = + client.matchProjectFromProjectUptimeCheckConfigName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectUptimeCheckConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchUptimeCheckConfigFromProjectUptimeCheckConfigName', () => { + const result = + client.matchUptimeCheckConfigFromProjectUptimeCheckConfigName( + fakePath, + ); + assert.strictEqual(result, 'uptimeCheckConfigValue'); + assert( + ( + client.pathTemplates.projectUptimeCheckConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('snooze', async () => { - const fakePath = "/rendered/path/snooze"; - const expectedParameters = { - project: "projectValue", - snooze: "snoozeValue", - }; - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.snoozePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.snoozePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('snoozePath', () => { - const result = client.snoozePath("projectValue", "snoozeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.snoozePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromSnoozeName', () => { - const result = client.matchProjectFromSnoozeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.snoozePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSnoozeFromSnoozeName', () => { - const result = client.matchSnoozeFromSnoozeName(fakePath); - assert.strictEqual(result, "snoozeValue"); - assert((client.pathTemplates.snoozePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('snooze', async () => { + const fakePath = '/rendered/path/snooze'; + const expectedParameters = { + project: 'projectValue', + snooze: 'snoozeValue', + }; + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.snoozePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.snoozePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('snoozePath', () => { + const result = client.snoozePath('projectValue', 'snoozeValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.snoozePathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromSnoozeName', () => { + const result = client.matchProjectFromSnoozeName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.snoozePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSnoozeFromSnoozeName', () => { + const result = client.matchSnoozeFromSnoozeName(fakePath); + assert.strictEqual(result, 'snoozeValue'); + assert( + (client.pathTemplates.snoozePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); }); + }); }); diff --git a/packages/google-cloud-monitoring/test/gapic_query_service_v3.ts b/packages/google-cloud-monitoring/test/gapic_query_service_v3.ts index 293156771fdd..d4a4a1fe798d 100644 --- a/packages/google-cloud-monitoring/test/gapic_query_service_v3.ts +++ b/packages/google-cloud-monitoring/test/gapic_query_service_v3.ts @@ -19,1503 +19,2256 @@ 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 queryserviceModule 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 -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); +const root = protobuf.Root.fromJSON( + require('../protos/protos.json'), +).resolveAll(); // eslint-disable-next-line @typescript-eslint/no-unused-vars function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; } function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; + const filledObject = ( + instance.constructor as typeof protobuf.Message + ).toObject(instance as protobuf.Message, { defaults: true }); + return (instance.constructor as typeof protobuf.Message).fromObject( + filledObject, + ) as T; } function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); + return error + ? sinon.stub().rejects(error) + : sinon.stub().resolves([response]); } -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +function stubSimpleCallWithCallback( + response?: ResponseType, + error?: Error, +) { + return error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); } -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } +function stubPageStreamingCall( + responses?: ResponseType[], + error?: Error, +) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); + } + const transformStub = error + ? sinon.stub().callsArgWith(2, error) + : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { + mockStream.write({}); + }); } - return sinon.stub().returns(mockStream); + setImmediate(() => { + mockStream.end(); + }); + } else { + setImmediate(() => { + mockStream.write({}); + }); + setImmediate(() => { + mockStream.end(); + }); + } + return sinon.stub().returns(mockStream); } -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); +function stubAsyncIterationCall( + responses?: ResponseType[], + error?: Error, +) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({ done: true, value: undefined }); + } + return Promise.resolve({ done: false, value: responses![counter++] }); + }, + }; + }, + }; + return sinon.stub().returns(asyncIterable); } describe('v3.QueryServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new queryserviceModule.v3.QueryServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'monitoring.googleapis.com'); - }); + describe('Common methods', () => { + it('has apiEndpoint', () => { + const client = new queryserviceModule.v3.QueryServiceClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'monitoring.googleapis.com'); + }); - it('has universeDomain', () => { - const client = new queryserviceModule.v3.QueryServiceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); + it('has universeDomain', () => { + const client = new queryserviceModule.v3.QueryServiceClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = queryserviceModule.v3.QueryServiceClient.servicePath; - assert.strictEqual(servicePath, 'monitoring.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = queryserviceModule.v3.QueryServiceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'monitoring.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new queryserviceModule.v3.QueryServiceClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'monitoring.example.com'); - }); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + queryserviceModule.v3.QueryServiceClient.servicePath; + assert.strictEqual(servicePath, 'monitoring.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + queryserviceModule.v3.QueryServiceClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'monitoring.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = new queryserviceModule.v3.QueryServiceClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'monitoring.example.com'); + }); - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new queryserviceModule.v3.QueryServiceClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'monitoring.example.com'); - }); + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = new queryserviceModule.v3.QueryServiceClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'monitoring.example.com'); + }); - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new queryserviceModule.v3.QueryServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'monitoring.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new queryserviceModule.v3.QueryServiceClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'monitoring.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new queryserviceModule.v3.QueryServiceClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); + if (typeof process === 'object' && 'env' in process) { + describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { + it('sets apiEndpoint from environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = new queryserviceModule.v3.QueryServiceClient(); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'monitoring.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } }); - it('has port', () => { - const port = queryserviceModule.v3.QueryServiceClient.port; - assert(port); - assert(typeof port === 'number'); + it('value configured in code has priority over environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = new queryserviceModule.v3.QueryServiceClient({ + universeDomain: 'configured.example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'monitoring.configured.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } }); - - it('should create a client with no option', () => { - const client = new queryserviceModule.v3.QueryServiceClient(); - assert(client); + }); + } + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new queryserviceModule.v3.QueryServiceClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', }); + }); + }); - it('should create a client with gRPC fallback', () => { - const client = new queryserviceModule.v3.QueryServiceClient({ - fallback: true, - }); - assert(client); - }); + it('has port', () => { + const port = queryserviceModule.v3.QueryServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); - it('has initialize method and supports deferred initialization', async () => { - const client = new queryserviceModule.v3.QueryServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.queryServiceStub, undefined); - await client.initialize(); - assert(client.queryServiceStub); - }); + it('should create a client with no option', () => { + const client = new queryserviceModule.v3.QueryServiceClient(); + assert(client); + }); - it('has close method for the initialized client', done => { - const client = new queryserviceModule.v3.QueryServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.queryServiceStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); + it('should create a client with gRPC fallback', () => { + const client = new queryserviceModule.v3.QueryServiceClient({ + fallback: true, + }); + assert(client); + }); - it('has close method for the non-initialized client', done => { - const client = new queryserviceModule.v3.QueryServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.queryServiceStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); + it('has initialize method and supports deferred initialization', async () => { + const client = new queryserviceModule.v3.QueryServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.queryServiceStub, undefined); + await client.initialize(); + assert(client.queryServiceStub); + }); - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new queryserviceModule.v3.QueryServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + it('has close method for the initialized client', (done) => { + const client = new queryserviceModule.v3.QueryServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.initialize().catch((err) => { + throw err; + }); + assert(client.queryServiceStub); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; }); + }); - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new queryserviceModule.v3.QueryServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); + it('has close method for the non-initialized client', (done) => { + const client = new queryserviceModule.v3.QueryServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.queryServiceStub, undefined); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; }); }); - describe('queryTimeSeries', () => { - it('invokes queryTimeSeries without error', async () => { - const client = new queryserviceModule.v3.QueryServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const stub = sinon.stub(client, 'warn'); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.QueryTimeSeriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.QueryTimeSeriesRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.monitoring.v3.TimeSeriesData()), - generateSampleMessage(new protos.google.monitoring.v3.TimeSeriesData()), - generateSampleMessage(new protos.google.monitoring.v3.TimeSeriesData()), - ]; - client.innerApiCalls.queryTimeSeries = stubSimpleCall(expectedResponse); - const [response] = await client.queryTimeSeries(request); - assert(stub.calledOnce); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.queryTimeSeries as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.queryTimeSeries as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new queryserviceModule.v3.QueryServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); - it('invokes queryTimeSeries without error using callback', async () => { - const client = new queryserviceModule.v3.QueryServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const stub = sinon.stub(client, 'warn'); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.QueryTimeSeriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.QueryTimeSeriesRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.monitoring.v3.TimeSeriesData()), - generateSampleMessage(new protos.google.monitoring.v3.TimeSeriesData()), - generateSampleMessage(new protos.google.monitoring.v3.TimeSeriesData()), - ]; - client.innerApiCalls.queryTimeSeries = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.queryTimeSeries( - request, - (err?: Error|null, result?: protos.google.monitoring.v3.ITimeSeriesData[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert(stub.calledOnce); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.queryTimeSeries as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.queryTimeSeries as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new queryserviceModule.v3.QueryServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + }); + + describe('queryTimeSeries', () => { + it('invokes queryTimeSeries without error', async () => { + const client = new queryserviceModule.v3.QueryServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + const stub = sinon.stub(client, 'warn'); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.QueryTimeSeriesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.QueryTimeSeriesRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.monitoring.v3.TimeSeriesData()), + generateSampleMessage(new protos.google.monitoring.v3.TimeSeriesData()), + generateSampleMessage(new protos.google.monitoring.v3.TimeSeriesData()), + ]; + client.innerApiCalls.queryTimeSeries = stubSimpleCall(expectedResponse); + const [response] = await client.queryTimeSeries(request); + assert(stub.calledOnce); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.queryTimeSeries as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.queryTimeSeries as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes queryTimeSeries with error', async () => { - const client = new queryserviceModule.v3.QueryServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const stub = sinon.stub(client, 'warn'); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.QueryTimeSeriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.QueryTimeSeriesRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.queryTimeSeries = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.queryTimeSeries(request), expectedError); - assert(stub.calledOnce); - const actualRequest = (client.innerApiCalls.queryTimeSeries as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.queryTimeSeries as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes queryTimeSeries without error using callback', async () => { + const client = new queryserviceModule.v3.QueryServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + const stub = sinon.stub(client, 'warn'); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.QueryTimeSeriesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.QueryTimeSeriesRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.monitoring.v3.TimeSeriesData()), + generateSampleMessage(new protos.google.monitoring.v3.TimeSeriesData()), + generateSampleMessage(new protos.google.monitoring.v3.TimeSeriesData()), + ]; + client.innerApiCalls.queryTimeSeries = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.queryTimeSeries( + request, + ( + err?: Error | null, + result?: protos.google.monitoring.v3.ITimeSeriesData[] | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert(stub.calledOnce); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.queryTimeSeries as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.queryTimeSeries as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes queryTimeSeriesStream without error', async () => { - const client = new queryserviceModule.v3.QueryServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const stub = sinon.stub(client, 'warn'); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.QueryTimeSeriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.QueryTimeSeriesRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.monitoring.v3.TimeSeriesData()), - generateSampleMessage(new protos.google.monitoring.v3.TimeSeriesData()), - generateSampleMessage(new protos.google.monitoring.v3.TimeSeriesData()), - ]; - client.descriptors.page.queryTimeSeries.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.queryTimeSeriesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.monitoring.v3.TimeSeriesData[] = []; - stream.on('data', (response: protos.google.monitoring.v3.TimeSeriesData) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert(stub.calledOnce); - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.queryTimeSeries.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.queryTimeSeries, request)); - assert( - (client.descriptors.page.queryTimeSeries.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('invokes queryTimeSeries with error', async () => { + const client = new queryserviceModule.v3.QueryServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + const stub = sinon.stub(client, 'warn'); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.QueryTimeSeriesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.QueryTimeSeriesRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.queryTimeSeries = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.queryTimeSeries(request), expectedError); + assert(stub.calledOnce); + const actualRequest = ( + client.innerApiCalls.queryTimeSeries as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.queryTimeSeries as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes queryTimeSeriesStream with error', async () => { - const client = new queryserviceModule.v3.QueryServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const stub = sinon.stub(client, 'warn'); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.QueryTimeSeriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.QueryTimeSeriesRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.queryTimeSeries.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.queryTimeSeriesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.monitoring.v3.TimeSeriesData[] = []; - stream.on('data', (response: protos.google.monitoring.v3.TimeSeriesData) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert(stub.calledOnce); - assert((client.descriptors.page.queryTimeSeries.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.queryTimeSeries, request)); - assert( - (client.descriptors.page.queryTimeSeries.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); + it('invokes queryTimeSeriesStream without error', async () => { + const client = new queryserviceModule.v3.QueryServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + const stub = sinon.stub(client, 'warn'); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.QueryTimeSeriesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.QueryTimeSeriesRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.monitoring.v3.TimeSeriesData()), + generateSampleMessage(new protos.google.monitoring.v3.TimeSeriesData()), + generateSampleMessage(new protos.google.monitoring.v3.TimeSeriesData()), + ]; + client.descriptors.page.queryTimeSeries.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.queryTimeSeriesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.monitoring.v3.TimeSeriesData[] = []; + stream.on( + 'data', + (response: protos.google.monitoring.v3.TimeSeriesData) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); }); - - it('uses async iteration with queryTimeSeries without error', async () => { - const client = new queryserviceModule.v3.QueryServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const stub = sinon.stub(client, 'warn'); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.QueryTimeSeriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.QueryTimeSeriesRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.monitoring.v3.TimeSeriesData()), - generateSampleMessage(new protos.google.monitoring.v3.TimeSeriesData()), - generateSampleMessage(new protos.google.monitoring.v3.TimeSeriesData()), - ]; - client.descriptors.page.queryTimeSeries.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.monitoring.v3.ITimeSeriesData[] = []; - const iterable = client.queryTimeSeriesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert(stub.calledOnce); - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.queryTimeSeries.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.queryTimeSeries.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); + stream.on('error', (err: Error) => { + reject(err); }); + }); + const responses = await promise; + assert(stub.calledOnce); + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.queryTimeSeries.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.queryTimeSeries, request), + ); + assert( + (client.descriptors.page.queryTimeSeries.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('uses async iteration with queryTimeSeries with error', async () => { - const client = new queryserviceModule.v3.QueryServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const stub = sinon.stub(client, 'warn'); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.QueryTimeSeriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.QueryTimeSeriesRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.queryTimeSeries.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.queryTimeSeriesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.monitoring.v3.ITimeSeriesData[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert(stub.calledOnce); - assert.deepStrictEqual( - (client.descriptors.page.queryTimeSeries.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.queryTimeSeries.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); + it('invokes queryTimeSeriesStream with error', async () => { + const client = new queryserviceModule.v3.QueryServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + const stub = sinon.stub(client, 'warn'); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.QueryTimeSeriesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.QueryTimeSeriesRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.queryTimeSeries.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.queryTimeSeriesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.monitoring.v3.TimeSeriesData[] = []; + stream.on( + 'data', + (response: protos.google.monitoring.v3.TimeSeriesData) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert(stub.calledOnce); + assert( + (client.descriptors.page.queryTimeSeries.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.queryTimeSeries, request), + ); + assert( + (client.descriptors.page.queryTimeSeries.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); }); - describe('Path templates', () => { - - describe('folderAlertPolicy', async () => { - const fakePath = "/rendered/path/folderAlertPolicy"; - const expectedParameters = { - folder: "folderValue", - alert_policy: "alertPolicyValue", - }; - const client = new queryserviceModule.v3.QueryServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.folderAlertPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderAlertPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderAlertPolicyPath', () => { - const result = client.folderAlertPolicyPath("folderValue", "alertPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderAlertPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderAlertPolicyName', () => { - const result = client.matchFolderFromFolderAlertPolicyName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderAlertPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAlertPolicyFromFolderAlertPolicyName', () => { - const result = client.matchAlertPolicyFromFolderAlertPolicyName(fakePath); - assert.strictEqual(result, "alertPolicyValue"); - assert((client.pathTemplates.folderAlertPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + it('uses async iteration with queryTimeSeries without error', async () => { + const client = new queryserviceModule.v3.QueryServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + const stub = sinon.stub(client, 'warn'); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.QueryTimeSeriesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.QueryTimeSeriesRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.monitoring.v3.TimeSeriesData()), + generateSampleMessage(new protos.google.monitoring.v3.TimeSeriesData()), + generateSampleMessage(new protos.google.monitoring.v3.TimeSeriesData()), + ]; + client.descriptors.page.queryTimeSeries.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.monitoring.v3.ITimeSeriesData[] = []; + const iterable = client.queryTimeSeriesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert(stub.calledOnce); + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.queryTimeSeries.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.queryTimeSeries.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - describe('folderAlertPolicyCondition', async () => { - const fakePath = "/rendered/path/folderAlertPolicyCondition"; - const expectedParameters = { - folder: "folderValue", - alert_policy: "alertPolicyValue", - condition: "conditionValue", - }; - const client = new queryserviceModule.v3.QueryServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.folderAlertPolicyConditionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderAlertPolicyConditionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderAlertPolicyConditionPath', () => { - const result = client.folderAlertPolicyConditionPath("folderValue", "alertPolicyValue", "conditionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderAlertPolicyConditionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderAlertPolicyConditionName', () => { - const result = client.matchFolderFromFolderAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAlertPolicyFromFolderAlertPolicyConditionName', () => { - const result = client.matchAlertPolicyFromFolderAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "alertPolicyValue"); - assert((client.pathTemplates.folderAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConditionFromFolderAlertPolicyConditionName', () => { - const result = client.matchConditionFromFolderAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "conditionValue"); - assert((client.pathTemplates.folderAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + it('uses async iteration with queryTimeSeries with error', async () => { + const client = new queryserviceModule.v3.QueryServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + const stub = sinon.stub(client, 'warn'); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.QueryTimeSeriesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.QueryTimeSeriesRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.queryTimeSeries.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.queryTimeSeriesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.monitoring.v3.ITimeSeriesData[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert(stub.calledOnce); + assert.deepStrictEqual( + ( + client.descriptors.page.queryTimeSeries.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.queryTimeSeries.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + }); + + describe('Path templates', () => { + describe('folderAlertPolicy', async () => { + const fakePath = '/rendered/path/folderAlertPolicy'; + const expectedParameters = { + folder: 'folderValue', + alert_policy: 'alertPolicyValue', + }; + const client = new queryserviceModule.v3.QueryServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.folderAlertPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.folderAlertPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('folderAlertPolicyPath', () => { + const result = client.folderAlertPolicyPath( + 'folderValue', + 'alertPolicyValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.folderAlertPolicyPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchFolderFromFolderAlertPolicyName', () => { + const result = client.matchFolderFromFolderAlertPolicyName(fakePath); + assert.strictEqual(result, 'folderValue'); + assert( + ( + client.pathTemplates.folderAlertPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchAlertPolicyFromFolderAlertPolicyName', () => { + const result = + client.matchAlertPolicyFromFolderAlertPolicyName(fakePath); + assert.strictEqual(result, 'alertPolicyValue'); + assert( + ( + client.pathTemplates.folderAlertPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('folderChannelDescriptor', async () => { - const fakePath = "/rendered/path/folderChannelDescriptor"; - const expectedParameters = { - folder: "folderValue", - channel_descriptor: "channelDescriptorValue", - }; - const client = new queryserviceModule.v3.QueryServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.folderChannelDescriptorPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderChannelDescriptorPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderChannelDescriptorPath', () => { - const result = client.folderChannelDescriptorPath("folderValue", "channelDescriptorValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderChannelDescriptorPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderChannelDescriptorName', () => { - const result = client.matchFolderFromFolderChannelDescriptorName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderChannelDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchChannelDescriptorFromFolderChannelDescriptorName', () => { - const result = client.matchChannelDescriptorFromFolderChannelDescriptorName(fakePath); - assert.strictEqual(result, "channelDescriptorValue"); - assert((client.pathTemplates.folderChannelDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('folderAlertPolicyCondition', async () => { + const fakePath = '/rendered/path/folderAlertPolicyCondition'; + const expectedParameters = { + folder: 'folderValue', + alert_policy: 'alertPolicyValue', + condition: 'conditionValue', + }; + const client = new queryserviceModule.v3.QueryServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.folderAlertPolicyConditionPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.folderAlertPolicyConditionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('folderAlertPolicyConditionPath', () => { + const result = client.folderAlertPolicyConditionPath( + 'folderValue', + 'alertPolicyValue', + 'conditionValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.folderAlertPolicyConditionPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchFolderFromFolderAlertPolicyConditionName', () => { + const result = + client.matchFolderFromFolderAlertPolicyConditionName(fakePath); + assert.strictEqual(result, 'folderValue'); + assert( + ( + client.pathTemplates.folderAlertPolicyConditionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchAlertPolicyFromFolderAlertPolicyConditionName', () => { + const result = + client.matchAlertPolicyFromFolderAlertPolicyConditionName(fakePath); + assert.strictEqual(result, 'alertPolicyValue'); + assert( + ( + client.pathTemplates.folderAlertPolicyConditionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchConditionFromFolderAlertPolicyConditionName', () => { + const result = + client.matchConditionFromFolderAlertPolicyConditionName(fakePath); + assert.strictEqual(result, 'conditionValue'); + assert( + ( + client.pathTemplates.folderAlertPolicyConditionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('folderGroup', async () => { - const fakePath = "/rendered/path/folderGroup"; - const expectedParameters = { - folder: "folderValue", - group: "groupValue", - }; - const client = new queryserviceModule.v3.QueryServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.folderGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderGroupPath', () => { - const result = client.folderGroupPath("folderValue", "groupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderGroupName', () => { - const result = client.matchFolderFromFolderGroupName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchGroupFromFolderGroupName', () => { - const result = client.matchGroupFromFolderGroupName(fakePath); - assert.strictEqual(result, "groupValue"); - assert((client.pathTemplates.folderGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('folderChannelDescriptor', async () => { + const fakePath = '/rendered/path/folderChannelDescriptor'; + const expectedParameters = { + folder: 'folderValue', + channel_descriptor: 'channelDescriptorValue', + }; + const client = new queryserviceModule.v3.QueryServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.folderChannelDescriptorPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.folderChannelDescriptorPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('folderChannelDescriptorPath', () => { + const result = client.folderChannelDescriptorPath( + 'folderValue', + 'channelDescriptorValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.folderChannelDescriptorPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchFolderFromFolderChannelDescriptorName', () => { + const result = + client.matchFolderFromFolderChannelDescriptorName(fakePath); + assert.strictEqual(result, 'folderValue'); + assert( + ( + client.pathTemplates.folderChannelDescriptorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchChannelDescriptorFromFolderChannelDescriptorName', () => { + const result = + client.matchChannelDescriptorFromFolderChannelDescriptorName( + fakePath, + ); + assert.strictEqual(result, 'channelDescriptorValue'); + assert( + ( + client.pathTemplates.folderChannelDescriptorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('folderNotificationChannel', async () => { - const fakePath = "/rendered/path/folderNotificationChannel"; - const expectedParameters = { - folder: "folderValue", - notification_channel: "notificationChannelValue", - }; - const client = new queryserviceModule.v3.QueryServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.folderNotificationChannelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderNotificationChannelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderNotificationChannelPath', () => { - const result = client.folderNotificationChannelPath("folderValue", "notificationChannelValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderNotificationChannelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderNotificationChannelName', () => { - const result = client.matchFolderFromFolderNotificationChannelName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderNotificationChannelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchNotificationChannelFromFolderNotificationChannelName', () => { - const result = client.matchNotificationChannelFromFolderNotificationChannelName(fakePath); - assert.strictEqual(result, "notificationChannelValue"); - assert((client.pathTemplates.folderNotificationChannelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('folderGroup', async () => { + const fakePath = '/rendered/path/folderGroup'; + const expectedParameters = { + folder: 'folderValue', + group: 'groupValue', + }; + const client = new queryserviceModule.v3.QueryServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.folderGroupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.folderGroupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('folderGroupPath', () => { + const result = client.folderGroupPath('folderValue', 'groupValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.folderGroupPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchFolderFromFolderGroupName', () => { + const result = client.matchFolderFromFolderGroupName(fakePath); + assert.strictEqual(result, 'folderValue'); + assert( + (client.pathTemplates.folderGroupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchGroupFromFolderGroupName', () => { + const result = client.matchGroupFromFolderGroupName(fakePath); + assert.strictEqual(result, 'groupValue'); + assert( + (client.pathTemplates.folderGroupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('folderService', async () => { - const fakePath = "/rendered/path/folderService"; - const expectedParameters = { - folder: "folderValue", - service: "serviceValue", - }; - const client = new queryserviceModule.v3.QueryServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.folderServicePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderServicePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderServicePath', () => { - const result = client.folderServicePath("folderValue", "serviceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderServicePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderServiceName', () => { - const result = client.matchFolderFromFolderServiceName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderServicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromFolderServiceName', () => { - const result = client.matchServiceFromFolderServiceName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.folderServicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('folderNotificationChannel', async () => { + const fakePath = '/rendered/path/folderNotificationChannel'; + const expectedParameters = { + folder: 'folderValue', + notification_channel: 'notificationChannelValue', + }; + const client = new queryserviceModule.v3.QueryServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.folderNotificationChannelPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.folderNotificationChannelPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('folderNotificationChannelPath', () => { + const result = client.folderNotificationChannelPath( + 'folderValue', + 'notificationChannelValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.folderNotificationChannelPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchFolderFromFolderNotificationChannelName', () => { + const result = + client.matchFolderFromFolderNotificationChannelName(fakePath); + assert.strictEqual(result, 'folderValue'); + assert( + ( + client.pathTemplates.folderNotificationChannelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchNotificationChannelFromFolderNotificationChannelName', () => { + const result = + client.matchNotificationChannelFromFolderNotificationChannelName( + fakePath, + ); + assert.strictEqual(result, 'notificationChannelValue'); + assert( + ( + client.pathTemplates.folderNotificationChannelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('folderServiceServiceLevelObjective', async () => { - const fakePath = "/rendered/path/folderServiceServiceLevelObjective"; - const expectedParameters = { - folder: "folderValue", - service: "serviceValue", - service_level_objective: "serviceLevelObjectiveValue", - }; - const client = new queryserviceModule.v3.QueryServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderServiceServiceLevelObjectivePath', () => { - const result = client.folderServiceServiceLevelObjectivePath("folderValue", "serviceValue", "serviceLevelObjectiveValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderServiceServiceLevelObjectiveName', () => { - const result = client.matchFolderFromFolderServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromFolderServiceServiceLevelObjectiveName', () => { - const result = client.matchServiceFromFolderServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceLevelObjectiveFromFolderServiceServiceLevelObjectiveName', () => { - const result = client.matchServiceLevelObjectiveFromFolderServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "serviceLevelObjectiveValue"); - assert((client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('folderService', async () => { + const fakePath = '/rendered/path/folderService'; + const expectedParameters = { + folder: 'folderValue', + service: 'serviceValue', + }; + const client = new queryserviceModule.v3.QueryServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.folderServicePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.folderServicePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('folderServicePath', () => { + const result = client.folderServicePath('folderValue', 'serviceValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.folderServicePathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchFolderFromFolderServiceName', () => { + const result = client.matchFolderFromFolderServiceName(fakePath); + assert.strictEqual(result, 'folderValue'); + assert( + (client.pathTemplates.folderServicePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchServiceFromFolderServiceName', () => { + const result = client.matchServiceFromFolderServiceName(fakePath); + assert.strictEqual(result, 'serviceValue'); + assert( + (client.pathTemplates.folderServicePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('folderUptimeCheckConfig', async () => { - const fakePath = "/rendered/path/folderUptimeCheckConfig"; - const expectedParameters = { - folder: "folderValue", - uptime_check_config: "uptimeCheckConfigValue", - }; - const client = new queryserviceModule.v3.QueryServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.folderUptimeCheckConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderUptimeCheckConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderUptimeCheckConfigPath', () => { - const result = client.folderUptimeCheckConfigPath("folderValue", "uptimeCheckConfigValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderUptimeCheckConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderUptimeCheckConfigName', () => { - const result = client.matchFolderFromFolderUptimeCheckConfigName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderUptimeCheckConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUptimeCheckConfigFromFolderUptimeCheckConfigName', () => { - const result = client.matchUptimeCheckConfigFromFolderUptimeCheckConfigName(fakePath); - assert.strictEqual(result, "uptimeCheckConfigValue"); - assert((client.pathTemplates.folderUptimeCheckConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('folderServiceServiceLevelObjective', async () => { + const fakePath = '/rendered/path/folderServiceServiceLevelObjective'; + const expectedParameters = { + folder: 'folderValue', + service: 'serviceValue', + service_level_objective: 'serviceLevelObjectiveValue', + }; + const client = new queryserviceModule.v3.QueryServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('folderServiceServiceLevelObjectivePath', () => { + const result = client.folderServiceServiceLevelObjectivePath( + 'folderValue', + 'serviceValue', + 'serviceLevelObjectiveValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchFolderFromFolderServiceServiceLevelObjectiveName', () => { + const result = + client.matchFolderFromFolderServiceServiceLevelObjectiveName( + fakePath, + ); + assert.strictEqual(result, 'folderValue'); + assert( + ( + client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchServiceFromFolderServiceServiceLevelObjectiveName', () => { + const result = + client.matchServiceFromFolderServiceServiceLevelObjectiveName( + fakePath, + ); + assert.strictEqual(result, 'serviceValue'); + assert( + ( + client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchServiceLevelObjectiveFromFolderServiceServiceLevelObjectiveName', () => { + const result = + client.matchServiceLevelObjectiveFromFolderServiceServiceLevelObjectiveName( + fakePath, + ); + assert.strictEqual(result, 'serviceLevelObjectiveValue'); + assert( + ( + client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('organizationAlertPolicy', async () => { - const fakePath = "/rendered/path/organizationAlertPolicy"; - const expectedParameters = { - organization: "organizationValue", - alert_policy: "alertPolicyValue", - }; - const client = new queryserviceModule.v3.QueryServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationAlertPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationAlertPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationAlertPolicyPath', () => { - const result = client.organizationAlertPolicyPath("organizationValue", "alertPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationAlertPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationAlertPolicyName', () => { - const result = client.matchOrganizationFromOrganizationAlertPolicyName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationAlertPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAlertPolicyFromOrganizationAlertPolicyName', () => { - const result = client.matchAlertPolicyFromOrganizationAlertPolicyName(fakePath); - assert.strictEqual(result, "alertPolicyValue"); - assert((client.pathTemplates.organizationAlertPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('folderUptimeCheckConfig', async () => { + const fakePath = '/rendered/path/folderUptimeCheckConfig'; + const expectedParameters = { + folder: 'folderValue', + uptime_check_config: 'uptimeCheckConfigValue', + }; + const client = new queryserviceModule.v3.QueryServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.folderUptimeCheckConfigPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.folderUptimeCheckConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('folderUptimeCheckConfigPath', () => { + const result = client.folderUptimeCheckConfigPath( + 'folderValue', + 'uptimeCheckConfigValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.folderUptimeCheckConfigPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchFolderFromFolderUptimeCheckConfigName', () => { + const result = + client.matchFolderFromFolderUptimeCheckConfigName(fakePath); + assert.strictEqual(result, 'folderValue'); + assert( + ( + client.pathTemplates.folderUptimeCheckConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchUptimeCheckConfigFromFolderUptimeCheckConfigName', () => { + const result = + client.matchUptimeCheckConfigFromFolderUptimeCheckConfigName( + fakePath, + ); + assert.strictEqual(result, 'uptimeCheckConfigValue'); + assert( + ( + client.pathTemplates.folderUptimeCheckConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('organizationAlertPolicyCondition', async () => { - const fakePath = "/rendered/path/organizationAlertPolicyCondition"; - const expectedParameters = { - organization: "organizationValue", - alert_policy: "alertPolicyValue", - condition: "conditionValue", - }; - const client = new queryserviceModule.v3.QueryServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationAlertPolicyConditionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationAlertPolicyConditionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationAlertPolicyConditionPath', () => { - const result = client.organizationAlertPolicyConditionPath("organizationValue", "alertPolicyValue", "conditionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationAlertPolicyConditionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationAlertPolicyConditionName', () => { - const result = client.matchOrganizationFromOrganizationAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAlertPolicyFromOrganizationAlertPolicyConditionName', () => { - const result = client.matchAlertPolicyFromOrganizationAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "alertPolicyValue"); - assert((client.pathTemplates.organizationAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConditionFromOrganizationAlertPolicyConditionName', () => { - const result = client.matchConditionFromOrganizationAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "conditionValue"); - assert((client.pathTemplates.organizationAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('organizationAlertPolicy', async () => { + const fakePath = '/rendered/path/organizationAlertPolicy'; + const expectedParameters = { + organization: 'organizationValue', + alert_policy: 'alertPolicyValue', + }; + const client = new queryserviceModule.v3.QueryServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.organizationAlertPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.organizationAlertPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('organizationAlertPolicyPath', () => { + const result = client.organizationAlertPolicyPath( + 'organizationValue', + 'alertPolicyValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationAlertPolicyPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchOrganizationFromOrganizationAlertPolicyName', () => { + const result = + client.matchOrganizationFromOrganizationAlertPolicyName(fakePath); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationAlertPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchAlertPolicyFromOrganizationAlertPolicyName', () => { + const result = + client.matchAlertPolicyFromOrganizationAlertPolicyName(fakePath); + assert.strictEqual(result, 'alertPolicyValue'); + assert( + ( + client.pathTemplates.organizationAlertPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('organizationChannelDescriptor', async () => { - const fakePath = "/rendered/path/organizationChannelDescriptor"; - const expectedParameters = { - organization: "organizationValue", - channel_descriptor: "channelDescriptorValue", - }; - const client = new queryserviceModule.v3.QueryServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationChannelDescriptorPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationChannelDescriptorPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationChannelDescriptorPath', () => { - const result = client.organizationChannelDescriptorPath("organizationValue", "channelDescriptorValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationChannelDescriptorPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationChannelDescriptorName', () => { - const result = client.matchOrganizationFromOrganizationChannelDescriptorName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationChannelDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchChannelDescriptorFromOrganizationChannelDescriptorName', () => { - const result = client.matchChannelDescriptorFromOrganizationChannelDescriptorName(fakePath); - assert.strictEqual(result, "channelDescriptorValue"); - assert((client.pathTemplates.organizationChannelDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('organizationAlertPolicyCondition', async () => { + const fakePath = '/rendered/path/organizationAlertPolicyCondition'; + const expectedParameters = { + organization: 'organizationValue', + alert_policy: 'alertPolicyValue', + condition: 'conditionValue', + }; + const client = new queryserviceModule.v3.QueryServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.organizationAlertPolicyConditionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationAlertPolicyConditionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationAlertPolicyConditionPath', () => { + const result = client.organizationAlertPolicyConditionPath( + 'organizationValue', + 'alertPolicyValue', + 'conditionValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationAlertPolicyConditionPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchOrganizationFromOrganizationAlertPolicyConditionName', () => { + const result = + client.matchOrganizationFromOrganizationAlertPolicyConditionName( + fakePath, + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationAlertPolicyConditionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchAlertPolicyFromOrganizationAlertPolicyConditionName', () => { + const result = + client.matchAlertPolicyFromOrganizationAlertPolicyConditionName( + fakePath, + ); + assert.strictEqual(result, 'alertPolicyValue'); + assert( + ( + client.pathTemplates.organizationAlertPolicyConditionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchConditionFromOrganizationAlertPolicyConditionName', () => { + const result = + client.matchConditionFromOrganizationAlertPolicyConditionName( + fakePath, + ); + assert.strictEqual(result, 'conditionValue'); + assert( + ( + client.pathTemplates.organizationAlertPolicyConditionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('organizationGroup', async () => { - const fakePath = "/rendered/path/organizationGroup"; - const expectedParameters = { - organization: "organizationValue", - group: "groupValue", - }; - const client = new queryserviceModule.v3.QueryServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationGroupPath', () => { - const result = client.organizationGroupPath("organizationValue", "groupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationGroupName', () => { - const result = client.matchOrganizationFromOrganizationGroupName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchGroupFromOrganizationGroupName', () => { - const result = client.matchGroupFromOrganizationGroupName(fakePath); - assert.strictEqual(result, "groupValue"); - assert((client.pathTemplates.organizationGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('organizationChannelDescriptor', async () => { + const fakePath = '/rendered/path/organizationChannelDescriptor'; + const expectedParameters = { + organization: 'organizationValue', + channel_descriptor: 'channelDescriptorValue', + }; + const client = new queryserviceModule.v3.QueryServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.organizationChannelDescriptorPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationChannelDescriptorPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationChannelDescriptorPath', () => { + const result = client.organizationChannelDescriptorPath( + 'organizationValue', + 'channelDescriptorValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationChannelDescriptorPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchOrganizationFromOrganizationChannelDescriptorName', () => { + const result = + client.matchOrganizationFromOrganizationChannelDescriptorName( + fakePath, + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationChannelDescriptorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchChannelDescriptorFromOrganizationChannelDescriptorName', () => { + const result = + client.matchChannelDescriptorFromOrganizationChannelDescriptorName( + fakePath, + ); + assert.strictEqual(result, 'channelDescriptorValue'); + assert( + ( + client.pathTemplates.organizationChannelDescriptorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('organizationNotificationChannel', async () => { - const fakePath = "/rendered/path/organizationNotificationChannel"; - const expectedParameters = { - organization: "organizationValue", - notification_channel: "notificationChannelValue", - }; - const client = new queryserviceModule.v3.QueryServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationNotificationChannelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationNotificationChannelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationNotificationChannelPath', () => { - const result = client.organizationNotificationChannelPath("organizationValue", "notificationChannelValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationNotificationChannelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationNotificationChannelName', () => { - const result = client.matchOrganizationFromOrganizationNotificationChannelName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationNotificationChannelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchNotificationChannelFromOrganizationNotificationChannelName', () => { - const result = client.matchNotificationChannelFromOrganizationNotificationChannelName(fakePath); - assert.strictEqual(result, "notificationChannelValue"); - assert((client.pathTemplates.organizationNotificationChannelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('organizationGroup', async () => { + const fakePath = '/rendered/path/organizationGroup'; + const expectedParameters = { + organization: 'organizationValue', + group: 'groupValue', + }; + const client = new queryserviceModule.v3.QueryServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.organizationGroupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.organizationGroupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('organizationGroupPath', () => { + const result = client.organizationGroupPath( + 'organizationValue', + 'groupValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchOrganizationFromOrganizationGroupName', () => { + const result = + client.matchOrganizationFromOrganizationGroupName(fakePath); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchGroupFromOrganizationGroupName', () => { + const result = client.matchGroupFromOrganizationGroupName(fakePath); + assert.strictEqual(result, 'groupValue'); + assert( + ( + client.pathTemplates.organizationGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('organizationService', async () => { - const fakePath = "/rendered/path/organizationService"; - const expectedParameters = { - organization: "organizationValue", - service: "serviceValue", - }; - const client = new queryserviceModule.v3.QueryServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationServicePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationServicePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationServicePath', () => { - const result = client.organizationServicePath("organizationValue", "serviceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationServicePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationServiceName', () => { - const result = client.matchOrganizationFromOrganizationServiceName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationServicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromOrganizationServiceName', () => { - const result = client.matchServiceFromOrganizationServiceName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.organizationServicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('organizationNotificationChannel', async () => { + const fakePath = '/rendered/path/organizationNotificationChannel'; + const expectedParameters = { + organization: 'organizationValue', + notification_channel: 'notificationChannelValue', + }; + const client = new queryserviceModule.v3.QueryServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.organizationNotificationChannelPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationNotificationChannelPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationNotificationChannelPath', () => { + const result = client.organizationNotificationChannelPath( + 'organizationValue', + 'notificationChannelValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationNotificationChannelPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchOrganizationFromOrganizationNotificationChannelName', () => { + const result = + client.matchOrganizationFromOrganizationNotificationChannelName( + fakePath, + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationNotificationChannelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchNotificationChannelFromOrganizationNotificationChannelName', () => { + const result = + client.matchNotificationChannelFromOrganizationNotificationChannelName( + fakePath, + ); + assert.strictEqual(result, 'notificationChannelValue'); + assert( + ( + client.pathTemplates.organizationNotificationChannelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('organizationServiceServiceLevelObjective', async () => { - const fakePath = "/rendered/path/organizationServiceServiceLevelObjective"; - const expectedParameters = { - organization: "organizationValue", - service: "serviceValue", - service_level_objective: "serviceLevelObjectiveValue", - }; - const client = new queryserviceModule.v3.QueryServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationServiceServiceLevelObjectivePath', () => { - const result = client.organizationServiceServiceLevelObjectivePath("organizationValue", "serviceValue", "serviceLevelObjectiveValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationServiceServiceLevelObjectiveName', () => { - const result = client.matchOrganizationFromOrganizationServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromOrganizationServiceServiceLevelObjectiveName', () => { - const result = client.matchServiceFromOrganizationServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceLevelObjectiveFromOrganizationServiceServiceLevelObjectiveName', () => { - const result = client.matchServiceLevelObjectiveFromOrganizationServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "serviceLevelObjectiveValue"); - assert((client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('organizationService', async () => { + const fakePath = '/rendered/path/organizationService'; + const expectedParameters = { + organization: 'organizationValue', + service: 'serviceValue', + }; + const client = new queryserviceModule.v3.QueryServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.organizationServicePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.organizationServicePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('organizationServicePath', () => { + const result = client.organizationServicePath( + 'organizationValue', + 'serviceValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationServicePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchOrganizationFromOrganizationServiceName', () => { + const result = + client.matchOrganizationFromOrganizationServiceName(fakePath); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationServicePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchServiceFromOrganizationServiceName', () => { + const result = client.matchServiceFromOrganizationServiceName(fakePath); + assert.strictEqual(result, 'serviceValue'); + assert( + ( + client.pathTemplates.organizationServicePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('organizationUptimeCheckConfig', async () => { - const fakePath = "/rendered/path/organizationUptimeCheckConfig"; - const expectedParameters = { - organization: "organizationValue", - uptime_check_config: "uptimeCheckConfigValue", - }; - const client = new queryserviceModule.v3.QueryServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationUptimeCheckConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationUptimeCheckConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationUptimeCheckConfigPath', () => { - const result = client.organizationUptimeCheckConfigPath("organizationValue", "uptimeCheckConfigValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationUptimeCheckConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationUptimeCheckConfigName', () => { - const result = client.matchOrganizationFromOrganizationUptimeCheckConfigName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationUptimeCheckConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUptimeCheckConfigFromOrganizationUptimeCheckConfigName', () => { - const result = client.matchUptimeCheckConfigFromOrganizationUptimeCheckConfigName(fakePath); - assert.strictEqual(result, "uptimeCheckConfigValue"); - assert((client.pathTemplates.organizationUptimeCheckConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('organizationServiceServiceLevelObjective', async () => { + const fakePath = + '/rendered/path/organizationServiceServiceLevelObjective'; + const expectedParameters = { + organization: 'organizationValue', + service: 'serviceValue', + service_level_objective: 'serviceLevelObjectiveValue', + }; + const client = new queryserviceModule.v3.QueryServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationServiceServiceLevelObjectivePath', () => { + const result = client.organizationServiceServiceLevelObjectivePath( + 'organizationValue', + 'serviceValue', + 'serviceLevelObjectiveValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .organizationServiceServiceLevelObjectivePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchOrganizationFromOrganizationServiceServiceLevelObjectiveName', () => { + const result = + client.matchOrganizationFromOrganizationServiceServiceLevelObjectiveName( + fakePath, + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates + .organizationServiceServiceLevelObjectivePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchServiceFromOrganizationServiceServiceLevelObjectiveName', () => { + const result = + client.matchServiceFromOrganizationServiceServiceLevelObjectiveName( + fakePath, + ); + assert.strictEqual(result, 'serviceValue'); + assert( + ( + client.pathTemplates + .organizationServiceServiceLevelObjectivePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchServiceLevelObjectiveFromOrganizationServiceServiceLevelObjectiveName', () => { + const result = + client.matchServiceLevelObjectiveFromOrganizationServiceServiceLevelObjectiveName( + fakePath, + ); + assert.strictEqual(result, 'serviceLevelObjectiveValue'); + assert( + ( + client.pathTemplates + .organizationServiceServiceLevelObjectivePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('projectAlertPolicy', async () => { - const fakePath = "/rendered/path/projectAlertPolicy"; - const expectedParameters = { - project: "projectValue", - alert_policy: "alertPolicyValue", - }; - const client = new queryserviceModule.v3.QueryServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectAlertPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAlertPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAlertPolicyPath', () => { - const result = client.projectAlertPolicyPath("projectValue", "alertPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAlertPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAlertPolicyName', () => { - const result = client.matchProjectFromProjectAlertPolicyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAlertPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAlertPolicyFromProjectAlertPolicyName', () => { - const result = client.matchAlertPolicyFromProjectAlertPolicyName(fakePath); - assert.strictEqual(result, "alertPolicyValue"); - assert((client.pathTemplates.projectAlertPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('organizationUptimeCheckConfig', async () => { + const fakePath = '/rendered/path/organizationUptimeCheckConfig'; + const expectedParameters = { + organization: 'organizationValue', + uptime_check_config: 'uptimeCheckConfigValue', + }; + const client = new queryserviceModule.v3.QueryServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.organizationUptimeCheckConfigPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationUptimeCheckConfigPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationUptimeCheckConfigPath', () => { + const result = client.organizationUptimeCheckConfigPath( + 'organizationValue', + 'uptimeCheckConfigValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationUptimeCheckConfigPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchOrganizationFromOrganizationUptimeCheckConfigName', () => { + const result = + client.matchOrganizationFromOrganizationUptimeCheckConfigName( + fakePath, + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationUptimeCheckConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchUptimeCheckConfigFromOrganizationUptimeCheckConfigName', () => { + const result = + client.matchUptimeCheckConfigFromOrganizationUptimeCheckConfigName( + fakePath, + ); + assert.strictEqual(result, 'uptimeCheckConfigValue'); + assert( + ( + client.pathTemplates.organizationUptimeCheckConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('projectAlertPolicyCondition', async () => { - const fakePath = "/rendered/path/projectAlertPolicyCondition"; - const expectedParameters = { - project: "projectValue", - alert_policy: "alertPolicyValue", - condition: "conditionValue", - }; - const client = new queryserviceModule.v3.QueryServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectAlertPolicyConditionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAlertPolicyConditionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAlertPolicyConditionPath', () => { - const result = client.projectAlertPolicyConditionPath("projectValue", "alertPolicyValue", "conditionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAlertPolicyConditionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAlertPolicyConditionName', () => { - const result = client.matchProjectFromProjectAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAlertPolicyFromProjectAlertPolicyConditionName', () => { - const result = client.matchAlertPolicyFromProjectAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "alertPolicyValue"); - assert((client.pathTemplates.projectAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConditionFromProjectAlertPolicyConditionName', () => { - const result = client.matchConditionFromProjectAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "conditionValue"); - assert((client.pathTemplates.projectAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('projectAlertPolicy', async () => { + const fakePath = '/rendered/path/projectAlertPolicy'; + const expectedParameters = { + project: 'projectValue', + alert_policy: 'alertPolicyValue', + }; + const client = new queryserviceModule.v3.QueryServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.projectAlertPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAlertPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAlertPolicyPath', () => { + const result = client.projectAlertPolicyPath( + 'projectValue', + 'alertPolicyValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAlertPolicyPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectAlertPolicyName', () => { + const result = client.matchProjectFromProjectAlertPolicyName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAlertPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchAlertPolicyFromProjectAlertPolicyName', () => { + const result = + client.matchAlertPolicyFromProjectAlertPolicyName(fakePath); + assert.strictEqual(result, 'alertPolicyValue'); + assert( + ( + client.pathTemplates.projectAlertPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('projectChannelDescriptor', async () => { - const fakePath = "/rendered/path/projectChannelDescriptor"; - const expectedParameters = { - project: "projectValue", - channel_descriptor: "channelDescriptorValue", - }; - const client = new queryserviceModule.v3.QueryServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectChannelDescriptorPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectChannelDescriptorPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectChannelDescriptorPath', () => { - const result = client.projectChannelDescriptorPath("projectValue", "channelDescriptorValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectChannelDescriptorPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectChannelDescriptorName', () => { - const result = client.matchProjectFromProjectChannelDescriptorName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectChannelDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchChannelDescriptorFromProjectChannelDescriptorName', () => { - const result = client.matchChannelDescriptorFromProjectChannelDescriptorName(fakePath); - assert.strictEqual(result, "channelDescriptorValue"); - assert((client.pathTemplates.projectChannelDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('projectAlertPolicyCondition', async () => { + const fakePath = '/rendered/path/projectAlertPolicyCondition'; + const expectedParameters = { + project: 'projectValue', + alert_policy: 'alertPolicyValue', + condition: 'conditionValue', + }; + const client = new queryserviceModule.v3.QueryServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.projectAlertPolicyConditionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAlertPolicyConditionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAlertPolicyConditionPath', () => { + const result = client.projectAlertPolicyConditionPath( + 'projectValue', + 'alertPolicyValue', + 'conditionValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAlertPolicyConditionPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectAlertPolicyConditionName', () => { + const result = + client.matchProjectFromProjectAlertPolicyConditionName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAlertPolicyConditionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchAlertPolicyFromProjectAlertPolicyConditionName', () => { + const result = + client.matchAlertPolicyFromProjectAlertPolicyConditionName(fakePath); + assert.strictEqual(result, 'alertPolicyValue'); + assert( + ( + client.pathTemplates.projectAlertPolicyConditionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchConditionFromProjectAlertPolicyConditionName', () => { + const result = + client.matchConditionFromProjectAlertPolicyConditionName(fakePath); + assert.strictEqual(result, 'conditionValue'); + assert( + ( + client.pathTemplates.projectAlertPolicyConditionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('projectGroup', async () => { - const fakePath = "/rendered/path/projectGroup"; - const expectedParameters = { - project: "projectValue", - group: "groupValue", - }; - const client = new queryserviceModule.v3.QueryServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectGroupPath', () => { - const result = client.projectGroupPath("projectValue", "groupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectGroupName', () => { - const result = client.matchProjectFromProjectGroupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchGroupFromProjectGroupName', () => { - const result = client.matchGroupFromProjectGroupName(fakePath); - assert.strictEqual(result, "groupValue"); - assert((client.pathTemplates.projectGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('projectChannelDescriptor', async () => { + const fakePath = '/rendered/path/projectChannelDescriptor'; + const expectedParameters = { + project: 'projectValue', + channel_descriptor: 'channelDescriptorValue', + }; + const client = new queryserviceModule.v3.QueryServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.projectChannelDescriptorPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectChannelDescriptorPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectChannelDescriptorPath', () => { + const result = client.projectChannelDescriptorPath( + 'projectValue', + 'channelDescriptorValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectChannelDescriptorPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectChannelDescriptorName', () => { + const result = + client.matchProjectFromProjectChannelDescriptorName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectChannelDescriptorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchChannelDescriptorFromProjectChannelDescriptorName', () => { + const result = + client.matchChannelDescriptorFromProjectChannelDescriptorName( + fakePath, + ); + assert.strictEqual(result, 'channelDescriptorValue'); + assert( + ( + client.pathTemplates.projectChannelDescriptorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('projectNotificationChannel', async () => { - const fakePath = "/rendered/path/projectNotificationChannel"; - const expectedParameters = { - project: "projectValue", - notification_channel: "notificationChannelValue", - }; - const client = new queryserviceModule.v3.QueryServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectNotificationChannelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectNotificationChannelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectNotificationChannelPath', () => { - const result = client.projectNotificationChannelPath("projectValue", "notificationChannelValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectNotificationChannelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectNotificationChannelName', () => { - const result = client.matchProjectFromProjectNotificationChannelName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectNotificationChannelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchNotificationChannelFromProjectNotificationChannelName', () => { - const result = client.matchNotificationChannelFromProjectNotificationChannelName(fakePath); - assert.strictEqual(result, "notificationChannelValue"); - assert((client.pathTemplates.projectNotificationChannelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('projectGroup', async () => { + const fakePath = '/rendered/path/projectGroup'; + const expectedParameters = { + project: 'projectValue', + group: 'groupValue', + }; + const client = new queryserviceModule.v3.QueryServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.projectGroupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectGroupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectGroupPath', () => { + const result = client.projectGroupPath('projectValue', 'groupValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectGroupPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectGroupName', () => { + const result = client.matchProjectFromProjectGroupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectGroupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchGroupFromProjectGroupName', () => { + const result = client.matchGroupFromProjectGroupName(fakePath); + assert.strictEqual(result, 'groupValue'); + assert( + (client.pathTemplates.projectGroupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('projectService', async () => { - const fakePath = "/rendered/path/projectService"; - const expectedParameters = { - project: "projectValue", - service: "serviceValue", - }; - const client = new queryserviceModule.v3.QueryServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectServicePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectServicePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectServicePath', () => { - const result = client.projectServicePath("projectValue", "serviceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectServicePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectServiceName', () => { - const result = client.matchProjectFromProjectServiceName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectServicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromProjectServiceName', () => { - const result = client.matchServiceFromProjectServiceName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.projectServicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('projectNotificationChannel', async () => { + const fakePath = '/rendered/path/projectNotificationChannel'; + const expectedParameters = { + project: 'projectValue', + notification_channel: 'notificationChannelValue', + }; + const client = new queryserviceModule.v3.QueryServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.projectNotificationChannelPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectNotificationChannelPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectNotificationChannelPath', () => { + const result = client.projectNotificationChannelPath( + 'projectValue', + 'notificationChannelValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectNotificationChannelPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectNotificationChannelName', () => { + const result = + client.matchProjectFromProjectNotificationChannelName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectNotificationChannelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchNotificationChannelFromProjectNotificationChannelName', () => { + const result = + client.matchNotificationChannelFromProjectNotificationChannelName( + fakePath, + ); + assert.strictEqual(result, 'notificationChannelValue'); + assert( + ( + client.pathTemplates.projectNotificationChannelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('projectServiceServiceLevelObjective', async () => { - const fakePath = "/rendered/path/projectServiceServiceLevelObjective"; - const expectedParameters = { - project: "projectValue", - service: "serviceValue", - service_level_objective: "serviceLevelObjectiveValue", - }; - const client = new queryserviceModule.v3.QueryServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectServiceServiceLevelObjectivePath', () => { - const result = client.projectServiceServiceLevelObjectivePath("projectValue", "serviceValue", "serviceLevelObjectiveValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectServiceServiceLevelObjectiveName', () => { - const result = client.matchProjectFromProjectServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromProjectServiceServiceLevelObjectiveName', () => { - const result = client.matchServiceFromProjectServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceLevelObjectiveFromProjectServiceServiceLevelObjectiveName', () => { - const result = client.matchServiceLevelObjectiveFromProjectServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "serviceLevelObjectiveValue"); - assert((client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('projectService', async () => { + const fakePath = '/rendered/path/projectService'; + const expectedParameters = { + project: 'projectValue', + service: 'serviceValue', + }; + const client = new queryserviceModule.v3.QueryServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.projectServicePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectServicePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectServicePath', () => { + const result = client.projectServicePath( + 'projectValue', + 'serviceValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectServicePathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectServiceName', () => { + const result = client.matchProjectFromProjectServiceName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectServicePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchServiceFromProjectServiceName', () => { + const result = client.matchServiceFromProjectServiceName(fakePath); + assert.strictEqual(result, 'serviceValue'); + assert( + (client.pathTemplates.projectServicePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('projectUptimeCheckConfig', async () => { - const fakePath = "/rendered/path/projectUptimeCheckConfig"; - const expectedParameters = { - project: "projectValue", - uptime_check_config: "uptimeCheckConfigValue", - }; - const client = new queryserviceModule.v3.QueryServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectUptimeCheckConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectUptimeCheckConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectUptimeCheckConfigPath', () => { - const result = client.projectUptimeCheckConfigPath("projectValue", "uptimeCheckConfigValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectUptimeCheckConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectUptimeCheckConfigName', () => { - const result = client.matchProjectFromProjectUptimeCheckConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectUptimeCheckConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUptimeCheckConfigFromProjectUptimeCheckConfigName', () => { - const result = client.matchUptimeCheckConfigFromProjectUptimeCheckConfigName(fakePath); - assert.strictEqual(result, "uptimeCheckConfigValue"); - assert((client.pathTemplates.projectUptimeCheckConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('projectServiceServiceLevelObjective', async () => { + const fakePath = '/rendered/path/projectServiceServiceLevelObjective'; + const expectedParameters = { + project: 'projectValue', + service: 'serviceValue', + service_level_objective: 'serviceLevelObjectiveValue', + }; + const client = new queryserviceModule.v3.QueryServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectServiceServiceLevelObjectivePath', () => { + const result = client.projectServiceServiceLevelObjectivePath( + 'projectValue', + 'serviceValue', + 'serviceLevelObjectiveValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectServiceServiceLevelObjectiveName', () => { + const result = + client.matchProjectFromProjectServiceServiceLevelObjectiveName( + fakePath, + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchServiceFromProjectServiceServiceLevelObjectiveName', () => { + const result = + client.matchServiceFromProjectServiceServiceLevelObjectiveName( + fakePath, + ); + assert.strictEqual(result, 'serviceValue'); + assert( + ( + client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchServiceLevelObjectiveFromProjectServiceServiceLevelObjectiveName', () => { + const result = + client.matchServiceLevelObjectiveFromProjectServiceServiceLevelObjectiveName( + fakePath, + ); + assert.strictEqual(result, 'serviceLevelObjectiveValue'); + assert( + ( + client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('snooze', async () => { - const fakePath = "/rendered/path/snooze"; - const expectedParameters = { - project: "projectValue", - snooze: "snoozeValue", - }; - const client = new queryserviceModule.v3.QueryServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.snoozePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.snoozePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('snoozePath', () => { - const result = client.snoozePath("projectValue", "snoozeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.snoozePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromSnoozeName', () => { - const result = client.matchProjectFromSnoozeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.snoozePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSnoozeFromSnoozeName', () => { - const result = client.matchSnoozeFromSnoozeName(fakePath); - assert.strictEqual(result, "snoozeValue"); - assert((client.pathTemplates.snoozePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('projectUptimeCheckConfig', async () => { + const fakePath = '/rendered/path/projectUptimeCheckConfig'; + const expectedParameters = { + project: 'projectValue', + uptime_check_config: 'uptimeCheckConfigValue', + }; + const client = new queryserviceModule.v3.QueryServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.projectUptimeCheckConfigPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectUptimeCheckConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectUptimeCheckConfigPath', () => { + const result = client.projectUptimeCheckConfigPath( + 'projectValue', + 'uptimeCheckConfigValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectUptimeCheckConfigPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectUptimeCheckConfigName', () => { + const result = + client.matchProjectFromProjectUptimeCheckConfigName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectUptimeCheckConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchUptimeCheckConfigFromProjectUptimeCheckConfigName', () => { + const result = + client.matchUptimeCheckConfigFromProjectUptimeCheckConfigName( + fakePath, + ); + assert.strictEqual(result, 'uptimeCheckConfigValue'); + assert( + ( + client.pathTemplates.projectUptimeCheckConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('snooze', async () => { + const fakePath = '/rendered/path/snooze'; + const expectedParameters = { + project: 'projectValue', + snooze: 'snoozeValue', + }; + const client = new queryserviceModule.v3.QueryServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.snoozePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.snoozePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('snoozePath', () => { + const result = client.snoozePath('projectValue', 'snoozeValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.snoozePathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromSnoozeName', () => { + const result = client.matchProjectFromSnoozeName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.snoozePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSnoozeFromSnoozeName', () => { + const result = client.matchSnoozeFromSnoozeName(fakePath); + assert.strictEqual(result, 'snoozeValue'); + assert( + (client.pathTemplates.snoozePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); }); + }); }); diff --git a/packages/google-cloud-monitoring/test/gapic_service_monitoring_service_v3.ts b/packages/google-cloud-monitoring/test/gapic_service_monitoring_service_v3.ts index a4beba1d761c..7a20e9b191c7 100644 --- a/packages/google-cloud-monitoring/test/gapic_service_monitoring_service_v3.ts +++ b/packages/google-cloud-monitoring/test/gapic_service_monitoring_service_v3.ts @@ -19,2636 +19,3811 @@ 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 servicemonitoringserviceModule 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 -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); +const root = protobuf.Root.fromJSON( + require('../protos/protos.json'), +).resolveAll(); // eslint-disable-next-line @typescript-eslint/no-unused-vars function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; } function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; + const filledObject = ( + instance.constructor as typeof protobuf.Message + ).toObject(instance as protobuf.Message, { defaults: true }); + return (instance.constructor as typeof protobuf.Message).fromObject( + filledObject, + ) as T; } function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); + return error + ? sinon.stub().rejects(error) + : sinon.stub().resolves([response]); } -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +function stubSimpleCallWithCallback( + response?: ResponseType, + error?: Error, +) { + return error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); } -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } +function stubPageStreamingCall( + responses?: ResponseType[], + error?: Error, +) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); + } + const transformStub = error + ? sinon.stub().callsArgWith(2, error) + : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { + mockStream.write({}); + }); } - return sinon.stub().returns(mockStream); + setImmediate(() => { + mockStream.end(); + }); + } else { + setImmediate(() => { + mockStream.write({}); + }); + setImmediate(() => { + mockStream.end(); + }); + } + return sinon.stub().returns(mockStream); } -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); +function stubAsyncIterationCall( + responses?: ResponseType[], + error?: Error, +) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({ done: true, value: undefined }); + } + return Promise.resolve({ done: false, value: responses![counter++] }); + }, + }; + }, + }; + return sinon.stub().returns(asyncIterable); } describe('v3.ServiceMonitoringServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'monitoring.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient.servicePath; - assert.strictEqual(servicePath, 'monitoring.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'monitoring.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'monitoring.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'monitoring.example.com'); - }); - - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'monitoring.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'monitoring.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); - - it('has port', () => { - const port = servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.serviceMonitoringServiceStub, undefined); - await client.initialize(); - assert(client.serviceMonitoringServiceStub); - }); - - it('has close method for the initialized client', done => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.serviceMonitoringServiceStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has close method for the non-initialized client', done => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.serviceMonitoringServiceStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('createService', () => { - it('invokes createService without error', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.CreateServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.CreateServiceRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.monitoring.v3.Service() - ); - client.innerApiCalls.createService = stubSimpleCall(expectedResponse); - const [response] = await client.createService(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createService without error using callback', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.CreateServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.CreateServiceRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.monitoring.v3.Service() - ); - client.innerApiCalls.createService = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createService( - request, - (err?: Error|null, result?: protos.google.monitoring.v3.IService|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createService with error', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.CreateServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.CreateServiceRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createService = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createService(request), expectedError); - const actualRequest = (client.innerApiCalls.createService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createService with closed client', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.CreateServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.CreateServiceRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.createService(request), expectedError); - }); - }); - - describe('getService', () => { - it('invokes getService without error', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.GetServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.GetServiceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.monitoring.v3.Service() - ); - client.innerApiCalls.getService = stubSimpleCall(expectedResponse); - const [response] = await client.getService(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getService without error using callback', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.GetServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.GetServiceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.monitoring.v3.Service() - ); - client.innerApiCalls.getService = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getService( - request, - (err?: Error|null, result?: protos.google.monitoring.v3.IService|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getService with error', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.GetServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.GetServiceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getService = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getService(request), expectedError); - const actualRequest = (client.innerApiCalls.getService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getService with closed client', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.GetServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.GetServiceRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getService(request), expectedError); - }); - }); - - describe('updateService', () => { - it('invokes updateService without error', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.UpdateServiceRequest() - ); - request.service ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.UpdateServiceRequest', ['service', 'name']); - request.service.name = defaultValue1; - const expectedHeaderRequestParams = `service.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.monitoring.v3.Service() - ); - client.innerApiCalls.updateService = stubSimpleCall(expectedResponse); - const [response] = await client.updateService(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateService without error using callback', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.UpdateServiceRequest() - ); - request.service ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.UpdateServiceRequest', ['service', 'name']); - request.service.name = defaultValue1; - const expectedHeaderRequestParams = `service.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.monitoring.v3.Service() - ); - client.innerApiCalls.updateService = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateService( - request, - (err?: Error|null, result?: protos.google.monitoring.v3.IService|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateService with error', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.UpdateServiceRequest() - ); - request.service ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.UpdateServiceRequest', ['service', 'name']); - request.service.name = defaultValue1; - const expectedHeaderRequestParams = `service.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateService = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateService(request), expectedError); - const actualRequest = (client.innerApiCalls.updateService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateService with closed client', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.UpdateServiceRequest() - ); - request.service ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.UpdateServiceRequest', ['service', 'name']); - request.service.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.updateService(request), expectedError); - }); - }); - - describe('deleteService', () => { - it('invokes deleteService without error', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.DeleteServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.DeleteServiceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteService = stubSimpleCall(expectedResponse); - const [response] = await client.deleteService(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteService without error using callback', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.DeleteServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.DeleteServiceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteService = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteService( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteService with error', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.DeleteServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.DeleteServiceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteService = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteService(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteService with closed client', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.DeleteServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.DeleteServiceRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.deleteService(request), expectedError); - }); - }); - - describe('createServiceLevelObjective', () => { - it('invokes createServiceLevelObjective without error', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.CreateServiceLevelObjectiveRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.CreateServiceLevelObjectiveRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.monitoring.v3.ServiceLevelObjective() - ); - client.innerApiCalls.createServiceLevelObjective = stubSimpleCall(expectedResponse); - const [response] = await client.createServiceLevelObjective(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createServiceLevelObjective as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createServiceLevelObjective as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createServiceLevelObjective without error using callback', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.CreateServiceLevelObjectiveRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.CreateServiceLevelObjectiveRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.monitoring.v3.ServiceLevelObjective() - ); - client.innerApiCalls.createServiceLevelObjective = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createServiceLevelObjective( - request, - (err?: Error|null, result?: protos.google.monitoring.v3.IServiceLevelObjective|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createServiceLevelObjective as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createServiceLevelObjective as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createServiceLevelObjective with error', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.CreateServiceLevelObjectiveRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.CreateServiceLevelObjectiveRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createServiceLevelObjective = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createServiceLevelObjective(request), expectedError); - const actualRequest = (client.innerApiCalls.createServiceLevelObjective as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createServiceLevelObjective as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createServiceLevelObjective with closed client', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.CreateServiceLevelObjectiveRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.CreateServiceLevelObjectiveRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.createServiceLevelObjective(request), expectedError); - }); - }); - - describe('getServiceLevelObjective', () => { - it('invokes getServiceLevelObjective without error', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.GetServiceLevelObjectiveRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.GetServiceLevelObjectiveRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.monitoring.v3.ServiceLevelObjective() - ); - client.innerApiCalls.getServiceLevelObjective = stubSimpleCall(expectedResponse); - const [response] = await client.getServiceLevelObjective(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getServiceLevelObjective as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getServiceLevelObjective as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getServiceLevelObjective without error using callback', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.GetServiceLevelObjectiveRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.GetServiceLevelObjectiveRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.monitoring.v3.ServiceLevelObjective() - ); - client.innerApiCalls.getServiceLevelObjective = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getServiceLevelObjective( - request, - (err?: Error|null, result?: protos.google.monitoring.v3.IServiceLevelObjective|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getServiceLevelObjective as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getServiceLevelObjective as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getServiceLevelObjective with error', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.GetServiceLevelObjectiveRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.GetServiceLevelObjectiveRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getServiceLevelObjective = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getServiceLevelObjective(request), expectedError); - const actualRequest = (client.innerApiCalls.getServiceLevelObjective as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getServiceLevelObjective as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getServiceLevelObjective with closed client', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.GetServiceLevelObjectiveRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.GetServiceLevelObjectiveRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getServiceLevelObjective(request), expectedError); - }); - }); - - describe('updateServiceLevelObjective', () => { - it('invokes updateServiceLevelObjective without error', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.UpdateServiceLevelObjectiveRequest() - ); - request.serviceLevelObjective ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.UpdateServiceLevelObjectiveRequest', ['serviceLevelObjective', 'name']); - request.serviceLevelObjective.name = defaultValue1; - const expectedHeaderRequestParams = `service_level_objective.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.monitoring.v3.ServiceLevelObjective() - ); - client.innerApiCalls.updateServiceLevelObjective = stubSimpleCall(expectedResponse); - const [response] = await client.updateServiceLevelObjective(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateServiceLevelObjective as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateServiceLevelObjective as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateServiceLevelObjective without error using callback', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.UpdateServiceLevelObjectiveRequest() - ); - request.serviceLevelObjective ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.UpdateServiceLevelObjectiveRequest', ['serviceLevelObjective', 'name']); - request.serviceLevelObjective.name = defaultValue1; - const expectedHeaderRequestParams = `service_level_objective.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.monitoring.v3.ServiceLevelObjective() - ); - client.innerApiCalls.updateServiceLevelObjective = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateServiceLevelObjective( - request, - (err?: Error|null, result?: protos.google.monitoring.v3.IServiceLevelObjective|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateServiceLevelObjective as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateServiceLevelObjective as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateServiceLevelObjective with error', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.UpdateServiceLevelObjectiveRequest() - ); - request.serviceLevelObjective ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.UpdateServiceLevelObjectiveRequest', ['serviceLevelObjective', 'name']); - request.serviceLevelObjective.name = defaultValue1; - const expectedHeaderRequestParams = `service_level_objective.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateServiceLevelObjective = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateServiceLevelObjective(request), expectedError); - const actualRequest = (client.innerApiCalls.updateServiceLevelObjective as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateServiceLevelObjective as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateServiceLevelObjective with closed client', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.UpdateServiceLevelObjectiveRequest() - ); - request.serviceLevelObjective ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.UpdateServiceLevelObjectiveRequest', ['serviceLevelObjective', 'name']); - request.serviceLevelObjective.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.updateServiceLevelObjective(request), expectedError); - }); - }); - - describe('deleteServiceLevelObjective', () => { - it('invokes deleteServiceLevelObjective without error', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.DeleteServiceLevelObjectiveRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.DeleteServiceLevelObjectiveRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteServiceLevelObjective = stubSimpleCall(expectedResponse); - const [response] = await client.deleteServiceLevelObjective(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteServiceLevelObjective as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteServiceLevelObjective as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteServiceLevelObjective without error using callback', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.DeleteServiceLevelObjectiveRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.DeleteServiceLevelObjectiveRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteServiceLevelObjective = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteServiceLevelObjective( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteServiceLevelObjective as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteServiceLevelObjective as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteServiceLevelObjective with error', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.DeleteServiceLevelObjectiveRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.DeleteServiceLevelObjectiveRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteServiceLevelObjective = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteServiceLevelObjective(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteServiceLevelObjective as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteServiceLevelObjective as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteServiceLevelObjective with closed client', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.DeleteServiceLevelObjectiveRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.DeleteServiceLevelObjectiveRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.deleteServiceLevelObjective(request), expectedError); - }); - }); - - describe('listServices', () => { - it('invokes listServices without error', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListServicesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListServicesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.monitoring.v3.Service()), - generateSampleMessage(new protos.google.monitoring.v3.Service()), - generateSampleMessage(new protos.google.monitoring.v3.Service()), - ]; - client.innerApiCalls.listServices = stubSimpleCall(expectedResponse); - const [response] = await client.listServices(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listServices as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listServices as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listServices without error using callback', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListServicesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListServicesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.monitoring.v3.Service()), - generateSampleMessage(new protos.google.monitoring.v3.Service()), - generateSampleMessage(new protos.google.monitoring.v3.Service()), - ]; - client.innerApiCalls.listServices = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listServices( - request, - (err?: Error|null, result?: protos.google.monitoring.v3.IService[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listServices as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listServices as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listServices with error', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListServicesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListServicesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listServices = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listServices(request), expectedError); - const actualRequest = (client.innerApiCalls.listServices as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listServices as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listServicesStream without error', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListServicesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListServicesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.monitoring.v3.Service()), - generateSampleMessage(new protos.google.monitoring.v3.Service()), - generateSampleMessage(new protos.google.monitoring.v3.Service()), - ]; - client.descriptors.page.listServices.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listServicesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.monitoring.v3.Service[] = []; - stream.on('data', (response: protos.google.monitoring.v3.Service) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listServices.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listServices, request)); - assert( - (client.descriptors.page.listServices.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + describe('Common methods', () => { + it('has apiEndpoint', () => { + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'monitoring.googleapis.com'); + }); - it('invokes listServicesStream with error', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListServicesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListServicesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listServices.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listServicesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.monitoring.v3.Service[] = []; - stream.on('data', (response: protos.google.monitoring.v3.Service) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listServices.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listServices, request)); - assert( - (client.descriptors.page.listServices.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('has universeDomain', () => { + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); - it('uses async iteration with listServices without error', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListServicesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListServicesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.monitoring.v3.Service()), - generateSampleMessage(new protos.google.monitoring.v3.Service()), - generateSampleMessage(new protos.google.monitoring.v3.Service()), - ]; - client.descriptors.page.listServices.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.monitoring.v3.IService[] = []; - const iterable = client.listServicesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listServices.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listServices.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient + .servicePath; + assert.strictEqual(servicePath, 'monitoring.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient + .apiEndpoint; + assert.strictEqual(apiEndpoint, 'monitoring.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + universeDomain: 'example.com', }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'monitoring.example.com'); + }); - it('uses async iteration with listServices with error', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListServicesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListServicesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listServices.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listServicesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.monitoring.v3.IService[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listServices.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listServices.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + universe_domain: 'example.com', }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'monitoring.example.com'); }); - describe('listServiceLevelObjectives', () => { - it('invokes listServiceLevelObjectives without error', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListServiceLevelObjectivesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListServiceLevelObjectivesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.monitoring.v3.ServiceLevelObjective()), - generateSampleMessage(new protos.google.monitoring.v3.ServiceLevelObjective()), - generateSampleMessage(new protos.google.monitoring.v3.ServiceLevelObjective()), - ]; - client.innerApiCalls.listServiceLevelObjectives = stubSimpleCall(expectedResponse); - const [response] = await client.listServiceLevelObjectives(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listServiceLevelObjectives as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listServiceLevelObjectives as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listServiceLevelObjectives without error using callback', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListServiceLevelObjectivesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListServiceLevelObjectivesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.monitoring.v3.ServiceLevelObjective()), - generateSampleMessage(new protos.google.monitoring.v3.ServiceLevelObjective()), - generateSampleMessage(new protos.google.monitoring.v3.ServiceLevelObjective()), - ]; - client.innerApiCalls.listServiceLevelObjectives = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listServiceLevelObjectives( - request, - (err?: Error|null, result?: protos.google.monitoring.v3.IServiceLevelObjective[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listServiceLevelObjectives as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listServiceLevelObjectives as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listServiceLevelObjectives with error', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListServiceLevelObjectivesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListServiceLevelObjectivesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listServiceLevelObjectives = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listServiceLevelObjectives(request), expectedError); - const actualRequest = (client.innerApiCalls.listServiceLevelObjectives as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listServiceLevelObjectives as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listServiceLevelObjectivesStream without error', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListServiceLevelObjectivesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListServiceLevelObjectivesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.monitoring.v3.ServiceLevelObjective()), - generateSampleMessage(new protos.google.monitoring.v3.ServiceLevelObjective()), - generateSampleMessage(new protos.google.monitoring.v3.ServiceLevelObjective()), - ]; - client.descriptors.page.listServiceLevelObjectives.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listServiceLevelObjectivesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.monitoring.v3.ServiceLevelObjective[] = []; - stream.on('data', (response: protos.google.monitoring.v3.ServiceLevelObjective) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listServiceLevelObjectives.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listServiceLevelObjectives, request)); - assert( - (client.descriptors.page.listServiceLevelObjectives.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); + if (typeof process === 'object' && 'env' in process) { + describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { + it('sets apiEndpoint from environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient(); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'monitoring.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } + }); + + it('value configured in code has priority over environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient( + { universeDomain: 'configured.example.com' }, + ); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'monitoring.configured.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } + }); + }); + } + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', }); + }); + }); - it('invokes listServiceLevelObjectivesStream with error', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListServiceLevelObjectivesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListServiceLevelObjectivesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listServiceLevelObjectives.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listServiceLevelObjectivesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.monitoring.v3.ServiceLevelObjective[] = []; - stream.on('data', (response: protos.google.monitoring.v3.ServiceLevelObjective) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listServiceLevelObjectives.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listServiceLevelObjectives, request)); - assert( - (client.descriptors.page.listServiceLevelObjectives.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); + it('has port', () => { + const port = + servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + fallback: true, }); + assert(client); + }); - it('uses async iteration with listServiceLevelObjectives without error', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListServiceLevelObjectivesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListServiceLevelObjectivesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.monitoring.v3.ServiceLevelObjective()), - generateSampleMessage(new protos.google.monitoring.v3.ServiceLevelObjective()), - generateSampleMessage(new protos.google.monitoring.v3.ServiceLevelObjective()), - ]; - client.descriptors.page.listServiceLevelObjectives.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.monitoring.v3.IServiceLevelObjective[] = []; - const iterable = client.listServiceLevelObjectivesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listServiceLevelObjectives.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listServiceLevelObjectives.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); + it('has initialize method and supports deferred initialization', async () => { + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); + assert.strictEqual(client.serviceMonitoringServiceStub, undefined); + await client.initialize(); + assert(client.serviceMonitoringServiceStub); + }); - it('uses async iteration with listServiceLevelObjectives with error', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListServiceLevelObjectivesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListServiceLevelObjectivesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listServiceLevelObjectives.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listServiceLevelObjectivesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.monitoring.v3.IServiceLevelObjective[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listServiceLevelObjectives.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listServiceLevelObjectives.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); + it('has close method for the initialized client', (done) => { + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.initialize().catch((err) => { + throw err; + }); + assert(client.serviceMonitoringServiceStub); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; }); }); - describe('Path templates', () => { - - describe('folderAlertPolicy', async () => { - const fakePath = "/rendered/path/folderAlertPolicy"; - const expectedParameters = { - folder: "folderValue", - alert_policy: "alertPolicyValue", - }; - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.folderAlertPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderAlertPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderAlertPolicyPath', () => { - const result = client.folderAlertPolicyPath("folderValue", "alertPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderAlertPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderAlertPolicyName', () => { - const result = client.matchFolderFromFolderAlertPolicyName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderAlertPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAlertPolicyFromFolderAlertPolicyName', () => { - const result = client.matchAlertPolicyFromFolderAlertPolicyName(fakePath); - assert.strictEqual(result, "alertPolicyValue"); - assert((client.pathTemplates.folderAlertPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderAlertPolicyCondition', async () => { - const fakePath = "/rendered/path/folderAlertPolicyCondition"; - const expectedParameters = { - folder: "folderValue", - alert_policy: "alertPolicyValue", - condition: "conditionValue", - }; - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.folderAlertPolicyConditionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderAlertPolicyConditionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderAlertPolicyConditionPath', () => { - const result = client.folderAlertPolicyConditionPath("folderValue", "alertPolicyValue", "conditionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderAlertPolicyConditionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderAlertPolicyConditionName', () => { - const result = client.matchFolderFromFolderAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAlertPolicyFromFolderAlertPolicyConditionName', () => { - const result = client.matchAlertPolicyFromFolderAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "alertPolicyValue"); - assert((client.pathTemplates.folderAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConditionFromFolderAlertPolicyConditionName', () => { - const result = client.matchConditionFromFolderAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "conditionValue"); - assert((client.pathTemplates.folderAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderChannelDescriptor', async () => { - const fakePath = "/rendered/path/folderChannelDescriptor"; - const expectedParameters = { - folder: "folderValue", - channel_descriptor: "channelDescriptorValue", - }; - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.folderChannelDescriptorPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderChannelDescriptorPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderChannelDescriptorPath', () => { - const result = client.folderChannelDescriptorPath("folderValue", "channelDescriptorValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderChannelDescriptorPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderChannelDescriptorName', () => { - const result = client.matchFolderFromFolderChannelDescriptorName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderChannelDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchChannelDescriptorFromFolderChannelDescriptorName', () => { - const result = client.matchChannelDescriptorFromFolderChannelDescriptorName(fakePath); - assert.strictEqual(result, "channelDescriptorValue"); - assert((client.pathTemplates.folderChannelDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderGroup', async () => { - const fakePath = "/rendered/path/folderGroup"; - const expectedParameters = { - folder: "folderValue", - group: "groupValue", - }; - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.folderGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderGroupPath', () => { - const result = client.folderGroupPath("folderValue", "groupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderGroupName', () => { - const result = client.matchFolderFromFolderGroupName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchGroupFromFolderGroupName', () => { - const result = client.matchGroupFromFolderGroupName(fakePath); - assert.strictEqual(result, "groupValue"); - assert((client.pathTemplates.folderGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderNotificationChannel', async () => { - const fakePath = "/rendered/path/folderNotificationChannel"; - const expectedParameters = { - folder: "folderValue", - notification_channel: "notificationChannelValue", - }; - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.folderNotificationChannelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderNotificationChannelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderNotificationChannelPath', () => { - const result = client.folderNotificationChannelPath("folderValue", "notificationChannelValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderNotificationChannelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderNotificationChannelName', () => { - const result = client.matchFolderFromFolderNotificationChannelName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderNotificationChannelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchNotificationChannelFromFolderNotificationChannelName', () => { - const result = client.matchNotificationChannelFromFolderNotificationChannelName(fakePath); - assert.strictEqual(result, "notificationChannelValue"); - assert((client.pathTemplates.folderNotificationChannelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderService', async () => { - const fakePath = "/rendered/path/folderService"; - const expectedParameters = { - folder: "folderValue", - service: "serviceValue", - }; - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.folderServicePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderServicePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderServicePath', () => { - const result = client.folderServicePath("folderValue", "serviceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderServicePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderServiceName', () => { - const result = client.matchFolderFromFolderServiceName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderServicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromFolderServiceName', () => { - const result = client.matchServiceFromFolderServiceName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.folderServicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderServiceServiceLevelObjective', async () => { - const fakePath = "/rendered/path/folderServiceServiceLevelObjective"; - const expectedParameters = { - folder: "folderValue", - service: "serviceValue", - service_level_objective: "serviceLevelObjectiveValue", - }; - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderServiceServiceLevelObjectivePath', () => { - const result = client.folderServiceServiceLevelObjectivePath("folderValue", "serviceValue", "serviceLevelObjectiveValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderServiceServiceLevelObjectiveName', () => { - const result = client.matchFolderFromFolderServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromFolderServiceServiceLevelObjectiveName', () => { - const result = client.matchServiceFromFolderServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceLevelObjectiveFromFolderServiceServiceLevelObjectiveName', () => { - const result = client.matchServiceLevelObjectiveFromFolderServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "serviceLevelObjectiveValue"); - assert((client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderUptimeCheckConfig', async () => { - const fakePath = "/rendered/path/folderUptimeCheckConfig"; - const expectedParameters = { - folder: "folderValue", - uptime_check_config: "uptimeCheckConfigValue", - }; - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.folderUptimeCheckConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderUptimeCheckConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderUptimeCheckConfigPath', () => { - const result = client.folderUptimeCheckConfigPath("folderValue", "uptimeCheckConfigValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderUptimeCheckConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderUptimeCheckConfigName', () => { - const result = client.matchFolderFromFolderUptimeCheckConfigName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderUptimeCheckConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUptimeCheckConfigFromFolderUptimeCheckConfigName', () => { - const result = client.matchUptimeCheckConfigFromFolderUptimeCheckConfigName(fakePath); - assert.strictEqual(result, "uptimeCheckConfigValue"); - assert((client.pathTemplates.folderUptimeCheckConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationAlertPolicy', async () => { - const fakePath = "/rendered/path/organizationAlertPolicy"; - const expectedParameters = { - organization: "organizationValue", - alert_policy: "alertPolicyValue", - }; - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationAlertPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationAlertPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationAlertPolicyPath', () => { - const result = client.organizationAlertPolicyPath("organizationValue", "alertPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationAlertPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationAlertPolicyName', () => { - const result = client.matchOrganizationFromOrganizationAlertPolicyName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationAlertPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAlertPolicyFromOrganizationAlertPolicyName', () => { - const result = client.matchAlertPolicyFromOrganizationAlertPolicyName(fakePath); - assert.strictEqual(result, "alertPolicyValue"); - assert((client.pathTemplates.organizationAlertPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationAlertPolicyCondition', async () => { - const fakePath = "/rendered/path/organizationAlertPolicyCondition"; - const expectedParameters = { - organization: "organizationValue", - alert_policy: "alertPolicyValue", - condition: "conditionValue", - }; - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationAlertPolicyConditionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationAlertPolicyConditionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationAlertPolicyConditionPath', () => { - const result = client.organizationAlertPolicyConditionPath("organizationValue", "alertPolicyValue", "conditionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationAlertPolicyConditionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationAlertPolicyConditionName', () => { - const result = client.matchOrganizationFromOrganizationAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAlertPolicyFromOrganizationAlertPolicyConditionName', () => { - const result = client.matchAlertPolicyFromOrganizationAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "alertPolicyValue"); - assert((client.pathTemplates.organizationAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConditionFromOrganizationAlertPolicyConditionName', () => { - const result = client.matchConditionFromOrganizationAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "conditionValue"); - assert((client.pathTemplates.organizationAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationChannelDescriptor', async () => { - const fakePath = "/rendered/path/organizationChannelDescriptor"; - const expectedParameters = { - organization: "organizationValue", - channel_descriptor: "channelDescriptorValue", - }; - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationChannelDescriptorPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationChannelDescriptorPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationChannelDescriptorPath', () => { - const result = client.organizationChannelDescriptorPath("organizationValue", "channelDescriptorValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationChannelDescriptorPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationChannelDescriptorName', () => { - const result = client.matchOrganizationFromOrganizationChannelDescriptorName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationChannelDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchChannelDescriptorFromOrganizationChannelDescriptorName', () => { - const result = client.matchChannelDescriptorFromOrganizationChannelDescriptorName(fakePath); - assert.strictEqual(result, "channelDescriptorValue"); - assert((client.pathTemplates.organizationChannelDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationGroup', async () => { - const fakePath = "/rendered/path/organizationGroup"; - const expectedParameters = { - organization: "organizationValue", - group: "groupValue", - }; - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationGroupPath', () => { - const result = client.organizationGroupPath("organizationValue", "groupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationGroupName', () => { - const result = client.matchOrganizationFromOrganizationGroupName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchGroupFromOrganizationGroupName', () => { - const result = client.matchGroupFromOrganizationGroupName(fakePath); - assert.strictEqual(result, "groupValue"); - assert((client.pathTemplates.organizationGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationNotificationChannel', async () => { - const fakePath = "/rendered/path/organizationNotificationChannel"; - const expectedParameters = { - organization: "organizationValue", - notification_channel: "notificationChannelValue", - }; - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationNotificationChannelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationNotificationChannelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationNotificationChannelPath', () => { - const result = client.organizationNotificationChannelPath("organizationValue", "notificationChannelValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationNotificationChannelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationNotificationChannelName', () => { - const result = client.matchOrganizationFromOrganizationNotificationChannelName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationNotificationChannelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchNotificationChannelFromOrganizationNotificationChannelName', () => { - const result = client.matchNotificationChannelFromOrganizationNotificationChannelName(fakePath); - assert.strictEqual(result, "notificationChannelValue"); - assert((client.pathTemplates.organizationNotificationChannelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationService', async () => { - const fakePath = "/rendered/path/organizationService"; - const expectedParameters = { - organization: "organizationValue", - service: "serviceValue", - }; - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationServicePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationServicePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationServicePath', () => { - const result = client.organizationServicePath("organizationValue", "serviceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationServicePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationServiceName', () => { - const result = client.matchOrganizationFromOrganizationServiceName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationServicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromOrganizationServiceName', () => { - const result = client.matchServiceFromOrganizationServiceName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.organizationServicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationServiceServiceLevelObjective', async () => { - const fakePath = "/rendered/path/organizationServiceServiceLevelObjective"; - const expectedParameters = { - organization: "organizationValue", - service: "serviceValue", - service_level_objective: "serviceLevelObjectiveValue", - }; - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationServiceServiceLevelObjectivePath', () => { - const result = client.organizationServiceServiceLevelObjectivePath("organizationValue", "serviceValue", "serviceLevelObjectiveValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationServiceServiceLevelObjectiveName', () => { - const result = client.matchOrganizationFromOrganizationServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromOrganizationServiceServiceLevelObjectiveName', () => { - const result = client.matchServiceFromOrganizationServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceLevelObjectiveFromOrganizationServiceServiceLevelObjectiveName', () => { - const result = client.matchServiceLevelObjectiveFromOrganizationServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "serviceLevelObjectiveValue"); - assert((client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationUptimeCheckConfig', async () => { - const fakePath = "/rendered/path/organizationUptimeCheckConfig"; - const expectedParameters = { - organization: "organizationValue", - uptime_check_config: "uptimeCheckConfigValue", - }; - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationUptimeCheckConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationUptimeCheckConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationUptimeCheckConfigPath', () => { - const result = client.organizationUptimeCheckConfigPath("organizationValue", "uptimeCheckConfigValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationUptimeCheckConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationUptimeCheckConfigName', () => { - const result = client.matchOrganizationFromOrganizationUptimeCheckConfigName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationUptimeCheckConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUptimeCheckConfigFromOrganizationUptimeCheckConfigName', () => { - const result = client.matchUptimeCheckConfigFromOrganizationUptimeCheckConfigName(fakePath); - assert.strictEqual(result, "uptimeCheckConfigValue"); - assert((client.pathTemplates.organizationUptimeCheckConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('project', async () => { - const fakePath = "/rendered/path/project"; - const expectedParameters = { - project: "projectValue", - }; - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectPath', () => { - const result = client.projectPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectName', () => { - const result = client.matchProjectFromProjectName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAlertPolicy', async () => { - const fakePath = "/rendered/path/projectAlertPolicy"; - const expectedParameters = { - project: "projectValue", - alert_policy: "alertPolicyValue", - }; - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectAlertPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAlertPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAlertPolicyPath', () => { - const result = client.projectAlertPolicyPath("projectValue", "alertPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAlertPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAlertPolicyName', () => { - const result = client.matchProjectFromProjectAlertPolicyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAlertPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAlertPolicyFromProjectAlertPolicyName', () => { - const result = client.matchAlertPolicyFromProjectAlertPolicyName(fakePath); - assert.strictEqual(result, "alertPolicyValue"); - assert((client.pathTemplates.projectAlertPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAlertPolicyCondition', async () => { - const fakePath = "/rendered/path/projectAlertPolicyCondition"; - const expectedParameters = { - project: "projectValue", - alert_policy: "alertPolicyValue", - condition: "conditionValue", - }; - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectAlertPolicyConditionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAlertPolicyConditionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAlertPolicyConditionPath', () => { - const result = client.projectAlertPolicyConditionPath("projectValue", "alertPolicyValue", "conditionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAlertPolicyConditionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAlertPolicyConditionName', () => { - const result = client.matchProjectFromProjectAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAlertPolicyFromProjectAlertPolicyConditionName', () => { - const result = client.matchAlertPolicyFromProjectAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "alertPolicyValue"); - assert((client.pathTemplates.projectAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConditionFromProjectAlertPolicyConditionName', () => { - const result = client.matchConditionFromProjectAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "conditionValue"); - assert((client.pathTemplates.projectAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectChannelDescriptor', async () => { - const fakePath = "/rendered/path/projectChannelDescriptor"; - const expectedParameters = { - project: "projectValue", - channel_descriptor: "channelDescriptorValue", - }; - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectChannelDescriptorPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectChannelDescriptorPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectChannelDescriptorPath', () => { - const result = client.projectChannelDescriptorPath("projectValue", "channelDescriptorValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectChannelDescriptorPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectChannelDescriptorName', () => { - const result = client.matchProjectFromProjectChannelDescriptorName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectChannelDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchChannelDescriptorFromProjectChannelDescriptorName', () => { - const result = client.matchChannelDescriptorFromProjectChannelDescriptorName(fakePath); - assert.strictEqual(result, "channelDescriptorValue"); - assert((client.pathTemplates.projectChannelDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectGroup', async () => { - const fakePath = "/rendered/path/projectGroup"; - const expectedParameters = { - project: "projectValue", - group: "groupValue", - }; - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectGroupPath', () => { - const result = client.projectGroupPath("projectValue", "groupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectGroupName', () => { - const result = client.matchProjectFromProjectGroupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchGroupFromProjectGroupName', () => { - const result = client.matchGroupFromProjectGroupName(fakePath); - assert.strictEqual(result, "groupValue"); - assert((client.pathTemplates.projectGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectNotificationChannel', async () => { - const fakePath = "/rendered/path/projectNotificationChannel"; - const expectedParameters = { - project: "projectValue", - notification_channel: "notificationChannelValue", - }; - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectNotificationChannelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectNotificationChannelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectNotificationChannelPath', () => { - const result = client.projectNotificationChannelPath("projectValue", "notificationChannelValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectNotificationChannelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectNotificationChannelName', () => { - const result = client.matchProjectFromProjectNotificationChannelName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectNotificationChannelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchNotificationChannelFromProjectNotificationChannelName', () => { - const result = client.matchNotificationChannelFromProjectNotificationChannelName(fakePath); - assert.strictEqual(result, "notificationChannelValue"); - assert((client.pathTemplates.projectNotificationChannelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectService', async () => { - const fakePath = "/rendered/path/projectService"; - const expectedParameters = { - project: "projectValue", - service: "serviceValue", - }; - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectServicePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectServicePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectServicePath', () => { - const result = client.projectServicePath("projectValue", "serviceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectServicePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectServiceName', () => { - const result = client.matchProjectFromProjectServiceName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectServicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromProjectServiceName', () => { - const result = client.matchServiceFromProjectServiceName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.projectServicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectServiceServiceLevelObjective', async () => { - const fakePath = "/rendered/path/projectServiceServiceLevelObjective"; - const expectedParameters = { - project: "projectValue", - service: "serviceValue", - service_level_objective: "serviceLevelObjectiveValue", - }; - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectServiceServiceLevelObjectivePath', () => { - const result = client.projectServiceServiceLevelObjectivePath("projectValue", "serviceValue", "serviceLevelObjectiveValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectServiceServiceLevelObjectiveName', () => { - const result = client.matchProjectFromProjectServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromProjectServiceServiceLevelObjectiveName', () => { - const result = client.matchServiceFromProjectServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceLevelObjectiveFromProjectServiceServiceLevelObjectiveName', () => { - const result = client.matchServiceLevelObjectiveFromProjectServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "serviceLevelObjectiveValue"); - assert((client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectUptimeCheckConfig', async () => { - const fakePath = "/rendered/path/projectUptimeCheckConfig"; - const expectedParameters = { - project: "projectValue", - uptime_check_config: "uptimeCheckConfigValue", - }; - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectUptimeCheckConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectUptimeCheckConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectUptimeCheckConfigPath', () => { - const result = client.projectUptimeCheckConfigPath("projectValue", "uptimeCheckConfigValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectUptimeCheckConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectUptimeCheckConfigName', () => { - const result = client.matchProjectFromProjectUptimeCheckConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectUptimeCheckConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUptimeCheckConfigFromProjectUptimeCheckConfigName', () => { - const result = client.matchUptimeCheckConfigFromProjectUptimeCheckConfigName(fakePath); - assert.strictEqual(result, "uptimeCheckConfigValue"); - assert((client.pathTemplates.projectUptimeCheckConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('snooze', async () => { - const fakePath = "/rendered/path/snooze"; - const expectedParameters = { - project: "projectValue", - snooze: "snoozeValue", - }; - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.snoozePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.snoozePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('snoozePath', () => { - const result = client.snoozePath("projectValue", "snoozeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.snoozePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromSnoozeName', () => { - const result = client.matchProjectFromSnoozeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.snoozePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSnoozeFromSnoozeName', () => { - const result = client.matchSnoozeFromSnoozeName(fakePath); - assert.strictEqual(result, "snoozeValue"); - assert((client.pathTemplates.snoozePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + it('has close method for the non-initialized client', (done) => { + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.serviceMonitoringServiceStub, undefined); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; }); }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + }); + + describe('createService', () => { + it('invokes createService without error', async () => { + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.CreateServiceRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.CreateServiceRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.monitoring.v3.Service(), + ); + client.innerApiCalls.createService = stubSimpleCall(expectedResponse); + const [response] = await client.createService(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createService as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createService as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createService without error using callback', async () => { + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.CreateServiceRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.CreateServiceRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.monitoring.v3.Service(), + ); + client.innerApiCalls.createService = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createService( + request, + ( + err?: Error | null, + result?: protos.google.monitoring.v3.IService | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createService as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createService as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createService with error', async () => { + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.CreateServiceRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.CreateServiceRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createService = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.createService(request), expectedError); + const actualRequest = ( + client.innerApiCalls.createService as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createService as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createService with closed client', async () => { + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.CreateServiceRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.CreateServiceRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.createService(request), expectedError); + }); + }); + + describe('getService', () => { + it('invokes getService without error', async () => { + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.GetServiceRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.GetServiceRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.monitoring.v3.Service(), + ); + client.innerApiCalls.getService = stubSimpleCall(expectedResponse); + const [response] = await client.getService(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getService as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getService as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getService without error using callback', async () => { + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.GetServiceRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.GetServiceRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.monitoring.v3.Service(), + ); + client.innerApiCalls.getService = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getService( + request, + ( + err?: Error | null, + result?: protos.google.monitoring.v3.IService | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getService as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getService as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getService with error', async () => { + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.GetServiceRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.GetServiceRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getService = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.getService(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getService as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getService as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getService with closed client', async () => { + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.GetServiceRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.GetServiceRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.getService(request), expectedError); + }); + }); + + describe('updateService', () => { + it('invokes updateService without error', async () => { + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.UpdateServiceRequest(), + ); + request.service ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.UpdateServiceRequest', + ['service', 'name'], + ); + request.service.name = defaultValue1; + const expectedHeaderRequestParams = `service.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.monitoring.v3.Service(), + ); + client.innerApiCalls.updateService = stubSimpleCall(expectedResponse); + const [response] = await client.updateService(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateService as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateService as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateService without error using callback', async () => { + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.UpdateServiceRequest(), + ); + request.service ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.UpdateServiceRequest', + ['service', 'name'], + ); + request.service.name = defaultValue1; + const expectedHeaderRequestParams = `service.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.monitoring.v3.Service(), + ); + client.innerApiCalls.updateService = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateService( + request, + ( + err?: Error | null, + result?: protos.google.monitoring.v3.IService | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateService as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateService as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateService with error', async () => { + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.UpdateServiceRequest(), + ); + request.service ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.UpdateServiceRequest', + ['service', 'name'], + ); + request.service.name = defaultValue1; + const expectedHeaderRequestParams = `service.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateService = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.updateService(request), expectedError); + const actualRequest = ( + client.innerApiCalls.updateService as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateService as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateService with closed client', async () => { + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.UpdateServiceRequest(), + ); + request.service ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.UpdateServiceRequest', + ['service', 'name'], + ); + request.service.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.updateService(request), expectedError); + }); + }); + + describe('deleteService', () => { + it('invokes deleteService without error', async () => { + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.DeleteServiceRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.DeleteServiceRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty(), + ); + client.innerApiCalls.deleteService = stubSimpleCall(expectedResponse); + const [response] = await client.deleteService(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteService as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteService as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteService without error using callback', async () => { + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.DeleteServiceRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.DeleteServiceRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty(), + ); + client.innerApiCalls.deleteService = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteService( + request, + ( + err?: Error | null, + result?: protos.google.protobuf.IEmpty | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteService as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteService as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteService with error', async () => { + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.DeleteServiceRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.DeleteServiceRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteService = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.deleteService(request), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteService as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteService as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteService with closed client', async () => { + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.DeleteServiceRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.DeleteServiceRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.deleteService(request), expectedError); + }); + }); + + describe('createServiceLevelObjective', () => { + it('invokes createServiceLevelObjective without error', async () => { + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.CreateServiceLevelObjectiveRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.CreateServiceLevelObjectiveRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.monitoring.v3.ServiceLevelObjective(), + ); + client.innerApiCalls.createServiceLevelObjective = + stubSimpleCall(expectedResponse); + const [response] = await client.createServiceLevelObjective(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createServiceLevelObjective as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createServiceLevelObjective as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createServiceLevelObjective without error using callback', async () => { + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.CreateServiceLevelObjectiveRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.CreateServiceLevelObjectiveRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.monitoring.v3.ServiceLevelObjective(), + ); + client.innerApiCalls.createServiceLevelObjective = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createServiceLevelObjective( + request, + ( + err?: Error | null, + result?: protos.google.monitoring.v3.IServiceLevelObjective | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createServiceLevelObjective as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createServiceLevelObjective as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createServiceLevelObjective with error', async () => { + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.CreateServiceLevelObjectiveRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.CreateServiceLevelObjectiveRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createServiceLevelObjective = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.createServiceLevelObjective(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.createServiceLevelObjective as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createServiceLevelObjective as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createServiceLevelObjective with closed client', async () => { + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.CreateServiceLevelObjectiveRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.CreateServiceLevelObjectiveRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects( + client.createServiceLevelObjective(request), + expectedError, + ); + }); + }); + + describe('getServiceLevelObjective', () => { + it('invokes getServiceLevelObjective without error', async () => { + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.GetServiceLevelObjectiveRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.GetServiceLevelObjectiveRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.monitoring.v3.ServiceLevelObjective(), + ); + client.innerApiCalls.getServiceLevelObjective = + stubSimpleCall(expectedResponse); + const [response] = await client.getServiceLevelObjective(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getServiceLevelObjective as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getServiceLevelObjective as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getServiceLevelObjective without error using callback', async () => { + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.GetServiceLevelObjectiveRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.GetServiceLevelObjectiveRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.monitoring.v3.ServiceLevelObjective(), + ); + client.innerApiCalls.getServiceLevelObjective = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getServiceLevelObjective( + request, + ( + err?: Error | null, + result?: protos.google.monitoring.v3.IServiceLevelObjective | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getServiceLevelObjective as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getServiceLevelObjective as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getServiceLevelObjective with error', async () => { + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.GetServiceLevelObjectiveRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.GetServiceLevelObjectiveRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getServiceLevelObjective = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.getServiceLevelObjective(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.getServiceLevelObjective as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getServiceLevelObjective as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getServiceLevelObjective with closed client', async () => { + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.GetServiceLevelObjectiveRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.GetServiceLevelObjectiveRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects( + client.getServiceLevelObjective(request), + expectedError, + ); + }); + }); + + describe('updateServiceLevelObjective', () => { + it('invokes updateServiceLevelObjective without error', async () => { + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.UpdateServiceLevelObjectiveRequest(), + ); + request.serviceLevelObjective ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.UpdateServiceLevelObjectiveRequest', + ['serviceLevelObjective', 'name'], + ); + request.serviceLevelObjective.name = defaultValue1; + const expectedHeaderRequestParams = `service_level_objective.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.monitoring.v3.ServiceLevelObjective(), + ); + client.innerApiCalls.updateServiceLevelObjective = + stubSimpleCall(expectedResponse); + const [response] = await client.updateServiceLevelObjective(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateServiceLevelObjective as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateServiceLevelObjective as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateServiceLevelObjective without error using callback', async () => { + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.UpdateServiceLevelObjectiveRequest(), + ); + request.serviceLevelObjective ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.UpdateServiceLevelObjectiveRequest', + ['serviceLevelObjective', 'name'], + ); + request.serviceLevelObjective.name = defaultValue1; + const expectedHeaderRequestParams = `service_level_objective.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.monitoring.v3.ServiceLevelObjective(), + ); + client.innerApiCalls.updateServiceLevelObjective = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateServiceLevelObjective( + request, + ( + err?: Error | null, + result?: protos.google.monitoring.v3.IServiceLevelObjective | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateServiceLevelObjective as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateServiceLevelObjective as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateServiceLevelObjective with error', async () => { + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.UpdateServiceLevelObjectiveRequest(), + ); + request.serviceLevelObjective ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.UpdateServiceLevelObjectiveRequest', + ['serviceLevelObjective', 'name'], + ); + request.serviceLevelObjective.name = defaultValue1; + const expectedHeaderRequestParams = `service_level_objective.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateServiceLevelObjective = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.updateServiceLevelObjective(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.updateServiceLevelObjective as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateServiceLevelObjective as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateServiceLevelObjective with closed client', async () => { + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.UpdateServiceLevelObjectiveRequest(), + ); + request.serviceLevelObjective ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.UpdateServiceLevelObjectiveRequest', + ['serviceLevelObjective', 'name'], + ); + request.serviceLevelObjective.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects( + client.updateServiceLevelObjective(request), + expectedError, + ); + }); + }); + + describe('deleteServiceLevelObjective', () => { + it('invokes deleteServiceLevelObjective without error', async () => { + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.DeleteServiceLevelObjectiveRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.DeleteServiceLevelObjectiveRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty(), + ); + client.innerApiCalls.deleteServiceLevelObjective = + stubSimpleCall(expectedResponse); + const [response] = await client.deleteServiceLevelObjective(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteServiceLevelObjective as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteServiceLevelObjective as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteServiceLevelObjective without error using callback', async () => { + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.DeleteServiceLevelObjectiveRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.DeleteServiceLevelObjectiveRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty(), + ); + client.innerApiCalls.deleteServiceLevelObjective = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteServiceLevelObjective( + request, + ( + err?: Error | null, + result?: protos.google.protobuf.IEmpty | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteServiceLevelObjective as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteServiceLevelObjective as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteServiceLevelObjective with error', async () => { + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.DeleteServiceLevelObjectiveRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.DeleteServiceLevelObjectiveRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteServiceLevelObjective = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.deleteServiceLevelObjective(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.deleteServiceLevelObjective as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteServiceLevelObjective as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteServiceLevelObjective with closed client', async () => { + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.DeleteServiceLevelObjectiveRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.DeleteServiceLevelObjectiveRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects( + client.deleteServiceLevelObjective(request), + expectedError, + ); + }); + }); + + describe('listServices', () => { + it('invokes listServices without error', async () => { + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListServicesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.ListServicesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.monitoring.v3.Service()), + generateSampleMessage(new protos.google.monitoring.v3.Service()), + generateSampleMessage(new protos.google.monitoring.v3.Service()), + ]; + client.innerApiCalls.listServices = stubSimpleCall(expectedResponse); + const [response] = await client.listServices(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listServices as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listServices as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listServices without error using callback', async () => { + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListServicesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.ListServicesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.monitoring.v3.Service()), + generateSampleMessage(new protos.google.monitoring.v3.Service()), + generateSampleMessage(new protos.google.monitoring.v3.Service()), + ]; + client.innerApiCalls.listServices = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listServices( + request, + ( + err?: Error | null, + result?: protos.google.monitoring.v3.IService[] | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listServices as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listServices as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listServices with error', async () => { + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListServicesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.ListServicesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listServices = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.listServices(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listServices as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listServices as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listServicesStream without error', async () => { + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListServicesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.ListServicesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.monitoring.v3.Service()), + generateSampleMessage(new protos.google.monitoring.v3.Service()), + generateSampleMessage(new protos.google.monitoring.v3.Service()), + ]; + client.descriptors.page.listServices.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listServicesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.monitoring.v3.Service[] = []; + stream.on('data', (response: protos.google.monitoring.v3.Service) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.listServices.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listServices, request), + ); + assert( + (client.descriptors.page.listServices.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + + it('invokes listServicesStream with error', async () => { + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListServicesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.ListServicesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listServices.createStream = stubPageStreamingCall( + undefined, + expectedError, + ); + const stream = client.listServicesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.monitoring.v3.Service[] = []; + stream.on('data', (response: protos.google.monitoring.v3.Service) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listServices.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listServices, request), + ); + assert( + (client.descriptors.page.listServices.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + + it('uses async iteration with listServices without error', async () => { + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListServicesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.ListServicesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.monitoring.v3.Service()), + generateSampleMessage(new protos.google.monitoring.v3.Service()), + generateSampleMessage(new protos.google.monitoring.v3.Service()), + ]; + client.descriptors.page.listServices.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.monitoring.v3.IService[] = []; + const iterable = client.listServicesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listServices.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listServices.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + + it('uses async iteration with listServices with error', async () => { + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListServicesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.ListServicesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listServices.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listServicesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.monitoring.v3.IService[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listServices.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listServices.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + }); + + describe('listServiceLevelObjectives', () => { + it('invokes listServiceLevelObjectives without error', async () => { + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListServiceLevelObjectivesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.ListServiceLevelObjectivesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.monitoring.v3.ServiceLevelObjective(), + ), + generateSampleMessage( + new protos.google.monitoring.v3.ServiceLevelObjective(), + ), + generateSampleMessage( + new protos.google.monitoring.v3.ServiceLevelObjective(), + ), + ]; + client.innerApiCalls.listServiceLevelObjectives = + stubSimpleCall(expectedResponse); + const [response] = await client.listServiceLevelObjectives(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listServiceLevelObjectives as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listServiceLevelObjectives as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listServiceLevelObjectives without error using callback', async () => { + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListServiceLevelObjectivesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.ListServiceLevelObjectivesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.monitoring.v3.ServiceLevelObjective(), + ), + generateSampleMessage( + new protos.google.monitoring.v3.ServiceLevelObjective(), + ), + generateSampleMessage( + new protos.google.monitoring.v3.ServiceLevelObjective(), + ), + ]; + client.innerApiCalls.listServiceLevelObjectives = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listServiceLevelObjectives( + request, + ( + err?: Error | null, + result?: + | protos.google.monitoring.v3.IServiceLevelObjective[] + | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listServiceLevelObjectives as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listServiceLevelObjectives as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listServiceLevelObjectives with error', async () => { + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListServiceLevelObjectivesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.ListServiceLevelObjectivesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listServiceLevelObjectives = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.listServiceLevelObjectives(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.listServiceLevelObjectives as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listServiceLevelObjectives as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listServiceLevelObjectivesStream without error', async () => { + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListServiceLevelObjectivesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.ListServiceLevelObjectivesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.monitoring.v3.ServiceLevelObjective(), + ), + generateSampleMessage( + new protos.google.monitoring.v3.ServiceLevelObjective(), + ), + generateSampleMessage( + new protos.google.monitoring.v3.ServiceLevelObjective(), + ), + ]; + client.descriptors.page.listServiceLevelObjectives.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listServiceLevelObjectivesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.monitoring.v3.ServiceLevelObjective[] = + []; + stream.on( + 'data', + (response: protos.google.monitoring.v3.ServiceLevelObjective) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + ( + client.descriptors.page.listServiceLevelObjectives + .createStream as SinonStub + ) + .getCall(0) + .calledWith(client.innerApiCalls.listServiceLevelObjectives, request), + ); + assert( + ( + client.descriptors.page.listServiceLevelObjectives + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + + it('invokes listServiceLevelObjectivesStream with error', async () => { + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListServiceLevelObjectivesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.ListServiceLevelObjectivesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listServiceLevelObjectives.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listServiceLevelObjectivesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.monitoring.v3.ServiceLevelObjective[] = + []; + stream.on( + 'data', + (response: protos.google.monitoring.v3.ServiceLevelObjective) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + ( + client.descriptors.page.listServiceLevelObjectives + .createStream as SinonStub + ) + .getCall(0) + .calledWith(client.innerApiCalls.listServiceLevelObjectives, request), + ); + assert( + ( + client.descriptors.page.listServiceLevelObjectives + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + + it('uses async iteration with listServiceLevelObjectives without error', async () => { + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListServiceLevelObjectivesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.ListServiceLevelObjectivesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.monitoring.v3.ServiceLevelObjective(), + ), + generateSampleMessage( + new protos.google.monitoring.v3.ServiceLevelObjective(), + ), + generateSampleMessage( + new protos.google.monitoring.v3.ServiceLevelObjective(), + ), + ]; + client.descriptors.page.listServiceLevelObjectives.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.monitoring.v3.IServiceLevelObjective[] = + []; + const iterable = client.listServiceLevelObjectivesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listServiceLevelObjectives + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.descriptors.page.listServiceLevelObjectives + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + + it('uses async iteration with listServiceLevelObjectives with error', async () => { + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListServiceLevelObjectivesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.ListServiceLevelObjectivesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listServiceLevelObjectives.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listServiceLevelObjectivesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.monitoring.v3.IServiceLevelObjective[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listServiceLevelObjectives + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.descriptors.page.listServiceLevelObjectives + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + }); + + describe('Path templates', () => { + describe('folderAlertPolicy', async () => { + const fakePath = '/rendered/path/folderAlertPolicy'; + const expectedParameters = { + folder: 'folderValue', + alert_policy: 'alertPolicyValue', + }; + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.folderAlertPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.folderAlertPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('folderAlertPolicyPath', () => { + const result = client.folderAlertPolicyPath( + 'folderValue', + 'alertPolicyValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.folderAlertPolicyPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchFolderFromFolderAlertPolicyName', () => { + const result = client.matchFolderFromFolderAlertPolicyName(fakePath); + assert.strictEqual(result, 'folderValue'); + assert( + ( + client.pathTemplates.folderAlertPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchAlertPolicyFromFolderAlertPolicyName', () => { + const result = + client.matchAlertPolicyFromFolderAlertPolicyName(fakePath); + assert.strictEqual(result, 'alertPolicyValue'); + assert( + ( + client.pathTemplates.folderAlertPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('folderAlertPolicyCondition', async () => { + const fakePath = '/rendered/path/folderAlertPolicyCondition'; + const expectedParameters = { + folder: 'folderValue', + alert_policy: 'alertPolicyValue', + condition: 'conditionValue', + }; + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.folderAlertPolicyConditionPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.folderAlertPolicyConditionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('folderAlertPolicyConditionPath', () => { + const result = client.folderAlertPolicyConditionPath( + 'folderValue', + 'alertPolicyValue', + 'conditionValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.folderAlertPolicyConditionPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchFolderFromFolderAlertPolicyConditionName', () => { + const result = + client.matchFolderFromFolderAlertPolicyConditionName(fakePath); + assert.strictEqual(result, 'folderValue'); + assert( + ( + client.pathTemplates.folderAlertPolicyConditionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchAlertPolicyFromFolderAlertPolicyConditionName', () => { + const result = + client.matchAlertPolicyFromFolderAlertPolicyConditionName(fakePath); + assert.strictEqual(result, 'alertPolicyValue'); + assert( + ( + client.pathTemplates.folderAlertPolicyConditionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchConditionFromFolderAlertPolicyConditionName', () => { + const result = + client.matchConditionFromFolderAlertPolicyConditionName(fakePath); + assert.strictEqual(result, 'conditionValue'); + assert( + ( + client.pathTemplates.folderAlertPolicyConditionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('folderChannelDescriptor', async () => { + const fakePath = '/rendered/path/folderChannelDescriptor'; + const expectedParameters = { + folder: 'folderValue', + channel_descriptor: 'channelDescriptorValue', + }; + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.folderChannelDescriptorPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.folderChannelDescriptorPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('folderChannelDescriptorPath', () => { + const result = client.folderChannelDescriptorPath( + 'folderValue', + 'channelDescriptorValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.folderChannelDescriptorPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchFolderFromFolderChannelDescriptorName', () => { + const result = + client.matchFolderFromFolderChannelDescriptorName(fakePath); + assert.strictEqual(result, 'folderValue'); + assert( + ( + client.pathTemplates.folderChannelDescriptorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchChannelDescriptorFromFolderChannelDescriptorName', () => { + const result = + client.matchChannelDescriptorFromFolderChannelDescriptorName( + fakePath, + ); + assert.strictEqual(result, 'channelDescriptorValue'); + assert( + ( + client.pathTemplates.folderChannelDescriptorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('folderGroup', async () => { + const fakePath = '/rendered/path/folderGroup'; + const expectedParameters = { + folder: 'folderValue', + group: 'groupValue', + }; + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.folderGroupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.folderGroupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('folderGroupPath', () => { + const result = client.folderGroupPath('folderValue', 'groupValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.folderGroupPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchFolderFromFolderGroupName', () => { + const result = client.matchFolderFromFolderGroupName(fakePath); + assert.strictEqual(result, 'folderValue'); + assert( + (client.pathTemplates.folderGroupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchGroupFromFolderGroupName', () => { + const result = client.matchGroupFromFolderGroupName(fakePath); + assert.strictEqual(result, 'groupValue'); + assert( + (client.pathTemplates.folderGroupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('folderNotificationChannel', async () => { + const fakePath = '/rendered/path/folderNotificationChannel'; + const expectedParameters = { + folder: 'folderValue', + notification_channel: 'notificationChannelValue', + }; + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.folderNotificationChannelPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.folderNotificationChannelPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('folderNotificationChannelPath', () => { + const result = client.folderNotificationChannelPath( + 'folderValue', + 'notificationChannelValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.folderNotificationChannelPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchFolderFromFolderNotificationChannelName', () => { + const result = + client.matchFolderFromFolderNotificationChannelName(fakePath); + assert.strictEqual(result, 'folderValue'); + assert( + ( + client.pathTemplates.folderNotificationChannelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchNotificationChannelFromFolderNotificationChannelName', () => { + const result = + client.matchNotificationChannelFromFolderNotificationChannelName( + fakePath, + ); + assert.strictEqual(result, 'notificationChannelValue'); + assert( + ( + client.pathTemplates.folderNotificationChannelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('folderService', async () => { + const fakePath = '/rendered/path/folderService'; + const expectedParameters = { + folder: 'folderValue', + service: 'serviceValue', + }; + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.folderServicePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.folderServicePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('folderServicePath', () => { + const result = client.folderServicePath('folderValue', 'serviceValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.folderServicePathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchFolderFromFolderServiceName', () => { + const result = client.matchFolderFromFolderServiceName(fakePath); + assert.strictEqual(result, 'folderValue'); + assert( + (client.pathTemplates.folderServicePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchServiceFromFolderServiceName', () => { + const result = client.matchServiceFromFolderServiceName(fakePath); + assert.strictEqual(result, 'serviceValue'); + assert( + (client.pathTemplates.folderServicePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('folderServiceServiceLevelObjective', async () => { + const fakePath = '/rendered/path/folderServiceServiceLevelObjective'; + const expectedParameters = { + folder: 'folderValue', + service: 'serviceValue', + service_level_objective: 'serviceLevelObjectiveValue', + }; + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('folderServiceServiceLevelObjectivePath', () => { + const result = client.folderServiceServiceLevelObjectivePath( + 'folderValue', + 'serviceValue', + 'serviceLevelObjectiveValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchFolderFromFolderServiceServiceLevelObjectiveName', () => { + const result = + client.matchFolderFromFolderServiceServiceLevelObjectiveName( + fakePath, + ); + assert.strictEqual(result, 'folderValue'); + assert( + ( + client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchServiceFromFolderServiceServiceLevelObjectiveName', () => { + const result = + client.matchServiceFromFolderServiceServiceLevelObjectiveName( + fakePath, + ); + assert.strictEqual(result, 'serviceValue'); + assert( + ( + client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchServiceLevelObjectiveFromFolderServiceServiceLevelObjectiveName', () => { + const result = + client.matchServiceLevelObjectiveFromFolderServiceServiceLevelObjectiveName( + fakePath, + ); + assert.strictEqual(result, 'serviceLevelObjectiveValue'); + assert( + ( + client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('folderUptimeCheckConfig', async () => { + const fakePath = '/rendered/path/folderUptimeCheckConfig'; + const expectedParameters = { + folder: 'folderValue', + uptime_check_config: 'uptimeCheckConfigValue', + }; + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.folderUptimeCheckConfigPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.folderUptimeCheckConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('folderUptimeCheckConfigPath', () => { + const result = client.folderUptimeCheckConfigPath( + 'folderValue', + 'uptimeCheckConfigValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.folderUptimeCheckConfigPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchFolderFromFolderUptimeCheckConfigName', () => { + const result = + client.matchFolderFromFolderUptimeCheckConfigName(fakePath); + assert.strictEqual(result, 'folderValue'); + assert( + ( + client.pathTemplates.folderUptimeCheckConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchUptimeCheckConfigFromFolderUptimeCheckConfigName', () => { + const result = + client.matchUptimeCheckConfigFromFolderUptimeCheckConfigName( + fakePath, + ); + assert.strictEqual(result, 'uptimeCheckConfigValue'); + assert( + ( + client.pathTemplates.folderUptimeCheckConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('organizationAlertPolicy', async () => { + const fakePath = '/rendered/path/organizationAlertPolicy'; + const expectedParameters = { + organization: 'organizationValue', + alert_policy: 'alertPolicyValue', + }; + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.organizationAlertPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.organizationAlertPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('organizationAlertPolicyPath', () => { + const result = client.organizationAlertPolicyPath( + 'organizationValue', + 'alertPolicyValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationAlertPolicyPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchOrganizationFromOrganizationAlertPolicyName', () => { + const result = + client.matchOrganizationFromOrganizationAlertPolicyName(fakePath); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationAlertPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchAlertPolicyFromOrganizationAlertPolicyName', () => { + const result = + client.matchAlertPolicyFromOrganizationAlertPolicyName(fakePath); + assert.strictEqual(result, 'alertPolicyValue'); + assert( + ( + client.pathTemplates.organizationAlertPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('organizationAlertPolicyCondition', async () => { + const fakePath = '/rendered/path/organizationAlertPolicyCondition'; + const expectedParameters = { + organization: 'organizationValue', + alert_policy: 'alertPolicyValue', + condition: 'conditionValue', + }; + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.organizationAlertPolicyConditionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationAlertPolicyConditionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationAlertPolicyConditionPath', () => { + const result = client.organizationAlertPolicyConditionPath( + 'organizationValue', + 'alertPolicyValue', + 'conditionValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationAlertPolicyConditionPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchOrganizationFromOrganizationAlertPolicyConditionName', () => { + const result = + client.matchOrganizationFromOrganizationAlertPolicyConditionName( + fakePath, + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationAlertPolicyConditionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchAlertPolicyFromOrganizationAlertPolicyConditionName', () => { + const result = + client.matchAlertPolicyFromOrganizationAlertPolicyConditionName( + fakePath, + ); + assert.strictEqual(result, 'alertPolicyValue'); + assert( + ( + client.pathTemplates.organizationAlertPolicyConditionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchConditionFromOrganizationAlertPolicyConditionName', () => { + const result = + client.matchConditionFromOrganizationAlertPolicyConditionName( + fakePath, + ); + assert.strictEqual(result, 'conditionValue'); + assert( + ( + client.pathTemplates.organizationAlertPolicyConditionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('organizationChannelDescriptor', async () => { + const fakePath = '/rendered/path/organizationChannelDescriptor'; + const expectedParameters = { + organization: 'organizationValue', + channel_descriptor: 'channelDescriptorValue', + }; + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.organizationChannelDescriptorPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationChannelDescriptorPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationChannelDescriptorPath', () => { + const result = client.organizationChannelDescriptorPath( + 'organizationValue', + 'channelDescriptorValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationChannelDescriptorPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchOrganizationFromOrganizationChannelDescriptorName', () => { + const result = + client.matchOrganizationFromOrganizationChannelDescriptorName( + fakePath, + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationChannelDescriptorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchChannelDescriptorFromOrganizationChannelDescriptorName', () => { + const result = + client.matchChannelDescriptorFromOrganizationChannelDescriptorName( + fakePath, + ); + assert.strictEqual(result, 'channelDescriptorValue'); + assert( + ( + client.pathTemplates.organizationChannelDescriptorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('organizationGroup', async () => { + const fakePath = '/rendered/path/organizationGroup'; + const expectedParameters = { + organization: 'organizationValue', + group: 'groupValue', + }; + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.organizationGroupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.organizationGroupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('organizationGroupPath', () => { + const result = client.organizationGroupPath( + 'organizationValue', + 'groupValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchOrganizationFromOrganizationGroupName', () => { + const result = + client.matchOrganizationFromOrganizationGroupName(fakePath); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchGroupFromOrganizationGroupName', () => { + const result = client.matchGroupFromOrganizationGroupName(fakePath); + assert.strictEqual(result, 'groupValue'); + assert( + ( + client.pathTemplates.organizationGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('organizationNotificationChannel', async () => { + const fakePath = '/rendered/path/organizationNotificationChannel'; + const expectedParameters = { + organization: 'organizationValue', + notification_channel: 'notificationChannelValue', + }; + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.organizationNotificationChannelPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationNotificationChannelPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationNotificationChannelPath', () => { + const result = client.organizationNotificationChannelPath( + 'organizationValue', + 'notificationChannelValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationNotificationChannelPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchOrganizationFromOrganizationNotificationChannelName', () => { + const result = + client.matchOrganizationFromOrganizationNotificationChannelName( + fakePath, + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationNotificationChannelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchNotificationChannelFromOrganizationNotificationChannelName', () => { + const result = + client.matchNotificationChannelFromOrganizationNotificationChannelName( + fakePath, + ); + assert.strictEqual(result, 'notificationChannelValue'); + assert( + ( + client.pathTemplates.organizationNotificationChannelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('organizationService', async () => { + const fakePath = '/rendered/path/organizationService'; + const expectedParameters = { + organization: 'organizationValue', + service: 'serviceValue', + }; + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.organizationServicePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.organizationServicePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('organizationServicePath', () => { + const result = client.organizationServicePath( + 'organizationValue', + 'serviceValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationServicePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchOrganizationFromOrganizationServiceName', () => { + const result = + client.matchOrganizationFromOrganizationServiceName(fakePath); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationServicePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchServiceFromOrganizationServiceName', () => { + const result = client.matchServiceFromOrganizationServiceName(fakePath); + assert.strictEqual(result, 'serviceValue'); + assert( + ( + client.pathTemplates.organizationServicePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('organizationServiceServiceLevelObjective', async () => { + const fakePath = + '/rendered/path/organizationServiceServiceLevelObjective'; + const expectedParameters = { + organization: 'organizationValue', + service: 'serviceValue', + service_level_objective: 'serviceLevelObjectiveValue', + }; + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationServiceServiceLevelObjectivePath', () => { + const result = client.organizationServiceServiceLevelObjectivePath( + 'organizationValue', + 'serviceValue', + 'serviceLevelObjectiveValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .organizationServiceServiceLevelObjectivePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchOrganizationFromOrganizationServiceServiceLevelObjectiveName', () => { + const result = + client.matchOrganizationFromOrganizationServiceServiceLevelObjectiveName( + fakePath, + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates + .organizationServiceServiceLevelObjectivePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchServiceFromOrganizationServiceServiceLevelObjectiveName', () => { + const result = + client.matchServiceFromOrganizationServiceServiceLevelObjectiveName( + fakePath, + ); + assert.strictEqual(result, 'serviceValue'); + assert( + ( + client.pathTemplates + .organizationServiceServiceLevelObjectivePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchServiceLevelObjectiveFromOrganizationServiceServiceLevelObjectiveName', () => { + const result = + client.matchServiceLevelObjectiveFromOrganizationServiceServiceLevelObjectiveName( + fakePath, + ); + assert.strictEqual(result, 'serviceLevelObjectiveValue'); + assert( + ( + client.pathTemplates + .organizationServiceServiceLevelObjectivePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('organizationUptimeCheckConfig', async () => { + const fakePath = '/rendered/path/organizationUptimeCheckConfig'; + const expectedParameters = { + organization: 'organizationValue', + uptime_check_config: 'uptimeCheckConfigValue', + }; + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.organizationUptimeCheckConfigPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationUptimeCheckConfigPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationUptimeCheckConfigPath', () => { + const result = client.organizationUptimeCheckConfigPath( + 'organizationValue', + 'uptimeCheckConfigValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationUptimeCheckConfigPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchOrganizationFromOrganizationUptimeCheckConfigName', () => { + const result = + client.matchOrganizationFromOrganizationUptimeCheckConfigName( + fakePath, + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationUptimeCheckConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchUptimeCheckConfigFromOrganizationUptimeCheckConfigName', () => { + const result = + client.matchUptimeCheckConfigFromOrganizationUptimeCheckConfigName( + fakePath, + ); + assert.strictEqual(result, 'uptimeCheckConfigValue'); + assert( + ( + client.pathTemplates.organizationUptimeCheckConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('project', async () => { + const fakePath = '/rendered/path/project'; + const expectedParameters = { + project: 'projectValue', + }; + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.projectPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectPath', () => { + const result = client.projectPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('projectAlertPolicy', async () => { + const fakePath = '/rendered/path/projectAlertPolicy'; + const expectedParameters = { + project: 'projectValue', + alert_policy: 'alertPolicyValue', + }; + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.projectAlertPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAlertPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAlertPolicyPath', () => { + const result = client.projectAlertPolicyPath( + 'projectValue', + 'alertPolicyValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAlertPolicyPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectAlertPolicyName', () => { + const result = client.matchProjectFromProjectAlertPolicyName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAlertPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchAlertPolicyFromProjectAlertPolicyName', () => { + const result = + client.matchAlertPolicyFromProjectAlertPolicyName(fakePath); + assert.strictEqual(result, 'alertPolicyValue'); + assert( + ( + client.pathTemplates.projectAlertPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('projectAlertPolicyCondition', async () => { + const fakePath = '/rendered/path/projectAlertPolicyCondition'; + const expectedParameters = { + project: 'projectValue', + alert_policy: 'alertPolicyValue', + condition: 'conditionValue', + }; + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.projectAlertPolicyConditionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAlertPolicyConditionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAlertPolicyConditionPath', () => { + const result = client.projectAlertPolicyConditionPath( + 'projectValue', + 'alertPolicyValue', + 'conditionValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAlertPolicyConditionPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectAlertPolicyConditionName', () => { + const result = + client.matchProjectFromProjectAlertPolicyConditionName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAlertPolicyConditionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchAlertPolicyFromProjectAlertPolicyConditionName', () => { + const result = + client.matchAlertPolicyFromProjectAlertPolicyConditionName(fakePath); + assert.strictEqual(result, 'alertPolicyValue'); + assert( + ( + client.pathTemplates.projectAlertPolicyConditionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchConditionFromProjectAlertPolicyConditionName', () => { + const result = + client.matchConditionFromProjectAlertPolicyConditionName(fakePath); + assert.strictEqual(result, 'conditionValue'); + assert( + ( + client.pathTemplates.projectAlertPolicyConditionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('projectChannelDescriptor', async () => { + const fakePath = '/rendered/path/projectChannelDescriptor'; + const expectedParameters = { + project: 'projectValue', + channel_descriptor: 'channelDescriptorValue', + }; + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.projectChannelDescriptorPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectChannelDescriptorPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectChannelDescriptorPath', () => { + const result = client.projectChannelDescriptorPath( + 'projectValue', + 'channelDescriptorValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectChannelDescriptorPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectChannelDescriptorName', () => { + const result = + client.matchProjectFromProjectChannelDescriptorName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectChannelDescriptorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchChannelDescriptorFromProjectChannelDescriptorName', () => { + const result = + client.matchChannelDescriptorFromProjectChannelDescriptorName( + fakePath, + ); + assert.strictEqual(result, 'channelDescriptorValue'); + assert( + ( + client.pathTemplates.projectChannelDescriptorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('projectGroup', async () => { + const fakePath = '/rendered/path/projectGroup'; + const expectedParameters = { + project: 'projectValue', + group: 'groupValue', + }; + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.projectGroupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectGroupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectGroupPath', () => { + const result = client.projectGroupPath('projectValue', 'groupValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectGroupPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectGroupName', () => { + const result = client.matchProjectFromProjectGroupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectGroupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchGroupFromProjectGroupName', () => { + const result = client.matchGroupFromProjectGroupName(fakePath); + assert.strictEqual(result, 'groupValue'); + assert( + (client.pathTemplates.projectGroupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('projectNotificationChannel', async () => { + const fakePath = '/rendered/path/projectNotificationChannel'; + const expectedParameters = { + project: 'projectValue', + notification_channel: 'notificationChannelValue', + }; + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.projectNotificationChannelPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectNotificationChannelPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectNotificationChannelPath', () => { + const result = client.projectNotificationChannelPath( + 'projectValue', + 'notificationChannelValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectNotificationChannelPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectNotificationChannelName', () => { + const result = + client.matchProjectFromProjectNotificationChannelName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectNotificationChannelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchNotificationChannelFromProjectNotificationChannelName', () => { + const result = + client.matchNotificationChannelFromProjectNotificationChannelName( + fakePath, + ); + assert.strictEqual(result, 'notificationChannelValue'); + assert( + ( + client.pathTemplates.projectNotificationChannelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('projectService', async () => { + const fakePath = '/rendered/path/projectService'; + const expectedParameters = { + project: 'projectValue', + service: 'serviceValue', + }; + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.projectServicePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectServicePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectServicePath', () => { + const result = client.projectServicePath( + 'projectValue', + 'serviceValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectServicePathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectServiceName', () => { + const result = client.matchProjectFromProjectServiceName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectServicePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchServiceFromProjectServiceName', () => { + const result = client.matchServiceFromProjectServiceName(fakePath); + assert.strictEqual(result, 'serviceValue'); + assert( + (client.pathTemplates.projectServicePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('projectServiceServiceLevelObjective', async () => { + const fakePath = '/rendered/path/projectServiceServiceLevelObjective'; + const expectedParameters = { + project: 'projectValue', + service: 'serviceValue', + service_level_objective: 'serviceLevelObjectiveValue', + }; + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectServiceServiceLevelObjectivePath', () => { + const result = client.projectServiceServiceLevelObjectivePath( + 'projectValue', + 'serviceValue', + 'serviceLevelObjectiveValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectServiceServiceLevelObjectiveName', () => { + const result = + client.matchProjectFromProjectServiceServiceLevelObjectiveName( + fakePath, + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchServiceFromProjectServiceServiceLevelObjectiveName', () => { + const result = + client.matchServiceFromProjectServiceServiceLevelObjectiveName( + fakePath, + ); + assert.strictEqual(result, 'serviceValue'); + assert( + ( + client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchServiceLevelObjectiveFromProjectServiceServiceLevelObjectiveName', () => { + const result = + client.matchServiceLevelObjectiveFromProjectServiceServiceLevelObjectiveName( + fakePath, + ); + assert.strictEqual(result, 'serviceLevelObjectiveValue'); + assert( + ( + client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('projectUptimeCheckConfig', async () => { + const fakePath = '/rendered/path/projectUptimeCheckConfig'; + const expectedParameters = { + project: 'projectValue', + uptime_check_config: 'uptimeCheckConfigValue', + }; + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.projectUptimeCheckConfigPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectUptimeCheckConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectUptimeCheckConfigPath', () => { + const result = client.projectUptimeCheckConfigPath( + 'projectValue', + 'uptimeCheckConfigValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectUptimeCheckConfigPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectUptimeCheckConfigName', () => { + const result = + client.matchProjectFromProjectUptimeCheckConfigName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectUptimeCheckConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchUptimeCheckConfigFromProjectUptimeCheckConfigName', () => { + const result = + client.matchUptimeCheckConfigFromProjectUptimeCheckConfigName( + fakePath, + ); + assert.strictEqual(result, 'uptimeCheckConfigValue'); + assert( + ( + client.pathTemplates.projectUptimeCheckConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('snooze', async () => { + const fakePath = '/rendered/path/snooze'; + const expectedParameters = { + project: 'projectValue', + snooze: 'snoozeValue', + }; + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.snoozePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.snoozePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('snoozePath', () => { + const result = client.snoozePath('projectValue', 'snoozeValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.snoozePathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromSnoozeName', () => { + const result = client.matchProjectFromSnoozeName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.snoozePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSnoozeFromSnoozeName', () => { + const result = client.matchSnoozeFromSnoozeName(fakePath); + assert.strictEqual(result, 'snoozeValue'); + assert( + (client.pathTemplates.snoozePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + }); }); diff --git a/packages/google-cloud-monitoring/test/gapic_snooze_service_v3.ts b/packages/google-cloud-monitoring/test/gapic_snooze_service_v3.ts index a576f7b5f3a8..0cd8fe2281cb 100644 --- a/packages/google-cloud-monitoring/test/gapic_snooze_service_v3.ts +++ b/packages/google-cloud-monitoring/test/gapic_snooze_service_v3.ts @@ -19,1847 +19,2675 @@ 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 snoozeserviceModule 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 -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); +const root = protobuf.Root.fromJSON( + require('../protos/protos.json'), +).resolveAll(); // eslint-disable-next-line @typescript-eslint/no-unused-vars function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; } function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; + const filledObject = ( + instance.constructor as typeof protobuf.Message + ).toObject(instance as protobuf.Message, { defaults: true }); + return (instance.constructor as typeof protobuf.Message).fromObject( + filledObject, + ) as T; } function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); + return error + ? sinon.stub().rejects(error) + : sinon.stub().resolves([response]); } -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +function stubSimpleCallWithCallback( + response?: ResponseType, + error?: Error, +) { + return error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); } -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } +function stubPageStreamingCall( + responses?: ResponseType[], + error?: Error, +) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); + } + const transformStub = error + ? sinon.stub().callsArgWith(2, error) + : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { + mockStream.write({}); + }); } - return sinon.stub().returns(mockStream); + setImmediate(() => { + mockStream.end(); + }); + } else { + setImmediate(() => { + mockStream.write({}); + }); + setImmediate(() => { + mockStream.end(); + }); + } + return sinon.stub().returns(mockStream); } -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); +function stubAsyncIterationCall( + responses?: ResponseType[], + error?: Error, +) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({ done: true, value: undefined }); + } + return Promise.resolve({ done: false, value: responses![counter++] }); + }, + }; + }, + }; + return sinon.stub().returns(asyncIterable); } describe('v3.SnoozeServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new snoozeserviceModule.v3.SnoozeServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'monitoring.googleapis.com'); - }); + describe('Common methods', () => { + it('has apiEndpoint', () => { + const client = new snoozeserviceModule.v3.SnoozeServiceClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'monitoring.googleapis.com'); + }); - it('has universeDomain', () => { - const client = new snoozeserviceModule.v3.SnoozeServiceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); + it('has universeDomain', () => { + const client = new snoozeserviceModule.v3.SnoozeServiceClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = snoozeserviceModule.v3.SnoozeServiceClient.servicePath; - assert.strictEqual(servicePath, 'monitoring.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = snoozeserviceModule.v3.SnoozeServiceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'monitoring.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new snoozeserviceModule.v3.SnoozeServiceClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'monitoring.example.com'); - }); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + snoozeserviceModule.v3.SnoozeServiceClient.servicePath; + assert.strictEqual(servicePath, 'monitoring.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + snoozeserviceModule.v3.SnoozeServiceClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'monitoring.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = new snoozeserviceModule.v3.SnoozeServiceClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'monitoring.example.com'); + }); - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new snoozeserviceModule.v3.SnoozeServiceClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'monitoring.example.com'); - }); + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = new snoozeserviceModule.v3.SnoozeServiceClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'monitoring.example.com'); + }); - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new snoozeserviceModule.v3.SnoozeServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'monitoring.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new snoozeserviceModule.v3.SnoozeServiceClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'monitoring.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new snoozeserviceModule.v3.SnoozeServiceClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); + if (typeof process === 'object' && 'env' in process) { + describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { + it('sets apiEndpoint from environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = new snoozeserviceModule.v3.SnoozeServiceClient(); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'monitoring.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } }); - it('has port', () => { - const port = snoozeserviceModule.v3.SnoozeServiceClient.port; - assert(port); - assert(typeof port === 'number'); + it('value configured in code has priority over environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = new snoozeserviceModule.v3.SnoozeServiceClient({ + universeDomain: 'configured.example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'monitoring.configured.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } }); - - it('should create a client with no option', () => { - const client = new snoozeserviceModule.v3.SnoozeServiceClient(); - assert(client); + }); + } + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new snoozeserviceModule.v3.SnoozeServiceClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', }); + }); + }); - it('should create a client with gRPC fallback', () => { - const client = new snoozeserviceModule.v3.SnoozeServiceClient({ - fallback: true, - }); - assert(client); - }); + it('has port', () => { + const port = snoozeserviceModule.v3.SnoozeServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); - it('has initialize method and supports deferred initialization', async () => { - const client = new snoozeserviceModule.v3.SnoozeServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.snoozeServiceStub, undefined); - await client.initialize(); - assert(client.snoozeServiceStub); - }); + it('should create a client with no option', () => { + const client = new snoozeserviceModule.v3.SnoozeServiceClient(); + assert(client); + }); - it('has close method for the initialized client', done => { - const client = new snoozeserviceModule.v3.SnoozeServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.snoozeServiceStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); + it('should create a client with gRPC fallback', () => { + const client = new snoozeserviceModule.v3.SnoozeServiceClient({ + fallback: true, + }); + assert(client); + }); - it('has close method for the non-initialized client', done => { - const client = new snoozeserviceModule.v3.SnoozeServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.snoozeServiceStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); + it('has initialize method and supports deferred initialization', async () => { + const client = new snoozeserviceModule.v3.SnoozeServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.snoozeServiceStub, undefined); + await client.initialize(); + assert(client.snoozeServiceStub); + }); - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new snoozeserviceModule.v3.SnoozeServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + it('has close method for the initialized client', (done) => { + const client = new snoozeserviceModule.v3.SnoozeServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.initialize().catch((err) => { + throw err; + }); + assert(client.snoozeServiceStub); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; }); + }); - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new snoozeserviceModule.v3.SnoozeServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); + it('has close method for the non-initialized client', (done) => { + const client = new snoozeserviceModule.v3.SnoozeServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.snoozeServiceStub, undefined); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; }); }); - describe('createSnooze', () => { - it('invokes createSnooze without error', async () => { - const client = new snoozeserviceModule.v3.SnoozeServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.CreateSnoozeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.CreateSnoozeRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.monitoring.v3.Snooze() - ); - client.innerApiCalls.createSnooze = stubSimpleCall(expectedResponse); - const [response] = await client.createSnooze(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createSnooze as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createSnooze as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new snoozeserviceModule.v3.SnoozeServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); - it('invokes createSnooze without error using callback', async () => { - const client = new snoozeserviceModule.v3.SnoozeServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.CreateSnoozeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.CreateSnoozeRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.monitoring.v3.Snooze() - ); - client.innerApiCalls.createSnooze = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createSnooze( - request, - (err?: Error|null, result?: protos.google.monitoring.v3.ISnooze|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createSnooze as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createSnooze as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new snoozeserviceModule.v3.SnoozeServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + }); + + describe('createSnooze', () => { + it('invokes createSnooze without error', async () => { + const client = new snoozeserviceModule.v3.SnoozeServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.CreateSnoozeRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.CreateSnoozeRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.monitoring.v3.Snooze(), + ); + client.innerApiCalls.createSnooze = stubSimpleCall(expectedResponse); + const [response] = await client.createSnooze(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createSnooze as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createSnooze as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createSnooze with error', async () => { - const client = new snoozeserviceModule.v3.SnoozeServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.CreateSnoozeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.CreateSnoozeRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createSnooze = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createSnooze(request), expectedError); - const actualRequest = (client.innerApiCalls.createSnooze as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createSnooze as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createSnooze without error using callback', async () => { + const client = new snoozeserviceModule.v3.SnoozeServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.CreateSnoozeRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.CreateSnoozeRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.monitoring.v3.Snooze(), + ); + client.innerApiCalls.createSnooze = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createSnooze( + request, + ( + err?: Error | null, + result?: protos.google.monitoring.v3.ISnooze | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createSnooze as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createSnooze as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createSnooze with closed client', async () => { - const client = new snoozeserviceModule.v3.SnoozeServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.CreateSnoozeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.CreateSnoozeRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.createSnooze(request), expectedError); - }); + it('invokes createSnooze with error', async () => { + const client = new snoozeserviceModule.v3.SnoozeServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.CreateSnoozeRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.CreateSnoozeRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createSnooze = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.createSnooze(request), expectedError); + const actualRequest = ( + client.innerApiCalls.createSnooze as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createSnooze as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('getSnooze', () => { - it('invokes getSnooze without error', async () => { - const client = new snoozeserviceModule.v3.SnoozeServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.GetSnoozeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.GetSnoozeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.monitoring.v3.Snooze() - ); - client.innerApiCalls.getSnooze = stubSimpleCall(expectedResponse); - const [response] = await client.getSnooze(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getSnooze as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSnooze as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createSnooze with closed client', async () => { + const client = new snoozeserviceModule.v3.SnoozeServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.CreateSnoozeRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.CreateSnoozeRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.createSnooze(request), expectedError); + }); + }); + + describe('getSnooze', () => { + it('invokes getSnooze without error', async () => { + const client = new snoozeserviceModule.v3.SnoozeServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.GetSnoozeRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.GetSnoozeRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.monitoring.v3.Snooze(), + ); + client.innerApiCalls.getSnooze = stubSimpleCall(expectedResponse); + const [response] = await client.getSnooze(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getSnooze as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getSnooze as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getSnooze without error using callback', async () => { - const client = new snoozeserviceModule.v3.SnoozeServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.GetSnoozeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.GetSnoozeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.monitoring.v3.Snooze() - ); - client.innerApiCalls.getSnooze = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getSnooze( - request, - (err?: Error|null, result?: protos.google.monitoring.v3.ISnooze|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getSnooze as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSnooze as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getSnooze without error using callback', async () => { + const client = new snoozeserviceModule.v3.SnoozeServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.GetSnoozeRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.GetSnoozeRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.monitoring.v3.Snooze(), + ); + client.innerApiCalls.getSnooze = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getSnooze( + request, + ( + err?: Error | null, + result?: protos.google.monitoring.v3.ISnooze | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getSnooze as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getSnooze as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getSnooze with error', async () => { - const client = new snoozeserviceModule.v3.SnoozeServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.GetSnoozeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.GetSnoozeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getSnooze = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getSnooze(request), expectedError); - const actualRequest = (client.innerApiCalls.getSnooze as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSnooze as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getSnooze with error', async () => { + const client = new snoozeserviceModule.v3.SnoozeServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.GetSnoozeRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.GetSnoozeRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getSnooze = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getSnooze(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getSnooze as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getSnooze as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getSnooze with closed client', async () => { - const client = new snoozeserviceModule.v3.SnoozeServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.GetSnoozeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.GetSnoozeRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getSnooze(request), expectedError); - }); + it('invokes getSnooze with closed client', async () => { + const client = new snoozeserviceModule.v3.SnoozeServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.GetSnoozeRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.GetSnoozeRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.getSnooze(request), expectedError); + }); + }); + + describe('updateSnooze', () => { + it('invokes updateSnooze without error', async () => { + const client = new snoozeserviceModule.v3.SnoozeServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.UpdateSnoozeRequest(), + ); + request.snooze ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.UpdateSnoozeRequest', + ['snooze', 'name'], + ); + request.snooze.name = defaultValue1; + const expectedHeaderRequestParams = `snooze.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.monitoring.v3.Snooze(), + ); + client.innerApiCalls.updateSnooze = stubSimpleCall(expectedResponse); + const [response] = await client.updateSnooze(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateSnooze as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateSnooze as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('updateSnooze', () => { - it('invokes updateSnooze without error', async () => { - const client = new snoozeserviceModule.v3.SnoozeServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.UpdateSnoozeRequest() - ); - request.snooze ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.UpdateSnoozeRequest', ['snooze', 'name']); - request.snooze.name = defaultValue1; - const expectedHeaderRequestParams = `snooze.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.monitoring.v3.Snooze() - ); - client.innerApiCalls.updateSnooze = stubSimpleCall(expectedResponse); - const [response] = await client.updateSnooze(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateSnooze as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateSnooze as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateSnooze without error using callback', async () => { + const client = new snoozeserviceModule.v3.SnoozeServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.UpdateSnoozeRequest(), + ); + request.snooze ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.UpdateSnoozeRequest', + ['snooze', 'name'], + ); + request.snooze.name = defaultValue1; + const expectedHeaderRequestParams = `snooze.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.monitoring.v3.Snooze(), + ); + client.innerApiCalls.updateSnooze = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateSnooze( + request, + ( + err?: Error | null, + result?: protos.google.monitoring.v3.ISnooze | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateSnooze as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateSnooze as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateSnooze without error using callback', async () => { - const client = new snoozeserviceModule.v3.SnoozeServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.UpdateSnoozeRequest() - ); - request.snooze ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.UpdateSnoozeRequest', ['snooze', 'name']); - request.snooze.name = defaultValue1; - const expectedHeaderRequestParams = `snooze.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.monitoring.v3.Snooze() - ); - client.innerApiCalls.updateSnooze = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateSnooze( - request, - (err?: Error|null, result?: protos.google.monitoring.v3.ISnooze|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateSnooze as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateSnooze as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateSnooze with error', async () => { + const client = new snoozeserviceModule.v3.SnoozeServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.UpdateSnoozeRequest(), + ); + request.snooze ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.UpdateSnoozeRequest', + ['snooze', 'name'], + ); + request.snooze.name = defaultValue1; + const expectedHeaderRequestParams = `snooze.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateSnooze = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.updateSnooze(request), expectedError); + const actualRequest = ( + client.innerApiCalls.updateSnooze as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateSnooze as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateSnooze with error', async () => { - const client = new snoozeserviceModule.v3.SnoozeServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.UpdateSnoozeRequest() - ); - request.snooze ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.UpdateSnoozeRequest', ['snooze', 'name']); - request.snooze.name = defaultValue1; - const expectedHeaderRequestParams = `snooze.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateSnooze = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateSnooze(request), expectedError); - const actualRequest = (client.innerApiCalls.updateSnooze as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateSnooze as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateSnooze with closed client', async () => { + const client = new snoozeserviceModule.v3.SnoozeServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.UpdateSnoozeRequest(), + ); + request.snooze ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.UpdateSnoozeRequest', + ['snooze', 'name'], + ); + request.snooze.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.updateSnooze(request), expectedError); + }); + }); + + describe('listSnoozes', () => { + it('invokes listSnoozes without error', async () => { + const client = new snoozeserviceModule.v3.SnoozeServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListSnoozesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.ListSnoozesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.monitoring.v3.Snooze()), + generateSampleMessage(new protos.google.monitoring.v3.Snooze()), + generateSampleMessage(new protos.google.monitoring.v3.Snooze()), + ]; + client.innerApiCalls.listSnoozes = stubSimpleCall(expectedResponse); + const [response] = await client.listSnoozes(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listSnoozes as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listSnoozes as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateSnooze with closed client', async () => { - const client = new snoozeserviceModule.v3.SnoozeServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.UpdateSnoozeRequest() - ); - request.snooze ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.UpdateSnoozeRequest', ['snooze', 'name']); - request.snooze.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.updateSnooze(request), expectedError); - }); + it('invokes listSnoozes without error using callback', async () => { + const client = new snoozeserviceModule.v3.SnoozeServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListSnoozesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.ListSnoozesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.monitoring.v3.Snooze()), + generateSampleMessage(new protos.google.monitoring.v3.Snooze()), + generateSampleMessage(new protos.google.monitoring.v3.Snooze()), + ]; + client.innerApiCalls.listSnoozes = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listSnoozes( + request, + ( + err?: Error | null, + result?: protos.google.monitoring.v3.ISnooze[] | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listSnoozes as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listSnoozes as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('listSnoozes', () => { - it('invokes listSnoozes without error', async () => { - const client = new snoozeserviceModule.v3.SnoozeServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListSnoozesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListSnoozesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.monitoring.v3.Snooze()), - generateSampleMessage(new protos.google.monitoring.v3.Snooze()), - generateSampleMessage(new protos.google.monitoring.v3.Snooze()), - ]; - client.innerApiCalls.listSnoozes = stubSimpleCall(expectedResponse); - const [response] = await client.listSnoozes(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listSnoozes as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listSnoozes as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listSnoozes with error', async () => { + const client = new snoozeserviceModule.v3.SnoozeServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListSnoozesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.ListSnoozesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listSnoozes = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.listSnoozes(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listSnoozes as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listSnoozes as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes listSnoozes without error using callback', async () => { - const client = new snoozeserviceModule.v3.SnoozeServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListSnoozesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListSnoozesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.monitoring.v3.Snooze()), - generateSampleMessage(new protos.google.monitoring.v3.Snooze()), - generateSampleMessage(new protos.google.monitoring.v3.Snooze()), - ]; - client.innerApiCalls.listSnoozes = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listSnoozes( - request, - (err?: Error|null, result?: protos.google.monitoring.v3.ISnooze[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listSnoozes as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listSnoozes as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + it('invokes listSnoozesStream without error', async () => { + const client = new snoozeserviceModule.v3.SnoozeServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListSnoozesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.ListSnoozesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.monitoring.v3.Snooze()), + generateSampleMessage(new protos.google.monitoring.v3.Snooze()), + generateSampleMessage(new protos.google.monitoring.v3.Snooze()), + ]; + client.descriptors.page.listSnoozes.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listSnoozesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.monitoring.v3.Snooze[] = []; + stream.on('data', (response: protos.google.monitoring.v3.Snooze) => { + responses.push(response); }); - - it('invokes listSnoozes with error', async () => { - const client = new snoozeserviceModule.v3.SnoozeServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListSnoozesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListSnoozesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listSnoozes = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listSnoozes(request), expectedError); - const actualRequest = (client.innerApiCalls.listSnoozes as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listSnoozes as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + stream.on('end', () => { + resolve(responses); }); - - it('invokes listSnoozesStream without error', async () => { - const client = new snoozeserviceModule.v3.SnoozeServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListSnoozesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListSnoozesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.monitoring.v3.Snooze()), - generateSampleMessage(new protos.google.monitoring.v3.Snooze()), - generateSampleMessage(new protos.google.monitoring.v3.Snooze()), - ]; - client.descriptors.page.listSnoozes.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listSnoozesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.monitoring.v3.Snooze[] = []; - stream.on('data', (response: protos.google.monitoring.v3.Snooze) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listSnoozes.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listSnoozes, request)); - assert( - (client.descriptors.page.listSnoozes.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); + stream.on('error', (err: Error) => { + reject(err); }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.listSnoozes.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listSnoozes, request), + ); + assert( + (client.descriptors.page.listSnoozes.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes listSnoozesStream with error', async () => { - const client = new snoozeserviceModule.v3.SnoozeServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListSnoozesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListSnoozesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listSnoozes.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listSnoozesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.monitoring.v3.Snooze[] = []; - stream.on('data', (response: protos.google.monitoring.v3.Snooze) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listSnoozes.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listSnoozes, request)); - assert( - (client.descriptors.page.listSnoozes.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); + it('invokes listSnoozesStream with error', async () => { + const client = new snoozeserviceModule.v3.SnoozeServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListSnoozesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.ListSnoozesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listSnoozes.createStream = stubPageStreamingCall( + undefined, + expectedError, + ); + const stream = client.listSnoozesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.monitoring.v3.Snooze[] = []; + stream.on('data', (response: protos.google.monitoring.v3.Snooze) => { + responses.push(response); }); - - it('uses async iteration with listSnoozes without error', async () => { - const client = new snoozeserviceModule.v3.SnoozeServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListSnoozesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListSnoozesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.monitoring.v3.Snooze()), - generateSampleMessage(new protos.google.monitoring.v3.Snooze()), - generateSampleMessage(new protos.google.monitoring.v3.Snooze()), - ]; - client.descriptors.page.listSnoozes.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.monitoring.v3.ISnooze[] = []; - const iterable = client.listSnoozesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listSnoozes.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listSnoozes.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); + stream.on('end', () => { + resolve(responses); }); - - it('uses async iteration with listSnoozes with error', async () => { - const client = new snoozeserviceModule.v3.SnoozeServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListSnoozesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListSnoozesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listSnoozes.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listSnoozesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.monitoring.v3.ISnooze[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listSnoozes.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listSnoozes.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); + stream.on('error', (err: Error) => { + reject(err); }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listSnoozes.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listSnoozes, request), + ); + assert( + (client.descriptors.page.listSnoozes.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); }); - describe('Path templates', () => { - - describe('folderAlertPolicy', async () => { - const fakePath = "/rendered/path/folderAlertPolicy"; - const expectedParameters = { - folder: "folderValue", - alert_policy: "alertPolicyValue", - }; - const client = new snoozeserviceModule.v3.SnoozeServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.folderAlertPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderAlertPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderAlertPolicyPath', () => { - const result = client.folderAlertPolicyPath("folderValue", "alertPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderAlertPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderAlertPolicyName', () => { - const result = client.matchFolderFromFolderAlertPolicyName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderAlertPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAlertPolicyFromFolderAlertPolicyName', () => { - const result = client.matchAlertPolicyFromFolderAlertPolicyName(fakePath); - assert.strictEqual(result, "alertPolicyValue"); - assert((client.pathTemplates.folderAlertPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + it('uses async iteration with listSnoozes without error', async () => { + const client = new snoozeserviceModule.v3.SnoozeServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListSnoozesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.ListSnoozesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.monitoring.v3.Snooze()), + generateSampleMessage(new protos.google.monitoring.v3.Snooze()), + generateSampleMessage(new protos.google.monitoring.v3.Snooze()), + ]; + client.descriptors.page.listSnoozes.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.monitoring.v3.ISnooze[] = []; + const iterable = client.listSnoozesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listSnoozes.asyncIterate as SinonStub).getCall( + 0, + ).args[1], + request, + ); + assert( + (client.descriptors.page.listSnoozes.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - describe('folderAlertPolicyCondition', async () => { - const fakePath = "/rendered/path/folderAlertPolicyCondition"; - const expectedParameters = { - folder: "folderValue", - alert_policy: "alertPolicyValue", - condition: "conditionValue", - }; - const client = new snoozeserviceModule.v3.SnoozeServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.folderAlertPolicyConditionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderAlertPolicyConditionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderAlertPolicyConditionPath', () => { - const result = client.folderAlertPolicyConditionPath("folderValue", "alertPolicyValue", "conditionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderAlertPolicyConditionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderAlertPolicyConditionName', () => { - const result = client.matchFolderFromFolderAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAlertPolicyFromFolderAlertPolicyConditionName', () => { - const result = client.matchAlertPolicyFromFolderAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "alertPolicyValue"); - assert((client.pathTemplates.folderAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConditionFromFolderAlertPolicyConditionName', () => { - const result = client.matchConditionFromFolderAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "conditionValue"); - assert((client.pathTemplates.folderAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + it('uses async iteration with listSnoozes with error', async () => { + const client = new snoozeserviceModule.v3.SnoozeServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListSnoozesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.ListSnoozesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listSnoozes.asyncIterate = stubAsyncIterationCall( + undefined, + expectedError, + ); + const iterable = client.listSnoozesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.monitoring.v3.ISnooze[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listSnoozes.asyncIterate as SinonStub).getCall( + 0, + ).args[1], + request, + ); + assert( + (client.descriptors.page.listSnoozes.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + }); + + describe('Path templates', () => { + describe('folderAlertPolicy', async () => { + const fakePath = '/rendered/path/folderAlertPolicy'; + const expectedParameters = { + folder: 'folderValue', + alert_policy: 'alertPolicyValue', + }; + const client = new snoozeserviceModule.v3.SnoozeServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.folderAlertPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.folderAlertPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('folderAlertPolicyPath', () => { + const result = client.folderAlertPolicyPath( + 'folderValue', + 'alertPolicyValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.folderAlertPolicyPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchFolderFromFolderAlertPolicyName', () => { + const result = client.matchFolderFromFolderAlertPolicyName(fakePath); + assert.strictEqual(result, 'folderValue'); + assert( + ( + client.pathTemplates.folderAlertPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchAlertPolicyFromFolderAlertPolicyName', () => { + const result = + client.matchAlertPolicyFromFolderAlertPolicyName(fakePath); + assert.strictEqual(result, 'alertPolicyValue'); + assert( + ( + client.pathTemplates.folderAlertPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('folderChannelDescriptor', async () => { - const fakePath = "/rendered/path/folderChannelDescriptor"; - const expectedParameters = { - folder: "folderValue", - channel_descriptor: "channelDescriptorValue", - }; - const client = new snoozeserviceModule.v3.SnoozeServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.folderChannelDescriptorPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderChannelDescriptorPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderChannelDescriptorPath', () => { - const result = client.folderChannelDescriptorPath("folderValue", "channelDescriptorValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderChannelDescriptorPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderChannelDescriptorName', () => { - const result = client.matchFolderFromFolderChannelDescriptorName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderChannelDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchChannelDescriptorFromFolderChannelDescriptorName', () => { - const result = client.matchChannelDescriptorFromFolderChannelDescriptorName(fakePath); - assert.strictEqual(result, "channelDescriptorValue"); - assert((client.pathTemplates.folderChannelDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('folderAlertPolicyCondition', async () => { + const fakePath = '/rendered/path/folderAlertPolicyCondition'; + const expectedParameters = { + folder: 'folderValue', + alert_policy: 'alertPolicyValue', + condition: 'conditionValue', + }; + const client = new snoozeserviceModule.v3.SnoozeServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.folderAlertPolicyConditionPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.folderAlertPolicyConditionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('folderAlertPolicyConditionPath', () => { + const result = client.folderAlertPolicyConditionPath( + 'folderValue', + 'alertPolicyValue', + 'conditionValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.folderAlertPolicyConditionPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchFolderFromFolderAlertPolicyConditionName', () => { + const result = + client.matchFolderFromFolderAlertPolicyConditionName(fakePath); + assert.strictEqual(result, 'folderValue'); + assert( + ( + client.pathTemplates.folderAlertPolicyConditionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchAlertPolicyFromFolderAlertPolicyConditionName', () => { + const result = + client.matchAlertPolicyFromFolderAlertPolicyConditionName(fakePath); + assert.strictEqual(result, 'alertPolicyValue'); + assert( + ( + client.pathTemplates.folderAlertPolicyConditionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchConditionFromFolderAlertPolicyConditionName', () => { + const result = + client.matchConditionFromFolderAlertPolicyConditionName(fakePath); + assert.strictEqual(result, 'conditionValue'); + assert( + ( + client.pathTemplates.folderAlertPolicyConditionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('folderGroup', async () => { - const fakePath = "/rendered/path/folderGroup"; - const expectedParameters = { - folder: "folderValue", - group: "groupValue", - }; - const client = new snoozeserviceModule.v3.SnoozeServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.folderGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderGroupPath', () => { - const result = client.folderGroupPath("folderValue", "groupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderGroupName', () => { - const result = client.matchFolderFromFolderGroupName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchGroupFromFolderGroupName', () => { - const result = client.matchGroupFromFolderGroupName(fakePath); - assert.strictEqual(result, "groupValue"); - assert((client.pathTemplates.folderGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('folderChannelDescriptor', async () => { + const fakePath = '/rendered/path/folderChannelDescriptor'; + const expectedParameters = { + folder: 'folderValue', + channel_descriptor: 'channelDescriptorValue', + }; + const client = new snoozeserviceModule.v3.SnoozeServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.folderChannelDescriptorPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.folderChannelDescriptorPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('folderChannelDescriptorPath', () => { + const result = client.folderChannelDescriptorPath( + 'folderValue', + 'channelDescriptorValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.folderChannelDescriptorPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchFolderFromFolderChannelDescriptorName', () => { + const result = + client.matchFolderFromFolderChannelDescriptorName(fakePath); + assert.strictEqual(result, 'folderValue'); + assert( + ( + client.pathTemplates.folderChannelDescriptorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchChannelDescriptorFromFolderChannelDescriptorName', () => { + const result = + client.matchChannelDescriptorFromFolderChannelDescriptorName( + fakePath, + ); + assert.strictEqual(result, 'channelDescriptorValue'); + assert( + ( + client.pathTemplates.folderChannelDescriptorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('folderNotificationChannel', async () => { - const fakePath = "/rendered/path/folderNotificationChannel"; - const expectedParameters = { - folder: "folderValue", - notification_channel: "notificationChannelValue", - }; - const client = new snoozeserviceModule.v3.SnoozeServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.folderNotificationChannelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderNotificationChannelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderNotificationChannelPath', () => { - const result = client.folderNotificationChannelPath("folderValue", "notificationChannelValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderNotificationChannelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderNotificationChannelName', () => { - const result = client.matchFolderFromFolderNotificationChannelName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderNotificationChannelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchNotificationChannelFromFolderNotificationChannelName', () => { - const result = client.matchNotificationChannelFromFolderNotificationChannelName(fakePath); - assert.strictEqual(result, "notificationChannelValue"); - assert((client.pathTemplates.folderNotificationChannelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('folderGroup', async () => { + const fakePath = '/rendered/path/folderGroup'; + const expectedParameters = { + folder: 'folderValue', + group: 'groupValue', + }; + const client = new snoozeserviceModule.v3.SnoozeServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.folderGroupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.folderGroupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('folderGroupPath', () => { + const result = client.folderGroupPath('folderValue', 'groupValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.folderGroupPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchFolderFromFolderGroupName', () => { + const result = client.matchFolderFromFolderGroupName(fakePath); + assert.strictEqual(result, 'folderValue'); + assert( + (client.pathTemplates.folderGroupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchGroupFromFolderGroupName', () => { + const result = client.matchGroupFromFolderGroupName(fakePath); + assert.strictEqual(result, 'groupValue'); + assert( + (client.pathTemplates.folderGroupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('folderService', async () => { - const fakePath = "/rendered/path/folderService"; - const expectedParameters = { - folder: "folderValue", - service: "serviceValue", - }; - const client = new snoozeserviceModule.v3.SnoozeServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.folderServicePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderServicePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderServicePath', () => { - const result = client.folderServicePath("folderValue", "serviceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderServicePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderServiceName', () => { - const result = client.matchFolderFromFolderServiceName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderServicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromFolderServiceName', () => { - const result = client.matchServiceFromFolderServiceName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.folderServicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('folderNotificationChannel', async () => { + const fakePath = '/rendered/path/folderNotificationChannel'; + const expectedParameters = { + folder: 'folderValue', + notification_channel: 'notificationChannelValue', + }; + const client = new snoozeserviceModule.v3.SnoozeServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.folderNotificationChannelPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.folderNotificationChannelPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('folderNotificationChannelPath', () => { + const result = client.folderNotificationChannelPath( + 'folderValue', + 'notificationChannelValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.folderNotificationChannelPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchFolderFromFolderNotificationChannelName', () => { + const result = + client.matchFolderFromFolderNotificationChannelName(fakePath); + assert.strictEqual(result, 'folderValue'); + assert( + ( + client.pathTemplates.folderNotificationChannelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchNotificationChannelFromFolderNotificationChannelName', () => { + const result = + client.matchNotificationChannelFromFolderNotificationChannelName( + fakePath, + ); + assert.strictEqual(result, 'notificationChannelValue'); + assert( + ( + client.pathTemplates.folderNotificationChannelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('folderServiceServiceLevelObjective', async () => { - const fakePath = "/rendered/path/folderServiceServiceLevelObjective"; - const expectedParameters = { - folder: "folderValue", - service: "serviceValue", - service_level_objective: "serviceLevelObjectiveValue", - }; - const client = new snoozeserviceModule.v3.SnoozeServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderServiceServiceLevelObjectivePath', () => { - const result = client.folderServiceServiceLevelObjectivePath("folderValue", "serviceValue", "serviceLevelObjectiveValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderServiceServiceLevelObjectiveName', () => { - const result = client.matchFolderFromFolderServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromFolderServiceServiceLevelObjectiveName', () => { - const result = client.matchServiceFromFolderServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceLevelObjectiveFromFolderServiceServiceLevelObjectiveName', () => { - const result = client.matchServiceLevelObjectiveFromFolderServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "serviceLevelObjectiveValue"); - assert((client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('folderService', async () => { + const fakePath = '/rendered/path/folderService'; + const expectedParameters = { + folder: 'folderValue', + service: 'serviceValue', + }; + const client = new snoozeserviceModule.v3.SnoozeServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.folderServicePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.folderServicePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('folderServicePath', () => { + const result = client.folderServicePath('folderValue', 'serviceValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.folderServicePathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchFolderFromFolderServiceName', () => { + const result = client.matchFolderFromFolderServiceName(fakePath); + assert.strictEqual(result, 'folderValue'); + assert( + (client.pathTemplates.folderServicePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchServiceFromFolderServiceName', () => { + const result = client.matchServiceFromFolderServiceName(fakePath); + assert.strictEqual(result, 'serviceValue'); + assert( + (client.pathTemplates.folderServicePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('folderUptimeCheckConfig', async () => { - const fakePath = "/rendered/path/folderUptimeCheckConfig"; - const expectedParameters = { - folder: "folderValue", - uptime_check_config: "uptimeCheckConfigValue", - }; - const client = new snoozeserviceModule.v3.SnoozeServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.folderUptimeCheckConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderUptimeCheckConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderUptimeCheckConfigPath', () => { - const result = client.folderUptimeCheckConfigPath("folderValue", "uptimeCheckConfigValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderUptimeCheckConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderUptimeCheckConfigName', () => { - const result = client.matchFolderFromFolderUptimeCheckConfigName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderUptimeCheckConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUptimeCheckConfigFromFolderUptimeCheckConfigName', () => { - const result = client.matchUptimeCheckConfigFromFolderUptimeCheckConfigName(fakePath); - assert.strictEqual(result, "uptimeCheckConfigValue"); - assert((client.pathTemplates.folderUptimeCheckConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('folderServiceServiceLevelObjective', async () => { + const fakePath = '/rendered/path/folderServiceServiceLevelObjective'; + const expectedParameters = { + folder: 'folderValue', + service: 'serviceValue', + service_level_objective: 'serviceLevelObjectiveValue', + }; + const client = new snoozeserviceModule.v3.SnoozeServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('folderServiceServiceLevelObjectivePath', () => { + const result = client.folderServiceServiceLevelObjectivePath( + 'folderValue', + 'serviceValue', + 'serviceLevelObjectiveValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchFolderFromFolderServiceServiceLevelObjectiveName', () => { + const result = + client.matchFolderFromFolderServiceServiceLevelObjectiveName( + fakePath, + ); + assert.strictEqual(result, 'folderValue'); + assert( + ( + client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchServiceFromFolderServiceServiceLevelObjectiveName', () => { + const result = + client.matchServiceFromFolderServiceServiceLevelObjectiveName( + fakePath, + ); + assert.strictEqual(result, 'serviceValue'); + assert( + ( + client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchServiceLevelObjectiveFromFolderServiceServiceLevelObjectiveName', () => { + const result = + client.matchServiceLevelObjectiveFromFolderServiceServiceLevelObjectiveName( + fakePath, + ); + assert.strictEqual(result, 'serviceLevelObjectiveValue'); + assert( + ( + client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('organizationAlertPolicy', async () => { - const fakePath = "/rendered/path/organizationAlertPolicy"; - const expectedParameters = { - organization: "organizationValue", - alert_policy: "alertPolicyValue", - }; - const client = new snoozeserviceModule.v3.SnoozeServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationAlertPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationAlertPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationAlertPolicyPath', () => { - const result = client.organizationAlertPolicyPath("organizationValue", "alertPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationAlertPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationAlertPolicyName', () => { - const result = client.matchOrganizationFromOrganizationAlertPolicyName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationAlertPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAlertPolicyFromOrganizationAlertPolicyName', () => { - const result = client.matchAlertPolicyFromOrganizationAlertPolicyName(fakePath); - assert.strictEqual(result, "alertPolicyValue"); - assert((client.pathTemplates.organizationAlertPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('folderUptimeCheckConfig', async () => { + const fakePath = '/rendered/path/folderUptimeCheckConfig'; + const expectedParameters = { + folder: 'folderValue', + uptime_check_config: 'uptimeCheckConfigValue', + }; + const client = new snoozeserviceModule.v3.SnoozeServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.folderUptimeCheckConfigPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.folderUptimeCheckConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('folderUptimeCheckConfigPath', () => { + const result = client.folderUptimeCheckConfigPath( + 'folderValue', + 'uptimeCheckConfigValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.folderUptimeCheckConfigPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchFolderFromFolderUptimeCheckConfigName', () => { + const result = + client.matchFolderFromFolderUptimeCheckConfigName(fakePath); + assert.strictEqual(result, 'folderValue'); + assert( + ( + client.pathTemplates.folderUptimeCheckConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchUptimeCheckConfigFromFolderUptimeCheckConfigName', () => { + const result = + client.matchUptimeCheckConfigFromFolderUptimeCheckConfigName( + fakePath, + ); + assert.strictEqual(result, 'uptimeCheckConfigValue'); + assert( + ( + client.pathTemplates.folderUptimeCheckConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('organizationAlertPolicyCondition', async () => { - const fakePath = "/rendered/path/organizationAlertPolicyCondition"; - const expectedParameters = { - organization: "organizationValue", - alert_policy: "alertPolicyValue", - condition: "conditionValue", - }; - const client = new snoozeserviceModule.v3.SnoozeServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationAlertPolicyConditionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationAlertPolicyConditionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationAlertPolicyConditionPath', () => { - const result = client.organizationAlertPolicyConditionPath("organizationValue", "alertPolicyValue", "conditionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationAlertPolicyConditionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationAlertPolicyConditionName', () => { - const result = client.matchOrganizationFromOrganizationAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAlertPolicyFromOrganizationAlertPolicyConditionName', () => { - const result = client.matchAlertPolicyFromOrganizationAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "alertPolicyValue"); - assert((client.pathTemplates.organizationAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConditionFromOrganizationAlertPolicyConditionName', () => { - const result = client.matchConditionFromOrganizationAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "conditionValue"); - assert((client.pathTemplates.organizationAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('organizationAlertPolicy', async () => { + const fakePath = '/rendered/path/organizationAlertPolicy'; + const expectedParameters = { + organization: 'organizationValue', + alert_policy: 'alertPolicyValue', + }; + const client = new snoozeserviceModule.v3.SnoozeServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.organizationAlertPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.organizationAlertPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('organizationAlertPolicyPath', () => { + const result = client.organizationAlertPolicyPath( + 'organizationValue', + 'alertPolicyValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationAlertPolicyPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchOrganizationFromOrganizationAlertPolicyName', () => { + const result = + client.matchOrganizationFromOrganizationAlertPolicyName(fakePath); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationAlertPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchAlertPolicyFromOrganizationAlertPolicyName', () => { + const result = + client.matchAlertPolicyFromOrganizationAlertPolicyName(fakePath); + assert.strictEqual(result, 'alertPolicyValue'); + assert( + ( + client.pathTemplates.organizationAlertPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('organizationChannelDescriptor', async () => { - const fakePath = "/rendered/path/organizationChannelDescriptor"; - const expectedParameters = { - organization: "organizationValue", - channel_descriptor: "channelDescriptorValue", - }; - const client = new snoozeserviceModule.v3.SnoozeServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationChannelDescriptorPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationChannelDescriptorPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationChannelDescriptorPath', () => { - const result = client.organizationChannelDescriptorPath("organizationValue", "channelDescriptorValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationChannelDescriptorPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationChannelDescriptorName', () => { - const result = client.matchOrganizationFromOrganizationChannelDescriptorName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationChannelDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchChannelDescriptorFromOrganizationChannelDescriptorName', () => { - const result = client.matchChannelDescriptorFromOrganizationChannelDescriptorName(fakePath); - assert.strictEqual(result, "channelDescriptorValue"); - assert((client.pathTemplates.organizationChannelDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('organizationAlertPolicyCondition', async () => { + const fakePath = '/rendered/path/organizationAlertPolicyCondition'; + const expectedParameters = { + organization: 'organizationValue', + alert_policy: 'alertPolicyValue', + condition: 'conditionValue', + }; + const client = new snoozeserviceModule.v3.SnoozeServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.organizationAlertPolicyConditionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationAlertPolicyConditionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationAlertPolicyConditionPath', () => { + const result = client.organizationAlertPolicyConditionPath( + 'organizationValue', + 'alertPolicyValue', + 'conditionValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationAlertPolicyConditionPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchOrganizationFromOrganizationAlertPolicyConditionName', () => { + const result = + client.matchOrganizationFromOrganizationAlertPolicyConditionName( + fakePath, + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationAlertPolicyConditionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchAlertPolicyFromOrganizationAlertPolicyConditionName', () => { + const result = + client.matchAlertPolicyFromOrganizationAlertPolicyConditionName( + fakePath, + ); + assert.strictEqual(result, 'alertPolicyValue'); + assert( + ( + client.pathTemplates.organizationAlertPolicyConditionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchConditionFromOrganizationAlertPolicyConditionName', () => { + const result = + client.matchConditionFromOrganizationAlertPolicyConditionName( + fakePath, + ); + assert.strictEqual(result, 'conditionValue'); + assert( + ( + client.pathTemplates.organizationAlertPolicyConditionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('organizationGroup', async () => { - const fakePath = "/rendered/path/organizationGroup"; - const expectedParameters = { - organization: "organizationValue", - group: "groupValue", - }; - const client = new snoozeserviceModule.v3.SnoozeServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationGroupPath', () => { - const result = client.organizationGroupPath("organizationValue", "groupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationGroupName', () => { - const result = client.matchOrganizationFromOrganizationGroupName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchGroupFromOrganizationGroupName', () => { - const result = client.matchGroupFromOrganizationGroupName(fakePath); - assert.strictEqual(result, "groupValue"); - assert((client.pathTemplates.organizationGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('organizationChannelDescriptor', async () => { + const fakePath = '/rendered/path/organizationChannelDescriptor'; + const expectedParameters = { + organization: 'organizationValue', + channel_descriptor: 'channelDescriptorValue', + }; + const client = new snoozeserviceModule.v3.SnoozeServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.organizationChannelDescriptorPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationChannelDescriptorPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationChannelDescriptorPath', () => { + const result = client.organizationChannelDescriptorPath( + 'organizationValue', + 'channelDescriptorValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationChannelDescriptorPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchOrganizationFromOrganizationChannelDescriptorName', () => { + const result = + client.matchOrganizationFromOrganizationChannelDescriptorName( + fakePath, + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationChannelDescriptorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchChannelDescriptorFromOrganizationChannelDescriptorName', () => { + const result = + client.matchChannelDescriptorFromOrganizationChannelDescriptorName( + fakePath, + ); + assert.strictEqual(result, 'channelDescriptorValue'); + assert( + ( + client.pathTemplates.organizationChannelDescriptorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('organizationNotificationChannel', async () => { - const fakePath = "/rendered/path/organizationNotificationChannel"; - const expectedParameters = { - organization: "organizationValue", - notification_channel: "notificationChannelValue", - }; - const client = new snoozeserviceModule.v3.SnoozeServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationNotificationChannelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationNotificationChannelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationNotificationChannelPath', () => { - const result = client.organizationNotificationChannelPath("organizationValue", "notificationChannelValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationNotificationChannelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationNotificationChannelName', () => { - const result = client.matchOrganizationFromOrganizationNotificationChannelName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationNotificationChannelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchNotificationChannelFromOrganizationNotificationChannelName', () => { - const result = client.matchNotificationChannelFromOrganizationNotificationChannelName(fakePath); - assert.strictEqual(result, "notificationChannelValue"); - assert((client.pathTemplates.organizationNotificationChannelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('organizationGroup', async () => { + const fakePath = '/rendered/path/organizationGroup'; + const expectedParameters = { + organization: 'organizationValue', + group: 'groupValue', + }; + const client = new snoozeserviceModule.v3.SnoozeServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.organizationGroupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.organizationGroupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('organizationGroupPath', () => { + const result = client.organizationGroupPath( + 'organizationValue', + 'groupValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchOrganizationFromOrganizationGroupName', () => { + const result = + client.matchOrganizationFromOrganizationGroupName(fakePath); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchGroupFromOrganizationGroupName', () => { + const result = client.matchGroupFromOrganizationGroupName(fakePath); + assert.strictEqual(result, 'groupValue'); + assert( + ( + client.pathTemplates.organizationGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('organizationService', async () => { - const fakePath = "/rendered/path/organizationService"; - const expectedParameters = { - organization: "organizationValue", - service: "serviceValue", - }; - const client = new snoozeserviceModule.v3.SnoozeServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationServicePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationServicePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationServicePath', () => { - const result = client.organizationServicePath("organizationValue", "serviceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationServicePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationServiceName', () => { - const result = client.matchOrganizationFromOrganizationServiceName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationServicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromOrganizationServiceName', () => { - const result = client.matchServiceFromOrganizationServiceName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.organizationServicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('organizationNotificationChannel', async () => { + const fakePath = '/rendered/path/organizationNotificationChannel'; + const expectedParameters = { + organization: 'organizationValue', + notification_channel: 'notificationChannelValue', + }; + const client = new snoozeserviceModule.v3.SnoozeServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.organizationNotificationChannelPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationNotificationChannelPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationNotificationChannelPath', () => { + const result = client.organizationNotificationChannelPath( + 'organizationValue', + 'notificationChannelValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationNotificationChannelPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchOrganizationFromOrganizationNotificationChannelName', () => { + const result = + client.matchOrganizationFromOrganizationNotificationChannelName( + fakePath, + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationNotificationChannelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchNotificationChannelFromOrganizationNotificationChannelName', () => { + const result = + client.matchNotificationChannelFromOrganizationNotificationChannelName( + fakePath, + ); + assert.strictEqual(result, 'notificationChannelValue'); + assert( + ( + client.pathTemplates.organizationNotificationChannelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('organizationServiceServiceLevelObjective', async () => { - const fakePath = "/rendered/path/organizationServiceServiceLevelObjective"; - const expectedParameters = { - organization: "organizationValue", - service: "serviceValue", - service_level_objective: "serviceLevelObjectiveValue", - }; - const client = new snoozeserviceModule.v3.SnoozeServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationServiceServiceLevelObjectivePath', () => { - const result = client.organizationServiceServiceLevelObjectivePath("organizationValue", "serviceValue", "serviceLevelObjectiveValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationServiceServiceLevelObjectiveName', () => { - const result = client.matchOrganizationFromOrganizationServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromOrganizationServiceServiceLevelObjectiveName', () => { - const result = client.matchServiceFromOrganizationServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceLevelObjectiveFromOrganizationServiceServiceLevelObjectiveName', () => { - const result = client.matchServiceLevelObjectiveFromOrganizationServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "serviceLevelObjectiveValue"); - assert((client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('organizationService', async () => { + const fakePath = '/rendered/path/organizationService'; + const expectedParameters = { + organization: 'organizationValue', + service: 'serviceValue', + }; + const client = new snoozeserviceModule.v3.SnoozeServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.organizationServicePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.organizationServicePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('organizationServicePath', () => { + const result = client.organizationServicePath( + 'organizationValue', + 'serviceValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationServicePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchOrganizationFromOrganizationServiceName', () => { + const result = + client.matchOrganizationFromOrganizationServiceName(fakePath); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationServicePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchServiceFromOrganizationServiceName', () => { + const result = client.matchServiceFromOrganizationServiceName(fakePath); + assert.strictEqual(result, 'serviceValue'); + assert( + ( + client.pathTemplates.organizationServicePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('organizationUptimeCheckConfig', async () => { - const fakePath = "/rendered/path/organizationUptimeCheckConfig"; - const expectedParameters = { - organization: "organizationValue", - uptime_check_config: "uptimeCheckConfigValue", - }; - const client = new snoozeserviceModule.v3.SnoozeServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationUptimeCheckConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationUptimeCheckConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationUptimeCheckConfigPath', () => { - const result = client.organizationUptimeCheckConfigPath("organizationValue", "uptimeCheckConfigValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationUptimeCheckConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationUptimeCheckConfigName', () => { - const result = client.matchOrganizationFromOrganizationUptimeCheckConfigName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationUptimeCheckConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUptimeCheckConfigFromOrganizationUptimeCheckConfigName', () => { - const result = client.matchUptimeCheckConfigFromOrganizationUptimeCheckConfigName(fakePath); - assert.strictEqual(result, "uptimeCheckConfigValue"); - assert((client.pathTemplates.organizationUptimeCheckConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('organizationServiceServiceLevelObjective', async () => { + const fakePath = + '/rendered/path/organizationServiceServiceLevelObjective'; + const expectedParameters = { + organization: 'organizationValue', + service: 'serviceValue', + service_level_objective: 'serviceLevelObjectiveValue', + }; + const client = new snoozeserviceModule.v3.SnoozeServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationServiceServiceLevelObjectivePath', () => { + const result = client.organizationServiceServiceLevelObjectivePath( + 'organizationValue', + 'serviceValue', + 'serviceLevelObjectiveValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .organizationServiceServiceLevelObjectivePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchOrganizationFromOrganizationServiceServiceLevelObjectiveName', () => { + const result = + client.matchOrganizationFromOrganizationServiceServiceLevelObjectiveName( + fakePath, + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates + .organizationServiceServiceLevelObjectivePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchServiceFromOrganizationServiceServiceLevelObjectiveName', () => { + const result = + client.matchServiceFromOrganizationServiceServiceLevelObjectiveName( + fakePath, + ); + assert.strictEqual(result, 'serviceValue'); + assert( + ( + client.pathTemplates + .organizationServiceServiceLevelObjectivePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchServiceLevelObjectiveFromOrganizationServiceServiceLevelObjectiveName', () => { + const result = + client.matchServiceLevelObjectiveFromOrganizationServiceServiceLevelObjectiveName( + fakePath, + ); + assert.strictEqual(result, 'serviceLevelObjectiveValue'); + assert( + ( + client.pathTemplates + .organizationServiceServiceLevelObjectivePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('project', async () => { - const fakePath = "/rendered/path/project"; - const expectedParameters = { - project: "projectValue", - }; - const client = new snoozeserviceModule.v3.SnoozeServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectPath', () => { - const result = client.projectPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectName', () => { - const result = client.matchProjectFromProjectName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('organizationUptimeCheckConfig', async () => { + const fakePath = '/rendered/path/organizationUptimeCheckConfig'; + const expectedParameters = { + organization: 'organizationValue', + uptime_check_config: 'uptimeCheckConfigValue', + }; + const client = new snoozeserviceModule.v3.SnoozeServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.organizationUptimeCheckConfigPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationUptimeCheckConfigPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationUptimeCheckConfigPath', () => { + const result = client.organizationUptimeCheckConfigPath( + 'organizationValue', + 'uptimeCheckConfigValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationUptimeCheckConfigPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchOrganizationFromOrganizationUptimeCheckConfigName', () => { + const result = + client.matchOrganizationFromOrganizationUptimeCheckConfigName( + fakePath, + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationUptimeCheckConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchUptimeCheckConfigFromOrganizationUptimeCheckConfigName', () => { + const result = + client.matchUptimeCheckConfigFromOrganizationUptimeCheckConfigName( + fakePath, + ); + assert.strictEqual(result, 'uptimeCheckConfigValue'); + assert( + ( + client.pathTemplates.organizationUptimeCheckConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('projectAlertPolicy', async () => { - const fakePath = "/rendered/path/projectAlertPolicy"; - const expectedParameters = { - project: "projectValue", - alert_policy: "alertPolicyValue", - }; - const client = new snoozeserviceModule.v3.SnoozeServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectAlertPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAlertPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAlertPolicyPath', () => { - const result = client.projectAlertPolicyPath("projectValue", "alertPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAlertPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAlertPolicyName', () => { - const result = client.matchProjectFromProjectAlertPolicyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAlertPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAlertPolicyFromProjectAlertPolicyName', () => { - const result = client.matchAlertPolicyFromProjectAlertPolicyName(fakePath); - assert.strictEqual(result, "alertPolicyValue"); - assert((client.pathTemplates.projectAlertPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('project', async () => { + const fakePath = '/rendered/path/project'; + const expectedParameters = { + project: 'projectValue', + }; + const client = new snoozeserviceModule.v3.SnoozeServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.projectPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectPath', () => { + const result = client.projectPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('projectAlertPolicyCondition', async () => { - const fakePath = "/rendered/path/projectAlertPolicyCondition"; - const expectedParameters = { - project: "projectValue", - alert_policy: "alertPolicyValue", - condition: "conditionValue", - }; - const client = new snoozeserviceModule.v3.SnoozeServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectAlertPolicyConditionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAlertPolicyConditionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAlertPolicyConditionPath', () => { - const result = client.projectAlertPolicyConditionPath("projectValue", "alertPolicyValue", "conditionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAlertPolicyConditionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAlertPolicyConditionName', () => { - const result = client.matchProjectFromProjectAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAlertPolicyFromProjectAlertPolicyConditionName', () => { - const result = client.matchAlertPolicyFromProjectAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "alertPolicyValue"); - assert((client.pathTemplates.projectAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConditionFromProjectAlertPolicyConditionName', () => { - const result = client.matchConditionFromProjectAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "conditionValue"); - assert((client.pathTemplates.projectAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('projectAlertPolicy', async () => { + const fakePath = '/rendered/path/projectAlertPolicy'; + const expectedParameters = { + project: 'projectValue', + alert_policy: 'alertPolicyValue', + }; + const client = new snoozeserviceModule.v3.SnoozeServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.projectAlertPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAlertPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAlertPolicyPath', () => { + const result = client.projectAlertPolicyPath( + 'projectValue', + 'alertPolicyValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAlertPolicyPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectAlertPolicyName', () => { + const result = client.matchProjectFromProjectAlertPolicyName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAlertPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchAlertPolicyFromProjectAlertPolicyName', () => { + const result = + client.matchAlertPolicyFromProjectAlertPolicyName(fakePath); + assert.strictEqual(result, 'alertPolicyValue'); + assert( + ( + client.pathTemplates.projectAlertPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('projectChannelDescriptor', async () => { - const fakePath = "/rendered/path/projectChannelDescriptor"; - const expectedParameters = { - project: "projectValue", - channel_descriptor: "channelDescriptorValue", - }; - const client = new snoozeserviceModule.v3.SnoozeServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectChannelDescriptorPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectChannelDescriptorPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectChannelDescriptorPath', () => { - const result = client.projectChannelDescriptorPath("projectValue", "channelDescriptorValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectChannelDescriptorPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectChannelDescriptorName', () => { - const result = client.matchProjectFromProjectChannelDescriptorName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectChannelDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchChannelDescriptorFromProjectChannelDescriptorName', () => { - const result = client.matchChannelDescriptorFromProjectChannelDescriptorName(fakePath); - assert.strictEqual(result, "channelDescriptorValue"); - assert((client.pathTemplates.projectChannelDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('projectAlertPolicyCondition', async () => { + const fakePath = '/rendered/path/projectAlertPolicyCondition'; + const expectedParameters = { + project: 'projectValue', + alert_policy: 'alertPolicyValue', + condition: 'conditionValue', + }; + const client = new snoozeserviceModule.v3.SnoozeServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.projectAlertPolicyConditionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAlertPolicyConditionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAlertPolicyConditionPath', () => { + const result = client.projectAlertPolicyConditionPath( + 'projectValue', + 'alertPolicyValue', + 'conditionValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAlertPolicyConditionPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectAlertPolicyConditionName', () => { + const result = + client.matchProjectFromProjectAlertPolicyConditionName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAlertPolicyConditionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchAlertPolicyFromProjectAlertPolicyConditionName', () => { + const result = + client.matchAlertPolicyFromProjectAlertPolicyConditionName(fakePath); + assert.strictEqual(result, 'alertPolicyValue'); + assert( + ( + client.pathTemplates.projectAlertPolicyConditionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchConditionFromProjectAlertPolicyConditionName', () => { + const result = + client.matchConditionFromProjectAlertPolicyConditionName(fakePath); + assert.strictEqual(result, 'conditionValue'); + assert( + ( + client.pathTemplates.projectAlertPolicyConditionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('projectGroup', async () => { - const fakePath = "/rendered/path/projectGroup"; - const expectedParameters = { - project: "projectValue", - group: "groupValue", - }; - const client = new snoozeserviceModule.v3.SnoozeServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectGroupPath', () => { - const result = client.projectGroupPath("projectValue", "groupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectGroupName', () => { - const result = client.matchProjectFromProjectGroupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchGroupFromProjectGroupName', () => { - const result = client.matchGroupFromProjectGroupName(fakePath); - assert.strictEqual(result, "groupValue"); - assert((client.pathTemplates.projectGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('projectChannelDescriptor', async () => { + const fakePath = '/rendered/path/projectChannelDescriptor'; + const expectedParameters = { + project: 'projectValue', + channel_descriptor: 'channelDescriptorValue', + }; + const client = new snoozeserviceModule.v3.SnoozeServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.projectChannelDescriptorPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectChannelDescriptorPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectChannelDescriptorPath', () => { + const result = client.projectChannelDescriptorPath( + 'projectValue', + 'channelDescriptorValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectChannelDescriptorPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectChannelDescriptorName', () => { + const result = + client.matchProjectFromProjectChannelDescriptorName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectChannelDescriptorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchChannelDescriptorFromProjectChannelDescriptorName', () => { + const result = + client.matchChannelDescriptorFromProjectChannelDescriptorName( + fakePath, + ); + assert.strictEqual(result, 'channelDescriptorValue'); + assert( + ( + client.pathTemplates.projectChannelDescriptorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('projectNotificationChannel', async () => { - const fakePath = "/rendered/path/projectNotificationChannel"; - const expectedParameters = { - project: "projectValue", - notification_channel: "notificationChannelValue", - }; - const client = new snoozeserviceModule.v3.SnoozeServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectNotificationChannelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectNotificationChannelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectNotificationChannelPath', () => { - const result = client.projectNotificationChannelPath("projectValue", "notificationChannelValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectNotificationChannelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectNotificationChannelName', () => { - const result = client.matchProjectFromProjectNotificationChannelName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectNotificationChannelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchNotificationChannelFromProjectNotificationChannelName', () => { - const result = client.matchNotificationChannelFromProjectNotificationChannelName(fakePath); - assert.strictEqual(result, "notificationChannelValue"); - assert((client.pathTemplates.projectNotificationChannelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('projectGroup', async () => { + const fakePath = '/rendered/path/projectGroup'; + const expectedParameters = { + project: 'projectValue', + group: 'groupValue', + }; + const client = new snoozeserviceModule.v3.SnoozeServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.projectGroupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectGroupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectGroupPath', () => { + const result = client.projectGroupPath('projectValue', 'groupValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectGroupPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectGroupName', () => { + const result = client.matchProjectFromProjectGroupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectGroupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchGroupFromProjectGroupName', () => { + const result = client.matchGroupFromProjectGroupName(fakePath); + assert.strictEqual(result, 'groupValue'); + assert( + (client.pathTemplates.projectGroupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('projectService', async () => { - const fakePath = "/rendered/path/projectService"; - const expectedParameters = { - project: "projectValue", - service: "serviceValue", - }; - const client = new snoozeserviceModule.v3.SnoozeServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectServicePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectServicePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectServicePath', () => { - const result = client.projectServicePath("projectValue", "serviceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectServicePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectServiceName', () => { - const result = client.matchProjectFromProjectServiceName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectServicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromProjectServiceName', () => { - const result = client.matchServiceFromProjectServiceName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.projectServicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('projectNotificationChannel', async () => { + const fakePath = '/rendered/path/projectNotificationChannel'; + const expectedParameters = { + project: 'projectValue', + notification_channel: 'notificationChannelValue', + }; + const client = new snoozeserviceModule.v3.SnoozeServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.projectNotificationChannelPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectNotificationChannelPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectNotificationChannelPath', () => { + const result = client.projectNotificationChannelPath( + 'projectValue', + 'notificationChannelValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectNotificationChannelPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectNotificationChannelName', () => { + const result = + client.matchProjectFromProjectNotificationChannelName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectNotificationChannelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchNotificationChannelFromProjectNotificationChannelName', () => { + const result = + client.matchNotificationChannelFromProjectNotificationChannelName( + fakePath, + ); + assert.strictEqual(result, 'notificationChannelValue'); + assert( + ( + client.pathTemplates.projectNotificationChannelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('projectServiceServiceLevelObjective', async () => { - const fakePath = "/rendered/path/projectServiceServiceLevelObjective"; - const expectedParameters = { - project: "projectValue", - service: "serviceValue", - service_level_objective: "serviceLevelObjectiveValue", - }; - const client = new snoozeserviceModule.v3.SnoozeServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectServiceServiceLevelObjectivePath', () => { - const result = client.projectServiceServiceLevelObjectivePath("projectValue", "serviceValue", "serviceLevelObjectiveValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectServiceServiceLevelObjectiveName', () => { - const result = client.matchProjectFromProjectServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromProjectServiceServiceLevelObjectiveName', () => { - const result = client.matchServiceFromProjectServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceLevelObjectiveFromProjectServiceServiceLevelObjectiveName', () => { - const result = client.matchServiceLevelObjectiveFromProjectServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "serviceLevelObjectiveValue"); - assert((client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('projectService', async () => { + const fakePath = '/rendered/path/projectService'; + const expectedParameters = { + project: 'projectValue', + service: 'serviceValue', + }; + const client = new snoozeserviceModule.v3.SnoozeServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.projectServicePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectServicePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectServicePath', () => { + const result = client.projectServicePath( + 'projectValue', + 'serviceValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectServicePathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectServiceName', () => { + const result = client.matchProjectFromProjectServiceName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectServicePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchServiceFromProjectServiceName', () => { + const result = client.matchServiceFromProjectServiceName(fakePath); + assert.strictEqual(result, 'serviceValue'); + assert( + (client.pathTemplates.projectServicePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('projectUptimeCheckConfig', async () => { - const fakePath = "/rendered/path/projectUptimeCheckConfig"; - const expectedParameters = { - project: "projectValue", - uptime_check_config: "uptimeCheckConfigValue", - }; - const client = new snoozeserviceModule.v3.SnoozeServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectUptimeCheckConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectUptimeCheckConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectUptimeCheckConfigPath', () => { - const result = client.projectUptimeCheckConfigPath("projectValue", "uptimeCheckConfigValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectUptimeCheckConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectUptimeCheckConfigName', () => { - const result = client.matchProjectFromProjectUptimeCheckConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectUptimeCheckConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUptimeCheckConfigFromProjectUptimeCheckConfigName', () => { - const result = client.matchUptimeCheckConfigFromProjectUptimeCheckConfigName(fakePath); - assert.strictEqual(result, "uptimeCheckConfigValue"); - assert((client.pathTemplates.projectUptimeCheckConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('projectServiceServiceLevelObjective', async () => { + const fakePath = '/rendered/path/projectServiceServiceLevelObjective'; + const expectedParameters = { + project: 'projectValue', + service: 'serviceValue', + service_level_objective: 'serviceLevelObjectiveValue', + }; + const client = new snoozeserviceModule.v3.SnoozeServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectServiceServiceLevelObjectivePath', () => { + const result = client.projectServiceServiceLevelObjectivePath( + 'projectValue', + 'serviceValue', + 'serviceLevelObjectiveValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectServiceServiceLevelObjectiveName', () => { + const result = + client.matchProjectFromProjectServiceServiceLevelObjectiveName( + fakePath, + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchServiceFromProjectServiceServiceLevelObjectiveName', () => { + const result = + client.matchServiceFromProjectServiceServiceLevelObjectiveName( + fakePath, + ); + assert.strictEqual(result, 'serviceValue'); + assert( + ( + client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchServiceLevelObjectiveFromProjectServiceServiceLevelObjectiveName', () => { + const result = + client.matchServiceLevelObjectiveFromProjectServiceServiceLevelObjectiveName( + fakePath, + ); + assert.strictEqual(result, 'serviceLevelObjectiveValue'); + assert( + ( + client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('snooze', async () => { - const fakePath = "/rendered/path/snooze"; - const expectedParameters = { - project: "projectValue", - snooze: "snoozeValue", - }; - const client = new snoozeserviceModule.v3.SnoozeServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.snoozePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.snoozePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('snoozePath', () => { - const result = client.snoozePath("projectValue", "snoozeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.snoozePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromSnoozeName', () => { - const result = client.matchProjectFromSnoozeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.snoozePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSnoozeFromSnoozeName', () => { - const result = client.matchSnoozeFromSnoozeName(fakePath); - assert.strictEqual(result, "snoozeValue"); - assert((client.pathTemplates.snoozePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('projectUptimeCheckConfig', async () => { + const fakePath = '/rendered/path/projectUptimeCheckConfig'; + const expectedParameters = { + project: 'projectValue', + uptime_check_config: 'uptimeCheckConfigValue', + }; + const client = new snoozeserviceModule.v3.SnoozeServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.projectUptimeCheckConfigPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectUptimeCheckConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectUptimeCheckConfigPath', () => { + const result = client.projectUptimeCheckConfigPath( + 'projectValue', + 'uptimeCheckConfigValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectUptimeCheckConfigPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectUptimeCheckConfigName', () => { + const result = + client.matchProjectFromProjectUptimeCheckConfigName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectUptimeCheckConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchUptimeCheckConfigFromProjectUptimeCheckConfigName', () => { + const result = + client.matchUptimeCheckConfigFromProjectUptimeCheckConfigName( + fakePath, + ); + assert.strictEqual(result, 'uptimeCheckConfigValue'); + assert( + ( + client.pathTemplates.projectUptimeCheckConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('snooze', async () => { + const fakePath = '/rendered/path/snooze'; + const expectedParameters = { + project: 'projectValue', + snooze: 'snoozeValue', + }; + const client = new snoozeserviceModule.v3.SnoozeServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.snoozePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.snoozePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('snoozePath', () => { + const result = client.snoozePath('projectValue', 'snoozeValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.snoozePathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromSnoozeName', () => { + const result = client.matchProjectFromSnoozeName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.snoozePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSnoozeFromSnoozeName', () => { + const result = client.matchSnoozeFromSnoozeName(fakePath); + assert.strictEqual(result, 'snoozeValue'); + assert( + (client.pathTemplates.snoozePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); }); + }); }); diff --git a/packages/google-cloud-monitoring/test/gapic_uptime_check_service_v3.ts b/packages/google-cloud-monitoring/test/gapic_uptime_check_service_v3.ts index 9f9ce3febae9..60f4a6d13b9f 100644 --- a/packages/google-cloud-monitoring/test/gapic_uptime_check_service_v3.ts +++ b/packages/google-cloud-monitoring/test/gapic_uptime_check_service_v3.ts @@ -19,2130 +19,3092 @@ 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 uptimecheckserviceModule 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 -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); +const root = protobuf.Root.fromJSON( + require('../protos/protos.json'), +).resolveAll(); // eslint-disable-next-line @typescript-eslint/no-unused-vars function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; } function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; + const filledObject = ( + instance.constructor as typeof protobuf.Message + ).toObject(instance as protobuf.Message, { defaults: true }); + return (instance.constructor as typeof protobuf.Message).fromObject( + filledObject, + ) as T; } function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); + return error + ? sinon.stub().rejects(error) + : sinon.stub().resolves([response]); } -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +function stubSimpleCallWithCallback( + response?: ResponseType, + error?: Error, +) { + return error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); } -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } +function stubPageStreamingCall( + responses?: ResponseType[], + error?: Error, +) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); + } + const transformStub = error + ? sinon.stub().callsArgWith(2, error) + : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { + mockStream.write({}); + }); } - return sinon.stub().returns(mockStream); + setImmediate(() => { + mockStream.end(); + }); + } else { + setImmediate(() => { + mockStream.write({}); + }); + setImmediate(() => { + mockStream.end(); + }); + } + return sinon.stub().returns(mockStream); } -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); +function stubAsyncIterationCall( + responses?: ResponseType[], + error?: Error, +) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({ done: true, value: undefined }); + } + return Promise.resolve({ done: false, value: responses![counter++] }); + }, + }; + }, + }; + return sinon.stub().returns(asyncIterable); } describe('v3.UptimeCheckServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'monitoring.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = uptimecheckserviceModule.v3.UptimeCheckServiceClient.servicePath; - assert.strictEqual(servicePath, 'monitoring.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = uptimecheckserviceModule.v3.UptimeCheckServiceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'monitoring.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'monitoring.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'monitoring.example.com'); - }); - - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'monitoring.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'monitoring.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new uptimecheckserviceModule.v3.UptimeCheckServiceClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); - - it('has port', () => { - const port = uptimecheckserviceModule.v3.UptimeCheckServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.uptimeCheckServiceStub, undefined); - await client.initialize(); - assert(client.uptimeCheckServiceStub); - }); - - it('has close method for the initialized client', done => { - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.uptimeCheckServiceStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has close method for the non-initialized client', done => { - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.uptimeCheckServiceStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); + describe('Common methods', () => { + it('has apiEndpoint', () => { + const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'monitoring.googleapis.com'); }); - describe('getUptimeCheckConfig', () => { - it('invokes getUptimeCheckConfig without error', async () => { - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.GetUptimeCheckConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.GetUptimeCheckConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.monitoring.v3.UptimeCheckConfig() - ); - client.innerApiCalls.getUptimeCheckConfig = stubSimpleCall(expectedResponse); - const [response] = await client.getUptimeCheckConfig(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getUptimeCheckConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getUptimeCheckConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getUptimeCheckConfig without error using callback', async () => { - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.GetUptimeCheckConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.GetUptimeCheckConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.monitoring.v3.UptimeCheckConfig() - ); - client.innerApiCalls.getUptimeCheckConfig = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getUptimeCheckConfig( - request, - (err?: Error|null, result?: protos.google.monitoring.v3.IUptimeCheckConfig|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getUptimeCheckConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getUptimeCheckConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getUptimeCheckConfig with error', async () => { - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.GetUptimeCheckConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.GetUptimeCheckConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getUptimeCheckConfig = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getUptimeCheckConfig(request), expectedError); - const actualRequest = (client.innerApiCalls.getUptimeCheckConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getUptimeCheckConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getUptimeCheckConfig with closed client', async () => { - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.GetUptimeCheckConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.GetUptimeCheckConfigRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getUptimeCheckConfig(request), expectedError); - }); + it('has universeDomain', () => { + const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); }); - describe('createUptimeCheckConfig', () => { - it('invokes createUptimeCheckConfig without error', async () => { - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.CreateUptimeCheckConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.CreateUptimeCheckConfigRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.monitoring.v3.UptimeCheckConfig() - ); - client.innerApiCalls.createUptimeCheckConfig = stubSimpleCall(expectedResponse); - const [response] = await client.createUptimeCheckConfig(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createUptimeCheckConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createUptimeCheckConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createUptimeCheckConfig without error using callback', async () => { - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.CreateUptimeCheckConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.CreateUptimeCheckConfigRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.monitoring.v3.UptimeCheckConfig() - ); - client.innerApiCalls.createUptimeCheckConfig = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createUptimeCheckConfig( - request, - (err?: Error|null, result?: protos.google.monitoring.v3.IUptimeCheckConfig|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createUptimeCheckConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createUptimeCheckConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createUptimeCheckConfig with error', async () => { - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.CreateUptimeCheckConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.CreateUptimeCheckConfigRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createUptimeCheckConfig = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createUptimeCheckConfig(request), expectedError); - const actualRequest = (client.innerApiCalls.createUptimeCheckConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createUptimeCheckConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createUptimeCheckConfig with closed client', async () => { - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.CreateUptimeCheckConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.CreateUptimeCheckConfigRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.createUptimeCheckConfig(request), expectedError); - }); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + uptimecheckserviceModule.v3.UptimeCheckServiceClient.servicePath; + assert.strictEqual(servicePath, 'monitoring.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + uptimecheckserviceModule.v3.UptimeCheckServiceClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'monitoring.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'monitoring.example.com'); }); - describe('updateUptimeCheckConfig', () => { - it('invokes updateUptimeCheckConfig without error', async () => { - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.UpdateUptimeCheckConfigRequest() - ); - request.uptimeCheckConfig ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.UpdateUptimeCheckConfigRequest', ['uptimeCheckConfig', 'name']); - request.uptimeCheckConfig.name = defaultValue1; - const expectedHeaderRequestParams = `uptime_check_config.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.monitoring.v3.UptimeCheckConfig() - ); - client.innerApiCalls.updateUptimeCheckConfig = stubSimpleCall(expectedResponse); - const [response] = await client.updateUptimeCheckConfig(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateUptimeCheckConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateUptimeCheckConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateUptimeCheckConfig without error using callback', async () => { - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.UpdateUptimeCheckConfigRequest() - ); - request.uptimeCheckConfig ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.UpdateUptimeCheckConfigRequest', ['uptimeCheckConfig', 'name']); - request.uptimeCheckConfig.name = defaultValue1; - const expectedHeaderRequestParams = `uptime_check_config.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.monitoring.v3.UptimeCheckConfig() - ); - client.innerApiCalls.updateUptimeCheckConfig = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateUptimeCheckConfig( - request, - (err?: Error|null, result?: protos.google.monitoring.v3.IUptimeCheckConfig|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateUptimeCheckConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateUptimeCheckConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateUptimeCheckConfig with error', async () => { - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.UpdateUptimeCheckConfigRequest() - ); - request.uptimeCheckConfig ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.UpdateUptimeCheckConfigRequest', ['uptimeCheckConfig', 'name']); - request.uptimeCheckConfig.name = defaultValue1; - const expectedHeaderRequestParams = `uptime_check_config.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateUptimeCheckConfig = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateUptimeCheckConfig(request), expectedError); - const actualRequest = (client.innerApiCalls.updateUptimeCheckConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateUptimeCheckConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateUptimeCheckConfig with closed client', async () => { - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.UpdateUptimeCheckConfigRequest() - ); - request.uptimeCheckConfig ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.UpdateUptimeCheckConfigRequest', ['uptimeCheckConfig', 'name']); - request.uptimeCheckConfig.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.updateUptimeCheckConfig(request), expectedError); - }); + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'monitoring.example.com'); }); - describe('deleteUptimeCheckConfig', () => { - it('invokes deleteUptimeCheckConfig without error', async () => { - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.DeleteUptimeCheckConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.DeleteUptimeCheckConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteUptimeCheckConfig = stubSimpleCall(expectedResponse); - const [response] = await client.deleteUptimeCheckConfig(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteUptimeCheckConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteUptimeCheckConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + if (typeof process === 'object' && 'env' in process) { + describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { + it('sets apiEndpoint from environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = + new uptimecheckserviceModule.v3.UptimeCheckServiceClient(); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'monitoring.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } + }); + + it('value configured in code has priority over environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = + new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ + universeDomain: 'configured.example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'monitoring.configured.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } + }); + }); + } + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', }); + }); + }); - it('invokes deleteUptimeCheckConfig without error using callback', async () => { - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.DeleteUptimeCheckConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.DeleteUptimeCheckConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteUptimeCheckConfig = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteUptimeCheckConfig( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteUptimeCheckConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteUptimeCheckConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('has port', () => { + const port = uptimecheckserviceModule.v3.UptimeCheckServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); - it('invokes deleteUptimeCheckConfig with error', async () => { - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.DeleteUptimeCheckConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.DeleteUptimeCheckConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteUptimeCheckConfig = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteUptimeCheckConfig(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteUptimeCheckConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteUptimeCheckConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('should create a client with no option', () => { + const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient(); + assert(client); + }); - it('invokes deleteUptimeCheckConfig with closed client', async () => { - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.DeleteUptimeCheckConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.DeleteUptimeCheckConfigRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.deleteUptimeCheckConfig(request), expectedError); - }); + it('should create a client with gRPC fallback', () => { + const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ + fallback: true, + }); + assert(client); }); - describe('listUptimeCheckConfigs', () => { - it('invokes listUptimeCheckConfigs without error', async () => { - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListUptimeCheckConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListUptimeCheckConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.monitoring.v3.UptimeCheckConfig()), - generateSampleMessage(new protos.google.monitoring.v3.UptimeCheckConfig()), - generateSampleMessage(new protos.google.monitoring.v3.UptimeCheckConfig()), - ]; - client.innerApiCalls.listUptimeCheckConfigs = stubSimpleCall(expectedResponse); - const [response] = await client.listUptimeCheckConfigs(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listUptimeCheckConfigs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listUptimeCheckConfigs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('has initialize method and supports deferred initialization', async () => { + const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.uptimeCheckServiceStub, undefined); + await client.initialize(); + assert(client.uptimeCheckServiceStub); + }); - it('invokes listUptimeCheckConfigs without error using callback', async () => { - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListUptimeCheckConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListUptimeCheckConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.monitoring.v3.UptimeCheckConfig()), - generateSampleMessage(new protos.google.monitoring.v3.UptimeCheckConfig()), - generateSampleMessage(new protos.google.monitoring.v3.UptimeCheckConfig()), - ]; - client.innerApiCalls.listUptimeCheckConfigs = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listUptimeCheckConfigs( - request, - (err?: Error|null, result?: protos.google.monitoring.v3.IUptimeCheckConfig[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listUptimeCheckConfigs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listUptimeCheckConfigs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + it('has close method for the initialized client', (done) => { + const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.initialize().catch((err) => { + throw err; + }); + assert(client.uptimeCheckServiceStub); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; }); + }); - it('invokes listUptimeCheckConfigs with error', async () => { - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListUptimeCheckConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListUptimeCheckConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listUptimeCheckConfigs = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listUptimeCheckConfigs(request), expectedError); - const actualRequest = (client.innerApiCalls.listUptimeCheckConfigs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listUptimeCheckConfigs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + it('has close method for the non-initialized client', (done) => { + const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.uptimeCheckServiceStub, undefined); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; }); + }); - it('invokes listUptimeCheckConfigsStream without error', async () => { - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListUptimeCheckConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListUptimeCheckConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.monitoring.v3.UptimeCheckConfig()), - generateSampleMessage(new protos.google.monitoring.v3.UptimeCheckConfig()), - generateSampleMessage(new protos.google.monitoring.v3.UptimeCheckConfig()), - ]; - client.descriptors.page.listUptimeCheckConfigs.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listUptimeCheckConfigsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.monitoring.v3.UptimeCheckConfig[] = []; - stream.on('data', (response: protos.google.monitoring.v3.UptimeCheckConfig) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listUptimeCheckConfigs.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listUptimeCheckConfigs, request)); - assert( - (client.descriptors.page.listUptimeCheckConfigs.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); - it('invokes listUptimeCheckConfigsStream with error', async () => { - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListUptimeCheckConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListUptimeCheckConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listUptimeCheckConfigs.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listUptimeCheckConfigsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.monitoring.v3.UptimeCheckConfig[] = []; - stream.on('data', (response: protos.google.monitoring.v3.UptimeCheckConfig) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listUptimeCheckConfigs.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listUptimeCheckConfigs, request)); - assert( - (client.descriptors.page.listUptimeCheckConfigs.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + }); + + describe('getUptimeCheckConfig', () => { + it('invokes getUptimeCheckConfig without error', async () => { + const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.GetUptimeCheckConfigRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.GetUptimeCheckConfigRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.monitoring.v3.UptimeCheckConfig(), + ); + client.innerApiCalls.getUptimeCheckConfig = + stubSimpleCall(expectedResponse); + const [response] = await client.getUptimeCheckConfig(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getUptimeCheckConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getUptimeCheckConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('uses async iteration with listUptimeCheckConfigs without error', async () => { - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListUptimeCheckConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListUptimeCheckConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.monitoring.v3.UptimeCheckConfig()), - generateSampleMessage(new protos.google.monitoring.v3.UptimeCheckConfig()), - generateSampleMessage(new protos.google.monitoring.v3.UptimeCheckConfig()), - ]; - client.descriptors.page.listUptimeCheckConfigs.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.monitoring.v3.IUptimeCheckConfig[] = []; - const iterable = client.listUptimeCheckConfigsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); + it('invokes getUptimeCheckConfig without error using callback', async () => { + const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.GetUptimeCheckConfigRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.GetUptimeCheckConfigRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.monitoring.v3.UptimeCheckConfig(), + ); + client.innerApiCalls.getUptimeCheckConfig = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getUptimeCheckConfig( + request, + ( + err?: Error | null, + result?: protos.google.monitoring.v3.IUptimeCheckConfig | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listUptimeCheckConfigs.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listUptimeCheckConfigs.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listUptimeCheckConfigs with error', async () => { - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListUptimeCheckConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListUptimeCheckConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listUptimeCheckConfigs.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listUptimeCheckConfigsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.monitoring.v3.IUptimeCheckConfig[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listUptimeCheckConfigs.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listUptimeCheckConfigs.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getUptimeCheckConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getUptimeCheckConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('listUptimeCheckIps', () => { - it('invokes listUptimeCheckIps without error', async () => { - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListUptimeCheckIpsRequest() - );const expectedResponse = [ - generateSampleMessage(new protos.google.monitoring.v3.UptimeCheckIp()), - generateSampleMessage(new protos.google.monitoring.v3.UptimeCheckIp()), - generateSampleMessage(new protos.google.monitoring.v3.UptimeCheckIp()), - ]; - client.innerApiCalls.listUptimeCheckIps = stubSimpleCall(expectedResponse); - const [response] = await client.listUptimeCheckIps(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes listUptimeCheckIps without error using callback', async () => { - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListUptimeCheckIpsRequest() - );const expectedResponse = [ - generateSampleMessage(new protos.google.monitoring.v3.UptimeCheckIp()), - generateSampleMessage(new protos.google.monitoring.v3.UptimeCheckIp()), - generateSampleMessage(new protos.google.monitoring.v3.UptimeCheckIp()), - ]; - client.innerApiCalls.listUptimeCheckIps = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listUptimeCheckIps( - request, - (err?: Error|null, result?: protos.google.monitoring.v3.IUptimeCheckIp[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes listUptimeCheckIps with error', async () => { - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListUptimeCheckIpsRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.listUptimeCheckIps = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listUptimeCheckIps(request), expectedError); - }); - - it('invokes listUptimeCheckIpsStream without error', async () => { - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListUptimeCheckIpsRequest() - ); - const expectedResponse = [ - generateSampleMessage(new protos.google.monitoring.v3.UptimeCheckIp()), - generateSampleMessage(new protos.google.monitoring.v3.UptimeCheckIp()), - generateSampleMessage(new protos.google.monitoring.v3.UptimeCheckIp()), - ]; - client.descriptors.page.listUptimeCheckIps.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listUptimeCheckIpsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.monitoring.v3.UptimeCheckIp[] = []; - stream.on('data', (response: protos.google.monitoring.v3.UptimeCheckIp) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listUptimeCheckIps.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listUptimeCheckIps, request)); - }); + it('invokes getUptimeCheckConfig with error', async () => { + const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.GetUptimeCheckConfigRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.GetUptimeCheckConfigRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getUptimeCheckConfig = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.getUptimeCheckConfig(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getUptimeCheckConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getUptimeCheckConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes listUptimeCheckIpsStream with error', async () => { - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListUptimeCheckIpsRequest() - ); - const expectedError = new Error('expected'); - client.descriptors.page.listUptimeCheckIps.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listUptimeCheckIpsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.monitoring.v3.UptimeCheckIp[] = []; - stream.on('data', (response: protos.google.monitoring.v3.UptimeCheckIp) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listUptimeCheckIps.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listUptimeCheckIps, request)); - }); + it('invokes getUptimeCheckConfig with closed client', async () => { + const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.GetUptimeCheckConfigRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.GetUptimeCheckConfigRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.getUptimeCheckConfig(request), expectedError); + }); + }); + + describe('createUptimeCheckConfig', () => { + it('invokes createUptimeCheckConfig without error', async () => { + const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.CreateUptimeCheckConfigRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.CreateUptimeCheckConfigRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.monitoring.v3.UptimeCheckConfig(), + ); + client.innerApiCalls.createUptimeCheckConfig = + stubSimpleCall(expectedResponse); + const [response] = await client.createUptimeCheckConfig(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createUptimeCheckConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createUptimeCheckConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('uses async iteration with listUptimeCheckIps without error', async () => { - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListUptimeCheckIpsRequest() - ); - const expectedResponse = [ - generateSampleMessage(new protos.google.monitoring.v3.UptimeCheckIp()), - generateSampleMessage(new protos.google.monitoring.v3.UptimeCheckIp()), - generateSampleMessage(new protos.google.monitoring.v3.UptimeCheckIp()), - ]; - client.descriptors.page.listUptimeCheckIps.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.monitoring.v3.IUptimeCheckIp[] = []; - const iterable = client.listUptimeCheckIpsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); + it('invokes createUptimeCheckConfig without error using callback', async () => { + const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.CreateUptimeCheckConfigRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.CreateUptimeCheckConfigRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.monitoring.v3.UptimeCheckConfig(), + ); + client.innerApiCalls.createUptimeCheckConfig = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createUptimeCheckConfig( + request, + ( + err?: Error | null, + result?: protos.google.monitoring.v3.IUptimeCheckConfig | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listUptimeCheckIps.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - - it('uses async iteration with listUptimeCheckIps with error', async () => { - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListUptimeCheckIpsRequest() - ); - const expectedError = new Error('expected'); - client.descriptors.page.listUptimeCheckIps.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listUptimeCheckIpsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.monitoring.v3.IUptimeCheckIp[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listUptimeCheckIps.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createUptimeCheckConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createUptimeCheckConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('Path templates', () => { - - describe('folderAlertPolicy', async () => { - const fakePath = "/rendered/path/folderAlertPolicy"; - const expectedParameters = { - folder: "folderValue", - alert_policy: "alertPolicyValue", - }; - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.folderAlertPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderAlertPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderAlertPolicyPath', () => { - const result = client.folderAlertPolicyPath("folderValue", "alertPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderAlertPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderAlertPolicyName', () => { - const result = client.matchFolderFromFolderAlertPolicyName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderAlertPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAlertPolicyFromFolderAlertPolicyName', () => { - const result = client.matchAlertPolicyFromFolderAlertPolicyName(fakePath); - assert.strictEqual(result, "alertPolicyValue"); - assert((client.pathTemplates.folderAlertPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderAlertPolicyCondition', async () => { - const fakePath = "/rendered/path/folderAlertPolicyCondition"; - const expectedParameters = { - folder: "folderValue", - alert_policy: "alertPolicyValue", - condition: "conditionValue", - }; - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.folderAlertPolicyConditionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderAlertPolicyConditionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderAlertPolicyConditionPath', () => { - const result = client.folderAlertPolicyConditionPath("folderValue", "alertPolicyValue", "conditionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderAlertPolicyConditionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderAlertPolicyConditionName', () => { - const result = client.matchFolderFromFolderAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAlertPolicyFromFolderAlertPolicyConditionName', () => { - const result = client.matchAlertPolicyFromFolderAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "alertPolicyValue"); - assert((client.pathTemplates.folderAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConditionFromFolderAlertPolicyConditionName', () => { - const result = client.matchConditionFromFolderAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "conditionValue"); - assert((client.pathTemplates.folderAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderChannelDescriptor', async () => { - const fakePath = "/rendered/path/folderChannelDescriptor"; - const expectedParameters = { - folder: "folderValue", - channel_descriptor: "channelDescriptorValue", - }; - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.folderChannelDescriptorPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderChannelDescriptorPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderChannelDescriptorPath', () => { - const result = client.folderChannelDescriptorPath("folderValue", "channelDescriptorValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderChannelDescriptorPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderChannelDescriptorName', () => { - const result = client.matchFolderFromFolderChannelDescriptorName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderChannelDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchChannelDescriptorFromFolderChannelDescriptorName', () => { - const result = client.matchChannelDescriptorFromFolderChannelDescriptorName(fakePath); - assert.strictEqual(result, "channelDescriptorValue"); - assert((client.pathTemplates.folderChannelDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderGroup', async () => { - const fakePath = "/rendered/path/folderGroup"; - const expectedParameters = { - folder: "folderValue", - group: "groupValue", - }; - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.folderGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderGroupPath', () => { - const result = client.folderGroupPath("folderValue", "groupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderGroupName', () => { - const result = client.matchFolderFromFolderGroupName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchGroupFromFolderGroupName', () => { - const result = client.matchGroupFromFolderGroupName(fakePath); - assert.strictEqual(result, "groupValue"); - assert((client.pathTemplates.folderGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderNotificationChannel', async () => { - const fakePath = "/rendered/path/folderNotificationChannel"; - const expectedParameters = { - folder: "folderValue", - notification_channel: "notificationChannelValue", - }; - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.folderNotificationChannelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderNotificationChannelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderNotificationChannelPath', () => { - const result = client.folderNotificationChannelPath("folderValue", "notificationChannelValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderNotificationChannelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderNotificationChannelName', () => { - const result = client.matchFolderFromFolderNotificationChannelName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderNotificationChannelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchNotificationChannelFromFolderNotificationChannelName', () => { - const result = client.matchNotificationChannelFromFolderNotificationChannelName(fakePath); - assert.strictEqual(result, "notificationChannelValue"); - assert((client.pathTemplates.folderNotificationChannelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderService', async () => { - const fakePath = "/rendered/path/folderService"; - const expectedParameters = { - folder: "folderValue", - service: "serviceValue", - }; - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.folderServicePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderServicePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderServicePath', () => { - const result = client.folderServicePath("folderValue", "serviceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderServicePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderServiceName', () => { - const result = client.matchFolderFromFolderServiceName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderServicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromFolderServiceName', () => { - const result = client.matchServiceFromFolderServiceName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.folderServicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderServiceServiceLevelObjective', async () => { - const fakePath = "/rendered/path/folderServiceServiceLevelObjective"; - const expectedParameters = { - folder: "folderValue", - service: "serviceValue", - service_level_objective: "serviceLevelObjectiveValue", - }; - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderServiceServiceLevelObjectivePath', () => { - const result = client.folderServiceServiceLevelObjectivePath("folderValue", "serviceValue", "serviceLevelObjectiveValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderServiceServiceLevelObjectiveName', () => { - const result = client.matchFolderFromFolderServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromFolderServiceServiceLevelObjectiveName', () => { - const result = client.matchServiceFromFolderServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceLevelObjectiveFromFolderServiceServiceLevelObjectiveName', () => { - const result = client.matchServiceLevelObjectiveFromFolderServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "serviceLevelObjectiveValue"); - assert((client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderUptimeCheckConfig', async () => { - const fakePath = "/rendered/path/folderUptimeCheckConfig"; - const expectedParameters = { - folder: "folderValue", - uptime_check_config: "uptimeCheckConfigValue", - }; - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.folderUptimeCheckConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderUptimeCheckConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderUptimeCheckConfigPath', () => { - const result = client.folderUptimeCheckConfigPath("folderValue", "uptimeCheckConfigValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderUptimeCheckConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderUptimeCheckConfigName', () => { - const result = client.matchFolderFromFolderUptimeCheckConfigName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderUptimeCheckConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUptimeCheckConfigFromFolderUptimeCheckConfigName', () => { - const result = client.matchUptimeCheckConfigFromFolderUptimeCheckConfigName(fakePath); - assert.strictEqual(result, "uptimeCheckConfigValue"); - assert((client.pathTemplates.folderUptimeCheckConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationAlertPolicy', async () => { - const fakePath = "/rendered/path/organizationAlertPolicy"; - const expectedParameters = { - organization: "organizationValue", - alert_policy: "alertPolicyValue", - }; - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationAlertPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationAlertPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationAlertPolicyPath', () => { - const result = client.organizationAlertPolicyPath("organizationValue", "alertPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationAlertPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationAlertPolicyName', () => { - const result = client.matchOrganizationFromOrganizationAlertPolicyName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationAlertPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAlertPolicyFromOrganizationAlertPolicyName', () => { - const result = client.matchAlertPolicyFromOrganizationAlertPolicyName(fakePath); - assert.strictEqual(result, "alertPolicyValue"); - assert((client.pathTemplates.organizationAlertPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationAlertPolicyCondition', async () => { - const fakePath = "/rendered/path/organizationAlertPolicyCondition"; - const expectedParameters = { - organization: "organizationValue", - alert_policy: "alertPolicyValue", - condition: "conditionValue", - }; - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationAlertPolicyConditionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationAlertPolicyConditionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationAlertPolicyConditionPath', () => { - const result = client.organizationAlertPolicyConditionPath("organizationValue", "alertPolicyValue", "conditionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationAlertPolicyConditionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationAlertPolicyConditionName', () => { - const result = client.matchOrganizationFromOrganizationAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAlertPolicyFromOrganizationAlertPolicyConditionName', () => { - const result = client.matchAlertPolicyFromOrganizationAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "alertPolicyValue"); - assert((client.pathTemplates.organizationAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConditionFromOrganizationAlertPolicyConditionName', () => { - const result = client.matchConditionFromOrganizationAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "conditionValue"); - assert((client.pathTemplates.organizationAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationChannelDescriptor', async () => { - const fakePath = "/rendered/path/organizationChannelDescriptor"; - const expectedParameters = { - organization: "organizationValue", - channel_descriptor: "channelDescriptorValue", - }; - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationChannelDescriptorPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationChannelDescriptorPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationChannelDescriptorPath', () => { - const result = client.organizationChannelDescriptorPath("organizationValue", "channelDescriptorValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationChannelDescriptorPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationChannelDescriptorName', () => { - const result = client.matchOrganizationFromOrganizationChannelDescriptorName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationChannelDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchChannelDescriptorFromOrganizationChannelDescriptorName', () => { - const result = client.matchChannelDescriptorFromOrganizationChannelDescriptorName(fakePath); - assert.strictEqual(result, "channelDescriptorValue"); - assert((client.pathTemplates.organizationChannelDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationGroup', async () => { - const fakePath = "/rendered/path/organizationGroup"; - const expectedParameters = { - organization: "organizationValue", - group: "groupValue", - }; - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationGroupPath', () => { - const result = client.organizationGroupPath("organizationValue", "groupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationGroupName', () => { - const result = client.matchOrganizationFromOrganizationGroupName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchGroupFromOrganizationGroupName', () => { - const result = client.matchGroupFromOrganizationGroupName(fakePath); - assert.strictEqual(result, "groupValue"); - assert((client.pathTemplates.organizationGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + it('invokes createUptimeCheckConfig with error', async () => { + const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.CreateUptimeCheckConfigRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.CreateUptimeCheckConfigRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createUptimeCheckConfig = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.createUptimeCheckConfig(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.createUptimeCheckConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createUptimeCheckConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - describe('organizationNotificationChannel', async () => { - const fakePath = "/rendered/path/organizationNotificationChannel"; - const expectedParameters = { - organization: "organizationValue", - notification_channel: "notificationChannelValue", - }; - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationNotificationChannelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationNotificationChannelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationNotificationChannelPath', () => { - const result = client.organizationNotificationChannelPath("organizationValue", "notificationChannelValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationNotificationChannelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); + it('invokes createUptimeCheckConfig with closed client', async () => { + const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.CreateUptimeCheckConfigRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.CreateUptimeCheckConfigRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects( + client.createUptimeCheckConfig(request), + expectedError, + ); + }); + }); + + describe('updateUptimeCheckConfig', () => { + it('invokes updateUptimeCheckConfig without error', async () => { + const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.UpdateUptimeCheckConfigRequest(), + ); + request.uptimeCheckConfig ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.UpdateUptimeCheckConfigRequest', + ['uptimeCheckConfig', 'name'], + ); + request.uptimeCheckConfig.name = defaultValue1; + const expectedHeaderRequestParams = `uptime_check_config.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.monitoring.v3.UptimeCheckConfig(), + ); + client.innerApiCalls.updateUptimeCheckConfig = + stubSimpleCall(expectedResponse); + const [response] = await client.updateUptimeCheckConfig(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateUptimeCheckConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateUptimeCheckConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('matchOrganizationFromOrganizationNotificationChannelName', () => { - const result = client.matchOrganizationFromOrganizationNotificationChannelName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationNotificationChannelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + it('invokes updateUptimeCheckConfig without error using callback', async () => { + const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.UpdateUptimeCheckConfigRequest(), + ); + request.uptimeCheckConfig ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.UpdateUptimeCheckConfigRequest', + ['uptimeCheckConfig', 'name'], + ); + request.uptimeCheckConfig.name = defaultValue1; + const expectedHeaderRequestParams = `uptime_check_config.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.monitoring.v3.UptimeCheckConfig(), + ); + client.innerApiCalls.updateUptimeCheckConfig = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateUptimeCheckConfig( + request, + ( + err?: Error | null, + result?: protos.google.monitoring.v3.IUptimeCheckConfig | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateUptimeCheckConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateUptimeCheckConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('matchNotificationChannelFromOrganizationNotificationChannelName', () => { - const result = client.matchNotificationChannelFromOrganizationNotificationChannelName(fakePath); - assert.strictEqual(result, "notificationChannelValue"); - assert((client.pathTemplates.organizationNotificationChannelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + it('invokes updateUptimeCheckConfig with error', async () => { + const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.UpdateUptimeCheckConfigRequest(), + ); + request.uptimeCheckConfig ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.UpdateUptimeCheckConfigRequest', + ['uptimeCheckConfig', 'name'], + ); + request.uptimeCheckConfig.name = defaultValue1; + const expectedHeaderRequestParams = `uptime_check_config.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateUptimeCheckConfig = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.updateUptimeCheckConfig(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.updateUptimeCheckConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateUptimeCheckConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - describe('organizationService', async () => { - const fakePath = "/rendered/path/organizationService"; - const expectedParameters = { - organization: "organizationValue", - service: "serviceValue", - }; - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationServicePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationServicePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationServicePath', () => { - const result = client.organizationServicePath("organizationValue", "serviceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationServicePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); + it('invokes updateUptimeCheckConfig with closed client', async () => { + const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.UpdateUptimeCheckConfigRequest(), + ); + request.uptimeCheckConfig ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.UpdateUptimeCheckConfigRequest', + ['uptimeCheckConfig', 'name'], + ); + request.uptimeCheckConfig.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects( + client.updateUptimeCheckConfig(request), + expectedError, + ); + }); + }); + + describe('deleteUptimeCheckConfig', () => { + it('invokes deleteUptimeCheckConfig without error', async () => { + const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.DeleteUptimeCheckConfigRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.DeleteUptimeCheckConfigRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty(), + ); + client.innerApiCalls.deleteUptimeCheckConfig = + stubSimpleCall(expectedResponse); + const [response] = await client.deleteUptimeCheckConfig(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteUptimeCheckConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteUptimeCheckConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('matchOrganizationFromOrganizationServiceName', () => { - const result = client.matchOrganizationFromOrganizationServiceName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationServicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + it('invokes deleteUptimeCheckConfig without error using callback', async () => { + const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.DeleteUptimeCheckConfigRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.DeleteUptimeCheckConfigRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty(), + ); + client.innerApiCalls.deleteUptimeCheckConfig = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteUptimeCheckConfig( + request, + ( + err?: Error | null, + result?: protos.google.protobuf.IEmpty | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteUptimeCheckConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteUptimeCheckConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('matchServiceFromOrganizationServiceName', () => { - const result = client.matchServiceFromOrganizationServiceName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.organizationServicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + it('invokes deleteUptimeCheckConfig with error', async () => { + const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.DeleteUptimeCheckConfigRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.DeleteUptimeCheckConfigRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteUptimeCheckConfig = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.deleteUptimeCheckConfig(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.deleteUptimeCheckConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteUptimeCheckConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - describe('organizationServiceServiceLevelObjective', async () => { - const fakePath = "/rendered/path/organizationServiceServiceLevelObjective"; - const expectedParameters = { - organization: "organizationValue", - service: "serviceValue", - service_level_objective: "serviceLevelObjectiveValue", - }; - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationServiceServiceLevelObjectivePath', () => { - const result = client.organizationServiceServiceLevelObjectivePath("organizationValue", "serviceValue", "serviceLevelObjectiveValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); + it('invokes deleteUptimeCheckConfig with closed client', async () => { + const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.DeleteUptimeCheckConfigRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.DeleteUptimeCheckConfigRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects( + client.deleteUptimeCheckConfig(request), + expectedError, + ); + }); + }); + + describe('listUptimeCheckConfigs', () => { + it('invokes listUptimeCheckConfigs without error', async () => { + const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListUptimeCheckConfigsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.ListUptimeCheckConfigsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.monitoring.v3.UptimeCheckConfig(), + ), + generateSampleMessage( + new protos.google.monitoring.v3.UptimeCheckConfig(), + ), + generateSampleMessage( + new protos.google.monitoring.v3.UptimeCheckConfig(), + ), + ]; + client.innerApiCalls.listUptimeCheckConfigs = + stubSimpleCall(expectedResponse); + const [response] = await client.listUptimeCheckConfigs(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listUptimeCheckConfigs as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listUptimeCheckConfigs as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('matchOrganizationFromOrganizationServiceServiceLevelObjectiveName', () => { - const result = client.matchOrganizationFromOrganizationServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + it('invokes listUptimeCheckConfigs without error using callback', async () => { + const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListUptimeCheckConfigsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.ListUptimeCheckConfigsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.monitoring.v3.UptimeCheckConfig(), + ), + generateSampleMessage( + new protos.google.monitoring.v3.UptimeCheckConfig(), + ), + generateSampleMessage( + new protos.google.monitoring.v3.UptimeCheckConfig(), + ), + ]; + client.innerApiCalls.listUptimeCheckConfigs = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listUptimeCheckConfigs( + request, + ( + err?: Error | null, + result?: protos.google.monitoring.v3.IUptimeCheckConfig[] | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listUptimeCheckConfigs as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listUptimeCheckConfigs as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('matchServiceFromOrganizationServiceServiceLevelObjectiveName', () => { - const result = client.matchServiceFromOrganizationServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + it('invokes listUptimeCheckConfigs with error', async () => { + const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListUptimeCheckConfigsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.ListUptimeCheckConfigsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listUptimeCheckConfigs = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.listUptimeCheckConfigs(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.listUptimeCheckConfigs as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listUptimeCheckConfigs as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('matchServiceLevelObjectiveFromOrganizationServiceServiceLevelObjectiveName', () => { - const result = client.matchServiceLevelObjectiveFromOrganizationServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "serviceLevelObjectiveValue"); - assert((client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + it('invokes listUptimeCheckConfigsStream without error', async () => { + const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListUptimeCheckConfigsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.ListUptimeCheckConfigsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.monitoring.v3.UptimeCheckConfig(), + ), + generateSampleMessage( + new protos.google.monitoring.v3.UptimeCheckConfig(), + ), + generateSampleMessage( + new protos.google.monitoring.v3.UptimeCheckConfig(), + ), + ]; + client.descriptors.page.listUptimeCheckConfigs.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listUptimeCheckConfigsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.monitoring.v3.UptimeCheckConfig[] = []; + stream.on( + 'data', + (response: protos.google.monitoring.v3.UptimeCheckConfig) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + ( + client.descriptors.page.listUptimeCheckConfigs + .createStream as SinonStub + ) + .getCall(0) + .calledWith(client.innerApiCalls.listUptimeCheckConfigs, request), + ); + assert( + ( + client.descriptors.page.listUptimeCheckConfigs + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - describe('organizationUptimeCheckConfig', async () => { - const fakePath = "/rendered/path/organizationUptimeCheckConfig"; - const expectedParameters = { - organization: "organizationValue", - uptime_check_config: "uptimeCheckConfigValue", - }; - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationUptimeCheckConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationUptimeCheckConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationUptimeCheckConfigPath', () => { - const result = client.organizationUptimeCheckConfigPath("organizationValue", "uptimeCheckConfigValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationUptimeCheckConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); + it('invokes listUptimeCheckConfigsStream with error', async () => { + const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListUptimeCheckConfigsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.ListUptimeCheckConfigsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listUptimeCheckConfigs.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listUptimeCheckConfigsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.monitoring.v3.UptimeCheckConfig[] = []; + stream.on( + 'data', + (response: protos.google.monitoring.v3.UptimeCheckConfig) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + ( + client.descriptors.page.listUptimeCheckConfigs + .createStream as SinonStub + ) + .getCall(0) + .calledWith(client.innerApiCalls.listUptimeCheckConfigs, request), + ); + assert( + ( + client.descriptors.page.listUptimeCheckConfigs + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('matchOrganizationFromOrganizationUptimeCheckConfigName', () => { - const result = client.matchOrganizationFromOrganizationUptimeCheckConfigName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationUptimeCheckConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + it('uses async iteration with listUptimeCheckConfigs without error', async () => { + const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListUptimeCheckConfigsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.ListUptimeCheckConfigsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.monitoring.v3.UptimeCheckConfig(), + ), + generateSampleMessage( + new protos.google.monitoring.v3.UptimeCheckConfig(), + ), + generateSampleMessage( + new protos.google.monitoring.v3.UptimeCheckConfig(), + ), + ]; + client.descriptors.page.listUptimeCheckConfigs.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.monitoring.v3.IUptimeCheckConfig[] = []; + const iterable = client.listUptimeCheckConfigsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listUptimeCheckConfigs + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.descriptors.page.listUptimeCheckConfigs + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('matchUptimeCheckConfigFromOrganizationUptimeCheckConfigName', () => { - const result = client.matchUptimeCheckConfigFromOrganizationUptimeCheckConfigName(fakePath); - assert.strictEqual(result, "uptimeCheckConfigValue"); - assert((client.pathTemplates.organizationUptimeCheckConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + it('uses async iteration with listUptimeCheckConfigs with error', async () => { + const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListUptimeCheckConfigsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.monitoring.v3.ListUptimeCheckConfigsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listUptimeCheckConfigs.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listUptimeCheckConfigsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.monitoring.v3.IUptimeCheckConfig[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listUptimeCheckConfigs + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.descriptors.page.listUptimeCheckConfigs + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + }); + + describe('listUptimeCheckIps', () => { + it('invokes listUptimeCheckIps without error', async () => { + const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListUptimeCheckIpsRequest(), + ); + const expectedResponse = [ + generateSampleMessage(new protos.google.monitoring.v3.UptimeCheckIp()), + generateSampleMessage(new protos.google.monitoring.v3.UptimeCheckIp()), + generateSampleMessage(new protos.google.monitoring.v3.UptimeCheckIp()), + ]; + client.innerApiCalls.listUptimeCheckIps = + stubSimpleCall(expectedResponse); + const [response] = await client.listUptimeCheckIps(request); + assert.deepStrictEqual(response, expectedResponse); + }); - describe('project', async () => { - const fakePath = "/rendered/path/project"; - const expectedParameters = { - project: "projectValue", - }; - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectPath', () => { - const result = client.projectPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); + it('invokes listUptimeCheckIps without error using callback', async () => { + const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListUptimeCheckIpsRequest(), + ); + const expectedResponse = [ + generateSampleMessage(new protos.google.monitoring.v3.UptimeCheckIp()), + generateSampleMessage(new protos.google.monitoring.v3.UptimeCheckIp()), + generateSampleMessage(new protos.google.monitoring.v3.UptimeCheckIp()), + ]; + client.innerApiCalls.listUptimeCheckIps = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listUptimeCheckIps( + request, + ( + err?: Error | null, + result?: protos.google.monitoring.v3.IUptimeCheckIp[] | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + }); - it('matchProjectFromProjectName', () => { - const result = client.matchProjectFromProjectName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + it('invokes listUptimeCheckIps with error', async () => { + const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListUptimeCheckIpsRequest(), + ); + const expectedError = new Error('expected'); + client.innerApiCalls.listUptimeCheckIps = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.listUptimeCheckIps(request), expectedError); + }); - describe('projectAlertPolicy', async () => { - const fakePath = "/rendered/path/projectAlertPolicy"; - const expectedParameters = { - project: "projectValue", - alert_policy: "alertPolicyValue", - }; - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectAlertPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAlertPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAlertPolicyPath', () => { - const result = client.projectAlertPolicyPath("projectValue", "alertPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAlertPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); + it('invokes listUptimeCheckIpsStream without error', async () => { + const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListUptimeCheckIpsRequest(), + ); + const expectedResponse = [ + generateSampleMessage(new protos.google.monitoring.v3.UptimeCheckIp()), + generateSampleMessage(new protos.google.monitoring.v3.UptimeCheckIp()), + generateSampleMessage(new protos.google.monitoring.v3.UptimeCheckIp()), + ]; + client.descriptors.page.listUptimeCheckIps.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listUptimeCheckIpsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.monitoring.v3.UptimeCheckIp[] = []; + stream.on( + 'data', + (response: protos.google.monitoring.v3.UptimeCheckIp) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.listUptimeCheckIps.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listUptimeCheckIps, request), + ); + }); - it('matchProjectFromProjectAlertPolicyName', () => { - const result = client.matchProjectFromProjectAlertPolicyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAlertPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + it('invokes listUptimeCheckIpsStream with error', async () => { + const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListUptimeCheckIpsRequest(), + ); + const expectedError = new Error('expected'); + client.descriptors.page.listUptimeCheckIps.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listUptimeCheckIpsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.monitoring.v3.UptimeCheckIp[] = []; + stream.on( + 'data', + (response: protos.google.monitoring.v3.UptimeCheckIp) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listUptimeCheckIps.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listUptimeCheckIps, request), + ); + }); - it('matchAlertPolicyFromProjectAlertPolicyName', () => { - const result = client.matchAlertPolicyFromProjectAlertPolicyName(fakePath); - assert.strictEqual(result, "alertPolicyValue"); - assert((client.pathTemplates.projectAlertPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + it('uses async iteration with listUptimeCheckIps without error', async () => { + const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListUptimeCheckIpsRequest(), + ); + const expectedResponse = [ + generateSampleMessage(new protos.google.monitoring.v3.UptimeCheckIp()), + generateSampleMessage(new protos.google.monitoring.v3.UptimeCheckIp()), + generateSampleMessage(new protos.google.monitoring.v3.UptimeCheckIp()), + ]; + client.descriptors.page.listUptimeCheckIps.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.monitoring.v3.IUptimeCheckIp[] = []; + const iterable = client.listUptimeCheckIpsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listUptimeCheckIps.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + }); - describe('projectAlertPolicyCondition', async () => { - const fakePath = "/rendered/path/projectAlertPolicyCondition"; - const expectedParameters = { - project: "projectValue", - alert_policy: "alertPolicyValue", - condition: "conditionValue", - }; - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectAlertPolicyConditionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAlertPolicyConditionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAlertPolicyConditionPath', () => { - const result = client.projectAlertPolicyConditionPath("projectValue", "alertPolicyValue", "conditionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAlertPolicyConditionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); + it('uses async iteration with listUptimeCheckIps with error', async () => { + const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListUptimeCheckIpsRequest(), + ); + const expectedError = new Error('expected'); + client.descriptors.page.listUptimeCheckIps.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listUptimeCheckIpsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.monitoring.v3.IUptimeCheckIp[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listUptimeCheckIps.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + }); + }); + + describe('Path templates', () => { + describe('folderAlertPolicy', async () => { + const fakePath = '/rendered/path/folderAlertPolicy'; + const expectedParameters = { + folder: 'folderValue', + alert_policy: 'alertPolicyValue', + }; + const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.folderAlertPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.folderAlertPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('folderAlertPolicyPath', () => { + const result = client.folderAlertPolicyPath( + 'folderValue', + 'alertPolicyValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.folderAlertPolicyPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchFolderFromFolderAlertPolicyName', () => { + const result = client.matchFolderFromFolderAlertPolicyName(fakePath); + assert.strictEqual(result, 'folderValue'); + assert( + ( + client.pathTemplates.folderAlertPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchAlertPolicyFromFolderAlertPolicyName', () => { + const result = + client.matchAlertPolicyFromFolderAlertPolicyName(fakePath); + assert.strictEqual(result, 'alertPolicyValue'); + assert( + ( + client.pathTemplates.folderAlertPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchProjectFromProjectAlertPolicyConditionName', () => { - const result = client.matchProjectFromProjectAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + describe('folderAlertPolicyCondition', async () => { + const fakePath = '/rendered/path/folderAlertPolicyCondition'; + const expectedParameters = { + folder: 'folderValue', + alert_policy: 'alertPolicyValue', + condition: 'conditionValue', + }; + const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.folderAlertPolicyConditionPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.folderAlertPolicyConditionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('folderAlertPolicyConditionPath', () => { + const result = client.folderAlertPolicyConditionPath( + 'folderValue', + 'alertPolicyValue', + 'conditionValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.folderAlertPolicyConditionPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchFolderFromFolderAlertPolicyConditionName', () => { + const result = + client.matchFolderFromFolderAlertPolicyConditionName(fakePath); + assert.strictEqual(result, 'folderValue'); + assert( + ( + client.pathTemplates.folderAlertPolicyConditionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchAlertPolicyFromFolderAlertPolicyConditionName', () => { + const result = + client.matchAlertPolicyFromFolderAlertPolicyConditionName(fakePath); + assert.strictEqual(result, 'alertPolicyValue'); + assert( + ( + client.pathTemplates.folderAlertPolicyConditionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchConditionFromFolderAlertPolicyConditionName', () => { + const result = + client.matchConditionFromFolderAlertPolicyConditionName(fakePath); + assert.strictEqual(result, 'conditionValue'); + assert( + ( + client.pathTemplates.folderAlertPolicyConditionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchAlertPolicyFromProjectAlertPolicyConditionName', () => { - const result = client.matchAlertPolicyFromProjectAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "alertPolicyValue"); - assert((client.pathTemplates.projectAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + describe('folderChannelDescriptor', async () => { + const fakePath = '/rendered/path/folderChannelDescriptor'; + const expectedParameters = { + folder: 'folderValue', + channel_descriptor: 'channelDescriptorValue', + }; + const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.folderChannelDescriptorPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.folderChannelDescriptorPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('folderChannelDescriptorPath', () => { + const result = client.folderChannelDescriptorPath( + 'folderValue', + 'channelDescriptorValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.folderChannelDescriptorPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchFolderFromFolderChannelDescriptorName', () => { + const result = + client.matchFolderFromFolderChannelDescriptorName(fakePath); + assert.strictEqual(result, 'folderValue'); + assert( + ( + client.pathTemplates.folderChannelDescriptorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchChannelDescriptorFromFolderChannelDescriptorName', () => { + const result = + client.matchChannelDescriptorFromFolderChannelDescriptorName( + fakePath, + ); + assert.strictEqual(result, 'channelDescriptorValue'); + assert( + ( + client.pathTemplates.folderChannelDescriptorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchConditionFromProjectAlertPolicyConditionName', () => { - const result = client.matchConditionFromProjectAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "conditionValue"); - assert((client.pathTemplates.projectAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('folderGroup', async () => { + const fakePath = '/rendered/path/folderGroup'; + const expectedParameters = { + folder: 'folderValue', + group: 'groupValue', + }; + const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.folderGroupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.folderGroupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('folderGroupPath', () => { + const result = client.folderGroupPath('folderValue', 'groupValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.folderGroupPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchFolderFromFolderGroupName', () => { + const result = client.matchFolderFromFolderGroupName(fakePath); + assert.strictEqual(result, 'folderValue'); + assert( + (client.pathTemplates.folderGroupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchGroupFromFolderGroupName', () => { + const result = client.matchGroupFromFolderGroupName(fakePath); + assert.strictEqual(result, 'groupValue'); + assert( + (client.pathTemplates.folderGroupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('projectChannelDescriptor', async () => { - const fakePath = "/rendered/path/projectChannelDescriptor"; - const expectedParameters = { - project: "projectValue", - channel_descriptor: "channelDescriptorValue", - }; - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectChannelDescriptorPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectChannelDescriptorPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectChannelDescriptorPath', () => { - const result = client.projectChannelDescriptorPath("projectValue", "channelDescriptorValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectChannelDescriptorPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); + describe('folderNotificationChannel', async () => { + const fakePath = '/rendered/path/folderNotificationChannel'; + const expectedParameters = { + folder: 'folderValue', + notification_channel: 'notificationChannelValue', + }; + const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.folderNotificationChannelPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.folderNotificationChannelPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('folderNotificationChannelPath', () => { + const result = client.folderNotificationChannelPath( + 'folderValue', + 'notificationChannelValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.folderNotificationChannelPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchFolderFromFolderNotificationChannelName', () => { + const result = + client.matchFolderFromFolderNotificationChannelName(fakePath); + assert.strictEqual(result, 'folderValue'); + assert( + ( + client.pathTemplates.folderNotificationChannelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchNotificationChannelFromFolderNotificationChannelName', () => { + const result = + client.matchNotificationChannelFromFolderNotificationChannelName( + fakePath, + ); + assert.strictEqual(result, 'notificationChannelValue'); + assert( + ( + client.pathTemplates.folderNotificationChannelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchProjectFromProjectChannelDescriptorName', () => { - const result = client.matchProjectFromProjectChannelDescriptorName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectChannelDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + describe('folderService', async () => { + const fakePath = '/rendered/path/folderService'; + const expectedParameters = { + folder: 'folderValue', + service: 'serviceValue', + }; + const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.folderServicePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.folderServicePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('folderServicePath', () => { + const result = client.folderServicePath('folderValue', 'serviceValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.folderServicePathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchFolderFromFolderServiceName', () => { + const result = client.matchFolderFromFolderServiceName(fakePath); + assert.strictEqual(result, 'folderValue'); + assert( + (client.pathTemplates.folderServicePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchServiceFromFolderServiceName', () => { + const result = client.matchServiceFromFolderServiceName(fakePath); + assert.strictEqual(result, 'serviceValue'); + assert( + (client.pathTemplates.folderServicePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchChannelDescriptorFromProjectChannelDescriptorName', () => { - const result = client.matchChannelDescriptorFromProjectChannelDescriptorName(fakePath); - assert.strictEqual(result, "channelDescriptorValue"); - assert((client.pathTemplates.projectChannelDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('folderServiceServiceLevelObjective', async () => { + const fakePath = '/rendered/path/folderServiceServiceLevelObjective'; + const expectedParameters = { + folder: 'folderValue', + service: 'serviceValue', + service_level_objective: 'serviceLevelObjectiveValue', + }; + const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('folderServiceServiceLevelObjectivePath', () => { + const result = client.folderServiceServiceLevelObjectivePath( + 'folderValue', + 'serviceValue', + 'serviceLevelObjectiveValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchFolderFromFolderServiceServiceLevelObjectiveName', () => { + const result = + client.matchFolderFromFolderServiceServiceLevelObjectiveName( + fakePath, + ); + assert.strictEqual(result, 'folderValue'); + assert( + ( + client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchServiceFromFolderServiceServiceLevelObjectiveName', () => { + const result = + client.matchServiceFromFolderServiceServiceLevelObjectiveName( + fakePath, + ); + assert.strictEqual(result, 'serviceValue'); + assert( + ( + client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchServiceLevelObjectiveFromFolderServiceServiceLevelObjectiveName', () => { + const result = + client.matchServiceLevelObjectiveFromFolderServiceServiceLevelObjectiveName( + fakePath, + ); + assert.strictEqual(result, 'serviceLevelObjectiveValue'); + assert( + ( + client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('projectGroup', async () => { - const fakePath = "/rendered/path/projectGroup"; - const expectedParameters = { - project: "projectValue", - group: "groupValue", - }; - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectGroupPath', () => { - const result = client.projectGroupPath("projectValue", "groupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); + describe('folderUptimeCheckConfig', async () => { + const fakePath = '/rendered/path/folderUptimeCheckConfig'; + const expectedParameters = { + folder: 'folderValue', + uptime_check_config: 'uptimeCheckConfigValue', + }; + const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.folderUptimeCheckConfigPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.folderUptimeCheckConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('folderUptimeCheckConfigPath', () => { + const result = client.folderUptimeCheckConfigPath( + 'folderValue', + 'uptimeCheckConfigValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.folderUptimeCheckConfigPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchFolderFromFolderUptimeCheckConfigName', () => { + const result = + client.matchFolderFromFolderUptimeCheckConfigName(fakePath); + assert.strictEqual(result, 'folderValue'); + assert( + ( + client.pathTemplates.folderUptimeCheckConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchUptimeCheckConfigFromFolderUptimeCheckConfigName', () => { + const result = + client.matchUptimeCheckConfigFromFolderUptimeCheckConfigName( + fakePath, + ); + assert.strictEqual(result, 'uptimeCheckConfigValue'); + assert( + ( + client.pathTemplates.folderUptimeCheckConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchProjectFromProjectGroupName', () => { - const result = client.matchProjectFromProjectGroupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + describe('organizationAlertPolicy', async () => { + const fakePath = '/rendered/path/organizationAlertPolicy'; + const expectedParameters = { + organization: 'organizationValue', + alert_policy: 'alertPolicyValue', + }; + const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.organizationAlertPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.organizationAlertPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('organizationAlertPolicyPath', () => { + const result = client.organizationAlertPolicyPath( + 'organizationValue', + 'alertPolicyValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationAlertPolicyPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchOrganizationFromOrganizationAlertPolicyName', () => { + const result = + client.matchOrganizationFromOrganizationAlertPolicyName(fakePath); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationAlertPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchAlertPolicyFromOrganizationAlertPolicyName', () => { + const result = + client.matchAlertPolicyFromOrganizationAlertPolicyName(fakePath); + assert.strictEqual(result, 'alertPolicyValue'); + assert( + ( + client.pathTemplates.organizationAlertPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchGroupFromProjectGroupName', () => { - const result = client.matchGroupFromProjectGroupName(fakePath); - assert.strictEqual(result, "groupValue"); - assert((client.pathTemplates.projectGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('organizationAlertPolicyCondition', async () => { + const fakePath = '/rendered/path/organizationAlertPolicyCondition'; + const expectedParameters = { + organization: 'organizationValue', + alert_policy: 'alertPolicyValue', + condition: 'conditionValue', + }; + const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.organizationAlertPolicyConditionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationAlertPolicyConditionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationAlertPolicyConditionPath', () => { + const result = client.organizationAlertPolicyConditionPath( + 'organizationValue', + 'alertPolicyValue', + 'conditionValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationAlertPolicyConditionPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchOrganizationFromOrganizationAlertPolicyConditionName', () => { + const result = + client.matchOrganizationFromOrganizationAlertPolicyConditionName( + fakePath, + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationAlertPolicyConditionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchAlertPolicyFromOrganizationAlertPolicyConditionName', () => { + const result = + client.matchAlertPolicyFromOrganizationAlertPolicyConditionName( + fakePath, + ); + assert.strictEqual(result, 'alertPolicyValue'); + assert( + ( + client.pathTemplates.organizationAlertPolicyConditionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchConditionFromOrganizationAlertPolicyConditionName', () => { + const result = + client.matchConditionFromOrganizationAlertPolicyConditionName( + fakePath, + ); + assert.strictEqual(result, 'conditionValue'); + assert( + ( + client.pathTemplates.organizationAlertPolicyConditionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('projectNotificationChannel', async () => { - const fakePath = "/rendered/path/projectNotificationChannel"; - const expectedParameters = { - project: "projectValue", - notification_channel: "notificationChannelValue", - }; - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectNotificationChannelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectNotificationChannelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectNotificationChannelPath', () => { - const result = client.projectNotificationChannelPath("projectValue", "notificationChannelValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectNotificationChannelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); + describe('organizationChannelDescriptor', async () => { + const fakePath = '/rendered/path/organizationChannelDescriptor'; + const expectedParameters = { + organization: 'organizationValue', + channel_descriptor: 'channelDescriptorValue', + }; + const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.organizationChannelDescriptorPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationChannelDescriptorPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationChannelDescriptorPath', () => { + const result = client.organizationChannelDescriptorPath( + 'organizationValue', + 'channelDescriptorValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationChannelDescriptorPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchOrganizationFromOrganizationChannelDescriptorName', () => { + const result = + client.matchOrganizationFromOrganizationChannelDescriptorName( + fakePath, + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationChannelDescriptorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchChannelDescriptorFromOrganizationChannelDescriptorName', () => { + const result = + client.matchChannelDescriptorFromOrganizationChannelDescriptorName( + fakePath, + ); + assert.strictEqual(result, 'channelDescriptorValue'); + assert( + ( + client.pathTemplates.organizationChannelDescriptorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchProjectFromProjectNotificationChannelName', () => { - const result = client.matchProjectFromProjectNotificationChannelName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectNotificationChannelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + describe('organizationGroup', async () => { + const fakePath = '/rendered/path/organizationGroup'; + const expectedParameters = { + organization: 'organizationValue', + group: 'groupValue', + }; + const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.organizationGroupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.organizationGroupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('organizationGroupPath', () => { + const result = client.organizationGroupPath( + 'organizationValue', + 'groupValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchOrganizationFromOrganizationGroupName', () => { + const result = + client.matchOrganizationFromOrganizationGroupName(fakePath); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchGroupFromOrganizationGroupName', () => { + const result = client.matchGroupFromOrganizationGroupName(fakePath); + assert.strictEqual(result, 'groupValue'); + assert( + ( + client.pathTemplates.organizationGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchNotificationChannelFromProjectNotificationChannelName', () => { - const result = client.matchNotificationChannelFromProjectNotificationChannelName(fakePath); - assert.strictEqual(result, "notificationChannelValue"); - assert((client.pathTemplates.projectNotificationChannelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('organizationNotificationChannel', async () => { + const fakePath = '/rendered/path/organizationNotificationChannel'; + const expectedParameters = { + organization: 'organizationValue', + notification_channel: 'notificationChannelValue', + }; + const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.organizationNotificationChannelPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationNotificationChannelPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationNotificationChannelPath', () => { + const result = client.organizationNotificationChannelPath( + 'organizationValue', + 'notificationChannelValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationNotificationChannelPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchOrganizationFromOrganizationNotificationChannelName', () => { + const result = + client.matchOrganizationFromOrganizationNotificationChannelName( + fakePath, + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationNotificationChannelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchNotificationChannelFromOrganizationNotificationChannelName', () => { + const result = + client.matchNotificationChannelFromOrganizationNotificationChannelName( + fakePath, + ); + assert.strictEqual(result, 'notificationChannelValue'); + assert( + ( + client.pathTemplates.organizationNotificationChannelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('projectService', async () => { - const fakePath = "/rendered/path/projectService"; - const expectedParameters = { - project: "projectValue", - service: "serviceValue", - }; - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectServicePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectServicePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectServicePath', () => { - const result = client.projectServicePath("projectValue", "serviceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectServicePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); + describe('organizationService', async () => { + const fakePath = '/rendered/path/organizationService'; + const expectedParameters = { + organization: 'organizationValue', + service: 'serviceValue', + }; + const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.organizationServicePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.organizationServicePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('organizationServicePath', () => { + const result = client.organizationServicePath( + 'organizationValue', + 'serviceValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationServicePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchOrganizationFromOrganizationServiceName', () => { + const result = + client.matchOrganizationFromOrganizationServiceName(fakePath); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationServicePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchServiceFromOrganizationServiceName', () => { + const result = client.matchServiceFromOrganizationServiceName(fakePath); + assert.strictEqual(result, 'serviceValue'); + assert( + ( + client.pathTemplates.organizationServicePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchProjectFromProjectServiceName', () => { - const result = client.matchProjectFromProjectServiceName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectServicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + describe('organizationServiceServiceLevelObjective', async () => { + const fakePath = + '/rendered/path/organizationServiceServiceLevelObjective'; + const expectedParameters = { + organization: 'organizationValue', + service: 'serviceValue', + service_level_objective: 'serviceLevelObjectiveValue', + }; + const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationServiceServiceLevelObjectivePath', () => { + const result = client.organizationServiceServiceLevelObjectivePath( + 'organizationValue', + 'serviceValue', + 'serviceLevelObjectiveValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .organizationServiceServiceLevelObjectivePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchOrganizationFromOrganizationServiceServiceLevelObjectiveName', () => { + const result = + client.matchOrganizationFromOrganizationServiceServiceLevelObjectiveName( + fakePath, + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates + .organizationServiceServiceLevelObjectivePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchServiceFromOrganizationServiceServiceLevelObjectiveName', () => { + const result = + client.matchServiceFromOrganizationServiceServiceLevelObjectiveName( + fakePath, + ); + assert.strictEqual(result, 'serviceValue'); + assert( + ( + client.pathTemplates + .organizationServiceServiceLevelObjectivePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchServiceLevelObjectiveFromOrganizationServiceServiceLevelObjectiveName', () => { + const result = + client.matchServiceLevelObjectiveFromOrganizationServiceServiceLevelObjectiveName( + fakePath, + ); + assert.strictEqual(result, 'serviceLevelObjectiveValue'); + assert( + ( + client.pathTemplates + .organizationServiceServiceLevelObjectivePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchServiceFromProjectServiceName', () => { - const result = client.matchServiceFromProjectServiceName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.projectServicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('organizationUptimeCheckConfig', async () => { + const fakePath = '/rendered/path/organizationUptimeCheckConfig'; + const expectedParameters = { + organization: 'organizationValue', + uptime_check_config: 'uptimeCheckConfigValue', + }; + const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.organizationUptimeCheckConfigPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationUptimeCheckConfigPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationUptimeCheckConfigPath', () => { + const result = client.organizationUptimeCheckConfigPath( + 'organizationValue', + 'uptimeCheckConfigValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationUptimeCheckConfigPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchOrganizationFromOrganizationUptimeCheckConfigName', () => { + const result = + client.matchOrganizationFromOrganizationUptimeCheckConfigName( + fakePath, + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationUptimeCheckConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchUptimeCheckConfigFromOrganizationUptimeCheckConfigName', () => { + const result = + client.matchUptimeCheckConfigFromOrganizationUptimeCheckConfigName( + fakePath, + ); + assert.strictEqual(result, 'uptimeCheckConfigValue'); + assert( + ( + client.pathTemplates.organizationUptimeCheckConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('projectServiceServiceLevelObjective', async () => { - const fakePath = "/rendered/path/projectServiceServiceLevelObjective"; - const expectedParameters = { - project: "projectValue", - service: "serviceValue", - service_level_objective: "serviceLevelObjectiveValue", - }; - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectServiceServiceLevelObjectivePath', () => { - const result = client.projectServiceServiceLevelObjectivePath("projectValue", "serviceValue", "serviceLevelObjectiveValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); + describe('project', async () => { + const fakePath = '/rendered/path/project'; + const expectedParameters = { + project: 'projectValue', + }; + const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.projectPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectPath', () => { + const result = client.projectPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchProjectFromProjectServiceServiceLevelObjectiveName', () => { - const result = client.matchProjectFromProjectServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + describe('projectAlertPolicy', async () => { + const fakePath = '/rendered/path/projectAlertPolicy'; + const expectedParameters = { + project: 'projectValue', + alert_policy: 'alertPolicyValue', + }; + const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.projectAlertPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAlertPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAlertPolicyPath', () => { + const result = client.projectAlertPolicyPath( + 'projectValue', + 'alertPolicyValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAlertPolicyPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectAlertPolicyName', () => { + const result = client.matchProjectFromProjectAlertPolicyName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAlertPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchAlertPolicyFromProjectAlertPolicyName', () => { + const result = + client.matchAlertPolicyFromProjectAlertPolicyName(fakePath); + assert.strictEqual(result, 'alertPolicyValue'); + assert( + ( + client.pathTemplates.projectAlertPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchServiceFromProjectServiceServiceLevelObjectiveName', () => { - const result = client.matchServiceFromProjectServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + describe('projectAlertPolicyCondition', async () => { + const fakePath = '/rendered/path/projectAlertPolicyCondition'; + const expectedParameters = { + project: 'projectValue', + alert_policy: 'alertPolicyValue', + condition: 'conditionValue', + }; + const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.projectAlertPolicyConditionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAlertPolicyConditionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAlertPolicyConditionPath', () => { + const result = client.projectAlertPolicyConditionPath( + 'projectValue', + 'alertPolicyValue', + 'conditionValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAlertPolicyConditionPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectAlertPolicyConditionName', () => { + const result = + client.matchProjectFromProjectAlertPolicyConditionName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAlertPolicyConditionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchAlertPolicyFromProjectAlertPolicyConditionName', () => { + const result = + client.matchAlertPolicyFromProjectAlertPolicyConditionName(fakePath); + assert.strictEqual(result, 'alertPolicyValue'); + assert( + ( + client.pathTemplates.projectAlertPolicyConditionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchConditionFromProjectAlertPolicyConditionName', () => { + const result = + client.matchConditionFromProjectAlertPolicyConditionName(fakePath); + assert.strictEqual(result, 'conditionValue'); + assert( + ( + client.pathTemplates.projectAlertPolicyConditionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchServiceLevelObjectiveFromProjectServiceServiceLevelObjectiveName', () => { - const result = client.matchServiceLevelObjectiveFromProjectServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "serviceLevelObjectiveValue"); - assert((client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('projectChannelDescriptor', async () => { + const fakePath = '/rendered/path/projectChannelDescriptor'; + const expectedParameters = { + project: 'projectValue', + channel_descriptor: 'channelDescriptorValue', + }; + const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.projectChannelDescriptorPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectChannelDescriptorPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectChannelDescriptorPath', () => { + const result = client.projectChannelDescriptorPath( + 'projectValue', + 'channelDescriptorValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectChannelDescriptorPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectChannelDescriptorName', () => { + const result = + client.matchProjectFromProjectChannelDescriptorName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectChannelDescriptorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchChannelDescriptorFromProjectChannelDescriptorName', () => { + const result = + client.matchChannelDescriptorFromProjectChannelDescriptorName( + fakePath, + ); + assert.strictEqual(result, 'channelDescriptorValue'); + assert( + ( + client.pathTemplates.projectChannelDescriptorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('projectUptimeCheckConfig', async () => { - const fakePath = "/rendered/path/projectUptimeCheckConfig"; - const expectedParameters = { - project: "projectValue", - uptime_check_config: "uptimeCheckConfigValue", - }; - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectUptimeCheckConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectUptimeCheckConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectUptimeCheckConfigPath', () => { - const result = client.projectUptimeCheckConfigPath("projectValue", "uptimeCheckConfigValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectUptimeCheckConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); + describe('projectGroup', async () => { + const fakePath = '/rendered/path/projectGroup'; + const expectedParameters = { + project: 'projectValue', + group: 'groupValue', + }; + const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.projectGroupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectGroupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectGroupPath', () => { + const result = client.projectGroupPath('projectValue', 'groupValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectGroupPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectGroupName', () => { + const result = client.matchProjectFromProjectGroupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectGroupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchGroupFromProjectGroupName', () => { + const result = client.matchGroupFromProjectGroupName(fakePath); + assert.strictEqual(result, 'groupValue'); + assert( + (client.pathTemplates.projectGroupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchProjectFromProjectUptimeCheckConfigName', () => { - const result = client.matchProjectFromProjectUptimeCheckConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectUptimeCheckConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + describe('projectNotificationChannel', async () => { + const fakePath = '/rendered/path/projectNotificationChannel'; + const expectedParameters = { + project: 'projectValue', + notification_channel: 'notificationChannelValue', + }; + const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.projectNotificationChannelPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectNotificationChannelPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectNotificationChannelPath', () => { + const result = client.projectNotificationChannelPath( + 'projectValue', + 'notificationChannelValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectNotificationChannelPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectNotificationChannelName', () => { + const result = + client.matchProjectFromProjectNotificationChannelName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectNotificationChannelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchNotificationChannelFromProjectNotificationChannelName', () => { + const result = + client.matchNotificationChannelFromProjectNotificationChannelName( + fakePath, + ); + assert.strictEqual(result, 'notificationChannelValue'); + assert( + ( + client.pathTemplates.projectNotificationChannelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchUptimeCheckConfigFromProjectUptimeCheckConfigName', () => { - const result = client.matchUptimeCheckConfigFromProjectUptimeCheckConfigName(fakePath); - assert.strictEqual(result, "uptimeCheckConfigValue"); - assert((client.pathTemplates.projectUptimeCheckConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('projectService', async () => { + const fakePath = '/rendered/path/projectService'; + const expectedParameters = { + project: 'projectValue', + service: 'serviceValue', + }; + const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.projectServicePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectServicePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectServicePath', () => { + const result = client.projectServicePath( + 'projectValue', + 'serviceValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectServicePathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectServiceName', () => { + const result = client.matchProjectFromProjectServiceName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectServicePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchServiceFromProjectServiceName', () => { + const result = client.matchServiceFromProjectServiceName(fakePath); + assert.strictEqual(result, 'serviceValue'); + assert( + (client.pathTemplates.projectServicePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('snooze', async () => { - const fakePath = "/rendered/path/snooze"; - const expectedParameters = { - project: "projectValue", - snooze: "snoozeValue", - }; - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.snoozePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.snoozePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('snoozePath', () => { - const result = client.snoozePath("projectValue", "snoozeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.snoozePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); + describe('projectServiceServiceLevelObjective', async () => { + const fakePath = '/rendered/path/projectServiceServiceLevelObjective'; + const expectedParameters = { + project: 'projectValue', + service: 'serviceValue', + service_level_objective: 'serviceLevelObjectiveValue', + }; + const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectServiceServiceLevelObjectivePath', () => { + const result = client.projectServiceServiceLevelObjectivePath( + 'projectValue', + 'serviceValue', + 'serviceLevelObjectiveValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectServiceServiceLevelObjectiveName', () => { + const result = + client.matchProjectFromProjectServiceServiceLevelObjectiveName( + fakePath, + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchServiceFromProjectServiceServiceLevelObjectiveName', () => { + const result = + client.matchServiceFromProjectServiceServiceLevelObjectiveName( + fakePath, + ); + assert.strictEqual(result, 'serviceValue'); + assert( + ( + client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchServiceLevelObjectiveFromProjectServiceServiceLevelObjectiveName', () => { + const result = + client.matchServiceLevelObjectiveFromProjectServiceServiceLevelObjectiveName( + fakePath, + ); + assert.strictEqual(result, 'serviceLevelObjectiveValue'); + assert( + ( + client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchProjectFromSnoozeName', () => { - const result = client.matchProjectFromSnoozeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.snoozePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + describe('projectUptimeCheckConfig', async () => { + const fakePath = '/rendered/path/projectUptimeCheckConfig'; + const expectedParameters = { + project: 'projectValue', + uptime_check_config: 'uptimeCheckConfigValue', + }; + const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.projectUptimeCheckConfigPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectUptimeCheckConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectUptimeCheckConfigPath', () => { + const result = client.projectUptimeCheckConfigPath( + 'projectValue', + 'uptimeCheckConfigValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectUptimeCheckConfigPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectUptimeCheckConfigName', () => { + const result = + client.matchProjectFromProjectUptimeCheckConfigName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectUptimeCheckConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchUptimeCheckConfigFromProjectUptimeCheckConfigName', () => { + const result = + client.matchUptimeCheckConfigFromProjectUptimeCheckConfigName( + fakePath, + ); + assert.strictEqual(result, 'uptimeCheckConfigValue'); + assert( + ( + client.pathTemplates.projectUptimeCheckConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchSnoozeFromSnoozeName', () => { - const result = client.matchSnoozeFromSnoozeName(fakePath); - assert.strictEqual(result, "snoozeValue"); - assert((client.pathTemplates.snoozePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('snooze', async () => { + const fakePath = '/rendered/path/snooze'; + const expectedParameters = { + project: 'projectValue', + snooze: 'snoozeValue', + }; + const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.snoozePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.snoozePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('snoozePath', () => { + const result = client.snoozePath('projectValue', 'snoozeValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.snoozePathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromSnoozeName', () => { + const result = client.matchProjectFromSnoozeName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.snoozePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSnoozeFromSnoozeName', () => { + const result = client.matchSnoozeFromSnoozeName(fakePath); + assert.strictEqual(result, 'snoozeValue'); + assert( + (client.pathTemplates.snoozePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); }); + }); }); diff --git a/packages/google-cloud-monitoring/webpack.config.js b/packages/google-cloud-monitoring/webpack.config.js index cc6e15b91055..7f81732c413d 100644 --- a/packages/google-cloud-monitoring/webpack.config.js +++ b/packages/google-cloud-monitoring/webpack.config.js @@ -1,4 +1,4 @@ -// Copyright 2026 Google LLC +// Copyright 2021 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License.