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