From fe035fa1f4d4f45a44b281f1d6d4a40b092fecfe Mon Sep 17 00:00:00 2001 From: Jeffrey Rennie Date: Tue, 15 May 2018 15:05:36 -0700 Subject: [PATCH 1/2] Add more doc tags to alerts sample. --- monitoring/api/v3/alerts-client/snippets.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/monitoring/api/v3/alerts-client/snippets.py b/monitoring/api/v3/alerts-client/snippets.py index 24c2bf8411e..bdae922b1e0 100644 --- a/monitoring/api/v3/alerts-client/snippets.py +++ b/monitoring/api/v3/alerts-client/snippets.py @@ -23,12 +23,14 @@ import tabulate +# [START monitoring_alert_list_policies] def list_alert_policies(project_name): client = monitoring_v3.AlertPolicyServiceClient() policies = client.list_alert_policies(project_name) print(tabulate.tabulate( [(policy.name, policy.display_name) for policy in policies], ('name', 'display_name'))) +# [END monitoring_alert_list_policies] # [START monitoring_alert_list_channels] @@ -113,6 +115,9 @@ def default(self, obj): # [START monitoring_alert_restore_policies] +# [START monitoring_alert_create_policy] +# [START monitoring_alert_create_channel] +# [START monitoring_alert_update_channel] def restore(project_name): print('Loading alert policies and notification channels from backup.json.') record = json.load(open('backup.json', 'rt')) @@ -193,7 +198,9 @@ def restore(project_name): policy = alert_client.create_alert_policy(project_name, policy) print('Updated', policy.name) # [END monitoring_alert_restore_policies] - +# [END monitoring_alert_create_policy] +# [END monitoring_alert_create_channel] +# [END monitoring_alert_update_channel] class MissingProjectIdError(Exception): pass From db2826426f6d574d17d11d317b7cef529680a5bc Mon Sep 17 00:00:00 2001 From: Jeffrey Rennie Date: Wed, 16 May 2018 09:00:12 -0700 Subject: [PATCH 2/2] lint --- monitoring/api/v3/alerts-client/snippets.py | 1 + 1 file changed, 1 insertion(+) diff --git a/monitoring/api/v3/alerts-client/snippets.py b/monitoring/api/v3/alerts-client/snippets.py index bdae922b1e0..cfb305c8190 100644 --- a/monitoring/api/v3/alerts-client/snippets.py +++ b/monitoring/api/v3/alerts-client/snippets.py @@ -202,6 +202,7 @@ def restore(project_name): # [END monitoring_alert_create_channel] # [END monitoring_alert_update_channel] + class MissingProjectIdError(Exception): pass