...
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 ExampleNewMetricClient() {
28 ctx := context.Background()
29 c, err := monitoring.NewMetricClient(ctx)
30 if err != nil {
31
32 }
33
34 _ = c
35 }
36
37 func ExampleMetricClient_ListMonitoredResourceDescriptors() {
38
39
40
41 ctx := context.Background()
42 c, err := monitoring.NewMetricClient(ctx)
43 if err != nil {
44
45 }
46
47 req := &monitoringpb.ListMonitoredResourceDescriptorsRequest{
48
49 }
50 it := c.ListMonitoredResourceDescriptors(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 ExampleMetricClient_GetMonitoredResourceDescriptor() {
65
66
67 ctx := context.Background()
68 c, err := monitoring.NewMetricClient(ctx)
69 if err != nil {
70
71 }
72
73 req := &monitoringpb.GetMonitoredResourceDescriptorRequest{
74
75 }
76 resp, err := c.GetMonitoredResourceDescriptor(ctx, req)
77 if err != nil {
78
79 }
80
81 _ = resp
82 }
83
84 func ExampleMetricClient_ListMetricDescriptors() {
85
86
87
88 ctx := context.Background()
89 c, err := monitoring.NewMetricClient(ctx)
90 if err != nil {
91
92 }
93
94 req := &monitoringpb.ListMetricDescriptorsRequest{
95
96 }
97 it := c.ListMetricDescriptors(ctx, req)
98 for {
99 resp, err := it.Next()
100 if err == iterator.Done {
101 break
102 }
103 if err != nil {
104
105 }
106
107 _ = resp
108 }
109 }
110
111 func ExampleMetricClient_GetMetricDescriptor() {
112
113
114 ctx := context.Background()
115 c, err := monitoring.NewMetricClient(ctx)
116 if err != nil {
117
118 }
119
120 req := &monitoringpb.GetMetricDescriptorRequest{
121
122 }
123 resp, err := c.GetMetricDescriptor(ctx, req)
124 if err != nil {
125
126 }
127
128 _ = resp
129 }
130
131 func ExampleMetricClient_CreateMetricDescriptor() {
132
133
134 ctx := context.Background()
135 c, err := monitoring.NewMetricClient(ctx)
136 if err != nil {
137
138 }
139
140 req := &monitoringpb.CreateMetricDescriptorRequest{
141
142 }
143 resp, err := c.CreateMetricDescriptor(ctx, req)
144 if err != nil {
145
146 }
147
148 _ = resp
149 }
150
151 func ExampleMetricClient_DeleteMetricDescriptor() {
152 ctx := context.Background()
153 c, err := monitoring.NewMetricClient(ctx)
154 if err != nil {
155
156 }
157
158 req := &monitoringpb.DeleteMetricDescriptorRequest{
159
160 }
161 err = c.DeleteMetricDescriptor(ctx, req)
162 if err != nil {
163
164 }
165 }
166
167 func ExampleMetricClient_ListTimeSeries() {
168
169
170
171 ctx := context.Background()
172 c, err := monitoring.NewMetricClient(ctx)
173 if err != nil {
174
175 }
176
177 req := &monitoringpb.ListTimeSeriesRequest{
178
179 }
180 it := c.ListTimeSeries(ctx, req)
181 for {
182 resp, err := it.Next()
183 if err == iterator.Done {
184 break
185 }
186 if err != nil {
187
188 }
189
190 _ = resp
191 }
192 }
193
194 func ExampleMetricClient_CreateTimeSeries() {
195 ctx := context.Background()
196 c, err := monitoring.NewMetricClient(ctx)
197 if err != nil {
198
199 }
200
201 req := &monitoringpb.CreateTimeSeriesRequest{
202
203 }
204 err = c.CreateTimeSeries(ctx, req)
205 if err != nil {
206
207 }
208 }
209
View as plain text