Skip to content

Commit d90dece

Browse files
mtabaskolesv
authored andcommitted
Adds region tags to Java alerting sample (GoogleCloudPlatform#1087)
Adds region tags to AlertSample.java, for extraction of doc samples without resorting to regexps.
1 parent 884ba89 commit d90dece

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

monitoring/v3/src/main/java/AlertSample.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,7 @@ private List<AlertPolicy> getAlertPolicies(String projectId) {
249249
return alertPolicies;
250250
}
251251

252+
// [START monitoring_alert_list_channels]
252253
private List<NotificationChannel> getNotificationChannels(String projectId) {
253254
List<NotificationChannel> notificationChannels = Lists.newArrayList();
254255
ListNotificationChannelsPagedResponse listNotificationChannelsResponse =
@@ -258,6 +259,7 @@ private List<NotificationChannel> getNotificationChannels(String projectId) {
258259
}
259260
return notificationChannels;
260261
}
262+
// [END monitoring_alert_list_channels]
261263

262264
private void writePoliciesBackupFile(String projectId,
263265
String filePath,
@@ -334,6 +336,7 @@ private List<AlertPolicy> reviseRestoredPolicies(AlertPolicy[] policies,
334336
return newPolicies;
335337
}
336338

339+
// [START monitoring_alert_create_policy]
337340
private void restoreRevisedPolicies(String projectId,
338341
boolean isSameProject,
339342
List<AlertPolicy> policies) {
@@ -351,6 +354,7 @@ private void restoreRevisedPolicies(String projectId,
351354
outputStream.println(String.format("Restored %s", policy.getName()));
352355
}
353356
}
357+
// [END monitoring_alert_create_policy]
354358

355359
private List<NotificationChannel> readNotificationChannelsJson(JsonObject backupContent) {
356360
if (backupContent.has("notification_channels")) {
@@ -361,6 +365,8 @@ private List<NotificationChannel> readNotificationChannelsJson(JsonObject backup
361365
return Lists.newArrayList();
362366
}
363367

368+
// [START monitoring_alert_create_channel]
369+
// [START monitoring_alert_update_channel]
364370
private Map<String, String> restoreNotificationChannels(String projectId,
365371
List<NotificationChannel> channels,
366372
boolean isSameProject) {
@@ -392,7 +398,9 @@ private Map<String, String> restoreNotificationChannels(String projectId,
392398
}
393399
return newChannelNames;
394400
}
395-
401+
// [END monitoring_alert_create_channel]
402+
// [END monitoring_alert_update_channel]
403+
396404
private JsonObject getPolicyJsonContents(String filePath, BufferedReader content, Gson gson) {
397405
try {
398406
return gson.fromJson(content, JsonObject.class);

0 commit comments

Comments
 (0)