Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
minherz opened this issue Apr 8, 2023 · 0 comments
Labels
api: monitoring Issues related to the Cloud Monitoring API. lang: nodejs Issues specific to JavaScript or TypeScript. priority: p2 Moderately-important priority. Fix may not be included in next release. samples Issues that are directly related to samples. type: cleanup An internal cleanup or hygiene concern.

Comments

@minherz
Copy link
Contributor

minherz commented Apr 8, 2023

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.

@minherz minherz added type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. api: monitoring Issues related to the Cloud Monitoring API. samples Issues that are directly related to samples. lang: nodejs Issues specific to JavaScript or TypeScript. labels Apr 8, 2023
@kweinmeister kweinmeister added type: cleanup An internal cleanup or hygiene concern. priority: p2 Moderately-important priority. Fix may not be included in next release. and removed type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. labels Apr 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: monitoring Issues related to the Cloud Monitoring API. lang: nodejs Issues specific to JavaScript or TypeScript. priority: p2 Moderately-important priority. Fix may not be included in next release. samples Issues that are directly related to samples. type: cleanup An internal cleanup or hygiene concern.
Projects
None yet
Development

No branches or pull requests

2 participants