From e32c38a739b0c6e1e950ed83c906817b668f4c05 Mon Sep 17 00:00:00 2001 From: Takashi Matsuo Date: Fri, 15 May 2020 22:58:55 +0000 Subject: [PATCH 1/4] use per-version projects --- .kokoro/python3.6/common.cfg | 2 +- .kokoro/python3.7/common.cfg | 2 +- .kokoro/python3.8/common.cfg | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.kokoro/python3.6/common.cfg b/.kokoro/python3.6/common.cfg index 66e6c7b32be3..b9d99848e091 100644 --- a/.kokoro/python3.6/common.cfg +++ b/.kokoro/python3.6/common.cfg @@ -48,5 +48,5 @@ env_vars: { # but we'll update the value once we have more Cloud projects. env_vars: { key: "BUILD_SPECIFIC_GCLOUD_PROJECT" - value: "python-docs-samples-tests" + value: "python-docs-samples-tests-py36" } diff --git a/.kokoro/python3.7/common.cfg b/.kokoro/python3.7/common.cfg index d7526612fac4..3ac2adcb09d6 100644 --- a/.kokoro/python3.7/common.cfg +++ b/.kokoro/python3.7/common.cfg @@ -48,5 +48,5 @@ env_vars: { # Temporary setting my own project for testing the behavior on the PR. env_vars: { key: "BUILD_SPECIFIC_GCLOUD_PROJECT" - value: "python-docs-samples-tests" + value: "python-docs-samples-tests-py37" } diff --git a/.kokoro/python3.8/common.cfg b/.kokoro/python3.8/common.cfg index 1cb2b8185f18..fd7dc9863cdf 100644 --- a/.kokoro/python3.8/common.cfg +++ b/.kokoro/python3.8/common.cfg @@ -48,5 +48,5 @@ env_vars: { # but we'll update the value once we have more Cloud projects. env_vars: { key: "BUILD_SPECIFIC_GCLOUD_PROJECT" - value: "python-docs-samples-tests" + value: "python-docs-samples-tests-py38" } From 86e4e0f2623d285f0fc75017212f523fa69216d5 Mon Sep 17 00:00:00 2001 From: Takashi Matsuo Date: Fri, 15 May 2020 23:19:20 +0000 Subject: [PATCH 2/4] [monitoring] testing: start using build specific projects part of #3310 --- monitoring/api/v3/alerts-client/README.rst | 21 ++++++++++++++++++- monitoring/api/v3/alerts-client/README.rst.in | 5 ++++- scripts/readme-gen/templates/README.tmpl.rst | 9 ++++++++ 3 files changed, 33 insertions(+), 2 deletions(-) diff --git a/monitoring/api/v3/alerts-client/README.rst b/monitoring/api/v3/alerts-client/README.rst index 68eba2344eb6..b071aa139210 100644 --- a/monitoring/api/v3/alerts-client/README.rst +++ b/monitoring/api/v3/alerts-client/README.rst @@ -14,6 +14,11 @@ 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. + + Setup ------------------------------------------------------------------------------- @@ -87,7 +92,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 +133,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/monitoring/api/v3/alerts-client/README.rst.in b/monitoring/api/v3/alerts-client/README.rst.in index ed7f6a3bcf1e..9fed59a6f432 100644 --- a/monitoring/api/v3/alerts-client/README.rst.in +++ b/monitoring/api/v3/alerts-client/README.rst.in @@ -12,6 +12,9 @@ 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://pantheon.corp.google.com/apis/library/monitoring.googleapis.com +required_role: Monitoring Admin + setup: - auth - install_deps @@ -23,4 +26,4 @@ samples: cloud_client_library: true -folder: monitoring/api/v3/alerts-client \ No newline at end of file +folder: monitoring/api/v3/alerts-client diff --git a/scripts/readme-gen/templates/README.tmpl.rst b/scripts/readme-gen/templates/README.tmpl.rst index 2314d7fc560b..11a191e9d183 100644 --- a/scripts/readme-gen/templates/README.tmpl.rst +++ b/scripts/readme-gen/templates/README.tmpl.rst @@ -15,6 +15,15 @@ This directory contains samples for {{product.name}}. {{product.description}} .. _{{product.name}}: {{product.url}} +{% if required_api_url %} +To run the sample, you need to enable the API at: {{required_api_url}} +{% endif %} + +{% if required_role %} +To run the sample, you need to have `{{required_role}}` role. +{% endif %} + + {% if setup %} Setup ------------------------------------------------------------------------------- From 430055e79984bdfee4ddfc9a021e5831df3aff51 Mon Sep 17 00:00:00 2001 From: Takashi Matsuo Date: Fri, 15 May 2020 23:47:12 +0000 Subject: [PATCH 3/4] add other_required_steps field --- monitoring/api/v3/alerts-client/README.rst | 4 +++- monitoring/api/v3/alerts-client/README.rst.in | 6 +++++- scripts/readme-gen/templates/README.tmpl.rst | 1 + 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/monitoring/api/v3/alerts-client/README.rst b/monitoring/api/v3/alerts-client/README.rst index b071aa139210..93159a8470b8 100644 --- a/monitoring/api/v3/alerts-client/README.rst +++ b/monitoring/api/v3/alerts-client/README.rst @@ -18,6 +18,8 @@ To run the sample, you need to enable the API at: https://console.cloud.google.c 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. + Setup ------------------------------------------------------------------------------- @@ -133,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/ +.. _Google Cloud SDK: https://cloud.google.com/sdk/ \ No newline at end of file diff --git a/monitoring/api/v3/alerts-client/README.rst.in b/monitoring/api/v3/alerts-client/README.rst.in index 9fed59a6f432..00b280124ea4 100644 --- a/monitoring/api/v3/alerts-client/README.rst.in +++ b/monitoring/api/v3/alerts-client/README.rst.in @@ -12,8 +12,12 @@ 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://pantheon.corp.google.com/apis/library/monitoring.googleapis.com +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 diff --git a/scripts/readme-gen/templates/README.tmpl.rst b/scripts/readme-gen/templates/README.tmpl.rst index 11a191e9d183..30ad03d050d8 100644 --- a/scripts/readme-gen/templates/README.tmpl.rst +++ b/scripts/readme-gen/templates/README.tmpl.rst @@ -23,6 +23,7 @@ To run the sample, you need to enable the API at: {{required_api_url}} To run the sample, you need to have `{{required_role}}` role. {% endif %} +{{other_required_steps}} {% if setup %} Setup From bd78e7ca1475f105e0160b1dc85c68dbcc81302e Mon Sep 17 00:00:00 2001 From: Takashi Matsuo Date: Fri, 15 May 2020 17:30:26 -0700 Subject: [PATCH 4/4] Update monitoring/api/v3/alerts-client/README.rst Co-authored-by: Kurtis Van Gent <31518063+kurtisvg@users.noreply.github.com> --- monitoring/api/v3/alerts-client/README.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/monitoring/api/v3/alerts-client/README.rst b/monitoring/api/v3/alerts-client/README.rst index 93159a8470b8..bb59aad5feeb 100644 --- a/monitoring/api/v3/alerts-client/README.rst +++ b/monitoring/api/v3/alerts-client/README.rst @@ -18,7 +18,7 @@ To run the sample, you need to enable the API at: https://console.cloud.google.c 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. +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 @@ -135,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/