1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package monitoring
18
19 import (
20 "context"
21 "fmt"
22 "math"
23 "net/url"
24 "time"
25
26 monitoringpb "cloud.google.com/go/monitoring/apiv3/v2/monitoringpb"
27 gax "github.com/googleapis/gax-go/v2"
28 "google.golang.org/api/iterator"
29 "google.golang.org/api/option"
30 "google.golang.org/api/option/internaloption"
31 gtransport "google.golang.org/api/transport/grpc"
32 "google.golang.org/grpc"
33 "google.golang.org/grpc/codes"
34 "google.golang.org/protobuf/proto"
35 )
36
37 var newNotificationChannelClientHook clientHook
38
39
40 type NotificationChannelCallOptions struct {
41 ListNotificationChannelDescriptors []gax.CallOption
42 GetNotificationChannelDescriptor []gax.CallOption
43 ListNotificationChannels []gax.CallOption
44 GetNotificationChannel []gax.CallOption
45 CreateNotificationChannel []gax.CallOption
46 UpdateNotificationChannel []gax.CallOption
47 DeleteNotificationChannel []gax.CallOption
48 SendNotificationChannelVerificationCode []gax.CallOption
49 GetNotificationChannelVerificationCode []gax.CallOption
50 VerifyNotificationChannel []gax.CallOption
51 }
52
53 func defaultNotificationChannelGRPCClientOptions() []option.ClientOption {
54 return []option.ClientOption{
55 internaloption.WithDefaultEndpoint("monitoring.googleapis.com:443"),
56 internaloption.WithDefaultEndpointTemplate("monitoring.UNIVERSE_DOMAIN:443"),
57 internaloption.WithDefaultMTLSEndpoint("monitoring.mtls.googleapis.com:443"),
58 internaloption.WithDefaultUniverseDomain("googleapis.com"),
59 internaloption.WithDefaultAudience("https://monitoring.googleapis.com/"),
60 internaloption.WithDefaultScopes(DefaultAuthScopes()...),
61 internaloption.EnableJwtWithScope(),
62 option.WithGRPCDialOption(grpc.WithDefaultCallOptions(
63 grpc.MaxCallRecvMsgSize(math.MaxInt32))),
64 }
65 }
66
67 func defaultNotificationChannelCallOptions() *NotificationChannelCallOptions {
68 return &NotificationChannelCallOptions{
69 ListNotificationChannelDescriptors: []gax.CallOption{
70 gax.WithTimeout(30000 * time.Millisecond),
71 gax.WithRetry(func() gax.Retryer {
72 return gax.OnCodes([]codes.Code{
73 codes.Unavailable,
74 }, gax.Backoff{
75 Initial: 100 * time.Millisecond,
76 Max: 30000 * time.Millisecond,
77 Multiplier: 1.30,
78 })
79 }),
80 },
81 GetNotificationChannelDescriptor: []gax.CallOption{
82 gax.WithTimeout(30000 * time.Millisecond),
83 gax.WithRetry(func() gax.Retryer {
84 return gax.OnCodes([]codes.Code{
85 codes.Unavailable,
86 }, gax.Backoff{
87 Initial: 100 * time.Millisecond,
88 Max: 30000 * time.Millisecond,
89 Multiplier: 1.30,
90 })
91 }),
92 },
93 ListNotificationChannels: []gax.CallOption{
94 gax.WithTimeout(30000 * time.Millisecond),
95 gax.WithRetry(func() gax.Retryer {
96 return gax.OnCodes([]codes.Code{
97 codes.Unavailable,
98 }, gax.Backoff{
99 Initial: 100 * time.Millisecond,
100 Max: 30000 * time.Millisecond,
101 Multiplier: 1.30,
102 })
103 }),
104 },
105 GetNotificationChannel: []gax.CallOption{
106 gax.WithTimeout(30000 * time.Millisecond),
107 gax.WithRetry(func() gax.Retryer {
108 return gax.OnCodes([]codes.Code{
109 codes.Unavailable,
110 }, gax.Backoff{
111 Initial: 100 * time.Millisecond,
112 Max: 30000 * time.Millisecond,
113 Multiplier: 1.30,
114 })
115 }),
116 },
117 CreateNotificationChannel: []gax.CallOption{
118 gax.WithTimeout(30000 * time.Millisecond),
119 },
120 UpdateNotificationChannel: []gax.CallOption{
121 gax.WithTimeout(30000 * time.Millisecond),
122 },
123 DeleteNotificationChannel: []gax.CallOption{
124 gax.WithTimeout(30000 * time.Millisecond),
125 gax.WithRetry(func() gax.Retryer {
126 return gax.OnCodes([]codes.Code{
127 codes.Unavailable,
128 }, gax.Backoff{
129 Initial: 100 * time.Millisecond,
130 Max: 30000 * time.Millisecond,
131 Multiplier: 1.30,
132 })
133 }),
134 },
135 SendNotificationChannelVerificationCode: []gax.CallOption{
136 gax.WithTimeout(30000 * time.Millisecond),
137 },
138 GetNotificationChannelVerificationCode: []gax.CallOption{
139 gax.WithTimeout(30000 * time.Millisecond),
140 gax.WithRetry(func() gax.Retryer {
141 return gax.OnCodes([]codes.Code{
142 codes.Unavailable,
143 }, gax.Backoff{
144 Initial: 100 * time.Millisecond,
145 Max: 30000 * time.Millisecond,
146 Multiplier: 1.30,
147 })
148 }),
149 },
150 VerifyNotificationChannel: []gax.CallOption{
151 gax.WithTimeout(30000 * time.Millisecond),
152 gax.WithRetry(func() gax.Retryer {
153 return gax.OnCodes([]codes.Code{
154 codes.Unavailable,
155 }, gax.Backoff{
156 Initial: 100 * time.Millisecond,
157 Max: 30000 * time.Millisecond,
158 Multiplier: 1.30,
159 })
160 }),
161 },
162 }
163 }
164
165
166 type internalNotificationChannelClient interface {
167 Close() error
168 setGoogleClientInfo(...string)
169 Connection() *grpc.ClientConn
170 ListNotificationChannelDescriptors(context.Context, *monitoringpb.ListNotificationChannelDescriptorsRequest, ...gax.CallOption) *NotificationChannelDescriptorIterator
171 GetNotificationChannelDescriptor(context.Context, *monitoringpb.GetNotificationChannelDescriptorRequest, ...gax.CallOption) (*monitoringpb.NotificationChannelDescriptor, error)
172 ListNotificationChannels(context.Context, *monitoringpb.ListNotificationChannelsRequest, ...gax.CallOption) *NotificationChannelIterator
173 GetNotificationChannel(context.Context, *monitoringpb.GetNotificationChannelRequest, ...gax.CallOption) (*monitoringpb.NotificationChannel, error)
174 CreateNotificationChannel(context.Context, *monitoringpb.CreateNotificationChannelRequest, ...gax.CallOption) (*monitoringpb.NotificationChannel, error)
175 UpdateNotificationChannel(context.Context, *monitoringpb.UpdateNotificationChannelRequest, ...gax.CallOption) (*monitoringpb.NotificationChannel, error)
176 DeleteNotificationChannel(context.Context, *monitoringpb.DeleteNotificationChannelRequest, ...gax.CallOption) error
177 SendNotificationChannelVerificationCode(context.Context, *monitoringpb.SendNotificationChannelVerificationCodeRequest, ...gax.CallOption) error
178 GetNotificationChannelVerificationCode(context.Context, *monitoringpb.GetNotificationChannelVerificationCodeRequest, ...gax.CallOption) (*monitoringpb.GetNotificationChannelVerificationCodeResponse, error)
179 VerifyNotificationChannel(context.Context, *monitoringpb.VerifyNotificationChannelRequest, ...gax.CallOption) (*monitoringpb.NotificationChannel, error)
180 }
181
182
183
184
185
186
187 type NotificationChannelClient struct {
188
189 internalClient internalNotificationChannelClient
190
191
192 CallOptions *NotificationChannelCallOptions
193 }
194
195
196
197
198
199 func (c *NotificationChannelClient) Close() error {
200 return c.internalClient.Close()
201 }
202
203
204
205
206 func (c *NotificationChannelClient) setGoogleClientInfo(keyval ...string) {
207 c.internalClient.setGoogleClientInfo(keyval...)
208 }
209
210
211
212
213
214 func (c *NotificationChannelClient) Connection() *grpc.ClientConn {
215 return c.internalClient.Connection()
216 }
217
218
219
220 func (c *NotificationChannelClient) ListNotificationChannelDescriptors(ctx context.Context, req *monitoringpb.ListNotificationChannelDescriptorsRequest, opts ...gax.CallOption) *NotificationChannelDescriptorIterator {
221 return c.internalClient.ListNotificationChannelDescriptors(ctx, req, opts...)
222 }
223
224
225
226 func (c *NotificationChannelClient) GetNotificationChannelDescriptor(ctx context.Context, req *monitoringpb.GetNotificationChannelDescriptorRequest, opts ...gax.CallOption) (*monitoringpb.NotificationChannelDescriptor, error) {
227 return c.internalClient.GetNotificationChannelDescriptor(ctx, req, opts...)
228 }
229
230
231
232
233 func (c *NotificationChannelClient) ListNotificationChannels(ctx context.Context, req *monitoringpb.ListNotificationChannelsRequest, opts ...gax.CallOption) *NotificationChannelIterator {
234 return c.internalClient.ListNotificationChannels(ctx, req, opts...)
235 }
236
237
238
239
240
241
242 func (c *NotificationChannelClient) GetNotificationChannel(ctx context.Context, req *monitoringpb.GetNotificationChannelRequest, opts ...gax.CallOption) (*monitoringpb.NotificationChannel, error) {
243 return c.internalClient.GetNotificationChannel(ctx, req, opts...)
244 }
245
246
247
248
249
250
251
252
253 func (c *NotificationChannelClient) CreateNotificationChannel(ctx context.Context, req *monitoringpb.CreateNotificationChannelRequest, opts ...gax.CallOption) (*monitoringpb.NotificationChannel, error) {
254 return c.internalClient.CreateNotificationChannel(ctx, req, opts...)
255 }
256
257
258
259
260
261
262
263
264 func (c *NotificationChannelClient) UpdateNotificationChannel(ctx context.Context, req *monitoringpb.UpdateNotificationChannelRequest, opts ...gax.CallOption) (*monitoringpb.NotificationChannel, error) {
265 return c.internalClient.UpdateNotificationChannel(ctx, req, opts...)
266 }
267
268
269
270
271
272
273
274 func (c *NotificationChannelClient) DeleteNotificationChannel(ctx context.Context, req *monitoringpb.DeleteNotificationChannelRequest, opts ...gax.CallOption) error {
275 return c.internalClient.DeleteNotificationChannel(ctx, req, opts...)
276 }
277
278
279
280 func (c *NotificationChannelClient) SendNotificationChannelVerificationCode(ctx context.Context, req *monitoringpb.SendNotificationChannelVerificationCodeRequest, opts ...gax.CallOption) error {
281 return c.internalClient.SendNotificationChannelVerificationCode(ctx, req, opts...)
282 }
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305 func (c *NotificationChannelClient) GetNotificationChannelVerificationCode(ctx context.Context, req *monitoringpb.GetNotificationChannelVerificationCodeRequest, opts ...gax.CallOption) (*monitoringpb.GetNotificationChannelVerificationCodeResponse, error) {
306 return c.internalClient.GetNotificationChannelVerificationCode(ctx, req, opts...)
307 }
308
309
310
311
312 func (c *NotificationChannelClient) VerifyNotificationChannel(ctx context.Context, req *monitoringpb.VerifyNotificationChannelRequest, opts ...gax.CallOption) (*monitoringpb.NotificationChannel, error) {
313 return c.internalClient.VerifyNotificationChannel(ctx, req, opts...)
314 }
315
316
317
318
319 type notificationChannelGRPCClient struct {
320
321 connPool gtransport.ConnPool
322
323
324 CallOptions **NotificationChannelCallOptions
325
326
327 notificationChannelClient monitoringpb.NotificationChannelServiceClient
328
329
330 xGoogHeaders []string
331 }
332
333
334
335
336
337
338 func NewNotificationChannelClient(ctx context.Context, opts ...option.ClientOption) (*NotificationChannelClient, error) {
339 clientOpts := defaultNotificationChannelGRPCClientOptions()
340 if newNotificationChannelClientHook != nil {
341 hookOpts, err := newNotificationChannelClientHook(ctx, clientHookParams{})
342 if err != nil {
343 return nil, err
344 }
345 clientOpts = append(clientOpts, hookOpts...)
346 }
347
348 connPool, err := gtransport.DialPool(ctx, append(clientOpts, opts...)...)
349 if err != nil {
350 return nil, err
351 }
352 client := NotificationChannelClient{CallOptions: defaultNotificationChannelCallOptions()}
353
354 c := ¬ificationChannelGRPCClient{
355 connPool: connPool,
356 notificationChannelClient: monitoringpb.NewNotificationChannelServiceClient(connPool),
357 CallOptions: &client.CallOptions,
358 }
359 c.setGoogleClientInfo()
360
361 client.internalClient = c
362
363 return &client, nil
364 }
365
366
367
368
369
370 func (c *notificationChannelGRPCClient) Connection() *grpc.ClientConn {
371 return c.connPool.Conn()
372 }
373
374
375
376
377 func (c *notificationChannelGRPCClient) setGoogleClientInfo(keyval ...string) {
378 kv := append([]string{"gl-go", gax.GoVersion}, keyval...)
379 kv = append(kv, "gapic", getVersionClient(), "gax", gax.Version, "grpc", grpc.Version)
380 c.xGoogHeaders = []string{"x-goog-api-client", gax.XGoogHeader(kv...)}
381 }
382
383
384
385 func (c *notificationChannelGRPCClient) Close() error {
386 return c.connPool.Close()
387 }
388
389 func (c *notificationChannelGRPCClient) ListNotificationChannelDescriptors(ctx context.Context, req *monitoringpb.ListNotificationChannelDescriptorsRequest, opts ...gax.CallOption) *NotificationChannelDescriptorIterator {
390 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
391
392 hds = append(c.xGoogHeaders, hds...)
393 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
394 opts = append((*c.CallOptions).ListNotificationChannelDescriptors[0:len((*c.CallOptions).ListNotificationChannelDescriptors):len((*c.CallOptions).ListNotificationChannelDescriptors)], opts...)
395 it := &NotificationChannelDescriptorIterator{}
396 req = proto.Clone(req).(*monitoringpb.ListNotificationChannelDescriptorsRequest)
397 it.InternalFetch = func(pageSize int, pageToken string) ([]*monitoringpb.NotificationChannelDescriptor, string, error) {
398 resp := &monitoringpb.ListNotificationChannelDescriptorsResponse{}
399 if pageToken != "" {
400 req.PageToken = pageToken
401 }
402 if pageSize > math.MaxInt32 {
403 req.PageSize = math.MaxInt32
404 } else if pageSize != 0 {
405 req.PageSize = int32(pageSize)
406 }
407 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
408 var err error
409 resp, err = c.notificationChannelClient.ListNotificationChannelDescriptors(ctx, req, settings.GRPC...)
410 return err
411 }, opts...)
412 if err != nil {
413 return nil, "", err
414 }
415
416 it.Response = resp
417 return resp.GetChannelDescriptors(), resp.GetNextPageToken(), nil
418 }
419 fetch := func(pageSize int, pageToken string) (string, error) {
420 items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
421 if err != nil {
422 return "", err
423 }
424 it.items = append(it.items, items...)
425 return nextPageToken, nil
426 }
427
428 it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
429 it.pageInfo.MaxSize = int(req.GetPageSize())
430 it.pageInfo.Token = req.GetPageToken()
431
432 return it
433 }
434
435 func (c *notificationChannelGRPCClient) GetNotificationChannelDescriptor(ctx context.Context, req *monitoringpb.GetNotificationChannelDescriptorRequest, opts ...gax.CallOption) (*monitoringpb.NotificationChannelDescriptor, error) {
436 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
437
438 hds = append(c.xGoogHeaders, hds...)
439 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
440 opts = append((*c.CallOptions).GetNotificationChannelDescriptor[0:len((*c.CallOptions).GetNotificationChannelDescriptor):len((*c.CallOptions).GetNotificationChannelDescriptor)], opts...)
441 var resp *monitoringpb.NotificationChannelDescriptor
442 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
443 var err error
444 resp, err = c.notificationChannelClient.GetNotificationChannelDescriptor(ctx, req, settings.GRPC...)
445 return err
446 }, opts...)
447 if err != nil {
448 return nil, err
449 }
450 return resp, nil
451 }
452
453 func (c *notificationChannelGRPCClient) ListNotificationChannels(ctx context.Context, req *monitoringpb.ListNotificationChannelsRequest, opts ...gax.CallOption) *NotificationChannelIterator {
454 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
455
456 hds = append(c.xGoogHeaders, hds...)
457 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
458 opts = append((*c.CallOptions).ListNotificationChannels[0:len((*c.CallOptions).ListNotificationChannels):len((*c.CallOptions).ListNotificationChannels)], opts...)
459 it := &NotificationChannelIterator{}
460 req = proto.Clone(req).(*monitoringpb.ListNotificationChannelsRequest)
461 it.InternalFetch = func(pageSize int, pageToken string) ([]*monitoringpb.NotificationChannel, string, error) {
462 resp := &monitoringpb.ListNotificationChannelsResponse{}
463 if pageToken != "" {
464 req.PageToken = pageToken
465 }
466 if pageSize > math.MaxInt32 {
467 req.PageSize = math.MaxInt32
468 } else if pageSize != 0 {
469 req.PageSize = int32(pageSize)
470 }
471 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
472 var err error
473 resp, err = c.notificationChannelClient.ListNotificationChannels(ctx, req, settings.GRPC...)
474 return err
475 }, opts...)
476 if err != nil {
477 return nil, "", err
478 }
479
480 it.Response = resp
481 return resp.GetNotificationChannels(), resp.GetNextPageToken(), nil
482 }
483 fetch := func(pageSize int, pageToken string) (string, error) {
484 items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
485 if err != nil {
486 return "", err
487 }
488 it.items = append(it.items, items...)
489 return nextPageToken, nil
490 }
491
492 it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
493 it.pageInfo.MaxSize = int(req.GetPageSize())
494 it.pageInfo.Token = req.GetPageToken()
495
496 return it
497 }
498
499 func (c *notificationChannelGRPCClient) GetNotificationChannel(ctx context.Context, req *monitoringpb.GetNotificationChannelRequest, opts ...gax.CallOption) (*monitoringpb.NotificationChannel, error) {
500 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
501
502 hds = append(c.xGoogHeaders, hds...)
503 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
504 opts = append((*c.CallOptions).GetNotificationChannel[0:len((*c.CallOptions).GetNotificationChannel):len((*c.CallOptions).GetNotificationChannel)], opts...)
505 var resp *monitoringpb.NotificationChannel
506 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
507 var err error
508 resp, err = c.notificationChannelClient.GetNotificationChannel(ctx, req, settings.GRPC...)
509 return err
510 }, opts...)
511 if err != nil {
512 return nil, err
513 }
514 return resp, nil
515 }
516
517 func (c *notificationChannelGRPCClient) CreateNotificationChannel(ctx context.Context, req *monitoringpb.CreateNotificationChannelRequest, opts ...gax.CallOption) (*monitoringpb.NotificationChannel, error) {
518 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
519
520 hds = append(c.xGoogHeaders, hds...)
521 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
522 opts = append((*c.CallOptions).CreateNotificationChannel[0:len((*c.CallOptions).CreateNotificationChannel):len((*c.CallOptions).CreateNotificationChannel)], opts...)
523 var resp *monitoringpb.NotificationChannel
524 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
525 var err error
526 resp, err = c.notificationChannelClient.CreateNotificationChannel(ctx, req, settings.GRPC...)
527 return err
528 }, opts...)
529 if err != nil {
530 return nil, err
531 }
532 return resp, nil
533 }
534
535 func (c *notificationChannelGRPCClient) UpdateNotificationChannel(ctx context.Context, req *monitoringpb.UpdateNotificationChannelRequest, opts ...gax.CallOption) (*monitoringpb.NotificationChannel, error) {
536 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "notification_channel.name", url.QueryEscape(req.GetNotificationChannel().GetName()))}
537
538 hds = append(c.xGoogHeaders, hds...)
539 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
540 opts = append((*c.CallOptions).UpdateNotificationChannel[0:len((*c.CallOptions).UpdateNotificationChannel):len((*c.CallOptions).UpdateNotificationChannel)], opts...)
541 var resp *monitoringpb.NotificationChannel
542 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
543 var err error
544 resp, err = c.notificationChannelClient.UpdateNotificationChannel(ctx, req, settings.GRPC...)
545 return err
546 }, opts...)
547 if err != nil {
548 return nil, err
549 }
550 return resp, nil
551 }
552
553 func (c *notificationChannelGRPCClient) DeleteNotificationChannel(ctx context.Context, req *monitoringpb.DeleteNotificationChannelRequest, opts ...gax.CallOption) error {
554 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
555
556 hds = append(c.xGoogHeaders, hds...)
557 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
558 opts = append((*c.CallOptions).DeleteNotificationChannel[0:len((*c.CallOptions).DeleteNotificationChannel):len((*c.CallOptions).DeleteNotificationChannel)], opts...)
559 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
560 var err error
561 _, err = c.notificationChannelClient.DeleteNotificationChannel(ctx, req, settings.GRPC...)
562 return err
563 }, opts...)
564 return err
565 }
566
567 func (c *notificationChannelGRPCClient) SendNotificationChannelVerificationCode(ctx context.Context, req *monitoringpb.SendNotificationChannelVerificationCodeRequest, opts ...gax.CallOption) error {
568 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
569
570 hds = append(c.xGoogHeaders, hds...)
571 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
572 opts = append((*c.CallOptions).SendNotificationChannelVerificationCode[0:len((*c.CallOptions).SendNotificationChannelVerificationCode):len((*c.CallOptions).SendNotificationChannelVerificationCode)], opts...)
573 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
574 var err error
575 _, err = c.notificationChannelClient.SendNotificationChannelVerificationCode(ctx, req, settings.GRPC...)
576 return err
577 }, opts...)
578 return err
579 }
580
581 func (c *notificationChannelGRPCClient) GetNotificationChannelVerificationCode(ctx context.Context, req *monitoringpb.GetNotificationChannelVerificationCodeRequest, opts ...gax.CallOption) (*monitoringpb.GetNotificationChannelVerificationCodeResponse, error) {
582 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
583
584 hds = append(c.xGoogHeaders, hds...)
585 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
586 opts = append((*c.CallOptions).GetNotificationChannelVerificationCode[0:len((*c.CallOptions).GetNotificationChannelVerificationCode):len((*c.CallOptions).GetNotificationChannelVerificationCode)], opts...)
587 var resp *monitoringpb.GetNotificationChannelVerificationCodeResponse
588 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
589 var err error
590 resp, err = c.notificationChannelClient.GetNotificationChannelVerificationCode(ctx, req, settings.GRPC...)
591 return err
592 }, opts...)
593 if err != nil {
594 return nil, err
595 }
596 return resp, nil
597 }
598
599 func (c *notificationChannelGRPCClient) VerifyNotificationChannel(ctx context.Context, req *monitoringpb.VerifyNotificationChannelRequest, opts ...gax.CallOption) (*monitoringpb.NotificationChannel, error) {
600 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
601
602 hds = append(c.xGoogHeaders, hds...)
603 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
604 opts = append((*c.CallOptions).VerifyNotificationChannel[0:len((*c.CallOptions).VerifyNotificationChannel):len((*c.CallOptions).VerifyNotificationChannel)], opts...)
605 var resp *monitoringpb.NotificationChannel
606 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
607 var err error
608 resp, err = c.notificationChannelClient.VerifyNotificationChannel(ctx, req, settings.GRPC...)
609 return err
610 }, opts...)
611 if err != nil {
612 return nil, err
613 }
614 return resp, nil
615 }
616
View as plain text