1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package logging
18
19 import (
20 "context"
21 "fmt"
22 "math"
23 "net/url"
24 "time"
25
26 loggingpb "cloud.google.com/go/logging/apiv2/loggingpb"
27 "cloud.google.com/go/longrunning"
28 lroauto "cloud.google.com/go/longrunning/autogen"
29 longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
30 gax "github.com/googleapis/gax-go/v2"
31 "google.golang.org/api/iterator"
32 "google.golang.org/api/option"
33 "google.golang.org/api/option/internaloption"
34 gtransport "google.golang.org/api/transport/grpc"
35 "google.golang.org/grpc"
36 "google.golang.org/grpc/codes"
37 "google.golang.org/protobuf/proto"
38 )
39
40 var newConfigClientHook clientHook
41
42
43 type ConfigCallOptions struct {
44 ListBuckets []gax.CallOption
45 GetBucket []gax.CallOption
46 CreateBucketAsync []gax.CallOption
47 UpdateBucketAsync []gax.CallOption
48 CreateBucket []gax.CallOption
49 UpdateBucket []gax.CallOption
50 DeleteBucket []gax.CallOption
51 UndeleteBucket []gax.CallOption
52 ListViews []gax.CallOption
53 GetView []gax.CallOption
54 CreateView []gax.CallOption
55 UpdateView []gax.CallOption
56 DeleteView []gax.CallOption
57 ListSinks []gax.CallOption
58 GetSink []gax.CallOption
59 CreateSink []gax.CallOption
60 UpdateSink []gax.CallOption
61 DeleteSink []gax.CallOption
62 CreateLink []gax.CallOption
63 DeleteLink []gax.CallOption
64 ListLinks []gax.CallOption
65 GetLink []gax.CallOption
66 ListExclusions []gax.CallOption
67 GetExclusion []gax.CallOption
68 CreateExclusion []gax.CallOption
69 UpdateExclusion []gax.CallOption
70 DeleteExclusion []gax.CallOption
71 GetCmekSettings []gax.CallOption
72 UpdateCmekSettings []gax.CallOption
73 GetSettings []gax.CallOption
74 UpdateSettings []gax.CallOption
75 CopyLogEntries []gax.CallOption
76 CancelOperation []gax.CallOption
77 GetOperation []gax.CallOption
78 ListOperations []gax.CallOption
79 }
80
81 func defaultConfigGRPCClientOptions() []option.ClientOption {
82 return []option.ClientOption{
83 internaloption.WithDefaultEndpoint("logging.googleapis.com:443"),
84 internaloption.WithDefaultEndpointTemplate("logging.UNIVERSE_DOMAIN:443"),
85 internaloption.WithDefaultMTLSEndpoint("logging.mtls.googleapis.com:443"),
86 internaloption.WithDefaultUniverseDomain("googleapis.com"),
87 internaloption.WithDefaultAudience("https://logging.googleapis.com/"),
88 internaloption.WithDefaultScopes(DefaultAuthScopes()...),
89 internaloption.EnableJwtWithScope(),
90 option.WithGRPCDialOption(grpc.WithDefaultCallOptions(
91 grpc.MaxCallRecvMsgSize(math.MaxInt32))),
92 }
93 }
94
95 func defaultConfigCallOptions() *ConfigCallOptions {
96 return &ConfigCallOptions{
97 ListBuckets: []gax.CallOption{},
98 GetBucket: []gax.CallOption{},
99 CreateBucketAsync: []gax.CallOption{},
100 UpdateBucketAsync: []gax.CallOption{},
101 CreateBucket: []gax.CallOption{},
102 UpdateBucket: []gax.CallOption{},
103 DeleteBucket: []gax.CallOption{},
104 UndeleteBucket: []gax.CallOption{},
105 ListViews: []gax.CallOption{},
106 GetView: []gax.CallOption{},
107 CreateView: []gax.CallOption{},
108 UpdateView: []gax.CallOption{},
109 DeleteView: []gax.CallOption{},
110 ListSinks: []gax.CallOption{
111 gax.WithTimeout(60000 * time.Millisecond),
112 gax.WithRetry(func() gax.Retryer {
113 return gax.OnCodes([]codes.Code{
114 codes.DeadlineExceeded,
115 codes.Internal,
116 codes.Unavailable,
117 }, gax.Backoff{
118 Initial: 100 * time.Millisecond,
119 Max: 60000 * time.Millisecond,
120 Multiplier: 1.30,
121 })
122 }),
123 },
124 GetSink: []gax.CallOption{
125 gax.WithTimeout(60000 * time.Millisecond),
126 gax.WithRetry(func() gax.Retryer {
127 return gax.OnCodes([]codes.Code{
128 codes.DeadlineExceeded,
129 codes.Internal,
130 codes.Unavailable,
131 }, gax.Backoff{
132 Initial: 100 * time.Millisecond,
133 Max: 60000 * time.Millisecond,
134 Multiplier: 1.30,
135 })
136 }),
137 },
138 CreateSink: []gax.CallOption{
139 gax.WithTimeout(120000 * time.Millisecond),
140 },
141 UpdateSink: []gax.CallOption{
142 gax.WithTimeout(60000 * time.Millisecond),
143 gax.WithRetry(func() gax.Retryer {
144 return gax.OnCodes([]codes.Code{
145 codes.DeadlineExceeded,
146 codes.Internal,
147 codes.Unavailable,
148 }, gax.Backoff{
149 Initial: 100 * time.Millisecond,
150 Max: 60000 * time.Millisecond,
151 Multiplier: 1.30,
152 })
153 }),
154 },
155 DeleteSink: []gax.CallOption{
156 gax.WithTimeout(60000 * time.Millisecond),
157 gax.WithRetry(func() gax.Retryer {
158 return gax.OnCodes([]codes.Code{
159 codes.DeadlineExceeded,
160 codes.Internal,
161 codes.Unavailable,
162 }, gax.Backoff{
163 Initial: 100 * time.Millisecond,
164 Max: 60000 * time.Millisecond,
165 Multiplier: 1.30,
166 })
167 }),
168 },
169 CreateLink: []gax.CallOption{},
170 DeleteLink: []gax.CallOption{},
171 ListLinks: []gax.CallOption{},
172 GetLink: []gax.CallOption{},
173 ListExclusions: []gax.CallOption{
174 gax.WithTimeout(60000 * time.Millisecond),
175 gax.WithRetry(func() gax.Retryer {
176 return gax.OnCodes([]codes.Code{
177 codes.DeadlineExceeded,
178 codes.Internal,
179 codes.Unavailable,
180 }, gax.Backoff{
181 Initial: 100 * time.Millisecond,
182 Max: 60000 * time.Millisecond,
183 Multiplier: 1.30,
184 })
185 }),
186 },
187 GetExclusion: []gax.CallOption{
188 gax.WithTimeout(60000 * time.Millisecond),
189 gax.WithRetry(func() gax.Retryer {
190 return gax.OnCodes([]codes.Code{
191 codes.DeadlineExceeded,
192 codes.Internal,
193 codes.Unavailable,
194 }, gax.Backoff{
195 Initial: 100 * time.Millisecond,
196 Max: 60000 * time.Millisecond,
197 Multiplier: 1.30,
198 })
199 }),
200 },
201 CreateExclusion: []gax.CallOption{
202 gax.WithTimeout(120000 * time.Millisecond),
203 },
204 UpdateExclusion: []gax.CallOption{
205 gax.WithTimeout(120000 * time.Millisecond),
206 },
207 DeleteExclusion: []gax.CallOption{
208 gax.WithTimeout(60000 * time.Millisecond),
209 gax.WithRetry(func() gax.Retryer {
210 return gax.OnCodes([]codes.Code{
211 codes.DeadlineExceeded,
212 codes.Internal,
213 codes.Unavailable,
214 }, gax.Backoff{
215 Initial: 100 * time.Millisecond,
216 Max: 60000 * time.Millisecond,
217 Multiplier: 1.30,
218 })
219 }),
220 },
221 GetCmekSettings: []gax.CallOption{},
222 UpdateCmekSettings: []gax.CallOption{},
223 GetSettings: []gax.CallOption{},
224 UpdateSettings: []gax.CallOption{},
225 CopyLogEntries: []gax.CallOption{},
226 CancelOperation: []gax.CallOption{},
227 GetOperation: []gax.CallOption{},
228 ListOperations: []gax.CallOption{},
229 }
230 }
231
232
233 type internalConfigClient interface {
234 Close() error
235 setGoogleClientInfo(...string)
236 Connection() *grpc.ClientConn
237 ListBuckets(context.Context, *loggingpb.ListBucketsRequest, ...gax.CallOption) *LogBucketIterator
238 GetBucket(context.Context, *loggingpb.GetBucketRequest, ...gax.CallOption) (*loggingpb.LogBucket, error)
239 CreateBucketAsync(context.Context, *loggingpb.CreateBucketRequest, ...gax.CallOption) (*CreateBucketAsyncOperation, error)
240 CreateBucketAsyncOperation(name string) *CreateBucketAsyncOperation
241 UpdateBucketAsync(context.Context, *loggingpb.UpdateBucketRequest, ...gax.CallOption) (*UpdateBucketAsyncOperation, error)
242 UpdateBucketAsyncOperation(name string) *UpdateBucketAsyncOperation
243 CreateBucket(context.Context, *loggingpb.CreateBucketRequest, ...gax.CallOption) (*loggingpb.LogBucket, error)
244 UpdateBucket(context.Context, *loggingpb.UpdateBucketRequest, ...gax.CallOption) (*loggingpb.LogBucket, error)
245 DeleteBucket(context.Context, *loggingpb.DeleteBucketRequest, ...gax.CallOption) error
246 UndeleteBucket(context.Context, *loggingpb.UndeleteBucketRequest, ...gax.CallOption) error
247 ListViews(context.Context, *loggingpb.ListViewsRequest, ...gax.CallOption) *LogViewIterator
248 GetView(context.Context, *loggingpb.GetViewRequest, ...gax.CallOption) (*loggingpb.LogView, error)
249 CreateView(context.Context, *loggingpb.CreateViewRequest, ...gax.CallOption) (*loggingpb.LogView, error)
250 UpdateView(context.Context, *loggingpb.UpdateViewRequest, ...gax.CallOption) (*loggingpb.LogView, error)
251 DeleteView(context.Context, *loggingpb.DeleteViewRequest, ...gax.CallOption) error
252 ListSinks(context.Context, *loggingpb.ListSinksRequest, ...gax.CallOption) *LogSinkIterator
253 GetSink(context.Context, *loggingpb.GetSinkRequest, ...gax.CallOption) (*loggingpb.LogSink, error)
254 CreateSink(context.Context, *loggingpb.CreateSinkRequest, ...gax.CallOption) (*loggingpb.LogSink, error)
255 UpdateSink(context.Context, *loggingpb.UpdateSinkRequest, ...gax.CallOption) (*loggingpb.LogSink, error)
256 DeleteSink(context.Context, *loggingpb.DeleteSinkRequest, ...gax.CallOption) error
257 CreateLink(context.Context, *loggingpb.CreateLinkRequest, ...gax.CallOption) (*CreateLinkOperation, error)
258 CreateLinkOperation(name string) *CreateLinkOperation
259 DeleteLink(context.Context, *loggingpb.DeleteLinkRequest, ...gax.CallOption) (*DeleteLinkOperation, error)
260 DeleteLinkOperation(name string) *DeleteLinkOperation
261 ListLinks(context.Context, *loggingpb.ListLinksRequest, ...gax.CallOption) *LinkIterator
262 GetLink(context.Context, *loggingpb.GetLinkRequest, ...gax.CallOption) (*loggingpb.Link, error)
263 ListExclusions(context.Context, *loggingpb.ListExclusionsRequest, ...gax.CallOption) *LogExclusionIterator
264 GetExclusion(context.Context, *loggingpb.GetExclusionRequest, ...gax.CallOption) (*loggingpb.LogExclusion, error)
265 CreateExclusion(context.Context, *loggingpb.CreateExclusionRequest, ...gax.CallOption) (*loggingpb.LogExclusion, error)
266 UpdateExclusion(context.Context, *loggingpb.UpdateExclusionRequest, ...gax.CallOption) (*loggingpb.LogExclusion, error)
267 DeleteExclusion(context.Context, *loggingpb.DeleteExclusionRequest, ...gax.CallOption) error
268 GetCmekSettings(context.Context, *loggingpb.GetCmekSettingsRequest, ...gax.CallOption) (*loggingpb.CmekSettings, error)
269 UpdateCmekSettings(context.Context, *loggingpb.UpdateCmekSettingsRequest, ...gax.CallOption) (*loggingpb.CmekSettings, error)
270 GetSettings(context.Context, *loggingpb.GetSettingsRequest, ...gax.CallOption) (*loggingpb.Settings, error)
271 UpdateSettings(context.Context, *loggingpb.UpdateSettingsRequest, ...gax.CallOption) (*loggingpb.Settings, error)
272 CopyLogEntries(context.Context, *loggingpb.CopyLogEntriesRequest, ...gax.CallOption) (*CopyLogEntriesOperation, error)
273 CopyLogEntriesOperation(name string) *CopyLogEntriesOperation
274 CancelOperation(context.Context, *longrunningpb.CancelOperationRequest, ...gax.CallOption) error
275 GetOperation(context.Context, *longrunningpb.GetOperationRequest, ...gax.CallOption) (*longrunningpb.Operation, error)
276 ListOperations(context.Context, *longrunningpb.ListOperationsRequest, ...gax.CallOption) *OperationIterator
277 }
278
279
280
281
282
283 type ConfigClient struct {
284
285 internalClient internalConfigClient
286
287
288 CallOptions *ConfigCallOptions
289
290
291
292
293 LROClient *lroauto.OperationsClient
294 }
295
296
297
298
299
300 func (c *ConfigClient) Close() error {
301 return c.internalClient.Close()
302 }
303
304
305
306
307 func (c *ConfigClient) setGoogleClientInfo(keyval ...string) {
308 c.internalClient.setGoogleClientInfo(keyval...)
309 }
310
311
312
313
314
315 func (c *ConfigClient) Connection() *grpc.ClientConn {
316 return c.internalClient.Connection()
317 }
318
319
320 func (c *ConfigClient) ListBuckets(ctx context.Context, req *loggingpb.ListBucketsRequest, opts ...gax.CallOption) *LogBucketIterator {
321 return c.internalClient.ListBuckets(ctx, req, opts...)
322 }
323
324
325 func (c *ConfigClient) GetBucket(ctx context.Context, req *loggingpb.GetBucketRequest, opts ...gax.CallOption) (*loggingpb.LogBucket, error) {
326 return c.internalClient.GetBucket(ctx, req, opts...)
327 }
328
329
330
331
332 func (c *ConfigClient) CreateBucketAsync(ctx context.Context, req *loggingpb.CreateBucketRequest, opts ...gax.CallOption) (*CreateBucketAsyncOperation, error) {
333 return c.internalClient.CreateBucketAsync(ctx, req, opts...)
334 }
335
336
337
338 func (c *ConfigClient) CreateBucketAsyncOperation(name string) *CreateBucketAsyncOperation {
339 return c.internalClient.CreateBucketAsyncOperation(name)
340 }
341
342
343
344
345
346
347
348 func (c *ConfigClient) UpdateBucketAsync(ctx context.Context, req *loggingpb.UpdateBucketRequest, opts ...gax.CallOption) (*UpdateBucketAsyncOperation, error) {
349 return c.internalClient.UpdateBucketAsync(ctx, req, opts...)
350 }
351
352
353
354 func (c *ConfigClient) UpdateBucketAsyncOperation(name string) *UpdateBucketAsyncOperation {
355 return c.internalClient.UpdateBucketAsyncOperation(name)
356 }
357
358
359
360 func (c *ConfigClient) CreateBucket(ctx context.Context, req *loggingpb.CreateBucketRequest, opts ...gax.CallOption) (*loggingpb.LogBucket, error) {
361 return c.internalClient.CreateBucket(ctx, req, opts...)
362 }
363
364
365
366
367
368
369
370 func (c *ConfigClient) UpdateBucket(ctx context.Context, req *loggingpb.UpdateBucketRequest, opts ...gax.CallOption) (*loggingpb.LogBucket, error) {
371 return c.internalClient.UpdateBucket(ctx, req, opts...)
372 }
373
374
375
376
377
378
379 func (c *ConfigClient) DeleteBucket(ctx context.Context, req *loggingpb.DeleteBucketRequest, opts ...gax.CallOption) error {
380 return c.internalClient.DeleteBucket(ctx, req, opts...)
381 }
382
383
384
385 func (c *ConfigClient) UndeleteBucket(ctx context.Context, req *loggingpb.UndeleteBucketRequest, opts ...gax.CallOption) error {
386 return c.internalClient.UndeleteBucket(ctx, req, opts...)
387 }
388
389
390 func (c *ConfigClient) ListViews(ctx context.Context, req *loggingpb.ListViewsRequest, opts ...gax.CallOption) *LogViewIterator {
391 return c.internalClient.ListViews(ctx, req, opts...)
392 }
393
394
395 func (c *ConfigClient) GetView(ctx context.Context, req *loggingpb.GetViewRequest, opts ...gax.CallOption) (*loggingpb.LogView, error) {
396 return c.internalClient.GetView(ctx, req, opts...)
397 }
398
399
400
401 func (c *ConfigClient) CreateView(ctx context.Context, req *loggingpb.CreateViewRequest, opts ...gax.CallOption) (*loggingpb.LogView, error) {
402 return c.internalClient.CreateView(ctx, req, opts...)
403 }
404
405
406
407
408
409
410 func (c *ConfigClient) UpdateView(ctx context.Context, req *loggingpb.UpdateViewRequest, opts ...gax.CallOption) (*loggingpb.LogView, error) {
411 return c.internalClient.UpdateView(ctx, req, opts...)
412 }
413
414
415
416
417
418 func (c *ConfigClient) DeleteView(ctx context.Context, req *loggingpb.DeleteViewRequest, opts ...gax.CallOption) error {
419 return c.internalClient.DeleteView(ctx, req, opts...)
420 }
421
422
423 func (c *ConfigClient) ListSinks(ctx context.Context, req *loggingpb.ListSinksRequest, opts ...gax.CallOption) *LogSinkIterator {
424 return c.internalClient.ListSinks(ctx, req, opts...)
425 }
426
427
428 func (c *ConfigClient) GetSink(ctx context.Context, req *loggingpb.GetSinkRequest, opts ...gax.CallOption) (*loggingpb.LogSink, error) {
429 return c.internalClient.GetSink(ctx, req, opts...)
430 }
431
432
433
434
435
436 func (c *ConfigClient) CreateSink(ctx context.Context, req *loggingpb.CreateSinkRequest, opts ...gax.CallOption) (*loggingpb.LogSink, error) {
437 return c.internalClient.CreateSink(ctx, req, opts...)
438 }
439
440
441
442
443
444
445 func (c *ConfigClient) UpdateSink(ctx context.Context, req *loggingpb.UpdateSinkRequest, opts ...gax.CallOption) (*loggingpb.LogSink, error) {
446 return c.internalClient.UpdateSink(ctx, req, opts...)
447 }
448
449
450
451 func (c *ConfigClient) DeleteSink(ctx context.Context, req *loggingpb.DeleteSinkRequest, opts ...gax.CallOption) error {
452 return c.internalClient.DeleteSink(ctx, req, opts...)
453 }
454
455
456
457
458 func (c *ConfigClient) CreateLink(ctx context.Context, req *loggingpb.CreateLinkRequest, opts ...gax.CallOption) (*CreateLinkOperation, error) {
459 return c.internalClient.CreateLink(ctx, req, opts...)
460 }
461
462
463
464 func (c *ConfigClient) CreateLinkOperation(name string) *CreateLinkOperation {
465 return c.internalClient.CreateLinkOperation(name)
466 }
467
468
469
470 func (c *ConfigClient) DeleteLink(ctx context.Context, req *loggingpb.DeleteLinkRequest, opts ...gax.CallOption) (*DeleteLinkOperation, error) {
471 return c.internalClient.DeleteLink(ctx, req, opts...)
472 }
473
474
475
476 func (c *ConfigClient) DeleteLinkOperation(name string) *DeleteLinkOperation {
477 return c.internalClient.DeleteLinkOperation(name)
478 }
479
480
481 func (c *ConfigClient) ListLinks(ctx context.Context, req *loggingpb.ListLinksRequest, opts ...gax.CallOption) *LinkIterator {
482 return c.internalClient.ListLinks(ctx, req, opts...)
483 }
484
485
486 func (c *ConfigClient) GetLink(ctx context.Context, req *loggingpb.GetLinkRequest, opts ...gax.CallOption) (*loggingpb.Link, error) {
487 return c.internalClient.GetLink(ctx, req, opts...)
488 }
489
490
491 func (c *ConfigClient) ListExclusions(ctx context.Context, req *loggingpb.ListExclusionsRequest, opts ...gax.CallOption) *LogExclusionIterator {
492 return c.internalClient.ListExclusions(ctx, req, opts...)
493 }
494
495
496 func (c *ConfigClient) GetExclusion(ctx context.Context, req *loggingpb.GetExclusionRequest, opts ...gax.CallOption) (*loggingpb.LogExclusion, error) {
497 return c.internalClient.GetExclusion(ctx, req, opts...)
498 }
499
500
501
502
503 func (c *ConfigClient) CreateExclusion(ctx context.Context, req *loggingpb.CreateExclusionRequest, opts ...gax.CallOption) (*loggingpb.LogExclusion, error) {
504 return c.internalClient.CreateExclusion(ctx, req, opts...)
505 }
506
507
508
509 func (c *ConfigClient) UpdateExclusion(ctx context.Context, req *loggingpb.UpdateExclusionRequest, opts ...gax.CallOption) (*loggingpb.LogExclusion, error) {
510 return c.internalClient.UpdateExclusion(ctx, req, opts...)
511 }
512
513
514 func (c *ConfigClient) DeleteExclusion(ctx context.Context, req *loggingpb.DeleteExclusionRequest, opts ...gax.CallOption) error {
515 return c.internalClient.DeleteExclusion(ctx, req, opts...)
516 }
517
518
519
520
521
522
523
524
525
526
527
528 func (c *ConfigClient) GetCmekSettings(ctx context.Context, req *loggingpb.GetCmekSettingsRequest, opts ...gax.CallOption) (*loggingpb.CmekSettings, error) {
529 return c.internalClient.GetCmekSettings(ctx, req, opts...)
530 }
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547 func (c *ConfigClient) UpdateCmekSettings(ctx context.Context, req *loggingpb.UpdateCmekSettingsRequest, opts ...gax.CallOption) (*loggingpb.CmekSettings, error) {
548 return c.internalClient.UpdateCmekSettings(ctx, req, opts...)
549 }
550
551
552
553
554
555
556
557
558
559
560
561 func (c *ConfigClient) GetSettings(ctx context.Context, req *loggingpb.GetSettingsRequest, opts ...gax.CallOption) (*loggingpb.Settings, error) {
562 return c.internalClient.GetSettings(ctx, req, opts...)
563 }
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581 func (c *ConfigClient) UpdateSettings(ctx context.Context, req *loggingpb.UpdateSettingsRequest, opts ...gax.CallOption) (*loggingpb.Settings, error) {
582 return c.internalClient.UpdateSettings(ctx, req, opts...)
583 }
584
585
586 func (c *ConfigClient) CopyLogEntries(ctx context.Context, req *loggingpb.CopyLogEntriesRequest, opts ...gax.CallOption) (*CopyLogEntriesOperation, error) {
587 return c.internalClient.CopyLogEntries(ctx, req, opts...)
588 }
589
590
591
592 func (c *ConfigClient) CopyLogEntriesOperation(name string) *CopyLogEntriesOperation {
593 return c.internalClient.CopyLogEntriesOperation(name)
594 }
595
596
597 func (c *ConfigClient) CancelOperation(ctx context.Context, req *longrunningpb.CancelOperationRequest, opts ...gax.CallOption) error {
598 return c.internalClient.CancelOperation(ctx, req, opts...)
599 }
600
601
602 func (c *ConfigClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error) {
603 return c.internalClient.GetOperation(ctx, req, opts...)
604 }
605
606
607 func (c *ConfigClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIterator {
608 return c.internalClient.ListOperations(ctx, req, opts...)
609 }
610
611
612
613
614 type configGRPCClient struct {
615
616 connPool gtransport.ConnPool
617
618
619 CallOptions **ConfigCallOptions
620
621
622 configClient loggingpb.ConfigServiceV2Client
623
624
625
626
627 LROClient **lroauto.OperationsClient
628
629 operationsClient longrunningpb.OperationsClient
630
631
632 xGoogHeaders []string
633 }
634
635
636
637
638
639 func NewConfigClient(ctx context.Context, opts ...option.ClientOption) (*ConfigClient, error) {
640 clientOpts := defaultConfigGRPCClientOptions()
641 if newConfigClientHook != nil {
642 hookOpts, err := newConfigClientHook(ctx, clientHookParams{})
643 if err != nil {
644 return nil, err
645 }
646 clientOpts = append(clientOpts, hookOpts...)
647 }
648
649 connPool, err := gtransport.DialPool(ctx, append(clientOpts, opts...)...)
650 if err != nil {
651 return nil, err
652 }
653 client := ConfigClient{CallOptions: defaultConfigCallOptions()}
654
655 c := &configGRPCClient{
656 connPool: connPool,
657 configClient: loggingpb.NewConfigServiceV2Client(connPool),
658 CallOptions: &client.CallOptions,
659 operationsClient: longrunningpb.NewOperationsClient(connPool),
660 }
661 c.setGoogleClientInfo()
662
663 client.internalClient = c
664
665 client.LROClient, err = lroauto.NewOperationsClient(ctx, gtransport.WithConnPool(connPool))
666 if err != nil {
667
668
669
670
671
672
673 return nil, err
674 }
675 c.LROClient = &client.LROClient
676 return &client, nil
677 }
678
679
680
681
682
683 func (c *configGRPCClient) Connection() *grpc.ClientConn {
684 return c.connPool.Conn()
685 }
686
687
688
689
690 func (c *configGRPCClient) setGoogleClientInfo(keyval ...string) {
691 kv := append([]string{"gl-go", gax.GoVersion}, keyval...)
692 kv = append(kv, "gapic", getVersionClient(), "gax", gax.Version, "grpc", grpc.Version)
693 c.xGoogHeaders = []string{"x-goog-api-client", gax.XGoogHeader(kv...)}
694 }
695
696
697
698 func (c *configGRPCClient) Close() error {
699 return c.connPool.Close()
700 }
701
702 func (c *configGRPCClient) ListBuckets(ctx context.Context, req *loggingpb.ListBucketsRequest, opts ...gax.CallOption) *LogBucketIterator {
703 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
704
705 hds = append(c.xGoogHeaders, hds...)
706 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
707 opts = append((*c.CallOptions).ListBuckets[0:len((*c.CallOptions).ListBuckets):len((*c.CallOptions).ListBuckets)], opts...)
708 it := &LogBucketIterator{}
709 req = proto.Clone(req).(*loggingpb.ListBucketsRequest)
710 it.InternalFetch = func(pageSize int, pageToken string) ([]*loggingpb.LogBucket, string, error) {
711 resp := &loggingpb.ListBucketsResponse{}
712 if pageToken != "" {
713 req.PageToken = pageToken
714 }
715 if pageSize > math.MaxInt32 {
716 req.PageSize = math.MaxInt32
717 } else if pageSize != 0 {
718 req.PageSize = int32(pageSize)
719 }
720 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
721 var err error
722 resp, err = c.configClient.ListBuckets(ctx, req, settings.GRPC...)
723 return err
724 }, opts...)
725 if err != nil {
726 return nil, "", err
727 }
728
729 it.Response = resp
730 return resp.GetBuckets(), resp.GetNextPageToken(), nil
731 }
732 fetch := func(pageSize int, pageToken string) (string, error) {
733 items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
734 if err != nil {
735 return "", err
736 }
737 it.items = append(it.items, items...)
738 return nextPageToken, nil
739 }
740
741 it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
742 it.pageInfo.MaxSize = int(req.GetPageSize())
743 it.pageInfo.Token = req.GetPageToken()
744
745 return it
746 }
747
748 func (c *configGRPCClient) GetBucket(ctx context.Context, req *loggingpb.GetBucketRequest, opts ...gax.CallOption) (*loggingpb.LogBucket, error) {
749 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
750
751 hds = append(c.xGoogHeaders, hds...)
752 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
753 opts = append((*c.CallOptions).GetBucket[0:len((*c.CallOptions).GetBucket):len((*c.CallOptions).GetBucket)], opts...)
754 var resp *loggingpb.LogBucket
755 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
756 var err error
757 resp, err = c.configClient.GetBucket(ctx, req, settings.GRPC...)
758 return err
759 }, opts...)
760 if err != nil {
761 return nil, err
762 }
763 return resp, nil
764 }
765
766 func (c *configGRPCClient) CreateBucketAsync(ctx context.Context, req *loggingpb.CreateBucketRequest, opts ...gax.CallOption) (*CreateBucketAsyncOperation, error) {
767 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
768
769 hds = append(c.xGoogHeaders, hds...)
770 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
771 opts = append((*c.CallOptions).CreateBucketAsync[0:len((*c.CallOptions).CreateBucketAsync):len((*c.CallOptions).CreateBucketAsync)], opts...)
772 var resp *longrunningpb.Operation
773 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
774 var err error
775 resp, err = c.configClient.CreateBucketAsync(ctx, req, settings.GRPC...)
776 return err
777 }, opts...)
778 if err != nil {
779 return nil, err
780 }
781 return &CreateBucketAsyncOperation{
782 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
783 }, nil
784 }
785
786 func (c *configGRPCClient) UpdateBucketAsync(ctx context.Context, req *loggingpb.UpdateBucketRequest, opts ...gax.CallOption) (*UpdateBucketAsyncOperation, error) {
787 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
788
789 hds = append(c.xGoogHeaders, hds...)
790 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
791 opts = append((*c.CallOptions).UpdateBucketAsync[0:len((*c.CallOptions).UpdateBucketAsync):len((*c.CallOptions).UpdateBucketAsync)], opts...)
792 var resp *longrunningpb.Operation
793 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
794 var err error
795 resp, err = c.configClient.UpdateBucketAsync(ctx, req, settings.GRPC...)
796 return err
797 }, opts...)
798 if err != nil {
799 return nil, err
800 }
801 return &UpdateBucketAsyncOperation{
802 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
803 }, nil
804 }
805
806 func (c *configGRPCClient) CreateBucket(ctx context.Context, req *loggingpb.CreateBucketRequest, opts ...gax.CallOption) (*loggingpb.LogBucket, error) {
807 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
808
809 hds = append(c.xGoogHeaders, hds...)
810 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
811 opts = append((*c.CallOptions).CreateBucket[0:len((*c.CallOptions).CreateBucket):len((*c.CallOptions).CreateBucket)], opts...)
812 var resp *loggingpb.LogBucket
813 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
814 var err error
815 resp, err = c.configClient.CreateBucket(ctx, req, settings.GRPC...)
816 return err
817 }, opts...)
818 if err != nil {
819 return nil, err
820 }
821 return resp, nil
822 }
823
824 func (c *configGRPCClient) UpdateBucket(ctx context.Context, req *loggingpb.UpdateBucketRequest, opts ...gax.CallOption) (*loggingpb.LogBucket, error) {
825 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
826
827 hds = append(c.xGoogHeaders, hds...)
828 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
829 opts = append((*c.CallOptions).UpdateBucket[0:len((*c.CallOptions).UpdateBucket):len((*c.CallOptions).UpdateBucket)], opts...)
830 var resp *loggingpb.LogBucket
831 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
832 var err error
833 resp, err = c.configClient.UpdateBucket(ctx, req, settings.GRPC...)
834 return err
835 }, opts...)
836 if err != nil {
837 return nil, err
838 }
839 return resp, nil
840 }
841
842 func (c *configGRPCClient) DeleteBucket(ctx context.Context, req *loggingpb.DeleteBucketRequest, opts ...gax.CallOption) error {
843 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
844
845 hds = append(c.xGoogHeaders, hds...)
846 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
847 opts = append((*c.CallOptions).DeleteBucket[0:len((*c.CallOptions).DeleteBucket):len((*c.CallOptions).DeleteBucket)], opts...)
848 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
849 var err error
850 _, err = c.configClient.DeleteBucket(ctx, req, settings.GRPC...)
851 return err
852 }, opts...)
853 return err
854 }
855
856 func (c *configGRPCClient) UndeleteBucket(ctx context.Context, req *loggingpb.UndeleteBucketRequest, opts ...gax.CallOption) error {
857 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
858
859 hds = append(c.xGoogHeaders, hds...)
860 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
861 opts = append((*c.CallOptions).UndeleteBucket[0:len((*c.CallOptions).UndeleteBucket):len((*c.CallOptions).UndeleteBucket)], opts...)
862 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
863 var err error
864 _, err = c.configClient.UndeleteBucket(ctx, req, settings.GRPC...)
865 return err
866 }, opts...)
867 return err
868 }
869
870 func (c *configGRPCClient) ListViews(ctx context.Context, req *loggingpb.ListViewsRequest, opts ...gax.CallOption) *LogViewIterator {
871 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
872
873 hds = append(c.xGoogHeaders, hds...)
874 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
875 opts = append((*c.CallOptions).ListViews[0:len((*c.CallOptions).ListViews):len((*c.CallOptions).ListViews)], opts...)
876 it := &LogViewIterator{}
877 req = proto.Clone(req).(*loggingpb.ListViewsRequest)
878 it.InternalFetch = func(pageSize int, pageToken string) ([]*loggingpb.LogView, string, error) {
879 resp := &loggingpb.ListViewsResponse{}
880 if pageToken != "" {
881 req.PageToken = pageToken
882 }
883 if pageSize > math.MaxInt32 {
884 req.PageSize = math.MaxInt32
885 } else if pageSize != 0 {
886 req.PageSize = int32(pageSize)
887 }
888 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
889 var err error
890 resp, err = c.configClient.ListViews(ctx, req, settings.GRPC...)
891 return err
892 }, opts...)
893 if err != nil {
894 return nil, "", err
895 }
896
897 it.Response = resp
898 return resp.GetViews(), resp.GetNextPageToken(), nil
899 }
900 fetch := func(pageSize int, pageToken string) (string, error) {
901 items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
902 if err != nil {
903 return "", err
904 }
905 it.items = append(it.items, items...)
906 return nextPageToken, nil
907 }
908
909 it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
910 it.pageInfo.MaxSize = int(req.GetPageSize())
911 it.pageInfo.Token = req.GetPageToken()
912
913 return it
914 }
915
916 func (c *configGRPCClient) GetView(ctx context.Context, req *loggingpb.GetViewRequest, opts ...gax.CallOption) (*loggingpb.LogView, error) {
917 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
918
919 hds = append(c.xGoogHeaders, hds...)
920 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
921 opts = append((*c.CallOptions).GetView[0:len((*c.CallOptions).GetView):len((*c.CallOptions).GetView)], opts...)
922 var resp *loggingpb.LogView
923 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
924 var err error
925 resp, err = c.configClient.GetView(ctx, req, settings.GRPC...)
926 return err
927 }, opts...)
928 if err != nil {
929 return nil, err
930 }
931 return resp, nil
932 }
933
934 func (c *configGRPCClient) CreateView(ctx context.Context, req *loggingpb.CreateViewRequest, opts ...gax.CallOption) (*loggingpb.LogView, error) {
935 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
936
937 hds = append(c.xGoogHeaders, hds...)
938 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
939 opts = append((*c.CallOptions).CreateView[0:len((*c.CallOptions).CreateView):len((*c.CallOptions).CreateView)], opts...)
940 var resp *loggingpb.LogView
941 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
942 var err error
943 resp, err = c.configClient.CreateView(ctx, req, settings.GRPC...)
944 return err
945 }, opts...)
946 if err != nil {
947 return nil, err
948 }
949 return resp, nil
950 }
951
952 func (c *configGRPCClient) UpdateView(ctx context.Context, req *loggingpb.UpdateViewRequest, opts ...gax.CallOption) (*loggingpb.LogView, error) {
953 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
954
955 hds = append(c.xGoogHeaders, hds...)
956 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
957 opts = append((*c.CallOptions).UpdateView[0:len((*c.CallOptions).UpdateView):len((*c.CallOptions).UpdateView)], opts...)
958 var resp *loggingpb.LogView
959 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
960 var err error
961 resp, err = c.configClient.UpdateView(ctx, req, settings.GRPC...)
962 return err
963 }, opts...)
964 if err != nil {
965 return nil, err
966 }
967 return resp, nil
968 }
969
970 func (c *configGRPCClient) DeleteView(ctx context.Context, req *loggingpb.DeleteViewRequest, opts ...gax.CallOption) error {
971 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
972
973 hds = append(c.xGoogHeaders, hds...)
974 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
975 opts = append((*c.CallOptions).DeleteView[0:len((*c.CallOptions).DeleteView):len((*c.CallOptions).DeleteView)], opts...)
976 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
977 var err error
978 _, err = c.configClient.DeleteView(ctx, req, settings.GRPC...)
979 return err
980 }, opts...)
981 return err
982 }
983
984 func (c *configGRPCClient) ListSinks(ctx context.Context, req *loggingpb.ListSinksRequest, opts ...gax.CallOption) *LogSinkIterator {
985 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
986
987 hds = append(c.xGoogHeaders, hds...)
988 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
989 opts = append((*c.CallOptions).ListSinks[0:len((*c.CallOptions).ListSinks):len((*c.CallOptions).ListSinks)], opts...)
990 it := &LogSinkIterator{}
991 req = proto.Clone(req).(*loggingpb.ListSinksRequest)
992 it.InternalFetch = func(pageSize int, pageToken string) ([]*loggingpb.LogSink, string, error) {
993 resp := &loggingpb.ListSinksResponse{}
994 if pageToken != "" {
995 req.PageToken = pageToken
996 }
997 if pageSize > math.MaxInt32 {
998 req.PageSize = math.MaxInt32
999 } else if pageSize != 0 {
1000 req.PageSize = int32(pageSize)
1001 }
1002 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1003 var err error
1004 resp, err = c.configClient.ListSinks(ctx, req, settings.GRPC...)
1005 return err
1006 }, opts...)
1007 if err != nil {
1008 return nil, "", err
1009 }
1010
1011 it.Response = resp
1012 return resp.GetSinks(), resp.GetNextPageToken(), nil
1013 }
1014 fetch := func(pageSize int, pageToken string) (string, error) {
1015 items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
1016 if err != nil {
1017 return "", err
1018 }
1019 it.items = append(it.items, items...)
1020 return nextPageToken, nil
1021 }
1022
1023 it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
1024 it.pageInfo.MaxSize = int(req.GetPageSize())
1025 it.pageInfo.Token = req.GetPageToken()
1026
1027 return it
1028 }
1029
1030 func (c *configGRPCClient) GetSink(ctx context.Context, req *loggingpb.GetSinkRequest, opts ...gax.CallOption) (*loggingpb.LogSink, error) {
1031 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "sink_name", url.QueryEscape(req.GetSinkName()))}
1032
1033 hds = append(c.xGoogHeaders, hds...)
1034 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1035 opts = append((*c.CallOptions).GetSink[0:len((*c.CallOptions).GetSink):len((*c.CallOptions).GetSink)], opts...)
1036 var resp *loggingpb.LogSink
1037 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1038 var err error
1039 resp, err = c.configClient.GetSink(ctx, req, settings.GRPC...)
1040 return err
1041 }, opts...)
1042 if err != nil {
1043 return nil, err
1044 }
1045 return resp, nil
1046 }
1047
1048 func (c *configGRPCClient) CreateSink(ctx context.Context, req *loggingpb.CreateSinkRequest, opts ...gax.CallOption) (*loggingpb.LogSink, error) {
1049 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
1050
1051 hds = append(c.xGoogHeaders, hds...)
1052 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1053 opts = append((*c.CallOptions).CreateSink[0:len((*c.CallOptions).CreateSink):len((*c.CallOptions).CreateSink)], opts...)
1054 var resp *loggingpb.LogSink
1055 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1056 var err error
1057 resp, err = c.configClient.CreateSink(ctx, req, settings.GRPC...)
1058 return err
1059 }, opts...)
1060 if err != nil {
1061 return nil, err
1062 }
1063 return resp, nil
1064 }
1065
1066 func (c *configGRPCClient) UpdateSink(ctx context.Context, req *loggingpb.UpdateSinkRequest, opts ...gax.CallOption) (*loggingpb.LogSink, error) {
1067 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "sink_name", url.QueryEscape(req.GetSinkName()))}
1068
1069 hds = append(c.xGoogHeaders, hds...)
1070 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1071 opts = append((*c.CallOptions).UpdateSink[0:len((*c.CallOptions).UpdateSink):len((*c.CallOptions).UpdateSink)], opts...)
1072 var resp *loggingpb.LogSink
1073 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1074 var err error
1075 resp, err = c.configClient.UpdateSink(ctx, req, settings.GRPC...)
1076 return err
1077 }, opts...)
1078 if err != nil {
1079 return nil, err
1080 }
1081 return resp, nil
1082 }
1083
1084 func (c *configGRPCClient) DeleteSink(ctx context.Context, req *loggingpb.DeleteSinkRequest, opts ...gax.CallOption) error {
1085 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "sink_name", url.QueryEscape(req.GetSinkName()))}
1086
1087 hds = append(c.xGoogHeaders, hds...)
1088 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1089 opts = append((*c.CallOptions).DeleteSink[0:len((*c.CallOptions).DeleteSink):len((*c.CallOptions).DeleteSink)], opts...)
1090 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1091 var err error
1092 _, err = c.configClient.DeleteSink(ctx, req, settings.GRPC...)
1093 return err
1094 }, opts...)
1095 return err
1096 }
1097
1098 func (c *configGRPCClient) CreateLink(ctx context.Context, req *loggingpb.CreateLinkRequest, opts ...gax.CallOption) (*CreateLinkOperation, error) {
1099 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
1100
1101 hds = append(c.xGoogHeaders, hds...)
1102 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1103 opts = append((*c.CallOptions).CreateLink[0:len((*c.CallOptions).CreateLink):len((*c.CallOptions).CreateLink)], opts...)
1104 var resp *longrunningpb.Operation
1105 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1106 var err error
1107 resp, err = c.configClient.CreateLink(ctx, req, settings.GRPC...)
1108 return err
1109 }, opts...)
1110 if err != nil {
1111 return nil, err
1112 }
1113 return &CreateLinkOperation{
1114 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
1115 }, nil
1116 }
1117
1118 func (c *configGRPCClient) DeleteLink(ctx context.Context, req *loggingpb.DeleteLinkRequest, opts ...gax.CallOption) (*DeleteLinkOperation, error) {
1119 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
1120
1121 hds = append(c.xGoogHeaders, hds...)
1122 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1123 opts = append((*c.CallOptions).DeleteLink[0:len((*c.CallOptions).DeleteLink):len((*c.CallOptions).DeleteLink)], opts...)
1124 var resp *longrunningpb.Operation
1125 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1126 var err error
1127 resp, err = c.configClient.DeleteLink(ctx, req, settings.GRPC...)
1128 return err
1129 }, opts...)
1130 if err != nil {
1131 return nil, err
1132 }
1133 return &DeleteLinkOperation{
1134 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
1135 }, nil
1136 }
1137
1138 func (c *configGRPCClient) ListLinks(ctx context.Context, req *loggingpb.ListLinksRequest, opts ...gax.CallOption) *LinkIterator {
1139 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
1140
1141 hds = append(c.xGoogHeaders, hds...)
1142 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1143 opts = append((*c.CallOptions).ListLinks[0:len((*c.CallOptions).ListLinks):len((*c.CallOptions).ListLinks)], opts...)
1144 it := &LinkIterator{}
1145 req = proto.Clone(req).(*loggingpb.ListLinksRequest)
1146 it.InternalFetch = func(pageSize int, pageToken string) ([]*loggingpb.Link, string, error) {
1147 resp := &loggingpb.ListLinksResponse{}
1148 if pageToken != "" {
1149 req.PageToken = pageToken
1150 }
1151 if pageSize > math.MaxInt32 {
1152 req.PageSize = math.MaxInt32
1153 } else if pageSize != 0 {
1154 req.PageSize = int32(pageSize)
1155 }
1156 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1157 var err error
1158 resp, err = c.configClient.ListLinks(ctx, req, settings.GRPC...)
1159 return err
1160 }, opts...)
1161 if err != nil {
1162 return nil, "", err
1163 }
1164
1165 it.Response = resp
1166 return resp.GetLinks(), resp.GetNextPageToken(), nil
1167 }
1168 fetch := func(pageSize int, pageToken string) (string, error) {
1169 items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
1170 if err != nil {
1171 return "", err
1172 }
1173 it.items = append(it.items, items...)
1174 return nextPageToken, nil
1175 }
1176
1177 it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
1178 it.pageInfo.MaxSize = int(req.GetPageSize())
1179 it.pageInfo.Token = req.GetPageToken()
1180
1181 return it
1182 }
1183
1184 func (c *configGRPCClient) GetLink(ctx context.Context, req *loggingpb.GetLinkRequest, opts ...gax.CallOption) (*loggingpb.Link, error) {
1185 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
1186
1187 hds = append(c.xGoogHeaders, hds...)
1188 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1189 opts = append((*c.CallOptions).GetLink[0:len((*c.CallOptions).GetLink):len((*c.CallOptions).GetLink)], opts...)
1190 var resp *loggingpb.Link
1191 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1192 var err error
1193 resp, err = c.configClient.GetLink(ctx, req, settings.GRPC...)
1194 return err
1195 }, opts...)
1196 if err != nil {
1197 return nil, err
1198 }
1199 return resp, nil
1200 }
1201
1202 func (c *configGRPCClient) ListExclusions(ctx context.Context, req *loggingpb.ListExclusionsRequest, opts ...gax.CallOption) *LogExclusionIterator {
1203 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
1204
1205 hds = append(c.xGoogHeaders, hds...)
1206 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1207 opts = append((*c.CallOptions).ListExclusions[0:len((*c.CallOptions).ListExclusions):len((*c.CallOptions).ListExclusions)], opts...)
1208 it := &LogExclusionIterator{}
1209 req = proto.Clone(req).(*loggingpb.ListExclusionsRequest)
1210 it.InternalFetch = func(pageSize int, pageToken string) ([]*loggingpb.LogExclusion, string, error) {
1211 resp := &loggingpb.ListExclusionsResponse{}
1212 if pageToken != "" {
1213 req.PageToken = pageToken
1214 }
1215 if pageSize > math.MaxInt32 {
1216 req.PageSize = math.MaxInt32
1217 } else if pageSize != 0 {
1218 req.PageSize = int32(pageSize)
1219 }
1220 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1221 var err error
1222 resp, err = c.configClient.ListExclusions(ctx, req, settings.GRPC...)
1223 return err
1224 }, opts...)
1225 if err != nil {
1226 return nil, "", err
1227 }
1228
1229 it.Response = resp
1230 return resp.GetExclusions(), resp.GetNextPageToken(), nil
1231 }
1232 fetch := func(pageSize int, pageToken string) (string, error) {
1233 items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
1234 if err != nil {
1235 return "", err
1236 }
1237 it.items = append(it.items, items...)
1238 return nextPageToken, nil
1239 }
1240
1241 it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
1242 it.pageInfo.MaxSize = int(req.GetPageSize())
1243 it.pageInfo.Token = req.GetPageToken()
1244
1245 return it
1246 }
1247
1248 func (c *configGRPCClient) GetExclusion(ctx context.Context, req *loggingpb.GetExclusionRequest, opts ...gax.CallOption) (*loggingpb.LogExclusion, error) {
1249 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
1250
1251 hds = append(c.xGoogHeaders, hds...)
1252 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1253 opts = append((*c.CallOptions).GetExclusion[0:len((*c.CallOptions).GetExclusion):len((*c.CallOptions).GetExclusion)], opts...)
1254 var resp *loggingpb.LogExclusion
1255 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1256 var err error
1257 resp, err = c.configClient.GetExclusion(ctx, req, settings.GRPC...)
1258 return err
1259 }, opts...)
1260 if err != nil {
1261 return nil, err
1262 }
1263 return resp, nil
1264 }
1265
1266 func (c *configGRPCClient) CreateExclusion(ctx context.Context, req *loggingpb.CreateExclusionRequest, opts ...gax.CallOption) (*loggingpb.LogExclusion, error) {
1267 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
1268
1269 hds = append(c.xGoogHeaders, hds...)
1270 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1271 opts = append((*c.CallOptions).CreateExclusion[0:len((*c.CallOptions).CreateExclusion):len((*c.CallOptions).CreateExclusion)], opts...)
1272 var resp *loggingpb.LogExclusion
1273 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1274 var err error
1275 resp, err = c.configClient.CreateExclusion(ctx, req, settings.GRPC...)
1276 return err
1277 }, opts...)
1278 if err != nil {
1279 return nil, err
1280 }
1281 return resp, nil
1282 }
1283
1284 func (c *configGRPCClient) UpdateExclusion(ctx context.Context, req *loggingpb.UpdateExclusionRequest, opts ...gax.CallOption) (*loggingpb.LogExclusion, error) {
1285 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
1286
1287 hds = append(c.xGoogHeaders, hds...)
1288 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1289 opts = append((*c.CallOptions).UpdateExclusion[0:len((*c.CallOptions).UpdateExclusion):len((*c.CallOptions).UpdateExclusion)], opts...)
1290 var resp *loggingpb.LogExclusion
1291 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1292 var err error
1293 resp, err = c.configClient.UpdateExclusion(ctx, req, settings.GRPC...)
1294 return err
1295 }, opts...)
1296 if err != nil {
1297 return nil, err
1298 }
1299 return resp, nil
1300 }
1301
1302 func (c *configGRPCClient) DeleteExclusion(ctx context.Context, req *loggingpb.DeleteExclusionRequest, opts ...gax.CallOption) error {
1303 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
1304
1305 hds = append(c.xGoogHeaders, hds...)
1306 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1307 opts = append((*c.CallOptions).DeleteExclusion[0:len((*c.CallOptions).DeleteExclusion):len((*c.CallOptions).DeleteExclusion)], opts...)
1308 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1309 var err error
1310 _, err = c.configClient.DeleteExclusion(ctx, req, settings.GRPC...)
1311 return err
1312 }, opts...)
1313 return err
1314 }
1315
1316 func (c *configGRPCClient) GetCmekSettings(ctx context.Context, req *loggingpb.GetCmekSettingsRequest, opts ...gax.CallOption) (*loggingpb.CmekSettings, error) {
1317 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
1318
1319 hds = append(c.xGoogHeaders, hds...)
1320 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1321 opts = append((*c.CallOptions).GetCmekSettings[0:len((*c.CallOptions).GetCmekSettings):len((*c.CallOptions).GetCmekSettings)], opts...)
1322 var resp *loggingpb.CmekSettings
1323 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1324 var err error
1325 resp, err = c.configClient.GetCmekSettings(ctx, req, settings.GRPC...)
1326 return err
1327 }, opts...)
1328 if err != nil {
1329 return nil, err
1330 }
1331 return resp, nil
1332 }
1333
1334 func (c *configGRPCClient) UpdateCmekSettings(ctx context.Context, req *loggingpb.UpdateCmekSettingsRequest, opts ...gax.CallOption) (*loggingpb.CmekSettings, error) {
1335 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
1336
1337 hds = append(c.xGoogHeaders, hds...)
1338 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1339 opts = append((*c.CallOptions).UpdateCmekSettings[0:len((*c.CallOptions).UpdateCmekSettings):len((*c.CallOptions).UpdateCmekSettings)], opts...)
1340 var resp *loggingpb.CmekSettings
1341 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1342 var err error
1343 resp, err = c.configClient.UpdateCmekSettings(ctx, req, settings.GRPC...)
1344 return err
1345 }, opts...)
1346 if err != nil {
1347 return nil, err
1348 }
1349 return resp, nil
1350 }
1351
1352 func (c *configGRPCClient) GetSettings(ctx context.Context, req *loggingpb.GetSettingsRequest, opts ...gax.CallOption) (*loggingpb.Settings, error) {
1353 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
1354
1355 hds = append(c.xGoogHeaders, hds...)
1356 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1357 opts = append((*c.CallOptions).GetSettings[0:len((*c.CallOptions).GetSettings):len((*c.CallOptions).GetSettings)], opts...)
1358 var resp *loggingpb.Settings
1359 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1360 var err error
1361 resp, err = c.configClient.GetSettings(ctx, req, settings.GRPC...)
1362 return err
1363 }, opts...)
1364 if err != nil {
1365 return nil, err
1366 }
1367 return resp, nil
1368 }
1369
1370 func (c *configGRPCClient) UpdateSettings(ctx context.Context, req *loggingpb.UpdateSettingsRequest, opts ...gax.CallOption) (*loggingpb.Settings, error) {
1371 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
1372
1373 hds = append(c.xGoogHeaders, hds...)
1374 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1375 opts = append((*c.CallOptions).UpdateSettings[0:len((*c.CallOptions).UpdateSettings):len((*c.CallOptions).UpdateSettings)], opts...)
1376 var resp *loggingpb.Settings
1377 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1378 var err error
1379 resp, err = c.configClient.UpdateSettings(ctx, req, settings.GRPC...)
1380 return err
1381 }, opts...)
1382 if err != nil {
1383 return nil, err
1384 }
1385 return resp, nil
1386 }
1387
1388 func (c *configGRPCClient) CopyLogEntries(ctx context.Context, req *loggingpb.CopyLogEntriesRequest, opts ...gax.CallOption) (*CopyLogEntriesOperation, error) {
1389 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, c.xGoogHeaders...)
1390 opts = append((*c.CallOptions).CopyLogEntries[0:len((*c.CallOptions).CopyLogEntries):len((*c.CallOptions).CopyLogEntries)], opts...)
1391 var resp *longrunningpb.Operation
1392 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1393 var err error
1394 resp, err = c.configClient.CopyLogEntries(ctx, req, settings.GRPC...)
1395 return err
1396 }, opts...)
1397 if err != nil {
1398 return nil, err
1399 }
1400 return &CopyLogEntriesOperation{
1401 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
1402 }, nil
1403 }
1404
1405 func (c *configGRPCClient) CancelOperation(ctx context.Context, req *longrunningpb.CancelOperationRequest, opts ...gax.CallOption) error {
1406 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
1407
1408 hds = append(c.xGoogHeaders, hds...)
1409 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1410 opts = append((*c.CallOptions).CancelOperation[0:len((*c.CallOptions).CancelOperation):len((*c.CallOptions).CancelOperation)], opts...)
1411 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1412 var err error
1413 _, err = c.operationsClient.CancelOperation(ctx, req, settings.GRPC...)
1414 return err
1415 }, opts...)
1416 return err
1417 }
1418
1419 func (c *configGRPCClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error) {
1420 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
1421
1422 hds = append(c.xGoogHeaders, hds...)
1423 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1424 opts = append((*c.CallOptions).GetOperation[0:len((*c.CallOptions).GetOperation):len((*c.CallOptions).GetOperation)], opts...)
1425 var resp *longrunningpb.Operation
1426 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1427 var err error
1428 resp, err = c.operationsClient.GetOperation(ctx, req, settings.GRPC...)
1429 return err
1430 }, opts...)
1431 if err != nil {
1432 return nil, err
1433 }
1434 return resp, nil
1435 }
1436
1437 func (c *configGRPCClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIterator {
1438 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
1439
1440 hds = append(c.xGoogHeaders, hds...)
1441 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1442 opts = append((*c.CallOptions).ListOperations[0:len((*c.CallOptions).ListOperations):len((*c.CallOptions).ListOperations)], opts...)
1443 it := &OperationIterator{}
1444 req = proto.Clone(req).(*longrunningpb.ListOperationsRequest)
1445 it.InternalFetch = func(pageSize int, pageToken string) ([]*longrunningpb.Operation, string, error) {
1446 resp := &longrunningpb.ListOperationsResponse{}
1447 if pageToken != "" {
1448 req.PageToken = pageToken
1449 }
1450 if pageSize > math.MaxInt32 {
1451 req.PageSize = math.MaxInt32
1452 } else if pageSize != 0 {
1453 req.PageSize = int32(pageSize)
1454 }
1455 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1456 var err error
1457 resp, err = c.operationsClient.ListOperations(ctx, req, settings.GRPC...)
1458 return err
1459 }, opts...)
1460 if err != nil {
1461 return nil, "", err
1462 }
1463
1464 it.Response = resp
1465 return resp.GetOperations(), resp.GetNextPageToken(), nil
1466 }
1467 fetch := func(pageSize int, pageToken string) (string, error) {
1468 items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
1469 if err != nil {
1470 return "", err
1471 }
1472 it.items = append(it.items, items...)
1473 return nextPageToken, nil
1474 }
1475
1476 it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
1477 it.pageInfo.MaxSize = int(req.GetPageSize())
1478 it.pageInfo.Token = req.GetPageToken()
1479
1480 return it
1481 }
1482
1483
1484
1485 func (c *configGRPCClient) CopyLogEntriesOperation(name string) *CopyLogEntriesOperation {
1486 return &CopyLogEntriesOperation{
1487 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
1488 }
1489 }
1490
1491
1492
1493 func (c *configGRPCClient) CreateBucketAsyncOperation(name string) *CreateBucketAsyncOperation {
1494 return &CreateBucketAsyncOperation{
1495 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
1496 }
1497 }
1498
1499
1500
1501 func (c *configGRPCClient) CreateLinkOperation(name string) *CreateLinkOperation {
1502 return &CreateLinkOperation{
1503 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
1504 }
1505 }
1506
1507
1508
1509 func (c *configGRPCClient) DeleteLinkOperation(name string) *DeleteLinkOperation {
1510 return &DeleteLinkOperation{
1511 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
1512 }
1513 }
1514
1515
1516
1517 func (c *configGRPCClient) UpdateBucketAsyncOperation(name string) *UpdateBucketAsyncOperation {
1518 return &UpdateBucketAsyncOperation{
1519 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
1520 }
1521 }
1522
View as plain text