Visitar URL original
Refactor alerts.replaceChannels.js snippet to align with code sample snippet guidelines · Issue #3114 · GoogleCloudPlatform/nodejs-docs-samples · GitHub
Skip to content

Refactor alerts.replaceChannels.js snippet to align with code sample snippet guidelines #3114

Description

@minherz

The current version of alerts.replaceChannels.js contains four different region tags that demonstrate 3 (or, arguably 4) different actions. The sample flow does three different actions:

  • runs through hardcoded list of notification channel names
    • calls API to enable each channel using its name
    • on (any) creates a new email notification channel with that name
  • modifies hardcoded alert policy to send notifications to the hardcoded list of channels

The code should be split into 3 snippets (a snippet per file) to demonstrate the following three actions:

  1. Update notification channel. The snippet can be conditioned that the channel should exist.
  2. Create a new notification channel.
  3. Update an alert policy with a notification channel.

All snippets should provide a reasonable error handling. Inputs should be clearly commented to explain expectations. Error handling should, at least, handle errors when inputs are invalid.

Activity

  1. added
    type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.
    api: monitoringIssues related to the Cloud Monitoring API.
    samplesIssues that are directly related to samples.
    lang: nodejsIssues specific to JavaScript or TypeScript.
    on Apr 8, 2023
  2. added
    type: cleanupAn internal cleanup or hygiene concern.
    priority: p2Moderately-important priority. Fix may not be included in next release.
    and removed
    type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.
    on Apr 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    api: monitoringIssues related to the Cloud Monitoring API.lang: nodejsIssues specific to JavaScript or TypeScript.priority: p2Moderately-important priority. Fix may not be included in next release.samplesIssues that are directly related to samples.type: cleanupAn internal cleanup or hygiene concern.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions