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 package bigqueryreservation
43
44 import (
45 "bytes"
46 "context"
47 "encoding/json"
48 "errors"
49 "fmt"
50 "io"
51 "net/http"
52 "net/url"
53 "strconv"
54 "strings"
55
56 googleapi "google.golang.org/api/googleapi"
57 gensupport "google.golang.org/api/internal/gensupport"
58 option "google.golang.org/api/option"
59 internaloption "google.golang.org/api/option/internaloption"
60 htransport "google.golang.org/api/transport/http"
61 )
62
63
64
65 var _ = bytes.NewBuffer
66 var _ = strconv.Itoa
67 var _ = fmt.Sprintf
68 var _ = json.NewDecoder
69 var _ = io.Copy
70 var _ = url.Parse
71 var _ = gensupport.MarshalJSON
72 var _ = googleapi.Version
73 var _ = errors.New
74 var _ = strings.Replace
75 var _ = context.Canceled
76 var _ = internaloption.WithDefaultEndpoint
77
78 const apiId = "bigqueryreservation:v1alpha2"
79 const apiName = "bigqueryreservation"
80 const apiVersion = "v1alpha2"
81 const basePath = "https://bigqueryreservation.googleapis.com/"
82 const mtlsBasePath = "https://bigqueryreservation.mtls.googleapis.com/"
83
84
85 const (
86
87 BigqueryScope = "https://www.googleapis.com/auth/bigquery"
88
89
90 CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platform"
91 )
92
93
94 func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {
95 scopesOption := option.WithScopes(
96 "https://www.googleapis.com/auth/bigquery",
97 "https://www.googleapis.com/auth/cloud-platform",
98 )
99
100 opts = append([]option.ClientOption{scopesOption}, opts...)
101 opts = append(opts, internaloption.WithDefaultEndpoint(basePath))
102 opts = append(opts, internaloption.WithDefaultMTLSEndpoint(mtlsBasePath))
103 client, endpoint, err := htransport.NewClient(ctx, opts...)
104 if err != nil {
105 return nil, err
106 }
107 s, err := New(client)
108 if err != nil {
109 return nil, err
110 }
111 if endpoint != "" {
112 s.BasePath = endpoint
113 }
114 return s, nil
115 }
116
117
118
119
120
121
122 func New(client *http.Client) (*Service, error) {
123 if client == nil {
124 return nil, errors.New("client is nil")
125 }
126 s := &Service{client: client, BasePath: basePath}
127 s.Projects = NewProjectsService(s)
128 return s, nil
129 }
130
131 type Service struct {
132 client *http.Client
133 BasePath string
134 UserAgent string
135
136 Projects *ProjectsService
137 }
138
139 func (s *Service) userAgent() string {
140 if s.UserAgent == "" {
141 return googleapi.UserAgent
142 }
143 return googleapi.UserAgent + " " + s.UserAgent
144 }
145
146 func NewProjectsService(s *Service) *ProjectsService {
147 rs := &ProjectsService{s: s}
148 rs.Locations = NewProjectsLocationsService(s)
149 return rs
150 }
151
152 type ProjectsService struct {
153 s *Service
154
155 Locations *ProjectsLocationsService
156 }
157
158 func NewProjectsLocationsService(s *Service) *ProjectsLocationsService {
159 rs := &ProjectsLocationsService{s: s}
160 rs.Operations = NewProjectsLocationsOperationsService(s)
161 rs.ReservationGrants = NewProjectsLocationsReservationGrantsService(s)
162 rs.Reservations = NewProjectsLocationsReservationsService(s)
163 return rs
164 }
165
166 type ProjectsLocationsService struct {
167 s *Service
168
169 Operations *ProjectsLocationsOperationsService
170
171 ReservationGrants *ProjectsLocationsReservationGrantsService
172
173 Reservations *ProjectsLocationsReservationsService
174 }
175
176 func NewProjectsLocationsOperationsService(s *Service) *ProjectsLocationsOperationsService {
177 rs := &ProjectsLocationsOperationsService{s: s}
178 return rs
179 }
180
181 type ProjectsLocationsOperationsService struct {
182 s *Service
183 }
184
185 func NewProjectsLocationsReservationGrantsService(s *Service) *ProjectsLocationsReservationGrantsService {
186 rs := &ProjectsLocationsReservationGrantsService{s: s}
187 return rs
188 }
189
190 type ProjectsLocationsReservationGrantsService struct {
191 s *Service
192 }
193
194 func NewProjectsLocationsReservationsService(s *Service) *ProjectsLocationsReservationsService {
195 rs := &ProjectsLocationsReservationsService{s: s}
196 rs.SlotPools = NewProjectsLocationsReservationsSlotPoolsService(s)
197 return rs
198 }
199
200 type ProjectsLocationsReservationsService struct {
201 s *Service
202
203 SlotPools *ProjectsLocationsReservationsSlotPoolsService
204 }
205
206 func NewProjectsLocationsReservationsSlotPoolsService(s *Service) *ProjectsLocationsReservationsSlotPoolsService {
207 rs := &ProjectsLocationsReservationsSlotPoolsService{s: s}
208 return rs
209 }
210
211 type ProjectsLocationsReservationsSlotPoolsService struct {
212 s *Service
213 }
214
215
216
217 type CreateSlotPoolMetadata struct {
218
219
220
221 SlotPool string `json:"slotPool,omitempty"`
222
223
224
225
226
227
228
229 ForceSendFields []string `json:"-"`
230
231
232
233
234
235
236
237 NullFields []string `json:"-"`
238 }
239
240 func (s *CreateSlotPoolMetadata) MarshalJSON() ([]byte, error) {
241 type NoMethod CreateSlotPoolMetadata
242 raw := NoMethod(*s)
243 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
244 }
245
246
247
248
249
250
251
252 type Empty struct {
253
254
255 googleapi.ServerResponse `json:"-"`
256 }
257
258
259
260 type ListReservationGrantsResponse struct {
261
262
263 NextPageToken string `json:"nextPageToken,omitempty"`
264
265
266 ReservationGrants []*ReservationGrant `json:"reservationGrants,omitempty"`
267
268
269
270 googleapi.ServerResponse `json:"-"`
271
272
273
274
275
276
277
278 ForceSendFields []string `json:"-"`
279
280
281
282
283
284
285
286 NullFields []string `json:"-"`
287 }
288
289 func (s *ListReservationGrantsResponse) MarshalJSON() ([]byte, error) {
290 type NoMethod ListReservationGrantsResponse
291 raw := NoMethod(*s)
292 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
293 }
294
295
296
297 type ListReservationsResponse struct {
298
299
300 NextPageToken string `json:"nextPageToken,omitempty"`
301
302
303 Reservations []*Reservation `json:"reservations,omitempty"`
304
305
306
307 googleapi.ServerResponse `json:"-"`
308
309
310
311
312
313
314
315 ForceSendFields []string `json:"-"`
316
317
318
319
320
321
322
323 NullFields []string `json:"-"`
324 }
325
326 func (s *ListReservationsResponse) MarshalJSON() ([]byte, error) {
327 type NoMethod ListReservationsResponse
328 raw := NoMethod(*s)
329 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
330 }
331
332
333
334 type ListSlotPoolsResponse struct {
335
336
337 NextPageToken string `json:"nextPageToken,omitempty"`
338
339
340 SlotPools []*SlotPool `json:"slotPools,omitempty"`
341
342
343
344 googleapi.ServerResponse `json:"-"`
345
346
347
348
349
350
351
352 ForceSendFields []string `json:"-"`
353
354
355
356
357
358
359
360 NullFields []string `json:"-"`
361 }
362
363 func (s *ListSlotPoolsResponse) MarshalJSON() ([]byte, error) {
364 type NoMethod ListSlotPoolsResponse
365 raw := NoMethod(*s)
366 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
367 }
368
369
370
371 type Operation struct {
372
373
374
375 Done bool `json:"done,omitempty"`
376
377
378
379 Error *Status `json:"error,omitempty"`
380
381
382
383
384
385
386 Metadata googleapi.RawMessage `json:"metadata,omitempty"`
387
388
389
390
391
392 Name string `json:"name,omitempty"`
393
394
395
396
397
398
399
400
401
402 Response googleapi.RawMessage `json:"response,omitempty"`
403
404
405
406 googleapi.ServerResponse `json:"-"`
407
408
409
410
411
412
413
414 ForceSendFields []string `json:"-"`
415
416
417
418
419
420
421
422 NullFields []string `json:"-"`
423 }
424
425 func (s *Operation) MarshalJSON() ([]byte, error) {
426 type NoMethod Operation
427 raw := NoMethod(*s)
428 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
429 }
430
431
432
433 type Reservation struct {
434
435
436
437
438 Name string `json:"name,omitempty"`
439
440
441
442
443
444
445
446
447
448 SlotCapacity int64 `json:"slotCapacity,omitempty,string"`
449
450
451
452
453
454
455
456
457
458
459 UseParentReservation bool `json:"useParentReservation,omitempty"`
460
461
462
463 googleapi.ServerResponse `json:"-"`
464
465
466
467
468
469
470
471 ForceSendFields []string `json:"-"`
472
473
474
475
476
477
478
479 NullFields []string `json:"-"`
480 }
481
482 func (s *Reservation) MarshalJSON() ([]byte, error) {
483 type NoMethod Reservation
484 raw := NoMethod(*s)
485 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
486 }
487
488
489
490 type ReservationGrant struct {
491
492
493 Grantee string `json:"grantee,omitempty"`
494
495
496
497
498
499
500
501
502
503 JobType string `json:"jobType,omitempty"`
504
505
506
507 Name string `json:"name,omitempty"`
508
509
510
511
512
513 Reservation string `json:"reservation,omitempty"`
514
515
516
517
518
519
520
521
522 State string `json:"state,omitempty"`
523
524
525
526 googleapi.ServerResponse `json:"-"`
527
528
529
530
531
532
533
534 ForceSendFields []string `json:"-"`
535
536
537
538
539
540
541
542 NullFields []string `json:"-"`
543 }
544
545 func (s *ReservationGrant) MarshalJSON() ([]byte, error) {
546 type NoMethod ReservationGrant
547 raw := NoMethod(*s)
548 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
549 }
550
551
552
553 type SearchReservationGrantsResponse struct {
554
555
556 NextPageToken string `json:"nextPageToken,omitempty"`
557
558
559 ReservationGrants []*ReservationGrant `json:"reservationGrants,omitempty"`
560
561
562
563 googleapi.ServerResponse `json:"-"`
564
565
566
567
568
569
570
571 ForceSendFields []string `json:"-"`
572
573
574
575
576
577
578
579 NullFields []string `json:"-"`
580 }
581
582 func (s *SearchReservationGrantsResponse) MarshalJSON() ([]byte, error) {
583 type NoMethod SearchReservationGrantsResponse
584 raw := NoMethod(*s)
585 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
586 }
587
588
589
590
591
592
593
594
595
596 type SlotPool struct {
597
598
599
600
601
602 CommitmentEndTime string `json:"commitmentEndTime,omitempty"`
603
604
605
606 FailureStatus *Status `json:"failureStatus,omitempty"`
607
608
609
610
611 Name string `json:"name,omitempty"`
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631 Plan string `json:"plan,omitempty"`
632
633
634 SlotCount int64 `json:"slotCount,omitempty,string"`
635
636
637
638
639
640
641
642
643
644
645 State string `json:"state,omitempty"`
646
647
648
649 googleapi.ServerResponse `json:"-"`
650
651
652
653
654
655
656
657 ForceSendFields []string `json:"-"`
658
659
660
661
662
663
664
665
666 NullFields []string `json:"-"`
667 }
668
669 func (s *SlotPool) MarshalJSON() ([]byte, error) {
670 type NoMethod SlotPool
671 raw := NoMethod(*s)
672 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
673 }
674
675
676
677
678
679
680
681
682 type Status struct {
683
684
685 Code int64 `json:"code,omitempty"`
686
687
688
689 Details []googleapi.RawMessage `json:"details,omitempty"`
690
691
692
693
694 Message string `json:"message,omitempty"`
695
696
697
698
699
700
701
702 ForceSendFields []string `json:"-"`
703
704
705
706
707
708
709
710 NullFields []string `json:"-"`
711 }
712
713 func (s *Status) MarshalJSON() ([]byte, error) {
714 type NoMethod Status
715 raw := NoMethod(*s)
716 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
717 }
718
719
720
721 type ProjectsLocationsSearchReservationGrantsCall struct {
722 s *Service
723 parent string
724 urlParams_ gensupport.URLParams
725 ifNoneMatch_ string
726 ctx_ context.Context
727 header_ http.Header
728 }
729
730
731
732
733
734
735
736
737
738
739
740
741 func (r *ProjectsLocationsService) SearchReservationGrants(parent string) *ProjectsLocationsSearchReservationGrantsCall {
742 c := &ProjectsLocationsSearchReservationGrantsCall{s: r.s, urlParams_: make(gensupport.URLParams)}
743 c.parent = parent
744 return c
745 }
746
747
748
749 func (c *ProjectsLocationsSearchReservationGrantsCall) PageSize(pageSize int64) *ProjectsLocationsSearchReservationGrantsCall {
750 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
751 return c
752 }
753
754
755
756 func (c *ProjectsLocationsSearchReservationGrantsCall) PageToken(pageToken string) *ProjectsLocationsSearchReservationGrantsCall {
757 c.urlParams_.Set("pageToken", pageToken)
758 return c
759 }
760
761
762
763
764 func (c *ProjectsLocationsSearchReservationGrantsCall) Query(query string) *ProjectsLocationsSearchReservationGrantsCall {
765 c.urlParams_.Set("query", query)
766 return c
767 }
768
769
770
771
772 func (c *ProjectsLocationsSearchReservationGrantsCall) Fields(s ...googleapi.Field) *ProjectsLocationsSearchReservationGrantsCall {
773 c.urlParams_.Set("fields", googleapi.CombineFields(s))
774 return c
775 }
776
777
778
779
780
781
782 func (c *ProjectsLocationsSearchReservationGrantsCall) IfNoneMatch(entityTag string) *ProjectsLocationsSearchReservationGrantsCall {
783 c.ifNoneMatch_ = entityTag
784 return c
785 }
786
787
788
789
790 func (c *ProjectsLocationsSearchReservationGrantsCall) Context(ctx context.Context) *ProjectsLocationsSearchReservationGrantsCall {
791 c.ctx_ = ctx
792 return c
793 }
794
795
796
797 func (c *ProjectsLocationsSearchReservationGrantsCall) Header() http.Header {
798 if c.header_ == nil {
799 c.header_ = make(http.Header)
800 }
801 return c.header_
802 }
803
804 func (c *ProjectsLocationsSearchReservationGrantsCall) doRequest(alt string) (*http.Response, error) {
805 reqHeaders := make(http.Header)
806 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201209")
807 for k, v := range c.header_ {
808 reqHeaders[k] = v
809 }
810 reqHeaders.Set("User-Agent", c.s.userAgent())
811 if c.ifNoneMatch_ != "" {
812 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
813 }
814 var body io.Reader = nil
815 c.urlParams_.Set("alt", alt)
816 c.urlParams_.Set("prettyPrint", "false")
817 urls := googleapi.ResolveRelative(c.s.BasePath, "v1alpha2/{+parent}:SearchReservationGrants")
818 urls += "?" + c.urlParams_.Encode()
819 req, err := http.NewRequest("GET", urls, body)
820 if err != nil {
821 return nil, err
822 }
823 req.Header = reqHeaders
824 googleapi.Expand(req.URL, map[string]string{
825 "parent": c.parent,
826 })
827 return gensupport.SendRequest(c.ctx_, c.s.client, req)
828 }
829
830
831
832
833
834
835
836
837 func (c *ProjectsLocationsSearchReservationGrantsCall) Do(opts ...googleapi.CallOption) (*SearchReservationGrantsResponse, error) {
838 gensupport.SetOptions(c.urlParams_, opts...)
839 res, err := c.doRequest("json")
840 if res != nil && res.StatusCode == http.StatusNotModified {
841 if res.Body != nil {
842 res.Body.Close()
843 }
844 return nil, &googleapi.Error{
845 Code: res.StatusCode,
846 Header: res.Header,
847 }
848 }
849 if err != nil {
850 return nil, err
851 }
852 defer googleapi.CloseBody(res)
853 if err := googleapi.CheckResponse(res); err != nil {
854 return nil, err
855 }
856 ret := &SearchReservationGrantsResponse{
857 ServerResponse: googleapi.ServerResponse{
858 Header: res.Header,
859 HTTPStatusCode: res.StatusCode,
860 },
861 }
862 target := &ret
863 if err := gensupport.DecodeResponse(target, res); err != nil {
864 return nil, err
865 }
866 return ret, nil
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910 }
911
912
913
914
915 func (c *ProjectsLocationsSearchReservationGrantsCall) Pages(ctx context.Context, f func(*SearchReservationGrantsResponse) error) error {
916 c.ctx_ = ctx
917 defer c.PageToken(c.urlParams_.Get("pageToken"))
918 for {
919 x, err := c.Do()
920 if err != nil {
921 return err
922 }
923 if err := f(x); err != nil {
924 return err
925 }
926 if x.NextPageToken == "" {
927 return nil
928 }
929 c.PageToken(x.NextPageToken)
930 }
931 }
932
933
934
935 type ProjectsLocationsOperationsCancelCall struct {
936 s *Service
937 name string
938 urlParams_ gensupport.URLParams
939 ctx_ context.Context
940 header_ http.Header
941 }
942
943
944
945
946
947
948
949
950
951
952
953 func (r *ProjectsLocationsOperationsService) Cancel(name string) *ProjectsLocationsOperationsCancelCall {
954 c := &ProjectsLocationsOperationsCancelCall{s: r.s, urlParams_: make(gensupport.URLParams)}
955 c.name = name
956 return c
957 }
958
959
960
961
962 func (c *ProjectsLocationsOperationsCancelCall) Fields(s ...googleapi.Field) *ProjectsLocationsOperationsCancelCall {
963 c.urlParams_.Set("fields", googleapi.CombineFields(s))
964 return c
965 }
966
967
968
969
970 func (c *ProjectsLocationsOperationsCancelCall) Context(ctx context.Context) *ProjectsLocationsOperationsCancelCall {
971 c.ctx_ = ctx
972 return c
973 }
974
975
976
977 func (c *ProjectsLocationsOperationsCancelCall) Header() http.Header {
978 if c.header_ == nil {
979 c.header_ = make(http.Header)
980 }
981 return c.header_
982 }
983
984 func (c *ProjectsLocationsOperationsCancelCall) doRequest(alt string) (*http.Response, error) {
985 reqHeaders := make(http.Header)
986 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201209")
987 for k, v := range c.header_ {
988 reqHeaders[k] = v
989 }
990 reqHeaders.Set("User-Agent", c.s.userAgent())
991 var body io.Reader = nil
992 c.urlParams_.Set("alt", alt)
993 c.urlParams_.Set("prettyPrint", "false")
994 urls := googleapi.ResolveRelative(c.s.BasePath, "v1alpha2/{+name}:cancel")
995 urls += "?" + c.urlParams_.Encode()
996 req, err := http.NewRequest("POST", urls, body)
997 if err != nil {
998 return nil, err
999 }
1000 req.Header = reqHeaders
1001 googleapi.Expand(req.URL, map[string]string{
1002 "name": c.name,
1003 })
1004 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1005 }
1006
1007
1008
1009
1010
1011
1012
1013
1014 func (c *ProjectsLocationsOperationsCancelCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
1015 gensupport.SetOptions(c.urlParams_, opts...)
1016 res, err := c.doRequest("json")
1017 if res != nil && res.StatusCode == http.StatusNotModified {
1018 if res.Body != nil {
1019 res.Body.Close()
1020 }
1021 return nil, &googleapi.Error{
1022 Code: res.StatusCode,
1023 Header: res.Header,
1024 }
1025 }
1026 if err != nil {
1027 return nil, err
1028 }
1029 defer googleapi.CloseBody(res)
1030 if err := googleapi.CheckResponse(res); err != nil {
1031 return nil, err
1032 }
1033 ret := &Empty{
1034 ServerResponse: googleapi.ServerResponse{
1035 Header: res.Header,
1036 HTTPStatusCode: res.StatusCode,
1037 },
1038 }
1039 target := &ret
1040 if err := gensupport.DecodeResponse(target, res); err != nil {
1041 return nil, err
1042 }
1043 return ret, nil
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071 }
1072
1073
1074
1075 type ProjectsLocationsOperationsGetCall struct {
1076 s *Service
1077 name string
1078 urlParams_ gensupport.URLParams
1079 ifNoneMatch_ string
1080 ctx_ context.Context
1081 header_ http.Header
1082 }
1083
1084
1085
1086
1087 func (r *ProjectsLocationsOperationsService) Get(name string) *ProjectsLocationsOperationsGetCall {
1088 c := &ProjectsLocationsOperationsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1089 c.name = name
1090 return c
1091 }
1092
1093
1094
1095
1096 func (c *ProjectsLocationsOperationsGetCall) Fields(s ...googleapi.Field) *ProjectsLocationsOperationsGetCall {
1097 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1098 return c
1099 }
1100
1101
1102
1103
1104
1105
1106 func (c *ProjectsLocationsOperationsGetCall) IfNoneMatch(entityTag string) *ProjectsLocationsOperationsGetCall {
1107 c.ifNoneMatch_ = entityTag
1108 return c
1109 }
1110
1111
1112
1113
1114 func (c *ProjectsLocationsOperationsGetCall) Context(ctx context.Context) *ProjectsLocationsOperationsGetCall {
1115 c.ctx_ = ctx
1116 return c
1117 }
1118
1119
1120
1121 func (c *ProjectsLocationsOperationsGetCall) Header() http.Header {
1122 if c.header_ == nil {
1123 c.header_ = make(http.Header)
1124 }
1125 return c.header_
1126 }
1127
1128 func (c *ProjectsLocationsOperationsGetCall) doRequest(alt string) (*http.Response, error) {
1129 reqHeaders := make(http.Header)
1130 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201209")
1131 for k, v := range c.header_ {
1132 reqHeaders[k] = v
1133 }
1134 reqHeaders.Set("User-Agent", c.s.userAgent())
1135 if c.ifNoneMatch_ != "" {
1136 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
1137 }
1138 var body io.Reader = nil
1139 c.urlParams_.Set("alt", alt)
1140 c.urlParams_.Set("prettyPrint", "false")
1141 urls := googleapi.ResolveRelative(c.s.BasePath, "v1alpha2/{+name}")
1142 urls += "?" + c.urlParams_.Encode()
1143 req, err := http.NewRequest("GET", urls, body)
1144 if err != nil {
1145 return nil, err
1146 }
1147 req.Header = reqHeaders
1148 googleapi.Expand(req.URL, map[string]string{
1149 "name": c.name,
1150 })
1151 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1152 }
1153
1154
1155
1156
1157
1158
1159
1160
1161 func (c *ProjectsLocationsOperationsGetCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
1162 gensupport.SetOptions(c.urlParams_, opts...)
1163 res, err := c.doRequest("json")
1164 if res != nil && res.StatusCode == http.StatusNotModified {
1165 if res.Body != nil {
1166 res.Body.Close()
1167 }
1168 return nil, &googleapi.Error{
1169 Code: res.StatusCode,
1170 Header: res.Header,
1171 }
1172 }
1173 if err != nil {
1174 return nil, err
1175 }
1176 defer googleapi.CloseBody(res)
1177 if err := googleapi.CheckResponse(res); err != nil {
1178 return nil, err
1179 }
1180 ret := &Operation{
1181 ServerResponse: googleapi.ServerResponse{
1182 Header: res.Header,
1183 HTTPStatusCode: res.StatusCode,
1184 },
1185 }
1186 target := &ret
1187 if err := gensupport.DecodeResponse(target, res); err != nil {
1188 return nil, err
1189 }
1190 return ret, nil
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218 }
1219
1220
1221
1222 type ProjectsLocationsReservationGrantsCreateCall struct {
1223 s *Service
1224 parent string
1225 reservationgrant *ReservationGrant
1226 urlParams_ gensupport.URLParams
1227 ctx_ context.Context
1228 header_ http.Header
1229 }
1230
1231
1232
1233
1234
1235
1236 func (r *ProjectsLocationsReservationGrantsService) Create(parent string, reservationgrant *ReservationGrant) *ProjectsLocationsReservationGrantsCreateCall {
1237 c := &ProjectsLocationsReservationGrantsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1238 c.parent = parent
1239 c.reservationgrant = reservationgrant
1240 return c
1241 }
1242
1243
1244
1245
1246 func (c *ProjectsLocationsReservationGrantsCreateCall) Fields(s ...googleapi.Field) *ProjectsLocationsReservationGrantsCreateCall {
1247 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1248 return c
1249 }
1250
1251
1252
1253
1254 func (c *ProjectsLocationsReservationGrantsCreateCall) Context(ctx context.Context) *ProjectsLocationsReservationGrantsCreateCall {
1255 c.ctx_ = ctx
1256 return c
1257 }
1258
1259
1260
1261 func (c *ProjectsLocationsReservationGrantsCreateCall) Header() http.Header {
1262 if c.header_ == nil {
1263 c.header_ = make(http.Header)
1264 }
1265 return c.header_
1266 }
1267
1268 func (c *ProjectsLocationsReservationGrantsCreateCall) doRequest(alt string) (*http.Response, error) {
1269 reqHeaders := make(http.Header)
1270 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201209")
1271 for k, v := range c.header_ {
1272 reqHeaders[k] = v
1273 }
1274 reqHeaders.Set("User-Agent", c.s.userAgent())
1275 var body io.Reader = nil
1276 body, err := googleapi.WithoutDataWrapper.JSONReader(c.reservationgrant)
1277 if err != nil {
1278 return nil, err
1279 }
1280 reqHeaders.Set("Content-Type", "application/json")
1281 c.urlParams_.Set("alt", alt)
1282 c.urlParams_.Set("prettyPrint", "false")
1283 urls := googleapi.ResolveRelative(c.s.BasePath, "v1alpha2/{+parent}/reservationGrants")
1284 urls += "?" + c.urlParams_.Encode()
1285 req, err := http.NewRequest("POST", urls, body)
1286 if err != nil {
1287 return nil, err
1288 }
1289 req.Header = reqHeaders
1290 googleapi.Expand(req.URL, map[string]string{
1291 "parent": c.parent,
1292 })
1293 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1294 }
1295
1296
1297
1298
1299
1300
1301
1302
1303 func (c *ProjectsLocationsReservationGrantsCreateCall) Do(opts ...googleapi.CallOption) (*ReservationGrant, error) {
1304 gensupport.SetOptions(c.urlParams_, opts...)
1305 res, err := c.doRequest("json")
1306 if res != nil && res.StatusCode == http.StatusNotModified {
1307 if res.Body != nil {
1308 res.Body.Close()
1309 }
1310 return nil, &googleapi.Error{
1311 Code: res.StatusCode,
1312 Header: res.Header,
1313 }
1314 }
1315 if err != nil {
1316 return nil, err
1317 }
1318 defer googleapi.CloseBody(res)
1319 if err := googleapi.CheckResponse(res); err != nil {
1320 return nil, err
1321 }
1322 ret := &ReservationGrant{
1323 ServerResponse: googleapi.ServerResponse{
1324 Header: res.Header,
1325 HTTPStatusCode: res.StatusCode,
1326 },
1327 }
1328 target := &ret
1329 if err := gensupport.DecodeResponse(target, res); err != nil {
1330 return nil, err
1331 }
1332 return ret, nil
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363 }
1364
1365
1366
1367 type ProjectsLocationsReservationGrantsDeleteCall struct {
1368 s *Service
1369 name string
1370 urlParams_ gensupport.URLParams
1371 ctx_ context.Context
1372 header_ http.Header
1373 }
1374
1375
1376
1377
1378
1379
1380
1381 func (r *ProjectsLocationsReservationGrantsService) Delete(name string) *ProjectsLocationsReservationGrantsDeleteCall {
1382 c := &ProjectsLocationsReservationGrantsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1383 c.name = name
1384 return c
1385 }
1386
1387
1388
1389
1390 func (c *ProjectsLocationsReservationGrantsDeleteCall) Fields(s ...googleapi.Field) *ProjectsLocationsReservationGrantsDeleteCall {
1391 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1392 return c
1393 }
1394
1395
1396
1397
1398 func (c *ProjectsLocationsReservationGrantsDeleteCall) Context(ctx context.Context) *ProjectsLocationsReservationGrantsDeleteCall {
1399 c.ctx_ = ctx
1400 return c
1401 }
1402
1403
1404
1405 func (c *ProjectsLocationsReservationGrantsDeleteCall) Header() http.Header {
1406 if c.header_ == nil {
1407 c.header_ = make(http.Header)
1408 }
1409 return c.header_
1410 }
1411
1412 func (c *ProjectsLocationsReservationGrantsDeleteCall) doRequest(alt string) (*http.Response, error) {
1413 reqHeaders := make(http.Header)
1414 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201209")
1415 for k, v := range c.header_ {
1416 reqHeaders[k] = v
1417 }
1418 reqHeaders.Set("User-Agent", c.s.userAgent())
1419 var body io.Reader = nil
1420 c.urlParams_.Set("alt", alt)
1421 c.urlParams_.Set("prettyPrint", "false")
1422 urls := googleapi.ResolveRelative(c.s.BasePath, "v1alpha2/{+name}")
1423 urls += "?" + c.urlParams_.Encode()
1424 req, err := http.NewRequest("DELETE", urls, body)
1425 if err != nil {
1426 return nil, err
1427 }
1428 req.Header = reqHeaders
1429 googleapi.Expand(req.URL, map[string]string{
1430 "name": c.name,
1431 })
1432 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1433 }
1434
1435
1436
1437
1438
1439
1440
1441
1442 func (c *ProjectsLocationsReservationGrantsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
1443 gensupport.SetOptions(c.urlParams_, opts...)
1444 res, err := c.doRequest("json")
1445 if res != nil && res.StatusCode == http.StatusNotModified {
1446 if res.Body != nil {
1447 res.Body.Close()
1448 }
1449 return nil, &googleapi.Error{
1450 Code: res.StatusCode,
1451 Header: res.Header,
1452 }
1453 }
1454 if err != nil {
1455 return nil, err
1456 }
1457 defer googleapi.CloseBody(res)
1458 if err := googleapi.CheckResponse(res); err != nil {
1459 return nil, err
1460 }
1461 ret := &Empty{
1462 ServerResponse: googleapi.ServerResponse{
1463 Header: res.Header,
1464 HTTPStatusCode: res.StatusCode,
1465 },
1466 }
1467 target := &ret
1468 if err := gensupport.DecodeResponse(target, res); err != nil {
1469 return nil, err
1470 }
1471 return ret, nil
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499 }
1500
1501
1502
1503 type ProjectsLocationsReservationGrantsListCall struct {
1504 s *Service
1505 parent string
1506 urlParams_ gensupport.URLParams
1507 ifNoneMatch_ string
1508 ctx_ context.Context
1509 header_ http.Header
1510 }
1511
1512
1513
1514
1515
1516
1517
1518 func (r *ProjectsLocationsReservationGrantsService) List(parent string) *ProjectsLocationsReservationGrantsListCall {
1519 c := &ProjectsLocationsReservationGrantsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1520 c.parent = parent
1521 return c
1522 }
1523
1524
1525
1526 func (c *ProjectsLocationsReservationGrantsListCall) PageSize(pageSize int64) *ProjectsLocationsReservationGrantsListCall {
1527 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
1528 return c
1529 }
1530
1531
1532
1533 func (c *ProjectsLocationsReservationGrantsListCall) PageToken(pageToken string) *ProjectsLocationsReservationGrantsListCall {
1534 c.urlParams_.Set("pageToken", pageToken)
1535 return c
1536 }
1537
1538
1539
1540
1541 func (c *ProjectsLocationsReservationGrantsListCall) Fields(s ...googleapi.Field) *ProjectsLocationsReservationGrantsListCall {
1542 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1543 return c
1544 }
1545
1546
1547
1548
1549
1550
1551 func (c *ProjectsLocationsReservationGrantsListCall) IfNoneMatch(entityTag string) *ProjectsLocationsReservationGrantsListCall {
1552 c.ifNoneMatch_ = entityTag
1553 return c
1554 }
1555
1556
1557
1558
1559 func (c *ProjectsLocationsReservationGrantsListCall) Context(ctx context.Context) *ProjectsLocationsReservationGrantsListCall {
1560 c.ctx_ = ctx
1561 return c
1562 }
1563
1564
1565
1566 func (c *ProjectsLocationsReservationGrantsListCall) Header() http.Header {
1567 if c.header_ == nil {
1568 c.header_ = make(http.Header)
1569 }
1570 return c.header_
1571 }
1572
1573 func (c *ProjectsLocationsReservationGrantsListCall) doRequest(alt string) (*http.Response, error) {
1574 reqHeaders := make(http.Header)
1575 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201209")
1576 for k, v := range c.header_ {
1577 reqHeaders[k] = v
1578 }
1579 reqHeaders.Set("User-Agent", c.s.userAgent())
1580 if c.ifNoneMatch_ != "" {
1581 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
1582 }
1583 var body io.Reader = nil
1584 c.urlParams_.Set("alt", alt)
1585 c.urlParams_.Set("prettyPrint", "false")
1586 urls := googleapi.ResolveRelative(c.s.BasePath, "v1alpha2/{+parent}/reservationGrants")
1587 urls += "?" + c.urlParams_.Encode()
1588 req, err := http.NewRequest("GET", urls, body)
1589 if err != nil {
1590 return nil, err
1591 }
1592 req.Header = reqHeaders
1593 googleapi.Expand(req.URL, map[string]string{
1594 "parent": c.parent,
1595 })
1596 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1597 }
1598
1599
1600
1601
1602
1603
1604
1605
1606 func (c *ProjectsLocationsReservationGrantsListCall) Do(opts ...googleapi.CallOption) (*ListReservationGrantsResponse, error) {
1607 gensupport.SetOptions(c.urlParams_, opts...)
1608 res, err := c.doRequest("json")
1609 if res != nil && res.StatusCode == http.StatusNotModified {
1610 if res.Body != nil {
1611 res.Body.Close()
1612 }
1613 return nil, &googleapi.Error{
1614 Code: res.StatusCode,
1615 Header: res.Header,
1616 }
1617 }
1618 if err != nil {
1619 return nil, err
1620 }
1621 defer googleapi.CloseBody(res)
1622 if err := googleapi.CheckResponse(res); err != nil {
1623 return nil, err
1624 }
1625 ret := &ListReservationGrantsResponse{
1626 ServerResponse: googleapi.ServerResponse{
1627 Header: res.Header,
1628 HTTPStatusCode: res.StatusCode,
1629 },
1630 }
1631 target := &ret
1632 if err := gensupport.DecodeResponse(target, res); err != nil {
1633 return nil, err
1634 }
1635 return ret, nil
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674 }
1675
1676
1677
1678
1679 func (c *ProjectsLocationsReservationGrantsListCall) Pages(ctx context.Context, f func(*ListReservationGrantsResponse) error) error {
1680 c.ctx_ = ctx
1681 defer c.PageToken(c.urlParams_.Get("pageToken"))
1682 for {
1683 x, err := c.Do()
1684 if err != nil {
1685 return err
1686 }
1687 if err := f(x); err != nil {
1688 return err
1689 }
1690 if x.NextPageToken == "" {
1691 return nil
1692 }
1693 c.PageToken(x.NextPageToken)
1694 }
1695 }
1696
1697
1698
1699 type ProjectsLocationsReservationsCreateCall struct {
1700 s *Service
1701 parent string
1702 reservation *Reservation
1703 urlParams_ gensupport.URLParams
1704 ctx_ context.Context
1705 header_ http.Header
1706 }
1707
1708
1709
1710 func (r *ProjectsLocationsReservationsService) Create(parent string, reservation *Reservation) *ProjectsLocationsReservationsCreateCall {
1711 c := &ProjectsLocationsReservationsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1712 c.parent = parent
1713 c.reservation = reservation
1714 return c
1715 }
1716
1717
1718
1719
1720 func (c *ProjectsLocationsReservationsCreateCall) ReservationId(reservationId string) *ProjectsLocationsReservationsCreateCall {
1721 c.urlParams_.Set("reservationId", reservationId)
1722 return c
1723 }
1724
1725
1726
1727
1728 func (c *ProjectsLocationsReservationsCreateCall) Fields(s ...googleapi.Field) *ProjectsLocationsReservationsCreateCall {
1729 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1730 return c
1731 }
1732
1733
1734
1735
1736 func (c *ProjectsLocationsReservationsCreateCall) Context(ctx context.Context) *ProjectsLocationsReservationsCreateCall {
1737 c.ctx_ = ctx
1738 return c
1739 }
1740
1741
1742
1743 func (c *ProjectsLocationsReservationsCreateCall) Header() http.Header {
1744 if c.header_ == nil {
1745 c.header_ = make(http.Header)
1746 }
1747 return c.header_
1748 }
1749
1750 func (c *ProjectsLocationsReservationsCreateCall) doRequest(alt string) (*http.Response, error) {
1751 reqHeaders := make(http.Header)
1752 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201209")
1753 for k, v := range c.header_ {
1754 reqHeaders[k] = v
1755 }
1756 reqHeaders.Set("User-Agent", c.s.userAgent())
1757 var body io.Reader = nil
1758 body, err := googleapi.WithoutDataWrapper.JSONReader(c.reservation)
1759 if err != nil {
1760 return nil, err
1761 }
1762 reqHeaders.Set("Content-Type", "application/json")
1763 c.urlParams_.Set("alt", alt)
1764 c.urlParams_.Set("prettyPrint", "false")
1765 urls := googleapi.ResolveRelative(c.s.BasePath, "v1alpha2/{+parent}/reservations")
1766 urls += "?" + c.urlParams_.Encode()
1767 req, err := http.NewRequest("POST", urls, body)
1768 if err != nil {
1769 return nil, err
1770 }
1771 req.Header = reqHeaders
1772 googleapi.Expand(req.URL, map[string]string{
1773 "parent": c.parent,
1774 })
1775 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1776 }
1777
1778
1779
1780
1781
1782
1783
1784
1785 func (c *ProjectsLocationsReservationsCreateCall) Do(opts ...googleapi.CallOption) (*Reservation, error) {
1786 gensupport.SetOptions(c.urlParams_, opts...)
1787 res, err := c.doRequest("json")
1788 if res != nil && res.StatusCode == http.StatusNotModified {
1789 if res.Body != nil {
1790 res.Body.Close()
1791 }
1792 return nil, &googleapi.Error{
1793 Code: res.StatusCode,
1794 Header: res.Header,
1795 }
1796 }
1797 if err != nil {
1798 return nil, err
1799 }
1800 defer googleapi.CloseBody(res)
1801 if err := googleapi.CheckResponse(res); err != nil {
1802 return nil, err
1803 }
1804 ret := &Reservation{
1805 ServerResponse: googleapi.ServerResponse{
1806 Header: res.Header,
1807 HTTPStatusCode: res.StatusCode,
1808 },
1809 }
1810 target := &ret
1811 if err := gensupport.DecodeResponse(target, res); err != nil {
1812 return nil, err
1813 }
1814 return ret, nil
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850 }
1851
1852
1853
1854 type ProjectsLocationsReservationsCreateReservationCall struct {
1855 s *Service
1856 parent string
1857 reservation *Reservation
1858 urlParams_ gensupport.URLParams
1859 ctx_ context.Context
1860 header_ http.Header
1861 }
1862
1863
1864
1865 func (r *ProjectsLocationsReservationsService) CreateReservation(parent string, reservation *Reservation) *ProjectsLocationsReservationsCreateReservationCall {
1866 c := &ProjectsLocationsReservationsCreateReservationCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1867 c.parent = parent
1868 c.reservation = reservation
1869 return c
1870 }
1871
1872
1873
1874
1875 func (c *ProjectsLocationsReservationsCreateReservationCall) ReservationId(reservationId string) *ProjectsLocationsReservationsCreateReservationCall {
1876 c.urlParams_.Set("reservationId", reservationId)
1877 return c
1878 }
1879
1880
1881
1882
1883 func (c *ProjectsLocationsReservationsCreateReservationCall) Fields(s ...googleapi.Field) *ProjectsLocationsReservationsCreateReservationCall {
1884 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1885 return c
1886 }
1887
1888
1889
1890
1891 func (c *ProjectsLocationsReservationsCreateReservationCall) Context(ctx context.Context) *ProjectsLocationsReservationsCreateReservationCall {
1892 c.ctx_ = ctx
1893 return c
1894 }
1895
1896
1897
1898 func (c *ProjectsLocationsReservationsCreateReservationCall) Header() http.Header {
1899 if c.header_ == nil {
1900 c.header_ = make(http.Header)
1901 }
1902 return c.header_
1903 }
1904
1905 func (c *ProjectsLocationsReservationsCreateReservationCall) doRequest(alt string) (*http.Response, error) {
1906 reqHeaders := make(http.Header)
1907 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201209")
1908 for k, v := range c.header_ {
1909 reqHeaders[k] = v
1910 }
1911 reqHeaders.Set("User-Agent", c.s.userAgent())
1912 var body io.Reader = nil
1913 body, err := googleapi.WithoutDataWrapper.JSONReader(c.reservation)
1914 if err != nil {
1915 return nil, err
1916 }
1917 reqHeaders.Set("Content-Type", "application/json")
1918 c.urlParams_.Set("alt", alt)
1919 c.urlParams_.Set("prettyPrint", "false")
1920 urls := googleapi.ResolveRelative(c.s.BasePath, "v1alpha2/{+parent}")
1921 urls += "?" + c.urlParams_.Encode()
1922 req, err := http.NewRequest("POST", urls, body)
1923 if err != nil {
1924 return nil, err
1925 }
1926 req.Header = reqHeaders
1927 googleapi.Expand(req.URL, map[string]string{
1928 "parent": c.parent,
1929 })
1930 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1931 }
1932
1933
1934
1935
1936
1937
1938
1939
1940 func (c *ProjectsLocationsReservationsCreateReservationCall) Do(opts ...googleapi.CallOption) (*Reservation, error) {
1941 gensupport.SetOptions(c.urlParams_, opts...)
1942 res, err := c.doRequest("json")
1943 if res != nil && res.StatusCode == http.StatusNotModified {
1944 if res.Body != nil {
1945 res.Body.Close()
1946 }
1947 return nil, &googleapi.Error{
1948 Code: res.StatusCode,
1949 Header: res.Header,
1950 }
1951 }
1952 if err != nil {
1953 return nil, err
1954 }
1955 defer googleapi.CloseBody(res)
1956 if err := googleapi.CheckResponse(res); err != nil {
1957 return nil, err
1958 }
1959 ret := &Reservation{
1960 ServerResponse: googleapi.ServerResponse{
1961 Header: res.Header,
1962 HTTPStatusCode: res.StatusCode,
1963 },
1964 }
1965 target := &ret
1966 if err := gensupport.DecodeResponse(target, res); err != nil {
1967 return nil, err
1968 }
1969 return ret, nil
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005 }
2006
2007
2008
2009 type ProjectsLocationsReservationsDeleteCall struct {
2010 s *Service
2011 name string
2012 urlParams_ gensupport.URLParams
2013 ctx_ context.Context
2014 header_ http.Header
2015 }
2016
2017
2018
2019
2020
2021
2022 func (r *ProjectsLocationsReservationsService) Delete(name string) *ProjectsLocationsReservationsDeleteCall {
2023 c := &ProjectsLocationsReservationsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
2024 c.name = name
2025 return c
2026 }
2027
2028
2029
2030
2031
2032 func (c *ProjectsLocationsReservationsDeleteCall) Force(force bool) *ProjectsLocationsReservationsDeleteCall {
2033 c.urlParams_.Set("force", fmt.Sprint(force))
2034 return c
2035 }
2036
2037
2038
2039
2040 func (c *ProjectsLocationsReservationsDeleteCall) Fields(s ...googleapi.Field) *ProjectsLocationsReservationsDeleteCall {
2041 c.urlParams_.Set("fields", googleapi.CombineFields(s))
2042 return c
2043 }
2044
2045
2046
2047
2048 func (c *ProjectsLocationsReservationsDeleteCall) Context(ctx context.Context) *ProjectsLocationsReservationsDeleteCall {
2049 c.ctx_ = ctx
2050 return c
2051 }
2052
2053
2054
2055 func (c *ProjectsLocationsReservationsDeleteCall) Header() http.Header {
2056 if c.header_ == nil {
2057 c.header_ = make(http.Header)
2058 }
2059 return c.header_
2060 }
2061
2062 func (c *ProjectsLocationsReservationsDeleteCall) doRequest(alt string) (*http.Response, error) {
2063 reqHeaders := make(http.Header)
2064 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201209")
2065 for k, v := range c.header_ {
2066 reqHeaders[k] = v
2067 }
2068 reqHeaders.Set("User-Agent", c.s.userAgent())
2069 var body io.Reader = nil
2070 c.urlParams_.Set("alt", alt)
2071 c.urlParams_.Set("prettyPrint", "false")
2072 urls := googleapi.ResolveRelative(c.s.BasePath, "v1alpha2/{+name}")
2073 urls += "?" + c.urlParams_.Encode()
2074 req, err := http.NewRequest("DELETE", urls, body)
2075 if err != nil {
2076 return nil, err
2077 }
2078 req.Header = reqHeaders
2079 googleapi.Expand(req.URL, map[string]string{
2080 "name": c.name,
2081 })
2082 return gensupport.SendRequest(c.ctx_, c.s.client, req)
2083 }
2084
2085
2086
2087
2088
2089
2090
2091
2092 func (c *ProjectsLocationsReservationsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
2093 gensupport.SetOptions(c.urlParams_, opts...)
2094 res, err := c.doRequest("json")
2095 if res != nil && res.StatusCode == http.StatusNotModified {
2096 if res.Body != nil {
2097 res.Body.Close()
2098 }
2099 return nil, &googleapi.Error{
2100 Code: res.StatusCode,
2101 Header: res.Header,
2102 }
2103 }
2104 if err != nil {
2105 return nil, err
2106 }
2107 defer googleapi.CloseBody(res)
2108 if err := googleapi.CheckResponse(res); err != nil {
2109 return nil, err
2110 }
2111 ret := &Empty{
2112 ServerResponse: googleapi.ServerResponse{
2113 Header: res.Header,
2114 HTTPStatusCode: res.StatusCode,
2115 },
2116 }
2117 target := &ret
2118 if err := gensupport.DecodeResponse(target, res); err != nil {
2119 return nil, err
2120 }
2121 return ret, nil
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154 }
2155
2156
2157
2158 type ProjectsLocationsReservationsGetCall struct {
2159 s *Service
2160 name string
2161 urlParams_ gensupport.URLParams
2162 ifNoneMatch_ string
2163 ctx_ context.Context
2164 header_ http.Header
2165 }
2166
2167
2168 func (r *ProjectsLocationsReservationsService) Get(name string) *ProjectsLocationsReservationsGetCall {
2169 c := &ProjectsLocationsReservationsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
2170 c.name = name
2171 return c
2172 }
2173
2174
2175
2176
2177 func (c *ProjectsLocationsReservationsGetCall) Fields(s ...googleapi.Field) *ProjectsLocationsReservationsGetCall {
2178 c.urlParams_.Set("fields", googleapi.CombineFields(s))
2179 return c
2180 }
2181
2182
2183
2184
2185
2186
2187 func (c *ProjectsLocationsReservationsGetCall) IfNoneMatch(entityTag string) *ProjectsLocationsReservationsGetCall {
2188 c.ifNoneMatch_ = entityTag
2189 return c
2190 }
2191
2192
2193
2194
2195 func (c *ProjectsLocationsReservationsGetCall) Context(ctx context.Context) *ProjectsLocationsReservationsGetCall {
2196 c.ctx_ = ctx
2197 return c
2198 }
2199
2200
2201
2202 func (c *ProjectsLocationsReservationsGetCall) Header() http.Header {
2203 if c.header_ == nil {
2204 c.header_ = make(http.Header)
2205 }
2206 return c.header_
2207 }
2208
2209 func (c *ProjectsLocationsReservationsGetCall) doRequest(alt string) (*http.Response, error) {
2210 reqHeaders := make(http.Header)
2211 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201209")
2212 for k, v := range c.header_ {
2213 reqHeaders[k] = v
2214 }
2215 reqHeaders.Set("User-Agent", c.s.userAgent())
2216 if c.ifNoneMatch_ != "" {
2217 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
2218 }
2219 var body io.Reader = nil
2220 c.urlParams_.Set("alt", alt)
2221 c.urlParams_.Set("prettyPrint", "false")
2222 urls := googleapi.ResolveRelative(c.s.BasePath, "v1alpha2/{+name}")
2223 urls += "?" + c.urlParams_.Encode()
2224 req, err := http.NewRequest("GET", urls, body)
2225 if err != nil {
2226 return nil, err
2227 }
2228 req.Header = reqHeaders
2229 googleapi.Expand(req.URL, map[string]string{
2230 "name": c.name,
2231 })
2232 return gensupport.SendRequest(c.ctx_, c.s.client, req)
2233 }
2234
2235
2236
2237
2238
2239
2240
2241
2242 func (c *ProjectsLocationsReservationsGetCall) Do(opts ...googleapi.CallOption) (*Reservation, error) {
2243 gensupport.SetOptions(c.urlParams_, opts...)
2244 res, err := c.doRequest("json")
2245 if res != nil && res.StatusCode == http.StatusNotModified {
2246 if res.Body != nil {
2247 res.Body.Close()
2248 }
2249 return nil, &googleapi.Error{
2250 Code: res.StatusCode,
2251 Header: res.Header,
2252 }
2253 }
2254 if err != nil {
2255 return nil, err
2256 }
2257 defer googleapi.CloseBody(res)
2258 if err := googleapi.CheckResponse(res); err != nil {
2259 return nil, err
2260 }
2261 ret := &Reservation{
2262 ServerResponse: googleapi.ServerResponse{
2263 Header: res.Header,
2264 HTTPStatusCode: res.StatusCode,
2265 },
2266 }
2267 target := &ret
2268 if err := gensupport.DecodeResponse(target, res); err != nil {
2269 return nil, err
2270 }
2271 return ret, nil
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299 }
2300
2301
2302
2303 type ProjectsLocationsReservationsListCall struct {
2304 s *Service
2305 parent string
2306 urlParams_ gensupport.URLParams
2307 ifNoneMatch_ string
2308 ctx_ context.Context
2309 header_ http.Header
2310 }
2311
2312
2313
2314 func (r *ProjectsLocationsReservationsService) List(parent string) *ProjectsLocationsReservationsListCall {
2315 c := &ProjectsLocationsReservationsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
2316 c.parent = parent
2317 return c
2318 }
2319
2320
2321
2322
2323
2324
2325 func (c *ProjectsLocationsReservationsListCall) Filter(filter string) *ProjectsLocationsReservationsListCall {
2326 c.urlParams_.Set("filter", filter)
2327 return c
2328 }
2329
2330
2331
2332 func (c *ProjectsLocationsReservationsListCall) PageSize(pageSize int64) *ProjectsLocationsReservationsListCall {
2333 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
2334 return c
2335 }
2336
2337
2338
2339 func (c *ProjectsLocationsReservationsListCall) PageToken(pageToken string) *ProjectsLocationsReservationsListCall {
2340 c.urlParams_.Set("pageToken", pageToken)
2341 return c
2342 }
2343
2344
2345
2346
2347 func (c *ProjectsLocationsReservationsListCall) Fields(s ...googleapi.Field) *ProjectsLocationsReservationsListCall {
2348 c.urlParams_.Set("fields", googleapi.CombineFields(s))
2349 return c
2350 }
2351
2352
2353
2354
2355
2356
2357 func (c *ProjectsLocationsReservationsListCall) IfNoneMatch(entityTag string) *ProjectsLocationsReservationsListCall {
2358 c.ifNoneMatch_ = entityTag
2359 return c
2360 }
2361
2362
2363
2364
2365 func (c *ProjectsLocationsReservationsListCall) Context(ctx context.Context) *ProjectsLocationsReservationsListCall {
2366 c.ctx_ = ctx
2367 return c
2368 }
2369
2370
2371
2372 func (c *ProjectsLocationsReservationsListCall) Header() http.Header {
2373 if c.header_ == nil {
2374 c.header_ = make(http.Header)
2375 }
2376 return c.header_
2377 }
2378
2379 func (c *ProjectsLocationsReservationsListCall) doRequest(alt string) (*http.Response, error) {
2380 reqHeaders := make(http.Header)
2381 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201209")
2382 for k, v := range c.header_ {
2383 reqHeaders[k] = v
2384 }
2385 reqHeaders.Set("User-Agent", c.s.userAgent())
2386 if c.ifNoneMatch_ != "" {
2387 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
2388 }
2389 var body io.Reader = nil
2390 c.urlParams_.Set("alt", alt)
2391 c.urlParams_.Set("prettyPrint", "false")
2392 urls := googleapi.ResolveRelative(c.s.BasePath, "v1alpha2/{+parent}/reservations")
2393 urls += "?" + c.urlParams_.Encode()
2394 req, err := http.NewRequest("GET", urls, body)
2395 if err != nil {
2396 return nil, err
2397 }
2398 req.Header = reqHeaders
2399 googleapi.Expand(req.URL, map[string]string{
2400 "parent": c.parent,
2401 })
2402 return gensupport.SendRequest(c.ctx_, c.s.client, req)
2403 }
2404
2405
2406
2407
2408
2409
2410
2411
2412 func (c *ProjectsLocationsReservationsListCall) Do(opts ...googleapi.CallOption) (*ListReservationsResponse, error) {
2413 gensupport.SetOptions(c.urlParams_, opts...)
2414 res, err := c.doRequest("json")
2415 if res != nil && res.StatusCode == http.StatusNotModified {
2416 if res.Body != nil {
2417 res.Body.Close()
2418 }
2419 return nil, &googleapi.Error{
2420 Code: res.StatusCode,
2421 Header: res.Header,
2422 }
2423 }
2424 if err != nil {
2425 return nil, err
2426 }
2427 defer googleapi.CloseBody(res)
2428 if err := googleapi.CheckResponse(res); err != nil {
2429 return nil, err
2430 }
2431 ret := &ListReservationsResponse{
2432 ServerResponse: googleapi.ServerResponse{
2433 Header: res.Header,
2434 HTTPStatusCode: res.StatusCode,
2435 },
2436 }
2437 target := &ret
2438 if err := gensupport.DecodeResponse(target, res); err != nil {
2439 return nil, err
2440 }
2441 return ret, nil
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485 }
2486
2487
2488
2489
2490 func (c *ProjectsLocationsReservationsListCall) Pages(ctx context.Context, f func(*ListReservationsResponse) error) error {
2491 c.ctx_ = ctx
2492 defer c.PageToken(c.urlParams_.Get("pageToken"))
2493 for {
2494 x, err := c.Do()
2495 if err != nil {
2496 return err
2497 }
2498 if err := f(x); err != nil {
2499 return err
2500 }
2501 if x.NextPageToken == "" {
2502 return nil
2503 }
2504 c.PageToken(x.NextPageToken)
2505 }
2506 }
2507
2508
2509
2510 type ProjectsLocationsReservationsPatchCall struct {
2511 s *Service
2512 name string
2513 reservation *Reservation
2514 urlParams_ gensupport.URLParams
2515 ctx_ context.Context
2516 header_ http.Header
2517 }
2518
2519
2520
2521 func (r *ProjectsLocationsReservationsService) Patch(name string, reservation *Reservation) *ProjectsLocationsReservationsPatchCall {
2522 c := &ProjectsLocationsReservationsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
2523 c.name = name
2524 c.reservation = reservation
2525 return c
2526 }
2527
2528
2529
2530 func (c *ProjectsLocationsReservationsPatchCall) UpdateMask(updateMask string) *ProjectsLocationsReservationsPatchCall {
2531 c.urlParams_.Set("updateMask", updateMask)
2532 return c
2533 }
2534
2535
2536
2537
2538 func (c *ProjectsLocationsReservationsPatchCall) Fields(s ...googleapi.Field) *ProjectsLocationsReservationsPatchCall {
2539 c.urlParams_.Set("fields", googleapi.CombineFields(s))
2540 return c
2541 }
2542
2543
2544
2545
2546 func (c *ProjectsLocationsReservationsPatchCall) Context(ctx context.Context) *ProjectsLocationsReservationsPatchCall {
2547 c.ctx_ = ctx
2548 return c
2549 }
2550
2551
2552
2553 func (c *ProjectsLocationsReservationsPatchCall) Header() http.Header {
2554 if c.header_ == nil {
2555 c.header_ = make(http.Header)
2556 }
2557 return c.header_
2558 }
2559
2560 func (c *ProjectsLocationsReservationsPatchCall) doRequest(alt string) (*http.Response, error) {
2561 reqHeaders := make(http.Header)
2562 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201209")
2563 for k, v := range c.header_ {
2564 reqHeaders[k] = v
2565 }
2566 reqHeaders.Set("User-Agent", c.s.userAgent())
2567 var body io.Reader = nil
2568 body, err := googleapi.WithoutDataWrapper.JSONReader(c.reservation)
2569 if err != nil {
2570 return nil, err
2571 }
2572 reqHeaders.Set("Content-Type", "application/json")
2573 c.urlParams_.Set("alt", alt)
2574 c.urlParams_.Set("prettyPrint", "false")
2575 urls := googleapi.ResolveRelative(c.s.BasePath, "v1alpha2/{+name}")
2576 urls += "?" + c.urlParams_.Encode()
2577 req, err := http.NewRequest("PATCH", urls, body)
2578 if err != nil {
2579 return nil, err
2580 }
2581 req.Header = reqHeaders
2582 googleapi.Expand(req.URL, map[string]string{
2583 "name": c.name,
2584 })
2585 return gensupport.SendRequest(c.ctx_, c.s.client, req)
2586 }
2587
2588
2589
2590
2591
2592
2593
2594
2595 func (c *ProjectsLocationsReservationsPatchCall) Do(opts ...googleapi.CallOption) (*Reservation, error) {
2596 gensupport.SetOptions(c.urlParams_, opts...)
2597 res, err := c.doRequest("json")
2598 if res != nil && res.StatusCode == http.StatusNotModified {
2599 if res.Body != nil {
2600 res.Body.Close()
2601 }
2602 return nil, &googleapi.Error{
2603 Code: res.StatusCode,
2604 Header: res.Header,
2605 }
2606 }
2607 if err != nil {
2608 return nil, err
2609 }
2610 defer googleapi.CloseBody(res)
2611 if err := googleapi.CheckResponse(res); err != nil {
2612 return nil, err
2613 }
2614 ret := &Reservation{
2615 ServerResponse: googleapi.ServerResponse{
2616 Header: res.Header,
2617 HTTPStatusCode: res.StatusCode,
2618 },
2619 }
2620 target := &ret
2621 if err := gensupport.DecodeResponse(target, res); err != nil {
2622 return nil, err
2623 }
2624 return ret, nil
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661 }
2662
2663
2664
2665 type ProjectsLocationsReservationsSlotPoolsDeleteCall struct {
2666 s *Service
2667 name string
2668 urlParams_ gensupport.URLParams
2669 ctx_ context.Context
2670 header_ http.Header
2671 }
2672
2673
2674
2675
2676 func (r *ProjectsLocationsReservationsSlotPoolsService) Delete(name string) *ProjectsLocationsReservationsSlotPoolsDeleteCall {
2677 c := &ProjectsLocationsReservationsSlotPoolsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
2678 c.name = name
2679 return c
2680 }
2681
2682
2683
2684
2685 func (c *ProjectsLocationsReservationsSlotPoolsDeleteCall) Fields(s ...googleapi.Field) *ProjectsLocationsReservationsSlotPoolsDeleteCall {
2686 c.urlParams_.Set("fields", googleapi.CombineFields(s))
2687 return c
2688 }
2689
2690
2691
2692
2693 func (c *ProjectsLocationsReservationsSlotPoolsDeleteCall) Context(ctx context.Context) *ProjectsLocationsReservationsSlotPoolsDeleteCall {
2694 c.ctx_ = ctx
2695 return c
2696 }
2697
2698
2699
2700 func (c *ProjectsLocationsReservationsSlotPoolsDeleteCall) Header() http.Header {
2701 if c.header_ == nil {
2702 c.header_ = make(http.Header)
2703 }
2704 return c.header_
2705 }
2706
2707 func (c *ProjectsLocationsReservationsSlotPoolsDeleteCall) doRequest(alt string) (*http.Response, error) {
2708 reqHeaders := make(http.Header)
2709 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201209")
2710 for k, v := range c.header_ {
2711 reqHeaders[k] = v
2712 }
2713 reqHeaders.Set("User-Agent", c.s.userAgent())
2714 var body io.Reader = nil
2715 c.urlParams_.Set("alt", alt)
2716 c.urlParams_.Set("prettyPrint", "false")
2717 urls := googleapi.ResolveRelative(c.s.BasePath, "v1alpha2/{+name}")
2718 urls += "?" + c.urlParams_.Encode()
2719 req, err := http.NewRequest("DELETE", urls, body)
2720 if err != nil {
2721 return nil, err
2722 }
2723 req.Header = reqHeaders
2724 googleapi.Expand(req.URL, map[string]string{
2725 "name": c.name,
2726 })
2727 return gensupport.SendRequest(c.ctx_, c.s.client, req)
2728 }
2729
2730
2731
2732
2733
2734
2735
2736
2737 func (c *ProjectsLocationsReservationsSlotPoolsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
2738 gensupport.SetOptions(c.urlParams_, opts...)
2739 res, err := c.doRequest("json")
2740 if res != nil && res.StatusCode == http.StatusNotModified {
2741 if res.Body != nil {
2742 res.Body.Close()
2743 }
2744 return nil, &googleapi.Error{
2745 Code: res.StatusCode,
2746 Header: res.Header,
2747 }
2748 }
2749 if err != nil {
2750 return nil, err
2751 }
2752 defer googleapi.CloseBody(res)
2753 if err := googleapi.CheckResponse(res); err != nil {
2754 return nil, err
2755 }
2756 ret := &Empty{
2757 ServerResponse: googleapi.ServerResponse{
2758 Header: res.Header,
2759 HTTPStatusCode: res.StatusCode,
2760 },
2761 }
2762 target := &ret
2763 if err := gensupport.DecodeResponse(target, res); err != nil {
2764 return nil, err
2765 }
2766 return ret, nil
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794 }
2795
2796
2797
2798 type ProjectsLocationsReservationsSlotPoolsGetCall struct {
2799 s *Service
2800 name string
2801 urlParams_ gensupport.URLParams
2802 ifNoneMatch_ string
2803 ctx_ context.Context
2804 header_ http.Header
2805 }
2806
2807
2808 func (r *ProjectsLocationsReservationsSlotPoolsService) Get(name string) *ProjectsLocationsReservationsSlotPoolsGetCall {
2809 c := &ProjectsLocationsReservationsSlotPoolsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
2810 c.name = name
2811 return c
2812 }
2813
2814
2815
2816
2817 func (c *ProjectsLocationsReservationsSlotPoolsGetCall) Fields(s ...googleapi.Field) *ProjectsLocationsReservationsSlotPoolsGetCall {
2818 c.urlParams_.Set("fields", googleapi.CombineFields(s))
2819 return c
2820 }
2821
2822
2823
2824
2825
2826
2827 func (c *ProjectsLocationsReservationsSlotPoolsGetCall) IfNoneMatch(entityTag string) *ProjectsLocationsReservationsSlotPoolsGetCall {
2828 c.ifNoneMatch_ = entityTag
2829 return c
2830 }
2831
2832
2833
2834
2835 func (c *ProjectsLocationsReservationsSlotPoolsGetCall) Context(ctx context.Context) *ProjectsLocationsReservationsSlotPoolsGetCall {
2836 c.ctx_ = ctx
2837 return c
2838 }
2839
2840
2841
2842 func (c *ProjectsLocationsReservationsSlotPoolsGetCall) Header() http.Header {
2843 if c.header_ == nil {
2844 c.header_ = make(http.Header)
2845 }
2846 return c.header_
2847 }
2848
2849 func (c *ProjectsLocationsReservationsSlotPoolsGetCall) doRequest(alt string) (*http.Response, error) {
2850 reqHeaders := make(http.Header)
2851 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201209")
2852 for k, v := range c.header_ {
2853 reqHeaders[k] = v
2854 }
2855 reqHeaders.Set("User-Agent", c.s.userAgent())
2856 if c.ifNoneMatch_ != "" {
2857 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
2858 }
2859 var body io.Reader = nil
2860 c.urlParams_.Set("alt", alt)
2861 c.urlParams_.Set("prettyPrint", "false")
2862 urls := googleapi.ResolveRelative(c.s.BasePath, "v1alpha2/{+name}")
2863 urls += "?" + c.urlParams_.Encode()
2864 req, err := http.NewRequest("GET", urls, body)
2865 if err != nil {
2866 return nil, err
2867 }
2868 req.Header = reqHeaders
2869 googleapi.Expand(req.URL, map[string]string{
2870 "name": c.name,
2871 })
2872 return gensupport.SendRequest(c.ctx_, c.s.client, req)
2873 }
2874
2875
2876
2877
2878
2879
2880
2881
2882 func (c *ProjectsLocationsReservationsSlotPoolsGetCall) Do(opts ...googleapi.CallOption) (*SlotPool, error) {
2883 gensupport.SetOptions(c.urlParams_, opts...)
2884 res, err := c.doRequest("json")
2885 if res != nil && res.StatusCode == http.StatusNotModified {
2886 if res.Body != nil {
2887 res.Body.Close()
2888 }
2889 return nil, &googleapi.Error{
2890 Code: res.StatusCode,
2891 Header: res.Header,
2892 }
2893 }
2894 if err != nil {
2895 return nil, err
2896 }
2897 defer googleapi.CloseBody(res)
2898 if err := googleapi.CheckResponse(res); err != nil {
2899 return nil, err
2900 }
2901 ret := &SlotPool{
2902 ServerResponse: googleapi.ServerResponse{
2903 Header: res.Header,
2904 HTTPStatusCode: res.StatusCode,
2905 },
2906 }
2907 target := &ret
2908 if err := gensupport.DecodeResponse(target, res); err != nil {
2909 return nil, err
2910 }
2911 return ret, nil
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939 }
2940
2941
2942
2943 type ProjectsLocationsReservationsSlotPoolsListCall struct {
2944 s *Service
2945 parent string
2946 urlParams_ gensupport.URLParams
2947 ifNoneMatch_ string
2948 ctx_ context.Context
2949 header_ http.Header
2950 }
2951
2952
2953 func (r *ProjectsLocationsReservationsSlotPoolsService) List(parent string) *ProjectsLocationsReservationsSlotPoolsListCall {
2954 c := &ProjectsLocationsReservationsSlotPoolsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
2955 c.parent = parent
2956 return c
2957 }
2958
2959
2960
2961 func (c *ProjectsLocationsReservationsSlotPoolsListCall) PageSize(pageSize int64) *ProjectsLocationsReservationsSlotPoolsListCall {
2962 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
2963 return c
2964 }
2965
2966
2967
2968 func (c *ProjectsLocationsReservationsSlotPoolsListCall) PageToken(pageToken string) *ProjectsLocationsReservationsSlotPoolsListCall {
2969 c.urlParams_.Set("pageToken", pageToken)
2970 return c
2971 }
2972
2973
2974
2975
2976 func (c *ProjectsLocationsReservationsSlotPoolsListCall) Fields(s ...googleapi.Field) *ProjectsLocationsReservationsSlotPoolsListCall {
2977 c.urlParams_.Set("fields", googleapi.CombineFields(s))
2978 return c
2979 }
2980
2981
2982
2983
2984
2985
2986 func (c *ProjectsLocationsReservationsSlotPoolsListCall) IfNoneMatch(entityTag string) *ProjectsLocationsReservationsSlotPoolsListCall {
2987 c.ifNoneMatch_ = entityTag
2988 return c
2989 }
2990
2991
2992
2993
2994 func (c *ProjectsLocationsReservationsSlotPoolsListCall) Context(ctx context.Context) *ProjectsLocationsReservationsSlotPoolsListCall {
2995 c.ctx_ = ctx
2996 return c
2997 }
2998
2999
3000
3001 func (c *ProjectsLocationsReservationsSlotPoolsListCall) Header() http.Header {
3002 if c.header_ == nil {
3003 c.header_ = make(http.Header)
3004 }
3005 return c.header_
3006 }
3007
3008 func (c *ProjectsLocationsReservationsSlotPoolsListCall) doRequest(alt string) (*http.Response, error) {
3009 reqHeaders := make(http.Header)
3010 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201209")
3011 for k, v := range c.header_ {
3012 reqHeaders[k] = v
3013 }
3014 reqHeaders.Set("User-Agent", c.s.userAgent())
3015 if c.ifNoneMatch_ != "" {
3016 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
3017 }
3018 var body io.Reader = nil
3019 c.urlParams_.Set("alt", alt)
3020 c.urlParams_.Set("prettyPrint", "false")
3021 urls := googleapi.ResolveRelative(c.s.BasePath, "v1alpha2/{+parent}/slotPools")
3022 urls += "?" + c.urlParams_.Encode()
3023 req, err := http.NewRequest("GET", urls, body)
3024 if err != nil {
3025 return nil, err
3026 }
3027 req.Header = reqHeaders
3028 googleapi.Expand(req.URL, map[string]string{
3029 "parent": c.parent,
3030 })
3031 return gensupport.SendRequest(c.ctx_, c.s.client, req)
3032 }
3033
3034
3035
3036
3037
3038
3039
3040
3041 func (c *ProjectsLocationsReservationsSlotPoolsListCall) Do(opts ...googleapi.CallOption) (*ListSlotPoolsResponse, error) {
3042 gensupport.SetOptions(c.urlParams_, opts...)
3043 res, err := c.doRequest("json")
3044 if res != nil && res.StatusCode == http.StatusNotModified {
3045 if res.Body != nil {
3046 res.Body.Close()
3047 }
3048 return nil, &googleapi.Error{
3049 Code: res.StatusCode,
3050 Header: res.Header,
3051 }
3052 }
3053 if err != nil {
3054 return nil, err
3055 }
3056 defer googleapi.CloseBody(res)
3057 if err := googleapi.CheckResponse(res); err != nil {
3058 return nil, err
3059 }
3060 ret := &ListSlotPoolsResponse{
3061 ServerResponse: googleapi.ServerResponse{
3062 Header: res.Header,
3063 HTTPStatusCode: res.StatusCode,
3064 },
3065 }
3066 target := &ret
3067 if err := gensupport.DecodeResponse(target, res); err != nil {
3068 return nil, err
3069 }
3070 return ret, nil
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109 }
3110
3111
3112
3113
3114 func (c *ProjectsLocationsReservationsSlotPoolsListCall) Pages(ctx context.Context, f func(*ListSlotPoolsResponse) error) error {
3115 c.ctx_ = ctx
3116 defer c.PageToken(c.urlParams_.Get("pageToken"))
3117 for {
3118 x, err := c.Do()
3119 if err != nil {
3120 return err
3121 }
3122 if err := f(x); err != nil {
3123 return err
3124 }
3125 if x.NextPageToken == "" {
3126 return nil
3127 }
3128 c.PageToken(x.NextPageToken)
3129 }
3130 }
3131
View as plain text