|
23 | 23 | import tabulate
|
24 | 24 |
|
25 | 25 |
|
| 26 | +# [START monitoring_alert_list_policies] |
26 | 27 | def list_alert_policies(project_name):
|
27 | 28 | client = monitoring_v3.AlertPolicyServiceClient()
|
28 | 29 | policies = client.list_alert_policies(project_name)
|
29 | 30 | print(tabulate.tabulate(
|
30 | 31 | [(policy.name, policy.display_name) for policy in policies],
|
31 | 32 | ('name', 'display_name')))
|
| 33 | +# [END monitoring_alert_list_policies] |
32 | 34 |
|
33 | 35 |
|
34 | 36 | # [START monitoring_alert_list_channels]
|
@@ -113,6 +115,9 @@ def default(self, obj):
|
113 | 115 |
|
114 | 116 |
|
115 | 117 | # [START monitoring_alert_restore_policies]
|
| 118 | +# [START monitoring_alert_create_policy] |
| 119 | +# [START monitoring_alert_create_channel] |
| 120 | +# [START monitoring_alert_update_channel] |
116 | 121 | def restore(project_name):
|
117 | 122 | print('Loading alert policies and notification channels from backup.json.')
|
118 | 123 | record = json.load(open('backup.json', 'rt'))
|
@@ -193,6 +198,9 @@ def restore(project_name):
|
193 | 198 | policy = alert_client.create_alert_policy(project_name, policy)
|
194 | 199 | print('Updated', policy.name)
|
195 | 200 | # [END monitoring_alert_restore_policies]
|
| 201 | +# [END monitoring_alert_create_policy] |
| 202 | +# [END monitoring_alert_create_channel] |
| 203 | +# [END monitoring_alert_update_channel] |
196 | 204 |
|
197 | 205 |
|
198 | 206 | class MissingProjectIdError(Exception):
|
|
0 commit comments