...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package monitoring_test
18
19 import (
20 "context"
21
22 monitoring "cloud.google.com/go/monitoring/apiv3"
23 "cloud.google.com/go/monitoring/apiv3/v2/monitoringpb"
24 "google.golang.org/api/iterator"
25 )
26
27 func ExampleNewAlertPolicyClient() {
28 ctx := context.Background()
29 c, err := monitoring.NewAlertPolicyClient(ctx)
30 if err != nil {
31
32 }
33
34 _ = c
35 }
36
37 func ExampleAlertPolicyClient_ListAlertPolicies() {
38
39
40
41 ctx := context.Background()
42 c, err := monitoring.NewAlertPolicyClient(ctx)
43 if err != nil {
44
45 }
46
47 req := &monitoringpb.ListAlertPoliciesRequest{
48
49 }
50 it := c.ListAlertPolicies(ctx, req)
51 for {
52 resp, err := it.Next()
53 if err == iterator.Done {
54 break
55 }
56 if err != nil {
57
58 }
59
60 _ = resp
61 }
62 }
63
64 func ExampleAlertPolicyClient_GetAlertPolicy() {
65
66
67 ctx := context.Background()
68 c, err := monitoring.NewAlertPolicyClient(ctx)
69 if err != nil {
70
71 }
72
73 req := &monitoringpb.GetAlertPolicyRequest{
74
75 }
76 resp, err := c.GetAlertPolicy(ctx, req)
77 if err != nil {
78
79 }
80
81 _ = resp
82 }
83
84 func ExampleAlertPolicyClient_CreateAlertPolicy() {
85
86
87 ctx := context.Background()
88 c, err := monitoring.NewAlertPolicyClient(ctx)
89 if err != nil {
90
91 }
92
93 req := &monitoringpb.CreateAlertPolicyRequest{
94
95 }
96 resp, err := c.CreateAlertPolicy(ctx, req)
97 if err != nil {
98
99 }
100
101 _ = resp
102 }
103
104 func ExampleAlertPolicyClient_DeleteAlertPolicy() {
105 ctx := context.Background()
106 c, err := monitoring.NewAlertPolicyClient(ctx)
107 if err != nil {
108
109 }
110
111 req := &monitoringpb.DeleteAlertPolicyRequest{
112
113 }
114 err = c.DeleteAlertPolicy(ctx, req)
115 if err != nil {
116
117 }
118 }
119
120 func ExampleAlertPolicyClient_UpdateAlertPolicy() {
121
122
123 ctx := context.Background()
124 c, err := monitoring.NewAlertPolicyClient(ctx)
125 if err != nil {
126
127 }
128
129 req := &monitoringpb.UpdateAlertPolicyRequest{
130
131 }
132 resp, err := c.UpdateAlertPolicy(ctx, req)
133 if err != nil {
134
135 }
136
137 _ = resp
138 }
139
View as plain text