1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51 package gkehub
52
53 import (
54 "bytes"
55 "context"
56 "encoding/json"
57 "errors"
58 "fmt"
59 "io"
60 "net/http"
61 "net/url"
62 "strconv"
63 "strings"
64
65 googleapi "google.golang.org/api/googleapi"
66 internal "google.golang.org/api/internal"
67 gensupport "google.golang.org/api/internal/gensupport"
68 option "google.golang.org/api/option"
69 internaloption "google.golang.org/api/option/internaloption"
70 htransport "google.golang.org/api/transport/http"
71 )
72
73
74
75 var _ = bytes.NewBuffer
76 var _ = strconv.Itoa
77 var _ = fmt.Sprintf
78 var _ = json.NewDecoder
79 var _ = io.Copy
80 var _ = url.Parse
81 var _ = gensupport.MarshalJSON
82 var _ = googleapi.Version
83 var _ = errors.New
84 var _ = strings.Replace
85 var _ = context.Canceled
86 var _ = internaloption.WithDefaultEndpoint
87 var _ = internal.Version
88
89 const apiId = "gkehub:v2alpha"
90 const apiName = "gkehub"
91 const apiVersion = "v2alpha"
92 const basePath = "https://gkehub.googleapis.com/"
93 const basePathTemplate = "https://gkehub.UNIVERSE_DOMAIN/"
94 const mtlsBasePath = "https://gkehub.mtls.googleapis.com/"
95
96
97 const (
98
99
100 CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platform"
101 )
102
103
104 func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {
105 scopesOption := internaloption.WithDefaultScopes(
106 "https://www.googleapis.com/auth/cloud-platform",
107 )
108
109 opts = append([]option.ClientOption{scopesOption}, opts...)
110 opts = append(opts, internaloption.WithDefaultEndpoint(basePath))
111 opts = append(opts, internaloption.WithDefaultEndpointTemplate(basePathTemplate))
112 opts = append(opts, internaloption.WithDefaultMTLSEndpoint(mtlsBasePath))
113 opts = append(opts, internaloption.EnableNewAuthLibrary())
114 client, endpoint, err := htransport.NewClient(ctx, opts...)
115 if err != nil {
116 return nil, err
117 }
118 s, err := New(client)
119 if err != nil {
120 return nil, err
121 }
122 if endpoint != "" {
123 s.BasePath = endpoint
124 }
125 return s, nil
126 }
127
128
129
130
131
132
133 func New(client *http.Client) (*Service, error) {
134 if client == nil {
135 return nil, errors.New("client is nil")
136 }
137 s := &Service{client: client, BasePath: basePath}
138 s.Projects = NewProjectsService(s)
139 return s, nil
140 }
141
142 type Service struct {
143 client *http.Client
144 BasePath string
145 UserAgent string
146
147 Projects *ProjectsService
148 }
149
150 func (s *Service) userAgent() string {
151 if s.UserAgent == "" {
152 return googleapi.UserAgent
153 }
154 return googleapi.UserAgent + " " + s.UserAgent
155 }
156
157 func NewProjectsService(s *Service) *ProjectsService {
158 rs := &ProjectsService{s: s}
159 rs.Locations = NewProjectsLocationsService(s)
160 return rs
161 }
162
163 type ProjectsService struct {
164 s *Service
165
166 Locations *ProjectsLocationsService
167 }
168
169 func NewProjectsLocationsService(s *Service) *ProjectsLocationsService {
170 rs := &ProjectsLocationsService{s: s}
171 rs.Operations = NewProjectsLocationsOperationsService(s)
172 return rs
173 }
174
175 type ProjectsLocationsService struct {
176 s *Service
177
178 Operations *ProjectsLocationsOperationsService
179 }
180
181 func NewProjectsLocationsOperationsService(s *Service) *ProjectsLocationsOperationsService {
182 rs := &ProjectsLocationsOperationsService{s: s}
183 return rs
184 }
185
186 type ProjectsLocationsOperationsService struct {
187 s *Service
188 }
189
190
191 type CancelOperationRequest struct {
192 }
193
194
195
196
197
198 type Empty struct {
199
200 googleapi.ServerResponse `json:"-"`
201 }
202
203
204
205
206
207
208
209 type GoogleRpcStatus struct {
210
211 Code int64 `json:"code,omitempty"`
212
213
214 Details []googleapi.RawMessage `json:"details,omitempty"`
215
216
217
218 Message string `json:"message,omitempty"`
219
220
221
222
223
224 ForceSendFields []string `json:"-"`
225
226
227
228
229 NullFields []string `json:"-"`
230 }
231
232 func (s *GoogleRpcStatus) MarshalJSON() ([]byte, error) {
233 type NoMethod GoogleRpcStatus
234 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
235 }
236
237
238 type ListLocationsResponse struct {
239
240
241 Locations []*Location `json:"locations,omitempty"`
242
243 NextPageToken string `json:"nextPageToken,omitempty"`
244
245
246 googleapi.ServerResponse `json:"-"`
247
248
249
250
251
252 ForceSendFields []string `json:"-"`
253
254
255
256
257 NullFields []string `json:"-"`
258 }
259
260 func (s *ListLocationsResponse) MarshalJSON() ([]byte, error) {
261 type NoMethod ListLocationsResponse
262 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
263 }
264
265
266 type ListOperationsResponse struct {
267
268 NextPageToken string `json:"nextPageToken,omitempty"`
269
270
271 Operations []*Operation `json:"operations,omitempty"`
272
273
274 googleapi.ServerResponse `json:"-"`
275
276
277
278
279
280 ForceSendFields []string `json:"-"`
281
282
283
284
285 NullFields []string `json:"-"`
286 }
287
288 func (s *ListOperationsResponse) MarshalJSON() ([]byte, error) {
289 type NoMethod ListOperationsResponse
290 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
291 }
292
293
294 type Location struct {
295
296
297 DisplayName string `json:"displayName,omitempty"`
298
299
300 Labels map[string]string `json:"labels,omitempty"`
301
302 LocationId string `json:"locationId,omitempty"`
303
304
305 Metadata googleapi.RawMessage `json:"metadata,omitempty"`
306
307
308
309 Name string `json:"name,omitempty"`
310
311
312 googleapi.ServerResponse `json:"-"`
313
314
315
316
317
318 ForceSendFields []string `json:"-"`
319
320
321
322
323 NullFields []string `json:"-"`
324 }
325
326 func (s *Location) MarshalJSON() ([]byte, error) {
327 type NoMethod Location
328 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
329 }
330
331
332
333 type Operation struct {
334
335
336
337 Done bool `json:"done,omitempty"`
338
339 Error *GoogleRpcStatus `json:"error,omitempty"`
340
341
342
343
344 Metadata googleapi.RawMessage `json:"metadata,omitempty"`
345
346
347
348 Name string `json:"name,omitempty"`
349
350
351
352
353
354
355
356 Response googleapi.RawMessage `json:"response,omitempty"`
357
358
359 googleapi.ServerResponse `json:"-"`
360
361
362
363
364
365 ForceSendFields []string `json:"-"`
366
367
368
369
370 NullFields []string `json:"-"`
371 }
372
373 func (s *Operation) MarshalJSON() ([]byte, error) {
374 type NoMethod Operation
375 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
376 }
377
378 type ProjectsLocationsGetCall struct {
379 s *Service
380 name string
381 urlParams_ gensupport.URLParams
382 ifNoneMatch_ string
383 ctx_ context.Context
384 header_ http.Header
385 }
386
387
388
389
390 func (r *ProjectsLocationsService) Get(name string) *ProjectsLocationsGetCall {
391 c := &ProjectsLocationsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
392 c.name = name
393 return c
394 }
395
396
397
398
399 func (c *ProjectsLocationsGetCall) Fields(s ...googleapi.Field) *ProjectsLocationsGetCall {
400 c.urlParams_.Set("fields", googleapi.CombineFields(s))
401 return c
402 }
403
404
405
406
407 func (c *ProjectsLocationsGetCall) IfNoneMatch(entityTag string) *ProjectsLocationsGetCall {
408 c.ifNoneMatch_ = entityTag
409 return c
410 }
411
412
413 func (c *ProjectsLocationsGetCall) Context(ctx context.Context) *ProjectsLocationsGetCall {
414 c.ctx_ = ctx
415 return c
416 }
417
418
419
420 func (c *ProjectsLocationsGetCall) Header() http.Header {
421 if c.header_ == nil {
422 c.header_ = make(http.Header)
423 }
424 return c.header_
425 }
426
427 func (c *ProjectsLocationsGetCall) doRequest(alt string) (*http.Response, error) {
428 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
429 if c.ifNoneMatch_ != "" {
430 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
431 }
432 var body io.Reader = nil
433 c.urlParams_.Set("alt", alt)
434 c.urlParams_.Set("prettyPrint", "false")
435 urls := googleapi.ResolveRelative(c.s.BasePath, "v2alpha/{+name}")
436 urls += "?" + c.urlParams_.Encode()
437 req, err := http.NewRequest("GET", urls, body)
438 if err != nil {
439 return nil, err
440 }
441 req.Header = reqHeaders
442 googleapi.Expand(req.URL, map[string]string{
443 "name": c.name,
444 })
445 return gensupport.SendRequest(c.ctx_, c.s.client, req)
446 }
447
448
449
450
451
452
453 func (c *ProjectsLocationsGetCall) Do(opts ...googleapi.CallOption) (*Location, error) {
454 gensupport.SetOptions(c.urlParams_, opts...)
455 res, err := c.doRequest("json")
456 if res != nil && res.StatusCode == http.StatusNotModified {
457 if res.Body != nil {
458 res.Body.Close()
459 }
460 return nil, gensupport.WrapError(&googleapi.Error{
461 Code: res.StatusCode,
462 Header: res.Header,
463 })
464 }
465 if err != nil {
466 return nil, err
467 }
468 defer googleapi.CloseBody(res)
469 if err := googleapi.CheckResponse(res); err != nil {
470 return nil, gensupport.WrapError(err)
471 }
472 ret := &Location{
473 ServerResponse: googleapi.ServerResponse{
474 Header: res.Header,
475 HTTPStatusCode: res.StatusCode,
476 },
477 }
478 target := &ret
479 if err := gensupport.DecodeResponse(target, res); err != nil {
480 return nil, err
481 }
482 return ret, nil
483 }
484
485 type ProjectsLocationsListCall struct {
486 s *Service
487 name string
488 urlParams_ gensupport.URLParams
489 ifNoneMatch_ string
490 ctx_ context.Context
491 header_ http.Header
492 }
493
494
495
496
497 func (r *ProjectsLocationsService) List(name string) *ProjectsLocationsListCall {
498 c := &ProjectsLocationsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
499 c.name = name
500 return c
501 }
502
503
504
505
506
507 func (c *ProjectsLocationsListCall) Filter(filter string) *ProjectsLocationsListCall {
508 c.urlParams_.Set("filter", filter)
509 return c
510 }
511
512
513
514 func (c *ProjectsLocationsListCall) PageSize(pageSize int64) *ProjectsLocationsListCall {
515 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
516 return c
517 }
518
519
520
521
522 func (c *ProjectsLocationsListCall) PageToken(pageToken string) *ProjectsLocationsListCall {
523 c.urlParams_.Set("pageToken", pageToken)
524 return c
525 }
526
527
528
529
530 func (c *ProjectsLocationsListCall) Fields(s ...googleapi.Field) *ProjectsLocationsListCall {
531 c.urlParams_.Set("fields", googleapi.CombineFields(s))
532 return c
533 }
534
535
536
537
538 func (c *ProjectsLocationsListCall) IfNoneMatch(entityTag string) *ProjectsLocationsListCall {
539 c.ifNoneMatch_ = entityTag
540 return c
541 }
542
543
544 func (c *ProjectsLocationsListCall) Context(ctx context.Context) *ProjectsLocationsListCall {
545 c.ctx_ = ctx
546 return c
547 }
548
549
550
551 func (c *ProjectsLocationsListCall) Header() http.Header {
552 if c.header_ == nil {
553 c.header_ = make(http.Header)
554 }
555 return c.header_
556 }
557
558 func (c *ProjectsLocationsListCall) doRequest(alt string) (*http.Response, error) {
559 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
560 if c.ifNoneMatch_ != "" {
561 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
562 }
563 var body io.Reader = nil
564 c.urlParams_.Set("alt", alt)
565 c.urlParams_.Set("prettyPrint", "false")
566 urls := googleapi.ResolveRelative(c.s.BasePath, "v2alpha/{+name}/locations")
567 urls += "?" + c.urlParams_.Encode()
568 req, err := http.NewRequest("GET", urls, body)
569 if err != nil {
570 return nil, err
571 }
572 req.Header = reqHeaders
573 googleapi.Expand(req.URL, map[string]string{
574 "name": c.name,
575 })
576 return gensupport.SendRequest(c.ctx_, c.s.client, req)
577 }
578
579
580
581
582
583
584
585 func (c *ProjectsLocationsListCall) Do(opts ...googleapi.CallOption) (*ListLocationsResponse, error) {
586 gensupport.SetOptions(c.urlParams_, opts...)
587 res, err := c.doRequest("json")
588 if res != nil && res.StatusCode == http.StatusNotModified {
589 if res.Body != nil {
590 res.Body.Close()
591 }
592 return nil, gensupport.WrapError(&googleapi.Error{
593 Code: res.StatusCode,
594 Header: res.Header,
595 })
596 }
597 if err != nil {
598 return nil, err
599 }
600 defer googleapi.CloseBody(res)
601 if err := googleapi.CheckResponse(res); err != nil {
602 return nil, gensupport.WrapError(err)
603 }
604 ret := &ListLocationsResponse{
605 ServerResponse: googleapi.ServerResponse{
606 Header: res.Header,
607 HTTPStatusCode: res.StatusCode,
608 },
609 }
610 target := &ret
611 if err := gensupport.DecodeResponse(target, res); err != nil {
612 return nil, err
613 }
614 return ret, nil
615 }
616
617
618
619
620 func (c *ProjectsLocationsListCall) Pages(ctx context.Context, f func(*ListLocationsResponse) error) error {
621 c.ctx_ = ctx
622 defer c.PageToken(c.urlParams_.Get("pageToken"))
623 for {
624 x, err := c.Do()
625 if err != nil {
626 return err
627 }
628 if err := f(x); err != nil {
629 return err
630 }
631 if x.NextPageToken == "" {
632 return nil
633 }
634 c.PageToken(x.NextPageToken)
635 }
636 }
637
638 type ProjectsLocationsOperationsCancelCall struct {
639 s *Service
640 name string
641 canceloperationrequest *CancelOperationRequest
642 urlParams_ gensupport.URLParams
643 ctx_ context.Context
644 header_ http.Header
645 }
646
647
648
649
650
651
652
653
654
655
656
657
658 func (r *ProjectsLocationsOperationsService) Cancel(name string, canceloperationrequest *CancelOperationRequest) *ProjectsLocationsOperationsCancelCall {
659 c := &ProjectsLocationsOperationsCancelCall{s: r.s, urlParams_: make(gensupport.URLParams)}
660 c.name = name
661 c.canceloperationrequest = canceloperationrequest
662 return c
663 }
664
665
666
667
668 func (c *ProjectsLocationsOperationsCancelCall) Fields(s ...googleapi.Field) *ProjectsLocationsOperationsCancelCall {
669 c.urlParams_.Set("fields", googleapi.CombineFields(s))
670 return c
671 }
672
673
674 func (c *ProjectsLocationsOperationsCancelCall) Context(ctx context.Context) *ProjectsLocationsOperationsCancelCall {
675 c.ctx_ = ctx
676 return c
677 }
678
679
680
681 func (c *ProjectsLocationsOperationsCancelCall) Header() http.Header {
682 if c.header_ == nil {
683 c.header_ = make(http.Header)
684 }
685 return c.header_
686 }
687
688 func (c *ProjectsLocationsOperationsCancelCall) doRequest(alt string) (*http.Response, error) {
689 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
690 var body io.Reader = nil
691 body, err := googleapi.WithoutDataWrapper.JSONReader(c.canceloperationrequest)
692 if err != nil {
693 return nil, err
694 }
695 c.urlParams_.Set("alt", alt)
696 c.urlParams_.Set("prettyPrint", "false")
697 urls := googleapi.ResolveRelative(c.s.BasePath, "v2alpha/{+name}:cancel")
698 urls += "?" + c.urlParams_.Encode()
699 req, err := http.NewRequest("POST", urls, body)
700 if err != nil {
701 return nil, err
702 }
703 req.Header = reqHeaders
704 googleapi.Expand(req.URL, map[string]string{
705 "name": c.name,
706 })
707 return gensupport.SendRequest(c.ctx_, c.s.client, req)
708 }
709
710
711
712
713
714
715 func (c *ProjectsLocationsOperationsCancelCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
716 gensupport.SetOptions(c.urlParams_, opts...)
717 res, err := c.doRequest("json")
718 if res != nil && res.StatusCode == http.StatusNotModified {
719 if res.Body != nil {
720 res.Body.Close()
721 }
722 return nil, gensupport.WrapError(&googleapi.Error{
723 Code: res.StatusCode,
724 Header: res.Header,
725 })
726 }
727 if err != nil {
728 return nil, err
729 }
730 defer googleapi.CloseBody(res)
731 if err := googleapi.CheckResponse(res); err != nil {
732 return nil, gensupport.WrapError(err)
733 }
734 ret := &Empty{
735 ServerResponse: googleapi.ServerResponse{
736 Header: res.Header,
737 HTTPStatusCode: res.StatusCode,
738 },
739 }
740 target := &ret
741 if err := gensupport.DecodeResponse(target, res); err != nil {
742 return nil, err
743 }
744 return ret, nil
745 }
746
747 type ProjectsLocationsOperationsGetCall struct {
748 s *Service
749 name string
750 urlParams_ gensupport.URLParams
751 ifNoneMatch_ string
752 ctx_ context.Context
753 header_ http.Header
754 }
755
756
757
758
759
760
761 func (r *ProjectsLocationsOperationsService) Get(name string) *ProjectsLocationsOperationsGetCall {
762 c := &ProjectsLocationsOperationsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
763 c.name = name
764 return c
765 }
766
767
768
769
770 func (c *ProjectsLocationsOperationsGetCall) Fields(s ...googleapi.Field) *ProjectsLocationsOperationsGetCall {
771 c.urlParams_.Set("fields", googleapi.CombineFields(s))
772 return c
773 }
774
775
776
777
778 func (c *ProjectsLocationsOperationsGetCall) IfNoneMatch(entityTag string) *ProjectsLocationsOperationsGetCall {
779 c.ifNoneMatch_ = entityTag
780 return c
781 }
782
783
784 func (c *ProjectsLocationsOperationsGetCall) Context(ctx context.Context) *ProjectsLocationsOperationsGetCall {
785 c.ctx_ = ctx
786 return c
787 }
788
789
790
791 func (c *ProjectsLocationsOperationsGetCall) Header() http.Header {
792 if c.header_ == nil {
793 c.header_ = make(http.Header)
794 }
795 return c.header_
796 }
797
798 func (c *ProjectsLocationsOperationsGetCall) doRequest(alt string) (*http.Response, error) {
799 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
800 if c.ifNoneMatch_ != "" {
801 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
802 }
803 var body io.Reader = nil
804 c.urlParams_.Set("alt", alt)
805 c.urlParams_.Set("prettyPrint", "false")
806 urls := googleapi.ResolveRelative(c.s.BasePath, "v2alpha/{+name}")
807 urls += "?" + c.urlParams_.Encode()
808 req, err := http.NewRequest("GET", urls, body)
809 if err != nil {
810 return nil, err
811 }
812 req.Header = reqHeaders
813 googleapi.Expand(req.URL, map[string]string{
814 "name": c.name,
815 })
816 return gensupport.SendRequest(c.ctx_, c.s.client, req)
817 }
818
819
820
821
822
823
824 func (c *ProjectsLocationsOperationsGetCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
825 gensupport.SetOptions(c.urlParams_, opts...)
826 res, err := c.doRequest("json")
827 if res != nil && res.StatusCode == http.StatusNotModified {
828 if res.Body != nil {
829 res.Body.Close()
830 }
831 return nil, gensupport.WrapError(&googleapi.Error{
832 Code: res.StatusCode,
833 Header: res.Header,
834 })
835 }
836 if err != nil {
837 return nil, err
838 }
839 defer googleapi.CloseBody(res)
840 if err := googleapi.CheckResponse(res); err != nil {
841 return nil, gensupport.WrapError(err)
842 }
843 ret := &Operation{
844 ServerResponse: googleapi.ServerResponse{
845 Header: res.Header,
846 HTTPStatusCode: res.StatusCode,
847 },
848 }
849 target := &ret
850 if err := gensupport.DecodeResponse(target, res); err != nil {
851 return nil, err
852 }
853 return ret, nil
854 }
855
856 type ProjectsLocationsOperationsListCall struct {
857 s *Service
858 name string
859 urlParams_ gensupport.URLParams
860 ifNoneMatch_ string
861 ctx_ context.Context
862 header_ http.Header
863 }
864
865
866
867
868
869 func (r *ProjectsLocationsOperationsService) List(name string) *ProjectsLocationsOperationsListCall {
870 c := &ProjectsLocationsOperationsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
871 c.name = name
872 return c
873 }
874
875
876 func (c *ProjectsLocationsOperationsListCall) Filter(filter string) *ProjectsLocationsOperationsListCall {
877 c.urlParams_.Set("filter", filter)
878 return c
879 }
880
881
882
883 func (c *ProjectsLocationsOperationsListCall) PageSize(pageSize int64) *ProjectsLocationsOperationsListCall {
884 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
885 return c
886 }
887
888
889
890 func (c *ProjectsLocationsOperationsListCall) PageToken(pageToken string) *ProjectsLocationsOperationsListCall {
891 c.urlParams_.Set("pageToken", pageToken)
892 return c
893 }
894
895
896
897
898 func (c *ProjectsLocationsOperationsListCall) Fields(s ...googleapi.Field) *ProjectsLocationsOperationsListCall {
899 c.urlParams_.Set("fields", googleapi.CombineFields(s))
900 return c
901 }
902
903
904
905
906 func (c *ProjectsLocationsOperationsListCall) IfNoneMatch(entityTag string) *ProjectsLocationsOperationsListCall {
907 c.ifNoneMatch_ = entityTag
908 return c
909 }
910
911
912 func (c *ProjectsLocationsOperationsListCall) Context(ctx context.Context) *ProjectsLocationsOperationsListCall {
913 c.ctx_ = ctx
914 return c
915 }
916
917
918
919 func (c *ProjectsLocationsOperationsListCall) Header() http.Header {
920 if c.header_ == nil {
921 c.header_ = make(http.Header)
922 }
923 return c.header_
924 }
925
926 func (c *ProjectsLocationsOperationsListCall) doRequest(alt string) (*http.Response, error) {
927 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
928 if c.ifNoneMatch_ != "" {
929 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
930 }
931 var body io.Reader = nil
932 c.urlParams_.Set("alt", alt)
933 c.urlParams_.Set("prettyPrint", "false")
934 urls := googleapi.ResolveRelative(c.s.BasePath, "v2alpha/{+name}/operations")
935 urls += "?" + c.urlParams_.Encode()
936 req, err := http.NewRequest("GET", urls, body)
937 if err != nil {
938 return nil, err
939 }
940 req.Header = reqHeaders
941 googleapi.Expand(req.URL, map[string]string{
942 "name": c.name,
943 })
944 return gensupport.SendRequest(c.ctx_, c.s.client, req)
945 }
946
947
948
949
950
951
952
953 func (c *ProjectsLocationsOperationsListCall) Do(opts ...googleapi.CallOption) (*ListOperationsResponse, error) {
954 gensupport.SetOptions(c.urlParams_, opts...)
955 res, err := c.doRequest("json")
956 if res != nil && res.StatusCode == http.StatusNotModified {
957 if res.Body != nil {
958 res.Body.Close()
959 }
960 return nil, gensupport.WrapError(&googleapi.Error{
961 Code: res.StatusCode,
962 Header: res.Header,
963 })
964 }
965 if err != nil {
966 return nil, err
967 }
968 defer googleapi.CloseBody(res)
969 if err := googleapi.CheckResponse(res); err != nil {
970 return nil, gensupport.WrapError(err)
971 }
972 ret := &ListOperationsResponse{
973 ServerResponse: googleapi.ServerResponse{
974 Header: res.Header,
975 HTTPStatusCode: res.StatusCode,
976 },
977 }
978 target := &ret
979 if err := gensupport.DecodeResponse(target, res); err != nil {
980 return nil, err
981 }
982 return ret, nil
983 }
984
985
986
987
988 func (c *ProjectsLocationsOperationsListCall) Pages(ctx context.Context, f func(*ListOperationsResponse) error) error {
989 c.ctx_ = ctx
990 defer c.PageToken(c.urlParams_.Get("pageToken"))
991 for {
992 x, err := c.Do()
993 if err != nil {
994 return err
995 }
996 if err := f(x); err != nil {
997 return err
998 }
999 if x.NextPageToken == "" {
1000 return nil
1001 }
1002 c.PageToken(x.NextPageToken)
1003 }
1004 }
1005
View as plain text