From aaba7cbf14926ab604e2a419ee9f5d557631ee5d Mon Sep 17 00:00:00 2001 From: Takashi Matsuo Date: Fri, 15 May 2020 18:12:09 -0700 Subject: [PATCH] [monitoring] testing: start using build specific projects [(#3771)](https://github.com/GoogleCloudPlatform/python-docs-samples/issues/3771) Also added `required_api_url` and `required_role` field in `README.rst.in`. A part of #3310 Note: Now the service account has permission only on the project for py36 build, so py37 build should fail. --- samples/snippets/v3/alerts-client/README.rst | 23 ++++++++++++++++++- .../snippets/v3/alerts-client/README.rst.in | 9 +++++++- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/samples/snippets/v3/alerts-client/README.rst b/samples/snippets/v3/alerts-client/README.rst index 68eba234..bb59aad5 100644 --- a/samples/snippets/v3/alerts-client/README.rst +++ b/samples/snippets/v3/alerts-client/README.rst @@ -14,6 +14,13 @@ This directory contains samples for Google Stackdriver Alerting API. Stackdriver .. _Google Stackdriver Alerting API: https://cloud.google.com/monitoring/alerts/ +To run the sample, you need to enable the API at: https://console.cloud.google.com/apis/library/monitoring.googleapis.com + +To run the sample, you need to have `Monitoring Admin` role. + +Please visit [the Cloud Console UI of this API](https://console.cloud.google.com/monitoring) and [create a new Workspace with the same name of your Cloud project](https://cloud.google.com/monitoring/workspaces/create). + + Setup ------------------------------------------------------------------------------- @@ -87,7 +94,21 @@ To run this sample: list-alert-policies list-notification-channels enable-alert-policies + Enable or disable alert policies in a project. + Arguments: project_name (str) enable (bool): Enable or + disable the policies. filter_ (str, optional): Only + enable/disable alert policies that match this filter_. + See + https://cloud.google.com/monitoring/api/v3/sorting- + and-filtering disable-alert-policies + Enable or disable alert policies in a project. + Arguments: project_name (str) enable (bool): Enable or + disable the policies. filter_ (str, optional): Only + enable/disable alert policies that match this filter_. + See + https://cloud.google.com/monitoring/api/v3/sorting- + and-filtering replace-notification-channels backup restore @@ -114,4 +135,4 @@ to `browse the source`_ and `report issues`_. https://github.com/GoogleCloudPlatform/google-cloud-python/issues -.. _Google Cloud SDK: https://cloud.google.com/sdk/ \ No newline at end of file +.. _Google Cloud SDK: https://cloud.google.com/sdk/ diff --git a/samples/snippets/v3/alerts-client/README.rst.in b/samples/snippets/v3/alerts-client/README.rst.in index ed7f6a3b..00b28012 100644 --- a/samples/snippets/v3/alerts-client/README.rst.in +++ b/samples/snippets/v3/alerts-client/README.rst.in @@ -12,6 +12,13 @@ product: and many others. Stackdriver's Alerting API allows you to create, delete, and make back up copies of your alert policies. +required_api_url: https://console.cloud.google.com/apis/library/monitoring.googleapis.com +required_role: Monitoring Admin +other_required_steps: > + Please visit [the Cloud Console UI of this + API](https://console.cloud.google.com/monitoring) and create a new + Workspace with the same name of your Cloud project. + setup: - auth - install_deps @@ -23,4 +30,4 @@ samples: cloud_client_library: true -folder: monitoring/api/v3/alerts-client \ No newline at end of file +folder: monitoring/api/v3/alerts-client