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 package storage
45
46 import (
47 "bytes"
48 "context"
49 "encoding/json"
50 "errors"
51 "fmt"
52 "io"
53 "net/http"
54 "net/url"
55 "strconv"
56 "strings"
57
58 googleapi "google.golang.org/api/googleapi"
59 gensupport "google.golang.org/api/internal/gensupport"
60 option "google.golang.org/api/option"
61 htransport "google.golang.org/api/transport/http"
62 )
63
64
65
66 var _ = bytes.NewBuffer
67 var _ = strconv.Itoa
68 var _ = fmt.Sprintf
69 var _ = json.NewDecoder
70 var _ = io.Copy
71 var _ = url.Parse
72 var _ = gensupport.MarshalJSON
73 var _ = googleapi.Version
74 var _ = errors.New
75 var _ = strings.Replace
76 var _ = context.Canceled
77
78 const apiId = "storage:v1beta1"
79 const apiName = "storage"
80 const apiVersion = "v1beta1"
81 const basePath = "https://www.googleapis.com/storage/v1beta1/"
82
83
84 const (
85
86 DevstorageFullControlScope = "https://www.googleapis.com/auth/devstorage.full_control"
87
88
89 DevstorageReadOnlyScope = "https://www.googleapis.com/auth/devstorage.read_only"
90
91
92 DevstorageReadWriteScope = "https://www.googleapis.com/auth/devstorage.read_write"
93 )
94
95
96 func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {
97 scopesOption := option.WithScopes(
98 "https://www.googleapis.com/auth/devstorage.full_control",
99 "https://www.googleapis.com/auth/devstorage.read_only",
100 "https://www.googleapis.com/auth/devstorage.read_write",
101 )
102
103 opts = append([]option.ClientOption{scopesOption}, opts...)
104 client, endpoint, err := htransport.NewClient(ctx, opts...)
105 if err != nil {
106 return nil, err
107 }
108 s, err := New(client)
109 if err != nil {
110 return nil, err
111 }
112 if endpoint != "" {
113 s.BasePath = endpoint
114 }
115 return s, nil
116 }
117
118
119
120
121
122
123 func New(client *http.Client) (*Service, error) {
124 if client == nil {
125 return nil, errors.New("client is nil")
126 }
127 s := &Service{client: client, BasePath: basePath}
128 s.BucketAccessControls = NewBucketAccessControlsService(s)
129 s.Buckets = NewBucketsService(s)
130 s.ObjectAccessControls = NewObjectAccessControlsService(s)
131 s.Objects = NewObjectsService(s)
132 return s, nil
133 }
134
135 type Service struct {
136 client *http.Client
137 BasePath string
138 UserAgent string
139
140 BucketAccessControls *BucketAccessControlsService
141
142 Buckets *BucketsService
143
144 ObjectAccessControls *ObjectAccessControlsService
145
146 Objects *ObjectsService
147 }
148
149 func (s *Service) userAgent() string {
150 if s.UserAgent == "" {
151 return googleapi.UserAgent
152 }
153 return googleapi.UserAgent + " " + s.UserAgent
154 }
155
156 func NewBucketAccessControlsService(s *Service) *BucketAccessControlsService {
157 rs := &BucketAccessControlsService{s: s}
158 return rs
159 }
160
161 type BucketAccessControlsService struct {
162 s *Service
163 }
164
165 func NewBucketsService(s *Service) *BucketsService {
166 rs := &BucketsService{s: s}
167 return rs
168 }
169
170 type BucketsService struct {
171 s *Service
172 }
173
174 func NewObjectAccessControlsService(s *Service) *ObjectAccessControlsService {
175 rs := &ObjectAccessControlsService{s: s}
176 return rs
177 }
178
179 type ObjectAccessControlsService struct {
180 s *Service
181 }
182
183 func NewObjectsService(s *Service) *ObjectsService {
184 rs := &ObjectsService{s: s}
185 return rs
186 }
187
188 type ObjectsService struct {
189 s *Service
190 }
191
192
193 type Bucket struct {
194
195 Acl []*BucketAccessControl `json:"acl,omitempty"`
196
197
198
199 DefaultObjectAcl []*ObjectAccessControl `json:"defaultObjectAcl,omitempty"`
200
201
202 Id string `json:"id,omitempty"`
203
204
205
206 Kind string `json:"kind,omitempty"`
207
208
209
210
211 Location string `json:"location,omitempty"`
212
213
214
215 Owner *BucketOwner `json:"owner,omitempty"`
216
217
218 ProjectId uint64 `json:"projectId,omitempty,string"`
219
220
221 SelfLink string `json:"selfLink,omitempty"`
222
223
224 TimeCreated string `json:"timeCreated,omitempty"`
225
226
227 Website *BucketWebsite `json:"website,omitempty"`
228
229
230
231 googleapi.ServerResponse `json:"-"`
232
233
234
235
236
237
238
239 ForceSendFields []string `json:"-"`
240
241
242
243
244
245
246
247 NullFields []string `json:"-"`
248 }
249
250 func (s *Bucket) MarshalJSON() ([]byte, error) {
251 type NoMethod Bucket
252 raw := NoMethod(*s)
253 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
254 }
255
256
257
258 type BucketOwner struct {
259
260 Entity string `json:"entity,omitempty"`
261
262
263 EntityId string `json:"entityId,omitempty"`
264
265
266
267
268
269
270
271 ForceSendFields []string `json:"-"`
272
273
274
275
276
277
278
279 NullFields []string `json:"-"`
280 }
281
282 func (s *BucketOwner) MarshalJSON() ([]byte, error) {
283 type NoMethod BucketOwner
284 raw := NoMethod(*s)
285 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
286 }
287
288
289 type BucketWebsite struct {
290
291
292 MainPageSuffix string `json:"mainPageSuffix,omitempty"`
293
294
295
296 NotFoundPage string `json:"notFoundPage,omitempty"`
297
298
299
300
301
302
303
304 ForceSendFields []string `json:"-"`
305
306
307
308
309
310
311
312
313 NullFields []string `json:"-"`
314 }
315
316 func (s *BucketWebsite) MarshalJSON() ([]byte, error) {
317 type NoMethod BucketWebsite
318 raw := NoMethod(*s)
319 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
320 }
321
322
323 type BucketAccessControl struct {
324
325 Bucket string `json:"bucket,omitempty"`
326
327
328 Domain string `json:"domain,omitempty"`
329
330
331 Email string `json:"email,omitempty"`
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347 Entity string `json:"entity,omitempty"`
348
349
350 EntityId string `json:"entityId,omitempty"`
351
352
353 Id string `json:"id,omitempty"`
354
355
356
357 Kind string `json:"kind,omitempty"`
358
359
360
361 Role string `json:"role,omitempty"`
362
363
364 SelfLink string `json:"selfLink,omitempty"`
365
366
367
368 googleapi.ServerResponse `json:"-"`
369
370
371
372
373
374
375
376 ForceSendFields []string `json:"-"`
377
378
379
380
381
382
383
384 NullFields []string `json:"-"`
385 }
386
387 func (s *BucketAccessControl) MarshalJSON() ([]byte, error) {
388 type NoMethod BucketAccessControl
389 raw := NoMethod(*s)
390 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
391 }
392
393
394 type BucketAccessControls struct {
395
396 Items []*BucketAccessControl `json:"items,omitempty"`
397
398
399
400 Kind string `json:"kind,omitempty"`
401
402
403
404 googleapi.ServerResponse `json:"-"`
405
406
407
408
409
410
411
412 ForceSendFields []string `json:"-"`
413
414
415
416
417
418
419
420 NullFields []string `json:"-"`
421 }
422
423 func (s *BucketAccessControls) MarshalJSON() ([]byte, error) {
424 type NoMethod BucketAccessControls
425 raw := NoMethod(*s)
426 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
427 }
428
429
430 type Buckets struct {
431
432 Items []*Bucket `json:"items,omitempty"`
433
434
435
436 Kind string `json:"kind,omitempty"`
437
438
439
440
441 NextPageToken string `json:"nextPageToken,omitempty"`
442
443
444
445 googleapi.ServerResponse `json:"-"`
446
447
448
449
450
451
452
453 ForceSendFields []string `json:"-"`
454
455
456
457
458
459
460
461 NullFields []string `json:"-"`
462 }
463
464 func (s *Buckets) MarshalJSON() ([]byte, error) {
465 type NoMethod Buckets
466 raw := NoMethod(*s)
467 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
468 }
469
470
471 type Object struct {
472
473 Acl []*ObjectAccessControl `json:"acl,omitempty"`
474
475
476 Bucket string `json:"bucket,omitempty"`
477
478
479 CacheControl string `json:"cacheControl,omitempty"`
480
481
482 ContentDisposition string `json:"contentDisposition,omitempty"`
483
484
485 ContentEncoding string `json:"contentEncoding,omitempty"`
486
487
488 ContentLanguage string `json:"contentLanguage,omitempty"`
489
490
491 Id string `json:"id,omitempty"`
492
493
494
495 Kind string `json:"kind,omitempty"`
496
497
498
499 Media *ObjectMedia `json:"media,omitempty"`
500
501
502 Metadata map[string]string `json:"metadata,omitempty"`
503
504
505
506 Name string `json:"name,omitempty"`
507
508
509
510 Owner *ObjectOwner `json:"owner,omitempty"`
511
512
513 SelfLink string `json:"selfLink,omitempty"`
514
515
516
517 googleapi.ServerResponse `json:"-"`
518
519
520
521
522
523
524
525 ForceSendFields []string `json:"-"`
526
527
528
529
530
531
532
533 NullFields []string `json:"-"`
534 }
535
536 func (s *Object) MarshalJSON() ([]byte, error) {
537 type NoMethod Object
538 raw := NoMethod(*s)
539 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
540 }
541
542
543
544
545 type ObjectMedia struct {
546
547
548 Algorithm string `json:"algorithm,omitempty"`
549
550
551 ContentType string `json:"contentType,omitempty"`
552
553
554
555
556
557 Data string `json:"data,omitempty"`
558
559
560 Hash string `json:"hash,omitempty"`
561
562
563 Length uint64 `json:"length,omitempty,string"`
564
565
566 Link string `json:"link,omitempty"`
567
568
569 TimeCreated string `json:"timeCreated,omitempty"`
570
571
572
573
574
575
576
577 ForceSendFields []string `json:"-"`
578
579
580
581
582
583
584
585 NullFields []string `json:"-"`
586 }
587
588 func (s *ObjectMedia) MarshalJSON() ([]byte, error) {
589 type NoMethod ObjectMedia
590 raw := NoMethod(*s)
591 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
592 }
593
594
595
596 type ObjectOwner struct {
597
598 Entity string `json:"entity,omitempty"`
599
600
601 EntityId string `json:"entityId,omitempty"`
602
603
604
605
606
607
608
609 ForceSendFields []string `json:"-"`
610
611
612
613
614
615
616
617 NullFields []string `json:"-"`
618 }
619
620 func (s *ObjectOwner) MarshalJSON() ([]byte, error) {
621 type NoMethod ObjectOwner
622 raw := NoMethod(*s)
623 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
624 }
625
626
627 type ObjectAccessControl struct {
628
629 Bucket string `json:"bucket,omitempty"`
630
631
632 Domain string `json:"domain,omitempty"`
633
634
635 Email string `json:"email,omitempty"`
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651 Entity string `json:"entity,omitempty"`
652
653
654 EntityId string `json:"entityId,omitempty"`
655
656
657 Id string `json:"id,omitempty"`
658
659
660
661 Kind string `json:"kind,omitempty"`
662
663
664 Object string `json:"object,omitempty"`
665
666
667 Role string `json:"role,omitempty"`
668
669
670 SelfLink string `json:"selfLink,omitempty"`
671
672
673
674 googleapi.ServerResponse `json:"-"`
675
676
677
678
679
680
681
682 ForceSendFields []string `json:"-"`
683
684
685
686
687
688
689
690 NullFields []string `json:"-"`
691 }
692
693 func (s *ObjectAccessControl) MarshalJSON() ([]byte, error) {
694 type NoMethod ObjectAccessControl
695 raw := NoMethod(*s)
696 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
697 }
698
699
700 type ObjectAccessControls struct {
701
702 Items []*ObjectAccessControl `json:"items,omitempty"`
703
704
705
706 Kind string `json:"kind,omitempty"`
707
708
709
710 googleapi.ServerResponse `json:"-"`
711
712
713
714
715
716
717
718 ForceSendFields []string `json:"-"`
719
720
721
722
723
724
725
726 NullFields []string `json:"-"`
727 }
728
729 func (s *ObjectAccessControls) MarshalJSON() ([]byte, error) {
730 type NoMethod ObjectAccessControls
731 raw := NoMethod(*s)
732 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
733 }
734
735
736 type Objects struct {
737
738 Items []*Object `json:"items,omitempty"`
739
740
741
742 Kind string `json:"kind,omitempty"`
743
744
745
746
747 NextPageToken string `json:"nextPageToken,omitempty"`
748
749
750
751 Prefixes []string `json:"prefixes,omitempty"`
752
753
754
755 googleapi.ServerResponse `json:"-"`
756
757
758
759
760
761
762
763 ForceSendFields []string `json:"-"`
764
765
766
767
768
769
770
771 NullFields []string `json:"-"`
772 }
773
774 func (s *Objects) MarshalJSON() ([]byte, error) {
775 type NoMethod Objects
776 raw := NoMethod(*s)
777 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
778 }
779
780
781
782 type BucketAccessControlsDeleteCall struct {
783 s *Service
784 bucket string
785 entity string
786 urlParams_ gensupport.URLParams
787 ctx_ context.Context
788 header_ http.Header
789 }
790
791
792
793 func (r *BucketAccessControlsService) Delete(bucket string, entity string) *BucketAccessControlsDeleteCall {
794 c := &BucketAccessControlsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
795 c.bucket = bucket
796 c.entity = entity
797 return c
798 }
799
800
801
802
803 func (c *BucketAccessControlsDeleteCall) Fields(s ...googleapi.Field) *BucketAccessControlsDeleteCall {
804 c.urlParams_.Set("fields", googleapi.CombineFields(s))
805 return c
806 }
807
808
809
810
811 func (c *BucketAccessControlsDeleteCall) Context(ctx context.Context) *BucketAccessControlsDeleteCall {
812 c.ctx_ = ctx
813 return c
814 }
815
816
817
818 func (c *BucketAccessControlsDeleteCall) Header() http.Header {
819 if c.header_ == nil {
820 c.header_ = make(http.Header)
821 }
822 return c.header_
823 }
824
825 func (c *BucketAccessControlsDeleteCall) doRequest(alt string) (*http.Response, error) {
826 reqHeaders := make(http.Header)
827 reqHeaders.Set("x-goog-api-client", "gl-go/1.13.7 gdcl/20200203")
828 for k, v := range c.header_ {
829 reqHeaders[k] = v
830 }
831 reqHeaders.Set("User-Agent", c.s.userAgent())
832 var body io.Reader = nil
833 c.urlParams_.Set("alt", alt)
834 c.urlParams_.Set("prettyPrint", "false")
835 urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/acl/{entity}")
836 urls += "?" + c.urlParams_.Encode()
837 req, err := http.NewRequest("DELETE", urls, body)
838 if err != nil {
839 return nil, err
840 }
841 req.Header = reqHeaders
842 googleapi.Expand(req.URL, map[string]string{
843 "bucket": c.bucket,
844 "entity": c.entity,
845 })
846 return gensupport.SendRequest(c.ctx_, c.s.client, req)
847 }
848
849
850 func (c *BucketAccessControlsDeleteCall) Do(opts ...googleapi.CallOption) error {
851 gensupport.SetOptions(c.urlParams_, opts...)
852 res, err := c.doRequest("json")
853 if err != nil {
854 return err
855 }
856 defer googleapi.CloseBody(res)
857 if err := googleapi.CheckResponse(res); err != nil {
858 return err
859 }
860 return nil
861
862
863
864
865
866
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 type BucketAccessControlsGetCall struct {
894 s *Service
895 bucket string
896 entity string
897 urlParams_ gensupport.URLParams
898 ifNoneMatch_ string
899 ctx_ context.Context
900 header_ http.Header
901 }
902
903
904
905 func (r *BucketAccessControlsService) Get(bucket string, entity string) *BucketAccessControlsGetCall {
906 c := &BucketAccessControlsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
907 c.bucket = bucket
908 c.entity = entity
909 return c
910 }
911
912
913
914
915 func (c *BucketAccessControlsGetCall) Fields(s ...googleapi.Field) *BucketAccessControlsGetCall {
916 c.urlParams_.Set("fields", googleapi.CombineFields(s))
917 return c
918 }
919
920
921
922
923
924
925 func (c *BucketAccessControlsGetCall) IfNoneMatch(entityTag string) *BucketAccessControlsGetCall {
926 c.ifNoneMatch_ = entityTag
927 return c
928 }
929
930
931
932
933 func (c *BucketAccessControlsGetCall) Context(ctx context.Context) *BucketAccessControlsGetCall {
934 c.ctx_ = ctx
935 return c
936 }
937
938
939
940 func (c *BucketAccessControlsGetCall) Header() http.Header {
941 if c.header_ == nil {
942 c.header_ = make(http.Header)
943 }
944 return c.header_
945 }
946
947 func (c *BucketAccessControlsGetCall) doRequest(alt string) (*http.Response, error) {
948 reqHeaders := make(http.Header)
949 reqHeaders.Set("x-goog-api-client", "gl-go/1.13.7 gdcl/20200203")
950 for k, v := range c.header_ {
951 reqHeaders[k] = v
952 }
953 reqHeaders.Set("User-Agent", c.s.userAgent())
954 if c.ifNoneMatch_ != "" {
955 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
956 }
957 var body io.Reader = nil
958 c.urlParams_.Set("alt", alt)
959 c.urlParams_.Set("prettyPrint", "false")
960 urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/acl/{entity}")
961 urls += "?" + c.urlParams_.Encode()
962 req, err := http.NewRequest("GET", urls, body)
963 if err != nil {
964 return nil, err
965 }
966 req.Header = reqHeaders
967 googleapi.Expand(req.URL, map[string]string{
968 "bucket": c.bucket,
969 "entity": c.entity,
970 })
971 return gensupport.SendRequest(c.ctx_, c.s.client, req)
972 }
973
974
975
976
977
978
979
980
981 func (c *BucketAccessControlsGetCall) Do(opts ...googleapi.CallOption) (*BucketAccessControl, error) {
982 gensupport.SetOptions(c.urlParams_, opts...)
983 res, err := c.doRequest("json")
984 if res != nil && res.StatusCode == http.StatusNotModified {
985 if res.Body != nil {
986 res.Body.Close()
987 }
988 return nil, &googleapi.Error{
989 Code: res.StatusCode,
990 Header: res.Header,
991 }
992 }
993 if err != nil {
994 return nil, err
995 }
996 defer googleapi.CloseBody(res)
997 if err := googleapi.CheckResponse(res); err != nil {
998 return nil, err
999 }
1000 ret := &BucketAccessControl{
1001 ServerResponse: googleapi.ServerResponse{
1002 Header: res.Header,
1003 HTTPStatusCode: res.StatusCode,
1004 },
1005 }
1006 target := &ret
1007 if err := gensupport.DecodeResponse(target, res); err != nil {
1008 return nil, err
1009 }
1010 return ret, nil
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042 }
1043
1044
1045
1046 type BucketAccessControlsInsertCall struct {
1047 s *Service
1048 bucket string
1049 bucketaccesscontrol *BucketAccessControl
1050 urlParams_ gensupport.URLParams
1051 ctx_ context.Context
1052 header_ http.Header
1053 }
1054
1055
1056 func (r *BucketAccessControlsService) Insert(bucket string, bucketaccesscontrol *BucketAccessControl) *BucketAccessControlsInsertCall {
1057 c := &BucketAccessControlsInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1058 c.bucket = bucket
1059 c.bucketaccesscontrol = bucketaccesscontrol
1060 return c
1061 }
1062
1063
1064
1065
1066 func (c *BucketAccessControlsInsertCall) Fields(s ...googleapi.Field) *BucketAccessControlsInsertCall {
1067 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1068 return c
1069 }
1070
1071
1072
1073
1074 func (c *BucketAccessControlsInsertCall) Context(ctx context.Context) *BucketAccessControlsInsertCall {
1075 c.ctx_ = ctx
1076 return c
1077 }
1078
1079
1080
1081 func (c *BucketAccessControlsInsertCall) Header() http.Header {
1082 if c.header_ == nil {
1083 c.header_ = make(http.Header)
1084 }
1085 return c.header_
1086 }
1087
1088 func (c *BucketAccessControlsInsertCall) doRequest(alt string) (*http.Response, error) {
1089 reqHeaders := make(http.Header)
1090 reqHeaders.Set("x-goog-api-client", "gl-go/1.13.7 gdcl/20200203")
1091 for k, v := range c.header_ {
1092 reqHeaders[k] = v
1093 }
1094 reqHeaders.Set("User-Agent", c.s.userAgent())
1095 var body io.Reader = nil
1096 body, err := googleapi.WithoutDataWrapper.JSONReader(c.bucketaccesscontrol)
1097 if err != nil {
1098 return nil, err
1099 }
1100 reqHeaders.Set("Content-Type", "application/json")
1101 c.urlParams_.Set("alt", alt)
1102 c.urlParams_.Set("prettyPrint", "false")
1103 urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/acl")
1104 urls += "?" + c.urlParams_.Encode()
1105 req, err := http.NewRequest("POST", urls, body)
1106 if err != nil {
1107 return nil, err
1108 }
1109 req.Header = reqHeaders
1110 googleapi.Expand(req.URL, map[string]string{
1111 "bucket": c.bucket,
1112 })
1113 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1114 }
1115
1116
1117
1118
1119
1120
1121
1122
1123 func (c *BucketAccessControlsInsertCall) Do(opts ...googleapi.CallOption) (*BucketAccessControl, error) {
1124 gensupport.SetOptions(c.urlParams_, opts...)
1125 res, err := c.doRequest("json")
1126 if res != nil && res.StatusCode == http.StatusNotModified {
1127 if res.Body != nil {
1128 res.Body.Close()
1129 }
1130 return nil, &googleapi.Error{
1131 Code: res.StatusCode,
1132 Header: res.Header,
1133 }
1134 }
1135 if err != nil {
1136 return nil, err
1137 }
1138 defer googleapi.CloseBody(res)
1139 if err := googleapi.CheckResponse(res); err != nil {
1140 return nil, err
1141 }
1142 ret := &BucketAccessControl{
1143 ServerResponse: googleapi.ServerResponse{
1144 Header: res.Header,
1145 HTTPStatusCode: res.StatusCode,
1146 },
1147 }
1148 target := &ret
1149 if err := gensupport.DecodeResponse(target, res); err != nil {
1150 return nil, err
1151 }
1152 return ret, nil
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180 }
1181
1182
1183
1184 type BucketAccessControlsListCall struct {
1185 s *Service
1186 bucket string
1187 urlParams_ gensupport.URLParams
1188 ifNoneMatch_ string
1189 ctx_ context.Context
1190 header_ http.Header
1191 }
1192
1193
1194 func (r *BucketAccessControlsService) List(bucket string) *BucketAccessControlsListCall {
1195 c := &BucketAccessControlsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1196 c.bucket = bucket
1197 return c
1198 }
1199
1200
1201
1202
1203 func (c *BucketAccessControlsListCall) Fields(s ...googleapi.Field) *BucketAccessControlsListCall {
1204 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1205 return c
1206 }
1207
1208
1209
1210
1211
1212
1213 func (c *BucketAccessControlsListCall) IfNoneMatch(entityTag string) *BucketAccessControlsListCall {
1214 c.ifNoneMatch_ = entityTag
1215 return c
1216 }
1217
1218
1219
1220
1221 func (c *BucketAccessControlsListCall) Context(ctx context.Context) *BucketAccessControlsListCall {
1222 c.ctx_ = ctx
1223 return c
1224 }
1225
1226
1227
1228 func (c *BucketAccessControlsListCall) Header() http.Header {
1229 if c.header_ == nil {
1230 c.header_ = make(http.Header)
1231 }
1232 return c.header_
1233 }
1234
1235 func (c *BucketAccessControlsListCall) doRequest(alt string) (*http.Response, error) {
1236 reqHeaders := make(http.Header)
1237 reqHeaders.Set("x-goog-api-client", "gl-go/1.13.7 gdcl/20200203")
1238 for k, v := range c.header_ {
1239 reqHeaders[k] = v
1240 }
1241 reqHeaders.Set("User-Agent", c.s.userAgent())
1242 if c.ifNoneMatch_ != "" {
1243 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
1244 }
1245 var body io.Reader = nil
1246 c.urlParams_.Set("alt", alt)
1247 c.urlParams_.Set("prettyPrint", "false")
1248 urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/acl")
1249 urls += "?" + c.urlParams_.Encode()
1250 req, err := http.NewRequest("GET", urls, body)
1251 if err != nil {
1252 return nil, err
1253 }
1254 req.Header = reqHeaders
1255 googleapi.Expand(req.URL, map[string]string{
1256 "bucket": c.bucket,
1257 })
1258 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1259 }
1260
1261
1262
1263
1264
1265
1266
1267
1268 func (c *BucketAccessControlsListCall) Do(opts ...googleapi.CallOption) (*BucketAccessControls, error) {
1269 gensupport.SetOptions(c.urlParams_, opts...)
1270 res, err := c.doRequest("json")
1271 if res != nil && res.StatusCode == http.StatusNotModified {
1272 if res.Body != nil {
1273 res.Body.Close()
1274 }
1275 return nil, &googleapi.Error{
1276 Code: res.StatusCode,
1277 Header: res.Header,
1278 }
1279 }
1280 if err != nil {
1281 return nil, err
1282 }
1283 defer googleapi.CloseBody(res)
1284 if err := googleapi.CheckResponse(res); err != nil {
1285 return nil, err
1286 }
1287 ret := &BucketAccessControls{
1288 ServerResponse: googleapi.ServerResponse{
1289 Header: res.Header,
1290 HTTPStatusCode: res.StatusCode,
1291 },
1292 }
1293 target := &ret
1294 if err := gensupport.DecodeResponse(target, res); err != nil {
1295 return nil, err
1296 }
1297 return ret, nil
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322 }
1323
1324
1325
1326 type BucketAccessControlsPatchCall struct {
1327 s *Service
1328 bucket string
1329 entity string
1330 bucketaccesscontrol *BucketAccessControl
1331 urlParams_ gensupport.URLParams
1332 ctx_ context.Context
1333 header_ http.Header
1334 }
1335
1336
1337
1338 func (r *BucketAccessControlsService) Patch(bucket string, entity string, bucketaccesscontrol *BucketAccessControl) *BucketAccessControlsPatchCall {
1339 c := &BucketAccessControlsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1340 c.bucket = bucket
1341 c.entity = entity
1342 c.bucketaccesscontrol = bucketaccesscontrol
1343 return c
1344 }
1345
1346
1347
1348
1349 func (c *BucketAccessControlsPatchCall) Fields(s ...googleapi.Field) *BucketAccessControlsPatchCall {
1350 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1351 return c
1352 }
1353
1354
1355
1356
1357 func (c *BucketAccessControlsPatchCall) Context(ctx context.Context) *BucketAccessControlsPatchCall {
1358 c.ctx_ = ctx
1359 return c
1360 }
1361
1362
1363
1364 func (c *BucketAccessControlsPatchCall) Header() http.Header {
1365 if c.header_ == nil {
1366 c.header_ = make(http.Header)
1367 }
1368 return c.header_
1369 }
1370
1371 func (c *BucketAccessControlsPatchCall) doRequest(alt string) (*http.Response, error) {
1372 reqHeaders := make(http.Header)
1373 reqHeaders.Set("x-goog-api-client", "gl-go/1.13.7 gdcl/20200203")
1374 for k, v := range c.header_ {
1375 reqHeaders[k] = v
1376 }
1377 reqHeaders.Set("User-Agent", c.s.userAgent())
1378 var body io.Reader = nil
1379 body, err := googleapi.WithoutDataWrapper.JSONReader(c.bucketaccesscontrol)
1380 if err != nil {
1381 return nil, err
1382 }
1383 reqHeaders.Set("Content-Type", "application/json")
1384 c.urlParams_.Set("alt", alt)
1385 c.urlParams_.Set("prettyPrint", "false")
1386 urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/acl/{entity}")
1387 urls += "?" + c.urlParams_.Encode()
1388 req, err := http.NewRequest("PATCH", urls, body)
1389 if err != nil {
1390 return nil, err
1391 }
1392 req.Header = reqHeaders
1393 googleapi.Expand(req.URL, map[string]string{
1394 "bucket": c.bucket,
1395 "entity": c.entity,
1396 })
1397 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1398 }
1399
1400
1401
1402
1403
1404
1405
1406
1407 func (c *BucketAccessControlsPatchCall) Do(opts ...googleapi.CallOption) (*BucketAccessControl, error) {
1408 gensupport.SetOptions(c.urlParams_, opts...)
1409 res, err := c.doRequest("json")
1410 if res != nil && res.StatusCode == http.StatusNotModified {
1411 if res.Body != nil {
1412 res.Body.Close()
1413 }
1414 return nil, &googleapi.Error{
1415 Code: res.StatusCode,
1416 Header: res.Header,
1417 }
1418 }
1419 if err != nil {
1420 return nil, err
1421 }
1422 defer googleapi.CloseBody(res)
1423 if err := googleapi.CheckResponse(res); err != nil {
1424 return nil, err
1425 }
1426 ret := &BucketAccessControl{
1427 ServerResponse: googleapi.ServerResponse{
1428 Header: res.Header,
1429 HTTPStatusCode: res.StatusCode,
1430 },
1431 }
1432 target := &ret
1433 if err := gensupport.DecodeResponse(target, res); err != nil {
1434 return nil, err
1435 }
1436 return ret, nil
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471 }
1472
1473
1474
1475 type BucketAccessControlsUpdateCall struct {
1476 s *Service
1477 bucket string
1478 entity string
1479 bucketaccesscontrol *BucketAccessControl
1480 urlParams_ gensupport.URLParams
1481 ctx_ context.Context
1482 header_ http.Header
1483 }
1484
1485
1486 func (r *BucketAccessControlsService) Update(bucket string, entity string, bucketaccesscontrol *BucketAccessControl) *BucketAccessControlsUpdateCall {
1487 c := &BucketAccessControlsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1488 c.bucket = bucket
1489 c.entity = entity
1490 c.bucketaccesscontrol = bucketaccesscontrol
1491 return c
1492 }
1493
1494
1495
1496
1497 func (c *BucketAccessControlsUpdateCall) Fields(s ...googleapi.Field) *BucketAccessControlsUpdateCall {
1498 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1499 return c
1500 }
1501
1502
1503
1504
1505 func (c *BucketAccessControlsUpdateCall) Context(ctx context.Context) *BucketAccessControlsUpdateCall {
1506 c.ctx_ = ctx
1507 return c
1508 }
1509
1510
1511
1512 func (c *BucketAccessControlsUpdateCall) Header() http.Header {
1513 if c.header_ == nil {
1514 c.header_ = make(http.Header)
1515 }
1516 return c.header_
1517 }
1518
1519 func (c *BucketAccessControlsUpdateCall) doRequest(alt string) (*http.Response, error) {
1520 reqHeaders := make(http.Header)
1521 reqHeaders.Set("x-goog-api-client", "gl-go/1.13.7 gdcl/20200203")
1522 for k, v := range c.header_ {
1523 reqHeaders[k] = v
1524 }
1525 reqHeaders.Set("User-Agent", c.s.userAgent())
1526 var body io.Reader = nil
1527 body, err := googleapi.WithoutDataWrapper.JSONReader(c.bucketaccesscontrol)
1528 if err != nil {
1529 return nil, err
1530 }
1531 reqHeaders.Set("Content-Type", "application/json")
1532 c.urlParams_.Set("alt", alt)
1533 c.urlParams_.Set("prettyPrint", "false")
1534 urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/acl/{entity}")
1535 urls += "?" + c.urlParams_.Encode()
1536 req, err := http.NewRequest("PUT", urls, body)
1537 if err != nil {
1538 return nil, err
1539 }
1540 req.Header = reqHeaders
1541 googleapi.Expand(req.URL, map[string]string{
1542 "bucket": c.bucket,
1543 "entity": c.entity,
1544 })
1545 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1546 }
1547
1548
1549
1550
1551
1552
1553
1554
1555 func (c *BucketAccessControlsUpdateCall) Do(opts ...googleapi.CallOption) (*BucketAccessControl, error) {
1556 gensupport.SetOptions(c.urlParams_, opts...)
1557 res, err := c.doRequest("json")
1558 if res != nil && res.StatusCode == http.StatusNotModified {
1559 if res.Body != nil {
1560 res.Body.Close()
1561 }
1562 return nil, &googleapi.Error{
1563 Code: res.StatusCode,
1564 Header: res.Header,
1565 }
1566 }
1567 if err != nil {
1568 return nil, err
1569 }
1570 defer googleapi.CloseBody(res)
1571 if err := googleapi.CheckResponse(res); err != nil {
1572 return nil, err
1573 }
1574 ret := &BucketAccessControl{
1575 ServerResponse: googleapi.ServerResponse{
1576 Header: res.Header,
1577 HTTPStatusCode: res.StatusCode,
1578 },
1579 }
1580 target := &ret
1581 if err := gensupport.DecodeResponse(target, res); err != nil {
1582 return nil, err
1583 }
1584 return ret, nil
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619 }
1620
1621
1622
1623 type BucketsDeleteCall struct {
1624 s *Service
1625 bucket string
1626 urlParams_ gensupport.URLParams
1627 ctx_ context.Context
1628 header_ http.Header
1629 }
1630
1631
1632 func (r *BucketsService) Delete(bucket string) *BucketsDeleteCall {
1633 c := &BucketsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1634 c.bucket = bucket
1635 return c
1636 }
1637
1638
1639
1640
1641 func (c *BucketsDeleteCall) Fields(s ...googleapi.Field) *BucketsDeleteCall {
1642 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1643 return c
1644 }
1645
1646
1647
1648
1649 func (c *BucketsDeleteCall) Context(ctx context.Context) *BucketsDeleteCall {
1650 c.ctx_ = ctx
1651 return c
1652 }
1653
1654
1655
1656 func (c *BucketsDeleteCall) Header() http.Header {
1657 if c.header_ == nil {
1658 c.header_ = make(http.Header)
1659 }
1660 return c.header_
1661 }
1662
1663 func (c *BucketsDeleteCall) doRequest(alt string) (*http.Response, error) {
1664 reqHeaders := make(http.Header)
1665 reqHeaders.Set("x-goog-api-client", "gl-go/1.13.7 gdcl/20200203")
1666 for k, v := range c.header_ {
1667 reqHeaders[k] = v
1668 }
1669 reqHeaders.Set("User-Agent", c.s.userAgent())
1670 var body io.Reader = nil
1671 c.urlParams_.Set("alt", alt)
1672 c.urlParams_.Set("prettyPrint", "false")
1673 urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}")
1674 urls += "?" + c.urlParams_.Encode()
1675 req, err := http.NewRequest("DELETE", urls, body)
1676 if err != nil {
1677 return nil, err
1678 }
1679 req.Header = reqHeaders
1680 googleapi.Expand(req.URL, map[string]string{
1681 "bucket": c.bucket,
1682 })
1683 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1684 }
1685
1686
1687 func (c *BucketsDeleteCall) Do(opts ...googleapi.CallOption) error {
1688 gensupport.SetOptions(c.urlParams_, opts...)
1689 res, err := c.doRequest("json")
1690 if err != nil {
1691 return err
1692 }
1693 defer googleapi.CloseBody(res)
1694 if err := googleapi.CheckResponse(res); err != nil {
1695 return err
1696 }
1697 return nil
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720 }
1721
1722
1723
1724 type BucketsGetCall struct {
1725 s *Service
1726 bucket string
1727 urlParams_ gensupport.URLParams
1728 ifNoneMatch_ string
1729 ctx_ context.Context
1730 header_ http.Header
1731 }
1732
1733
1734 func (r *BucketsService) Get(bucket string) *BucketsGetCall {
1735 c := &BucketsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1736 c.bucket = bucket
1737 return c
1738 }
1739
1740
1741
1742
1743
1744
1745
1746
1747 func (c *BucketsGetCall) Projection(projection string) *BucketsGetCall {
1748 c.urlParams_.Set("projection", projection)
1749 return c
1750 }
1751
1752
1753
1754
1755 func (c *BucketsGetCall) Fields(s ...googleapi.Field) *BucketsGetCall {
1756 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1757 return c
1758 }
1759
1760
1761
1762
1763
1764
1765 func (c *BucketsGetCall) IfNoneMatch(entityTag string) *BucketsGetCall {
1766 c.ifNoneMatch_ = entityTag
1767 return c
1768 }
1769
1770
1771
1772
1773 func (c *BucketsGetCall) Context(ctx context.Context) *BucketsGetCall {
1774 c.ctx_ = ctx
1775 return c
1776 }
1777
1778
1779
1780 func (c *BucketsGetCall) Header() http.Header {
1781 if c.header_ == nil {
1782 c.header_ = make(http.Header)
1783 }
1784 return c.header_
1785 }
1786
1787 func (c *BucketsGetCall) doRequest(alt string) (*http.Response, error) {
1788 reqHeaders := make(http.Header)
1789 reqHeaders.Set("x-goog-api-client", "gl-go/1.13.7 gdcl/20200203")
1790 for k, v := range c.header_ {
1791 reqHeaders[k] = v
1792 }
1793 reqHeaders.Set("User-Agent", c.s.userAgent())
1794 if c.ifNoneMatch_ != "" {
1795 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
1796 }
1797 var body io.Reader = nil
1798 c.urlParams_.Set("alt", alt)
1799 c.urlParams_.Set("prettyPrint", "false")
1800 urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}")
1801 urls += "?" + c.urlParams_.Encode()
1802 req, err := http.NewRequest("GET", urls, body)
1803 if err != nil {
1804 return nil, err
1805 }
1806 req.Header = reqHeaders
1807 googleapi.Expand(req.URL, map[string]string{
1808 "bucket": c.bucket,
1809 })
1810 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1811 }
1812
1813
1814
1815
1816
1817
1818
1819
1820 func (c *BucketsGetCall) Do(opts ...googleapi.CallOption) (*Bucket, error) {
1821 gensupport.SetOptions(c.urlParams_, opts...)
1822 res, err := c.doRequest("json")
1823 if res != nil && res.StatusCode == http.StatusNotModified {
1824 if res.Body != nil {
1825 res.Body.Close()
1826 }
1827 return nil, &googleapi.Error{
1828 Code: res.StatusCode,
1829 Header: res.Header,
1830 }
1831 }
1832 if err != nil {
1833 return nil, err
1834 }
1835 defer googleapi.CloseBody(res)
1836 if err := googleapi.CheckResponse(res); err != nil {
1837 return nil, err
1838 }
1839 ret := &Bucket{
1840 ServerResponse: googleapi.ServerResponse{
1841 Header: res.Header,
1842 HTTPStatusCode: res.StatusCode,
1843 },
1844 }
1845 target := &ret
1846 if err := gensupport.DecodeResponse(target, res); err != nil {
1847 return nil, err
1848 }
1849 return ret, nil
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889 }
1890
1891
1892
1893 type BucketsInsertCall struct {
1894 s *Service
1895 bucket *Bucket
1896 urlParams_ gensupport.URLParams
1897 ctx_ context.Context
1898 header_ http.Header
1899 }
1900
1901
1902 func (r *BucketsService) Insert(bucket *Bucket) *BucketsInsertCall {
1903 c := &BucketsInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1904 c.bucket = bucket
1905 return c
1906 }
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917 func (c *BucketsInsertCall) Projection(projection string) *BucketsInsertCall {
1918 c.urlParams_.Set("projection", projection)
1919 return c
1920 }
1921
1922
1923
1924
1925 func (c *BucketsInsertCall) Fields(s ...googleapi.Field) *BucketsInsertCall {
1926 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1927 return c
1928 }
1929
1930
1931
1932
1933 func (c *BucketsInsertCall) Context(ctx context.Context) *BucketsInsertCall {
1934 c.ctx_ = ctx
1935 return c
1936 }
1937
1938
1939
1940 func (c *BucketsInsertCall) Header() http.Header {
1941 if c.header_ == nil {
1942 c.header_ = make(http.Header)
1943 }
1944 return c.header_
1945 }
1946
1947 func (c *BucketsInsertCall) doRequest(alt string) (*http.Response, error) {
1948 reqHeaders := make(http.Header)
1949 reqHeaders.Set("x-goog-api-client", "gl-go/1.13.7 gdcl/20200203")
1950 for k, v := range c.header_ {
1951 reqHeaders[k] = v
1952 }
1953 reqHeaders.Set("User-Agent", c.s.userAgent())
1954 var body io.Reader = nil
1955 body, err := googleapi.WithoutDataWrapper.JSONReader(c.bucket)
1956 if err != nil {
1957 return nil, err
1958 }
1959 reqHeaders.Set("Content-Type", "application/json")
1960 c.urlParams_.Set("alt", alt)
1961 c.urlParams_.Set("prettyPrint", "false")
1962 urls := googleapi.ResolveRelative(c.s.BasePath, "b")
1963 urls += "?" + c.urlParams_.Encode()
1964 req, err := http.NewRequest("POST", urls, body)
1965 if err != nil {
1966 return nil, err
1967 }
1968 req.Header = reqHeaders
1969 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1970 }
1971
1972
1973
1974
1975
1976
1977
1978
1979 func (c *BucketsInsertCall) Do(opts ...googleapi.CallOption) (*Bucket, error) {
1980 gensupport.SetOptions(c.urlParams_, opts...)
1981 res, err := c.doRequest("json")
1982 if res != nil && res.StatusCode == http.StatusNotModified {
1983 if res.Body != nil {
1984 res.Body.Close()
1985 }
1986 return nil, &googleapi.Error{
1987 Code: res.StatusCode,
1988 Header: res.Header,
1989 }
1990 }
1991 if err != nil {
1992 return nil, err
1993 }
1994 defer googleapi.CloseBody(res)
1995 if err := googleapi.CheckResponse(res); err != nil {
1996 return nil, err
1997 }
1998 ret := &Bucket{
1999 ServerResponse: googleapi.ServerResponse{
2000 Header: res.Header,
2001 HTTPStatusCode: res.StatusCode,
2002 },
2003 }
2004 target := &ret
2005 if err := gensupport.DecodeResponse(target, res); err != nil {
2006 return nil, err
2007 }
2008 return ret, nil
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041 }
2042
2043
2044
2045 type BucketsListCall struct {
2046 s *Service
2047 urlParams_ gensupport.URLParams
2048 ifNoneMatch_ string
2049 ctx_ context.Context
2050 header_ http.Header
2051 }
2052
2053
2054 func (r *BucketsService) List(projectId uint64) *BucketsListCall {
2055 c := &BucketsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
2056 c.urlParams_.Set("projectId", fmt.Sprint(projectId))
2057 return c
2058 }
2059
2060
2061
2062 func (c *BucketsListCall) MaxResults(maxResults int64) *BucketsListCall {
2063 c.urlParams_.Set("max-results", fmt.Sprint(maxResults))
2064 return c
2065 }
2066
2067
2068
2069
2070 func (c *BucketsListCall) PageToken(pageToken string) *BucketsListCall {
2071 c.urlParams_.Set("pageToken", pageToken)
2072 return c
2073 }
2074
2075
2076
2077
2078
2079
2080
2081
2082 func (c *BucketsListCall) Projection(projection string) *BucketsListCall {
2083 c.urlParams_.Set("projection", projection)
2084 return c
2085 }
2086
2087
2088
2089
2090 func (c *BucketsListCall) Fields(s ...googleapi.Field) *BucketsListCall {
2091 c.urlParams_.Set("fields", googleapi.CombineFields(s))
2092 return c
2093 }
2094
2095
2096
2097
2098
2099
2100 func (c *BucketsListCall) IfNoneMatch(entityTag string) *BucketsListCall {
2101 c.ifNoneMatch_ = entityTag
2102 return c
2103 }
2104
2105
2106
2107
2108 func (c *BucketsListCall) Context(ctx context.Context) *BucketsListCall {
2109 c.ctx_ = ctx
2110 return c
2111 }
2112
2113
2114
2115 func (c *BucketsListCall) Header() http.Header {
2116 if c.header_ == nil {
2117 c.header_ = make(http.Header)
2118 }
2119 return c.header_
2120 }
2121
2122 func (c *BucketsListCall) doRequest(alt string) (*http.Response, error) {
2123 reqHeaders := make(http.Header)
2124 reqHeaders.Set("x-goog-api-client", "gl-go/1.13.7 gdcl/20200203")
2125 for k, v := range c.header_ {
2126 reqHeaders[k] = v
2127 }
2128 reqHeaders.Set("User-Agent", c.s.userAgent())
2129 if c.ifNoneMatch_ != "" {
2130 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
2131 }
2132 var body io.Reader = nil
2133 c.urlParams_.Set("alt", alt)
2134 c.urlParams_.Set("prettyPrint", "false")
2135 urls := googleapi.ResolveRelative(c.s.BasePath, "b")
2136 urls += "?" + c.urlParams_.Encode()
2137 req, err := http.NewRequest("GET", urls, body)
2138 if err != nil {
2139 return nil, err
2140 }
2141 req.Header = reqHeaders
2142 return gensupport.SendRequest(c.ctx_, c.s.client, req)
2143 }
2144
2145
2146
2147
2148
2149
2150
2151
2152 func (c *BucketsListCall) Do(opts ...googleapi.CallOption) (*Buckets, error) {
2153 gensupport.SetOptions(c.urlParams_, opts...)
2154 res, err := c.doRequest("json")
2155 if res != nil && res.StatusCode == http.StatusNotModified {
2156 if res.Body != nil {
2157 res.Body.Close()
2158 }
2159 return nil, &googleapi.Error{
2160 Code: res.StatusCode,
2161 Header: res.Header,
2162 }
2163 }
2164 if err != nil {
2165 return nil, err
2166 }
2167 defer googleapi.CloseBody(res)
2168 if err := googleapi.CheckResponse(res); err != nil {
2169 return nil, err
2170 }
2171 ret := &Buckets{
2172 ServerResponse: googleapi.ServerResponse{
2173 Header: res.Header,
2174 HTTPStatusCode: res.StatusCode,
2175 },
2176 }
2177 target := &ret
2178 if err := gensupport.DecodeResponse(target, res); err != nil {
2179 return nil, err
2180 }
2181 return ret, nil
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234 }
2235
2236
2237
2238
2239 func (c *BucketsListCall) Pages(ctx context.Context, f func(*Buckets) error) error {
2240 c.ctx_ = ctx
2241 defer c.PageToken(c.urlParams_.Get("pageToken"))
2242 for {
2243 x, err := c.Do()
2244 if err != nil {
2245 return err
2246 }
2247 if err := f(x); err != nil {
2248 return err
2249 }
2250 if x.NextPageToken == "" {
2251 return nil
2252 }
2253 c.PageToken(x.NextPageToken)
2254 }
2255 }
2256
2257
2258
2259 type BucketsPatchCall struct {
2260 s *Service
2261 bucket string
2262 bucket2 *Bucket
2263 urlParams_ gensupport.URLParams
2264 ctx_ context.Context
2265 header_ http.Header
2266 }
2267
2268
2269 func (r *BucketsService) Patch(bucket string, bucket2 *Bucket) *BucketsPatchCall {
2270 c := &BucketsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
2271 c.bucket = bucket
2272 c.bucket2 = bucket2
2273 return c
2274 }
2275
2276
2277
2278
2279
2280
2281
2282
2283 func (c *BucketsPatchCall) Projection(projection string) *BucketsPatchCall {
2284 c.urlParams_.Set("projection", projection)
2285 return c
2286 }
2287
2288
2289
2290
2291 func (c *BucketsPatchCall) Fields(s ...googleapi.Field) *BucketsPatchCall {
2292 c.urlParams_.Set("fields", googleapi.CombineFields(s))
2293 return c
2294 }
2295
2296
2297
2298
2299 func (c *BucketsPatchCall) Context(ctx context.Context) *BucketsPatchCall {
2300 c.ctx_ = ctx
2301 return c
2302 }
2303
2304
2305
2306 func (c *BucketsPatchCall) Header() http.Header {
2307 if c.header_ == nil {
2308 c.header_ = make(http.Header)
2309 }
2310 return c.header_
2311 }
2312
2313 func (c *BucketsPatchCall) doRequest(alt string) (*http.Response, error) {
2314 reqHeaders := make(http.Header)
2315 reqHeaders.Set("x-goog-api-client", "gl-go/1.13.7 gdcl/20200203")
2316 for k, v := range c.header_ {
2317 reqHeaders[k] = v
2318 }
2319 reqHeaders.Set("User-Agent", c.s.userAgent())
2320 var body io.Reader = nil
2321 body, err := googleapi.WithoutDataWrapper.JSONReader(c.bucket2)
2322 if err != nil {
2323 return nil, err
2324 }
2325 reqHeaders.Set("Content-Type", "application/json")
2326 c.urlParams_.Set("alt", alt)
2327 c.urlParams_.Set("prettyPrint", "false")
2328 urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}")
2329 urls += "?" + c.urlParams_.Encode()
2330 req, err := http.NewRequest("PATCH", urls, body)
2331 if err != nil {
2332 return nil, err
2333 }
2334 req.Header = reqHeaders
2335 googleapi.Expand(req.URL, map[string]string{
2336 "bucket": c.bucket,
2337 })
2338 return gensupport.SendRequest(c.ctx_, c.s.client, req)
2339 }
2340
2341
2342
2343
2344
2345
2346
2347
2348 func (c *BucketsPatchCall) Do(opts ...googleapi.CallOption) (*Bucket, error) {
2349 gensupport.SetOptions(c.urlParams_, opts...)
2350 res, err := c.doRequest("json")
2351 if res != nil && res.StatusCode == http.StatusNotModified {
2352 if res.Body != nil {
2353 res.Body.Close()
2354 }
2355 return nil, &googleapi.Error{
2356 Code: res.StatusCode,
2357 Header: res.Header,
2358 }
2359 }
2360 if err != nil {
2361 return nil, err
2362 }
2363 defer googleapi.CloseBody(res)
2364 if err := googleapi.CheckResponse(res); err != nil {
2365 return nil, err
2366 }
2367 ret := &Bucket{
2368 ServerResponse: googleapi.ServerResponse{
2369 Header: res.Header,
2370 HTTPStatusCode: res.StatusCode,
2371 },
2372 }
2373 target := &ret
2374 if err := gensupport.DecodeResponse(target, res); err != nil {
2375 return nil, err
2376 }
2377 return ret, nil
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419 }
2420
2421
2422
2423 type BucketsUpdateCall struct {
2424 s *Service
2425 bucket string
2426 bucket2 *Bucket
2427 urlParams_ gensupport.URLParams
2428 ctx_ context.Context
2429 header_ http.Header
2430 }
2431
2432
2433 func (r *BucketsService) Update(bucket string, bucket2 *Bucket) *BucketsUpdateCall {
2434 c := &BucketsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
2435 c.bucket = bucket
2436 c.bucket2 = bucket2
2437 return c
2438 }
2439
2440
2441
2442
2443
2444
2445
2446
2447 func (c *BucketsUpdateCall) Projection(projection string) *BucketsUpdateCall {
2448 c.urlParams_.Set("projection", projection)
2449 return c
2450 }
2451
2452
2453
2454
2455 func (c *BucketsUpdateCall) Fields(s ...googleapi.Field) *BucketsUpdateCall {
2456 c.urlParams_.Set("fields", googleapi.CombineFields(s))
2457 return c
2458 }
2459
2460
2461
2462
2463 func (c *BucketsUpdateCall) Context(ctx context.Context) *BucketsUpdateCall {
2464 c.ctx_ = ctx
2465 return c
2466 }
2467
2468
2469
2470 func (c *BucketsUpdateCall) Header() http.Header {
2471 if c.header_ == nil {
2472 c.header_ = make(http.Header)
2473 }
2474 return c.header_
2475 }
2476
2477 func (c *BucketsUpdateCall) doRequest(alt string) (*http.Response, error) {
2478 reqHeaders := make(http.Header)
2479 reqHeaders.Set("x-goog-api-client", "gl-go/1.13.7 gdcl/20200203")
2480 for k, v := range c.header_ {
2481 reqHeaders[k] = v
2482 }
2483 reqHeaders.Set("User-Agent", c.s.userAgent())
2484 var body io.Reader = nil
2485 body, err := googleapi.WithoutDataWrapper.JSONReader(c.bucket2)
2486 if err != nil {
2487 return nil, err
2488 }
2489 reqHeaders.Set("Content-Type", "application/json")
2490 c.urlParams_.Set("alt", alt)
2491 c.urlParams_.Set("prettyPrint", "false")
2492 urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}")
2493 urls += "?" + c.urlParams_.Encode()
2494 req, err := http.NewRequest("PUT", urls, body)
2495 if err != nil {
2496 return nil, err
2497 }
2498 req.Header = reqHeaders
2499 googleapi.Expand(req.URL, map[string]string{
2500 "bucket": c.bucket,
2501 })
2502 return gensupport.SendRequest(c.ctx_, c.s.client, req)
2503 }
2504
2505
2506
2507
2508
2509
2510
2511
2512 func (c *BucketsUpdateCall) Do(opts ...googleapi.CallOption) (*Bucket, error) {
2513 gensupport.SetOptions(c.urlParams_, opts...)
2514 res, err := c.doRequest("json")
2515 if res != nil && res.StatusCode == http.StatusNotModified {
2516 if res.Body != nil {
2517 res.Body.Close()
2518 }
2519 return nil, &googleapi.Error{
2520 Code: res.StatusCode,
2521 Header: res.Header,
2522 }
2523 }
2524 if err != nil {
2525 return nil, err
2526 }
2527 defer googleapi.CloseBody(res)
2528 if err := googleapi.CheckResponse(res); err != nil {
2529 return nil, err
2530 }
2531 ret := &Bucket{
2532 ServerResponse: googleapi.ServerResponse{
2533 Header: res.Header,
2534 HTTPStatusCode: res.StatusCode,
2535 },
2536 }
2537 target := &ret
2538 if err := gensupport.DecodeResponse(target, res); err != nil {
2539 return nil, err
2540 }
2541 return ret, nil
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583 }
2584
2585
2586
2587 type ObjectAccessControlsDeleteCall struct {
2588 s *Service
2589 bucket string
2590 object string
2591 entity string
2592 urlParams_ gensupport.URLParams
2593 ctx_ context.Context
2594 header_ http.Header
2595 }
2596
2597
2598
2599 func (r *ObjectAccessControlsService) Delete(bucket string, object string, entity string) *ObjectAccessControlsDeleteCall {
2600 c := &ObjectAccessControlsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
2601 c.bucket = bucket
2602 c.object = object
2603 c.entity = entity
2604 return c
2605 }
2606
2607
2608
2609
2610 func (c *ObjectAccessControlsDeleteCall) Fields(s ...googleapi.Field) *ObjectAccessControlsDeleteCall {
2611 c.urlParams_.Set("fields", googleapi.CombineFields(s))
2612 return c
2613 }
2614
2615
2616
2617
2618 func (c *ObjectAccessControlsDeleteCall) Context(ctx context.Context) *ObjectAccessControlsDeleteCall {
2619 c.ctx_ = ctx
2620 return c
2621 }
2622
2623
2624
2625 func (c *ObjectAccessControlsDeleteCall) Header() http.Header {
2626 if c.header_ == nil {
2627 c.header_ = make(http.Header)
2628 }
2629 return c.header_
2630 }
2631
2632 func (c *ObjectAccessControlsDeleteCall) doRequest(alt string) (*http.Response, error) {
2633 reqHeaders := make(http.Header)
2634 reqHeaders.Set("x-goog-api-client", "gl-go/1.13.7 gdcl/20200203")
2635 for k, v := range c.header_ {
2636 reqHeaders[k] = v
2637 }
2638 reqHeaders.Set("User-Agent", c.s.userAgent())
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, "b/{bucket}/o/{object}/acl/{entity}")
2643 urls += "?" + c.urlParams_.Encode()
2644 req, err := http.NewRequest("DELETE", urls, body)
2645 if err != nil {
2646 return nil, err
2647 }
2648 req.Header = reqHeaders
2649 googleapi.Expand(req.URL, map[string]string{
2650 "bucket": c.bucket,
2651 "object": c.object,
2652 "entity": c.entity,
2653 })
2654 return gensupport.SendRequest(c.ctx_, c.s.client, req)
2655 }
2656
2657
2658 func (c *ObjectAccessControlsDeleteCall) Do(opts ...googleapi.CallOption) error {
2659 gensupport.SetOptions(c.urlParams_, opts...)
2660 res, err := c.doRequest("json")
2661 if err != nil {
2662 return err
2663 }
2664 defer googleapi.CloseBody(res)
2665 if err := googleapi.CheckResponse(res); err != nil {
2666 return err
2667 }
2668 return nil
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704 }
2705
2706
2707
2708 type ObjectAccessControlsGetCall struct {
2709 s *Service
2710 bucket string
2711 object string
2712 entity string
2713 urlParams_ gensupport.URLParams
2714 ifNoneMatch_ string
2715 ctx_ context.Context
2716 header_ http.Header
2717 }
2718
2719
2720
2721 func (r *ObjectAccessControlsService) Get(bucket string, object string, entity string) *ObjectAccessControlsGetCall {
2722 c := &ObjectAccessControlsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
2723 c.bucket = bucket
2724 c.object = object
2725 c.entity = entity
2726 return c
2727 }
2728
2729
2730
2731
2732 func (c *ObjectAccessControlsGetCall) Fields(s ...googleapi.Field) *ObjectAccessControlsGetCall {
2733 c.urlParams_.Set("fields", googleapi.CombineFields(s))
2734 return c
2735 }
2736
2737
2738
2739
2740
2741
2742 func (c *ObjectAccessControlsGetCall) IfNoneMatch(entityTag string) *ObjectAccessControlsGetCall {
2743 c.ifNoneMatch_ = entityTag
2744 return c
2745 }
2746
2747
2748
2749
2750 func (c *ObjectAccessControlsGetCall) Context(ctx context.Context) *ObjectAccessControlsGetCall {
2751 c.ctx_ = ctx
2752 return c
2753 }
2754
2755
2756
2757 func (c *ObjectAccessControlsGetCall) Header() http.Header {
2758 if c.header_ == nil {
2759 c.header_ = make(http.Header)
2760 }
2761 return c.header_
2762 }
2763
2764 func (c *ObjectAccessControlsGetCall) doRequest(alt string) (*http.Response, error) {
2765 reqHeaders := make(http.Header)
2766 reqHeaders.Set("x-goog-api-client", "gl-go/1.13.7 gdcl/20200203")
2767 for k, v := range c.header_ {
2768 reqHeaders[k] = v
2769 }
2770 reqHeaders.Set("User-Agent", c.s.userAgent())
2771 if c.ifNoneMatch_ != "" {
2772 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
2773 }
2774 var body io.Reader = nil
2775 c.urlParams_.Set("alt", alt)
2776 c.urlParams_.Set("prettyPrint", "false")
2777 urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o/{object}/acl/{entity}")
2778 urls += "?" + c.urlParams_.Encode()
2779 req, err := http.NewRequest("GET", urls, body)
2780 if err != nil {
2781 return nil, err
2782 }
2783 req.Header = reqHeaders
2784 googleapi.Expand(req.URL, map[string]string{
2785 "bucket": c.bucket,
2786 "object": c.object,
2787 "entity": c.entity,
2788 })
2789 return gensupport.SendRequest(c.ctx_, c.s.client, req)
2790 }
2791
2792
2793
2794
2795
2796
2797
2798
2799 func (c *ObjectAccessControlsGetCall) Do(opts ...googleapi.CallOption) (*ObjectAccessControl, error) {
2800 gensupport.SetOptions(c.urlParams_, opts...)
2801 res, err := c.doRequest("json")
2802 if res != nil && res.StatusCode == http.StatusNotModified {
2803 if res.Body != nil {
2804 res.Body.Close()
2805 }
2806 return nil, &googleapi.Error{
2807 Code: res.StatusCode,
2808 Header: res.Header,
2809 }
2810 }
2811 if err != nil {
2812 return nil, err
2813 }
2814 defer googleapi.CloseBody(res)
2815 if err := googleapi.CheckResponse(res); err != nil {
2816 return nil, err
2817 }
2818 ret := &ObjectAccessControl{
2819 ServerResponse: googleapi.ServerResponse{
2820 Header: res.Header,
2821 HTTPStatusCode: res.StatusCode,
2822 },
2823 }
2824 target := &ret
2825 if err := gensupport.DecodeResponse(target, res); err != nil {
2826 return nil, err
2827 }
2828 return ret, nil
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867 }
2868
2869
2870
2871 type ObjectAccessControlsInsertCall struct {
2872 s *Service
2873 bucket string
2874 object string
2875 objectaccesscontrol *ObjectAccessControl
2876 urlParams_ gensupport.URLParams
2877 ctx_ context.Context
2878 header_ http.Header
2879 }
2880
2881
2882 func (r *ObjectAccessControlsService) Insert(bucket string, object string, objectaccesscontrol *ObjectAccessControl) *ObjectAccessControlsInsertCall {
2883 c := &ObjectAccessControlsInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
2884 c.bucket = bucket
2885 c.object = object
2886 c.objectaccesscontrol = objectaccesscontrol
2887 return c
2888 }
2889
2890
2891
2892
2893 func (c *ObjectAccessControlsInsertCall) Fields(s ...googleapi.Field) *ObjectAccessControlsInsertCall {
2894 c.urlParams_.Set("fields", googleapi.CombineFields(s))
2895 return c
2896 }
2897
2898
2899
2900
2901 func (c *ObjectAccessControlsInsertCall) Context(ctx context.Context) *ObjectAccessControlsInsertCall {
2902 c.ctx_ = ctx
2903 return c
2904 }
2905
2906
2907
2908 func (c *ObjectAccessControlsInsertCall) Header() http.Header {
2909 if c.header_ == nil {
2910 c.header_ = make(http.Header)
2911 }
2912 return c.header_
2913 }
2914
2915 func (c *ObjectAccessControlsInsertCall) doRequest(alt string) (*http.Response, error) {
2916 reqHeaders := make(http.Header)
2917 reqHeaders.Set("x-goog-api-client", "gl-go/1.13.7 gdcl/20200203")
2918 for k, v := range c.header_ {
2919 reqHeaders[k] = v
2920 }
2921 reqHeaders.Set("User-Agent", c.s.userAgent())
2922 var body io.Reader = nil
2923 body, err := googleapi.WithoutDataWrapper.JSONReader(c.objectaccesscontrol)
2924 if err != nil {
2925 return nil, err
2926 }
2927 reqHeaders.Set("Content-Type", "application/json")
2928 c.urlParams_.Set("alt", alt)
2929 c.urlParams_.Set("prettyPrint", "false")
2930 urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o/{object}/acl")
2931 urls += "?" + c.urlParams_.Encode()
2932 req, err := http.NewRequest("POST", urls, body)
2933 if err != nil {
2934 return nil, err
2935 }
2936 req.Header = reqHeaders
2937 googleapi.Expand(req.URL, map[string]string{
2938 "bucket": c.bucket,
2939 "object": c.object,
2940 })
2941 return gensupport.SendRequest(c.ctx_, c.s.client, req)
2942 }
2943
2944
2945
2946
2947
2948
2949
2950
2951 func (c *ObjectAccessControlsInsertCall) Do(opts ...googleapi.CallOption) (*ObjectAccessControl, error) {
2952 gensupport.SetOptions(c.urlParams_, opts...)
2953 res, err := c.doRequest("json")
2954 if res != nil && res.StatusCode == http.StatusNotModified {
2955 if res.Body != nil {
2956 res.Body.Close()
2957 }
2958 return nil, &googleapi.Error{
2959 Code: res.StatusCode,
2960 Header: res.Header,
2961 }
2962 }
2963 if err != nil {
2964 return nil, err
2965 }
2966 defer googleapi.CloseBody(res)
2967 if err := googleapi.CheckResponse(res); err != nil {
2968 return nil, err
2969 }
2970 ret := &ObjectAccessControl{
2971 ServerResponse: googleapi.ServerResponse{
2972 Header: res.Header,
2973 HTTPStatusCode: res.StatusCode,
2974 },
2975 }
2976 target := &ret
2977 if err := gensupport.DecodeResponse(target, res); err != nil {
2978 return nil, err
2979 }
2980 return ret, nil
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015 }
3016
3017
3018
3019 type ObjectAccessControlsListCall struct {
3020 s *Service
3021 bucket string
3022 object string
3023 urlParams_ gensupport.URLParams
3024 ifNoneMatch_ string
3025 ctx_ context.Context
3026 header_ http.Header
3027 }
3028
3029
3030 func (r *ObjectAccessControlsService) List(bucket string, object string) *ObjectAccessControlsListCall {
3031 c := &ObjectAccessControlsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
3032 c.bucket = bucket
3033 c.object = object
3034 return c
3035 }
3036
3037
3038
3039
3040 func (c *ObjectAccessControlsListCall) Fields(s ...googleapi.Field) *ObjectAccessControlsListCall {
3041 c.urlParams_.Set("fields", googleapi.CombineFields(s))
3042 return c
3043 }
3044
3045
3046
3047
3048
3049
3050 func (c *ObjectAccessControlsListCall) IfNoneMatch(entityTag string) *ObjectAccessControlsListCall {
3051 c.ifNoneMatch_ = entityTag
3052 return c
3053 }
3054
3055
3056
3057
3058 func (c *ObjectAccessControlsListCall) Context(ctx context.Context) *ObjectAccessControlsListCall {
3059 c.ctx_ = ctx
3060 return c
3061 }
3062
3063
3064
3065 func (c *ObjectAccessControlsListCall) Header() http.Header {
3066 if c.header_ == nil {
3067 c.header_ = make(http.Header)
3068 }
3069 return c.header_
3070 }
3071
3072 func (c *ObjectAccessControlsListCall) doRequest(alt string) (*http.Response, error) {
3073 reqHeaders := make(http.Header)
3074 reqHeaders.Set("x-goog-api-client", "gl-go/1.13.7 gdcl/20200203")
3075 for k, v := range c.header_ {
3076 reqHeaders[k] = v
3077 }
3078 reqHeaders.Set("User-Agent", c.s.userAgent())
3079 if c.ifNoneMatch_ != "" {
3080 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
3081 }
3082 var body io.Reader = nil
3083 c.urlParams_.Set("alt", alt)
3084 c.urlParams_.Set("prettyPrint", "false")
3085 urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o/{object}/acl")
3086 urls += "?" + c.urlParams_.Encode()
3087 req, err := http.NewRequest("GET", urls, body)
3088 if err != nil {
3089 return nil, err
3090 }
3091 req.Header = reqHeaders
3092 googleapi.Expand(req.URL, map[string]string{
3093 "bucket": c.bucket,
3094 "object": c.object,
3095 })
3096 return gensupport.SendRequest(c.ctx_, c.s.client, req)
3097 }
3098
3099
3100
3101
3102
3103
3104
3105
3106 func (c *ObjectAccessControlsListCall) Do(opts ...googleapi.CallOption) (*ObjectAccessControls, error) {
3107 gensupport.SetOptions(c.urlParams_, opts...)
3108 res, err := c.doRequest("json")
3109 if res != nil && res.StatusCode == http.StatusNotModified {
3110 if res.Body != nil {
3111 res.Body.Close()
3112 }
3113 return nil, &googleapi.Error{
3114 Code: res.StatusCode,
3115 Header: res.Header,
3116 }
3117 }
3118 if err != nil {
3119 return nil, err
3120 }
3121 defer googleapi.CloseBody(res)
3122 if err := googleapi.CheckResponse(res); err != nil {
3123 return nil, err
3124 }
3125 ret := &ObjectAccessControls{
3126 ServerResponse: googleapi.ServerResponse{
3127 Header: res.Header,
3128 HTTPStatusCode: res.StatusCode,
3129 },
3130 }
3131 target := &ret
3132 if err := gensupport.DecodeResponse(target, res); err != nil {
3133 return nil, err
3134 }
3135 return ret, nil
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167 }
3168
3169
3170
3171 type ObjectAccessControlsPatchCall struct {
3172 s *Service
3173 bucket string
3174 object string
3175 entity string
3176 objectaccesscontrol *ObjectAccessControl
3177 urlParams_ gensupport.URLParams
3178 ctx_ context.Context
3179 header_ http.Header
3180 }
3181
3182
3183
3184 func (r *ObjectAccessControlsService) Patch(bucket string, object string, entity string, objectaccesscontrol *ObjectAccessControl) *ObjectAccessControlsPatchCall {
3185 c := &ObjectAccessControlsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
3186 c.bucket = bucket
3187 c.object = object
3188 c.entity = entity
3189 c.objectaccesscontrol = objectaccesscontrol
3190 return c
3191 }
3192
3193
3194
3195
3196 func (c *ObjectAccessControlsPatchCall) Fields(s ...googleapi.Field) *ObjectAccessControlsPatchCall {
3197 c.urlParams_.Set("fields", googleapi.CombineFields(s))
3198 return c
3199 }
3200
3201
3202
3203
3204 func (c *ObjectAccessControlsPatchCall) Context(ctx context.Context) *ObjectAccessControlsPatchCall {
3205 c.ctx_ = ctx
3206 return c
3207 }
3208
3209
3210
3211 func (c *ObjectAccessControlsPatchCall) Header() http.Header {
3212 if c.header_ == nil {
3213 c.header_ = make(http.Header)
3214 }
3215 return c.header_
3216 }
3217
3218 func (c *ObjectAccessControlsPatchCall) doRequest(alt string) (*http.Response, error) {
3219 reqHeaders := make(http.Header)
3220 reqHeaders.Set("x-goog-api-client", "gl-go/1.13.7 gdcl/20200203")
3221 for k, v := range c.header_ {
3222 reqHeaders[k] = v
3223 }
3224 reqHeaders.Set("User-Agent", c.s.userAgent())
3225 var body io.Reader = nil
3226 body, err := googleapi.WithoutDataWrapper.JSONReader(c.objectaccesscontrol)
3227 if err != nil {
3228 return nil, err
3229 }
3230 reqHeaders.Set("Content-Type", "application/json")
3231 c.urlParams_.Set("alt", alt)
3232 c.urlParams_.Set("prettyPrint", "false")
3233 urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o/{object}/acl/{entity}")
3234 urls += "?" + c.urlParams_.Encode()
3235 req, err := http.NewRequest("PATCH", urls, body)
3236 if err != nil {
3237 return nil, err
3238 }
3239 req.Header = reqHeaders
3240 googleapi.Expand(req.URL, map[string]string{
3241 "bucket": c.bucket,
3242 "object": c.object,
3243 "entity": c.entity,
3244 })
3245 return gensupport.SendRequest(c.ctx_, c.s.client, req)
3246 }
3247
3248
3249
3250
3251
3252
3253
3254
3255 func (c *ObjectAccessControlsPatchCall) Do(opts ...googleapi.CallOption) (*ObjectAccessControl, error) {
3256 gensupport.SetOptions(c.urlParams_, opts...)
3257 res, err := c.doRequest("json")
3258 if res != nil && res.StatusCode == http.StatusNotModified {
3259 if res.Body != nil {
3260 res.Body.Close()
3261 }
3262 return nil, &googleapi.Error{
3263 Code: res.StatusCode,
3264 Header: res.Header,
3265 }
3266 }
3267 if err != nil {
3268 return nil, err
3269 }
3270 defer googleapi.CloseBody(res)
3271 if err := googleapi.CheckResponse(res); err != nil {
3272 return nil, err
3273 }
3274 ret := &ObjectAccessControl{
3275 ServerResponse: googleapi.ServerResponse{
3276 Header: res.Header,
3277 HTTPStatusCode: res.StatusCode,
3278 },
3279 }
3280 target := &ret
3281 if err := gensupport.DecodeResponse(target, res); err != nil {
3282 return nil, err
3283 }
3284 return ret, nil
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326 }
3327
3328
3329
3330 type ObjectAccessControlsUpdateCall struct {
3331 s *Service
3332 bucket string
3333 object string
3334 entity string
3335 objectaccesscontrol *ObjectAccessControl
3336 urlParams_ gensupport.URLParams
3337 ctx_ context.Context
3338 header_ http.Header
3339 }
3340
3341
3342 func (r *ObjectAccessControlsService) Update(bucket string, object string, entity string, objectaccesscontrol *ObjectAccessControl) *ObjectAccessControlsUpdateCall {
3343 c := &ObjectAccessControlsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
3344 c.bucket = bucket
3345 c.object = object
3346 c.entity = entity
3347 c.objectaccesscontrol = objectaccesscontrol
3348 return c
3349 }
3350
3351
3352
3353
3354 func (c *ObjectAccessControlsUpdateCall) Fields(s ...googleapi.Field) *ObjectAccessControlsUpdateCall {
3355 c.urlParams_.Set("fields", googleapi.CombineFields(s))
3356 return c
3357 }
3358
3359
3360
3361
3362 func (c *ObjectAccessControlsUpdateCall) Context(ctx context.Context) *ObjectAccessControlsUpdateCall {
3363 c.ctx_ = ctx
3364 return c
3365 }
3366
3367
3368
3369 func (c *ObjectAccessControlsUpdateCall) Header() http.Header {
3370 if c.header_ == nil {
3371 c.header_ = make(http.Header)
3372 }
3373 return c.header_
3374 }
3375
3376 func (c *ObjectAccessControlsUpdateCall) doRequest(alt string) (*http.Response, error) {
3377 reqHeaders := make(http.Header)
3378 reqHeaders.Set("x-goog-api-client", "gl-go/1.13.7 gdcl/20200203")
3379 for k, v := range c.header_ {
3380 reqHeaders[k] = v
3381 }
3382 reqHeaders.Set("User-Agent", c.s.userAgent())
3383 var body io.Reader = nil
3384 body, err := googleapi.WithoutDataWrapper.JSONReader(c.objectaccesscontrol)
3385 if err != nil {
3386 return nil, err
3387 }
3388 reqHeaders.Set("Content-Type", "application/json")
3389 c.urlParams_.Set("alt", alt)
3390 c.urlParams_.Set("prettyPrint", "false")
3391 urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o/{object}/acl/{entity}")
3392 urls += "?" + c.urlParams_.Encode()
3393 req, err := http.NewRequest("PUT", urls, body)
3394 if err != nil {
3395 return nil, err
3396 }
3397 req.Header = reqHeaders
3398 googleapi.Expand(req.URL, map[string]string{
3399 "bucket": c.bucket,
3400 "object": c.object,
3401 "entity": c.entity,
3402 })
3403 return gensupport.SendRequest(c.ctx_, c.s.client, req)
3404 }
3405
3406
3407
3408
3409
3410
3411
3412
3413 func (c *ObjectAccessControlsUpdateCall) Do(opts ...googleapi.CallOption) (*ObjectAccessControl, error) {
3414 gensupport.SetOptions(c.urlParams_, opts...)
3415 res, err := c.doRequest("json")
3416 if res != nil && res.StatusCode == http.StatusNotModified {
3417 if res.Body != nil {
3418 res.Body.Close()
3419 }
3420 return nil, &googleapi.Error{
3421 Code: res.StatusCode,
3422 Header: res.Header,
3423 }
3424 }
3425 if err != nil {
3426 return nil, err
3427 }
3428 defer googleapi.CloseBody(res)
3429 if err := googleapi.CheckResponse(res); err != nil {
3430 return nil, err
3431 }
3432 ret := &ObjectAccessControl{
3433 ServerResponse: googleapi.ServerResponse{
3434 Header: res.Header,
3435 HTTPStatusCode: res.StatusCode,
3436 },
3437 }
3438 target := &ret
3439 if err := gensupport.DecodeResponse(target, res); err != nil {
3440 return nil, err
3441 }
3442 return ret, nil
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484 }
3485
3486
3487
3488 type ObjectsDeleteCall struct {
3489 s *Service
3490 bucket string
3491 object string
3492 urlParams_ gensupport.URLParams
3493 ctx_ context.Context
3494 header_ http.Header
3495 }
3496
3497
3498 func (r *ObjectsService) Delete(bucket string, object string) *ObjectsDeleteCall {
3499 c := &ObjectsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
3500 c.bucket = bucket
3501 c.object = object
3502 return c
3503 }
3504
3505
3506
3507
3508 func (c *ObjectsDeleteCall) Fields(s ...googleapi.Field) *ObjectsDeleteCall {
3509 c.urlParams_.Set("fields", googleapi.CombineFields(s))
3510 return c
3511 }
3512
3513
3514
3515
3516 func (c *ObjectsDeleteCall) Context(ctx context.Context) *ObjectsDeleteCall {
3517 c.ctx_ = ctx
3518 return c
3519 }
3520
3521
3522
3523 func (c *ObjectsDeleteCall) Header() http.Header {
3524 if c.header_ == nil {
3525 c.header_ = make(http.Header)
3526 }
3527 return c.header_
3528 }
3529
3530 func (c *ObjectsDeleteCall) doRequest(alt string) (*http.Response, error) {
3531 reqHeaders := make(http.Header)
3532 reqHeaders.Set("x-goog-api-client", "gl-go/1.13.7 gdcl/20200203")
3533 for k, v := range c.header_ {
3534 reqHeaders[k] = v
3535 }
3536 reqHeaders.Set("User-Agent", c.s.userAgent())
3537 var body io.Reader = nil
3538 c.urlParams_.Set("alt", alt)
3539 c.urlParams_.Set("prettyPrint", "false")
3540 urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o/{object}")
3541 urls += "?" + c.urlParams_.Encode()
3542 req, err := http.NewRequest("DELETE", urls, body)
3543 if err != nil {
3544 return nil, err
3545 }
3546 req.Header = reqHeaders
3547 googleapi.Expand(req.URL, map[string]string{
3548 "bucket": c.bucket,
3549 "object": c.object,
3550 })
3551 return gensupport.SendRequest(c.ctx_, c.s.client, req)
3552 }
3553
3554
3555 func (c *ObjectsDeleteCall) Do(opts ...googleapi.CallOption) error {
3556 gensupport.SetOptions(c.urlParams_, opts...)
3557 res, err := c.doRequest("json")
3558 if err != nil {
3559 return err
3560 }
3561 defer googleapi.CloseBody(res)
3562 if err := googleapi.CheckResponse(res); err != nil {
3563 return err
3564 }
3565 return nil
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595 }
3596
3597
3598
3599 type ObjectsGetCall struct {
3600 s *Service
3601 bucket string
3602 object string
3603 urlParams_ gensupport.URLParams
3604 ifNoneMatch_ string
3605 ctx_ context.Context
3606 header_ http.Header
3607 }
3608
3609
3610 func (r *ObjectsService) Get(bucket string, object string) *ObjectsGetCall {
3611 c := &ObjectsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
3612 c.bucket = bucket
3613 c.object = object
3614 return c
3615 }
3616
3617
3618
3619
3620
3621
3622
3623
3624 func (c *ObjectsGetCall) Projection(projection string) *ObjectsGetCall {
3625 c.urlParams_.Set("projection", projection)
3626 return c
3627 }
3628
3629
3630
3631
3632 func (c *ObjectsGetCall) Fields(s ...googleapi.Field) *ObjectsGetCall {
3633 c.urlParams_.Set("fields", googleapi.CombineFields(s))
3634 return c
3635 }
3636
3637
3638
3639
3640
3641
3642 func (c *ObjectsGetCall) IfNoneMatch(entityTag string) *ObjectsGetCall {
3643 c.ifNoneMatch_ = entityTag
3644 return c
3645 }
3646
3647
3648
3649
3650 func (c *ObjectsGetCall) Context(ctx context.Context) *ObjectsGetCall {
3651 c.ctx_ = ctx
3652 return c
3653 }
3654
3655
3656
3657 func (c *ObjectsGetCall) Header() http.Header {
3658 if c.header_ == nil {
3659 c.header_ = make(http.Header)
3660 }
3661 return c.header_
3662 }
3663
3664 func (c *ObjectsGetCall) doRequest(alt string) (*http.Response, error) {
3665 reqHeaders := make(http.Header)
3666 reqHeaders.Set("x-goog-api-client", "gl-go/1.13.7 gdcl/20200203")
3667 for k, v := range c.header_ {
3668 reqHeaders[k] = v
3669 }
3670 reqHeaders.Set("User-Agent", c.s.userAgent())
3671 if c.ifNoneMatch_ != "" {
3672 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
3673 }
3674 var body io.Reader = nil
3675 c.urlParams_.Set("alt", alt)
3676 c.urlParams_.Set("prettyPrint", "false")
3677 urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o/{object}")
3678 urls += "?" + c.urlParams_.Encode()
3679 req, err := http.NewRequest("GET", urls, body)
3680 if err != nil {
3681 return nil, err
3682 }
3683 req.Header = reqHeaders
3684 googleapi.Expand(req.URL, map[string]string{
3685 "bucket": c.bucket,
3686 "object": c.object,
3687 })
3688 return gensupport.SendRequest(c.ctx_, c.s.client, req)
3689 }
3690
3691
3692
3693
3694 func (c *ObjectsGetCall) Download(opts ...googleapi.CallOption) (*http.Response, error) {
3695 gensupport.SetOptions(c.urlParams_, opts...)
3696 res, err := c.doRequest("media")
3697 if err != nil {
3698 return nil, err
3699 }
3700 if err := googleapi.CheckMediaResponse(res); err != nil {
3701 res.Body.Close()
3702 return nil, err
3703 }
3704 return res, nil
3705 }
3706
3707
3708
3709
3710
3711
3712
3713
3714 func (c *ObjectsGetCall) Do(opts ...googleapi.CallOption) (*Object, error) {
3715 gensupport.SetOptions(c.urlParams_, opts...)
3716 res, err := c.doRequest("json")
3717 if res != nil && res.StatusCode == http.StatusNotModified {
3718 if res.Body != nil {
3719 res.Body.Close()
3720 }
3721 return nil, &googleapi.Error{
3722 Code: res.StatusCode,
3723 Header: res.Header,
3724 }
3725 }
3726 if err != nil {
3727 return nil, err
3728 }
3729 defer googleapi.CloseBody(res)
3730 if err := googleapi.CheckResponse(res); err != nil {
3731 return nil, err
3732 }
3733 ret := &Object{
3734 ServerResponse: googleapi.ServerResponse{
3735 Header: res.Header,
3736 HTTPStatusCode: res.StatusCode,
3737 },
3738 }
3739 target := &ret
3740 if err := gensupport.DecodeResponse(target, res); err != nil {
3741 return nil, err
3742 }
3743 return ret, nil
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791 }
3792
3793
3794
3795 type ObjectsInsertCall struct {
3796 s *Service
3797 bucket string
3798 object *Object
3799 urlParams_ gensupport.URLParams
3800 mediaInfo_ *gensupport.MediaInfo
3801 ctx_ context.Context
3802 header_ http.Header
3803 }
3804
3805
3806 func (r *ObjectsService) Insert(bucket string, object *Object) *ObjectsInsertCall {
3807 c := &ObjectsInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
3808 c.bucket = bucket
3809 c.object = object
3810 return c
3811 }
3812
3813
3814
3815
3816 func (c *ObjectsInsertCall) Name(name string) *ObjectsInsertCall {
3817 c.urlParams_.Set("name", name)
3818 return c
3819 }
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829 func (c *ObjectsInsertCall) Projection(projection string) *ObjectsInsertCall {
3830 c.urlParams_.Set("projection", projection)
3831 return c
3832 }
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842 func (c *ObjectsInsertCall) Media(r io.Reader, options ...googleapi.MediaOption) *ObjectsInsertCall {
3843 c.mediaInfo_ = gensupport.NewInfoFromMedia(r, options)
3844 return c
3845 }
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856 func (c *ObjectsInsertCall) ResumableMedia(ctx context.Context, r io.ReaderAt, size int64, mediaType string) *ObjectsInsertCall {
3857 c.ctx_ = ctx
3858 c.mediaInfo_ = gensupport.NewInfoFromResumableMedia(r, size, mediaType)
3859 return c
3860 }
3861
3862
3863
3864
3865
3866 func (c *ObjectsInsertCall) ProgressUpdater(pu googleapi.ProgressUpdater) *ObjectsInsertCall {
3867 c.mediaInfo_.SetProgressUpdater(pu)
3868 return c
3869 }
3870
3871
3872
3873
3874 func (c *ObjectsInsertCall) Fields(s ...googleapi.Field) *ObjectsInsertCall {
3875 c.urlParams_.Set("fields", googleapi.CombineFields(s))
3876 return c
3877 }
3878
3879
3880
3881
3882
3883
3884 func (c *ObjectsInsertCall) Context(ctx context.Context) *ObjectsInsertCall {
3885 c.ctx_ = ctx
3886 return c
3887 }
3888
3889
3890
3891 func (c *ObjectsInsertCall) Header() http.Header {
3892 if c.header_ == nil {
3893 c.header_ = make(http.Header)
3894 }
3895 return c.header_
3896 }
3897
3898 func (c *ObjectsInsertCall) doRequest(alt string) (*http.Response, error) {
3899 reqHeaders := make(http.Header)
3900 reqHeaders.Set("x-goog-api-client", "gl-go/1.13.7 gdcl/20200203")
3901 for k, v := range c.header_ {
3902 reqHeaders[k] = v
3903 }
3904 reqHeaders.Set("User-Agent", c.s.userAgent())
3905 var body io.Reader = nil
3906 body, err := googleapi.WithoutDataWrapper.JSONReader(c.object)
3907 if err != nil {
3908 return nil, err
3909 }
3910 reqHeaders.Set("Content-Type", "application/json")
3911 c.urlParams_.Set("alt", alt)
3912 c.urlParams_.Set("prettyPrint", "false")
3913 urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o")
3914 if c.mediaInfo_ != nil {
3915 urls = googleapi.ResolveRelative(c.s.BasePath, "/upload/storage/v1beta1/b/{bucket}/o")
3916 c.urlParams_.Set("uploadType", c.mediaInfo_.UploadType())
3917 }
3918 if body == nil {
3919 body = new(bytes.Buffer)
3920 reqHeaders.Set("Content-Type", "application/json")
3921 }
3922 body, getBody, cleanup := c.mediaInfo_.UploadRequest(reqHeaders, body)
3923 defer cleanup()
3924 urls += "?" + c.urlParams_.Encode()
3925 req, err := http.NewRequest("POST", urls, body)
3926 if err != nil {
3927 return nil, err
3928 }
3929 req.Header = reqHeaders
3930 req.GetBody = getBody
3931 googleapi.Expand(req.URL, map[string]string{
3932 "bucket": c.bucket,
3933 })
3934 return gensupport.SendRequest(c.ctx_, c.s.client, req)
3935 }
3936
3937
3938
3939
3940
3941
3942
3943
3944 func (c *ObjectsInsertCall) Do(opts ...googleapi.CallOption) (*Object, error) {
3945 gensupport.SetOptions(c.urlParams_, opts...)
3946 res, err := c.doRequest("json")
3947 if res != nil && res.StatusCode == http.StatusNotModified {
3948 if res.Body != nil {
3949 res.Body.Close()
3950 }
3951 return nil, &googleapi.Error{
3952 Code: res.StatusCode,
3953 Header: res.Header,
3954 }
3955 }
3956 if err != nil {
3957 return nil, err
3958 }
3959 defer googleapi.CloseBody(res)
3960 if err := googleapi.CheckResponse(res); err != nil {
3961 return nil, err
3962 }
3963 rx := c.mediaInfo_.ResumableUpload(res.Header.Get("Location"))
3964 if rx != nil {
3965 rx.Client = c.s.client
3966 rx.UserAgent = c.s.userAgent()
3967 ctx := c.ctx_
3968 if ctx == nil {
3969 ctx = context.TODO()
3970 }
3971 res, err = rx.Upload(ctx)
3972 if err != nil {
3973 return nil, err
3974 }
3975 defer res.Body.Close()
3976 if err := googleapi.CheckResponse(res); err != nil {
3977 return nil, err
3978 }
3979 }
3980 ret := &Object{
3981 ServerResponse: googleapi.ServerResponse{
3982 Header: res.Header,
3983 HTTPStatusCode: res.StatusCode,
3984 },
3985 }
3986 target := &ret
3987 if err := gensupport.DecodeResponse(target, res); err != nil {
3988 return nil, err
3989 }
3990 return ret, nil
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054 }
4055
4056
4057
4058 type ObjectsListCall struct {
4059 s *Service
4060 bucket string
4061 urlParams_ gensupport.URLParams
4062 ifNoneMatch_ string
4063 ctx_ context.Context
4064 header_ http.Header
4065 }
4066
4067
4068 func (r *ObjectsService) List(bucket string) *ObjectsListCall {
4069 c := &ObjectsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
4070 c.bucket = bucket
4071 return c
4072 }
4073
4074
4075
4076
4077
4078
4079
4080 func (c *ObjectsListCall) Delimiter(delimiter string) *ObjectsListCall {
4081 c.urlParams_.Set("delimiter", delimiter)
4082 return c
4083 }
4084
4085
4086
4087
4088 func (c *ObjectsListCall) MaxResults(maxResults int64) *ObjectsListCall {
4089 c.urlParams_.Set("max-results", fmt.Sprint(maxResults))
4090 return c
4091 }
4092
4093
4094
4095
4096 func (c *ObjectsListCall) PageToken(pageToken string) *ObjectsListCall {
4097 c.urlParams_.Set("pageToken", pageToken)
4098 return c
4099 }
4100
4101
4102
4103 func (c *ObjectsListCall) Prefix(prefix string) *ObjectsListCall {
4104 c.urlParams_.Set("prefix", prefix)
4105 return c
4106 }
4107
4108
4109
4110
4111
4112
4113
4114
4115 func (c *ObjectsListCall) Projection(projection string) *ObjectsListCall {
4116 c.urlParams_.Set("projection", projection)
4117 return c
4118 }
4119
4120
4121
4122
4123 func (c *ObjectsListCall) Fields(s ...googleapi.Field) *ObjectsListCall {
4124 c.urlParams_.Set("fields", googleapi.CombineFields(s))
4125 return c
4126 }
4127
4128
4129
4130
4131
4132
4133 func (c *ObjectsListCall) IfNoneMatch(entityTag string) *ObjectsListCall {
4134 c.ifNoneMatch_ = entityTag
4135 return c
4136 }
4137
4138
4139
4140
4141 func (c *ObjectsListCall) Context(ctx context.Context) *ObjectsListCall {
4142 c.ctx_ = ctx
4143 return c
4144 }
4145
4146
4147
4148 func (c *ObjectsListCall) Header() http.Header {
4149 if c.header_ == nil {
4150 c.header_ = make(http.Header)
4151 }
4152 return c.header_
4153 }
4154
4155 func (c *ObjectsListCall) doRequest(alt string) (*http.Response, error) {
4156 reqHeaders := make(http.Header)
4157 reqHeaders.Set("x-goog-api-client", "gl-go/1.13.7 gdcl/20200203")
4158 for k, v := range c.header_ {
4159 reqHeaders[k] = v
4160 }
4161 reqHeaders.Set("User-Agent", c.s.userAgent())
4162 if c.ifNoneMatch_ != "" {
4163 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
4164 }
4165 var body io.Reader = nil
4166 c.urlParams_.Set("alt", alt)
4167 c.urlParams_.Set("prettyPrint", "false")
4168 urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o")
4169 urls += "?" + c.urlParams_.Encode()
4170 req, err := http.NewRequest("GET", urls, body)
4171 if err != nil {
4172 return nil, err
4173 }
4174 req.Header = reqHeaders
4175 googleapi.Expand(req.URL, map[string]string{
4176 "bucket": c.bucket,
4177 })
4178 return gensupport.SendRequest(c.ctx_, c.s.client, req)
4179 }
4180
4181
4182
4183
4184
4185
4186
4187
4188 func (c *ObjectsListCall) Do(opts ...googleapi.CallOption) (*Objects, error) {
4189 gensupport.SetOptions(c.urlParams_, opts...)
4190 res, err := c.doRequest("json")
4191 if res != nil && res.StatusCode == http.StatusNotModified {
4192 if res.Body != nil {
4193 res.Body.Close()
4194 }
4195 return nil, &googleapi.Error{
4196 Code: res.StatusCode,
4197 Header: res.Header,
4198 }
4199 }
4200 if err != nil {
4201 return nil, err
4202 }
4203 defer googleapi.CloseBody(res)
4204 if err := googleapi.CheckResponse(res); err != nil {
4205 return nil, err
4206 }
4207 ret := &Objects{
4208 ServerResponse: googleapi.ServerResponse{
4209 Header: res.Header,
4210 HTTPStatusCode: res.StatusCode,
4211 },
4212 }
4213 target := &ret
4214 if err := gensupport.DecodeResponse(target, res); err != nil {
4215 return nil, err
4216 }
4217 return ret, nil
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280 }
4281
4282
4283
4284
4285 func (c *ObjectsListCall) Pages(ctx context.Context, f func(*Objects) error) error {
4286 c.ctx_ = ctx
4287 defer c.PageToken(c.urlParams_.Get("pageToken"))
4288 for {
4289 x, err := c.Do()
4290 if err != nil {
4291 return err
4292 }
4293 if err := f(x); err != nil {
4294 return err
4295 }
4296 if x.NextPageToken == "" {
4297 return nil
4298 }
4299 c.PageToken(x.NextPageToken)
4300 }
4301 }
4302
4303
4304
4305 type ObjectsPatchCall struct {
4306 s *Service
4307 bucket string
4308 object string
4309 object2 *Object
4310 urlParams_ gensupport.URLParams
4311 ctx_ context.Context
4312 header_ http.Header
4313 }
4314
4315
4316
4317 func (r *ObjectsService) Patch(bucket string, object string, object2 *Object) *ObjectsPatchCall {
4318 c := &ObjectsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
4319 c.bucket = bucket
4320 c.object = object
4321 c.object2 = object2
4322 return c
4323 }
4324
4325
4326
4327
4328
4329
4330
4331
4332 func (c *ObjectsPatchCall) Projection(projection string) *ObjectsPatchCall {
4333 c.urlParams_.Set("projection", projection)
4334 return c
4335 }
4336
4337
4338
4339
4340 func (c *ObjectsPatchCall) Fields(s ...googleapi.Field) *ObjectsPatchCall {
4341 c.urlParams_.Set("fields", googleapi.CombineFields(s))
4342 return c
4343 }
4344
4345
4346
4347
4348 func (c *ObjectsPatchCall) Context(ctx context.Context) *ObjectsPatchCall {
4349 c.ctx_ = ctx
4350 return c
4351 }
4352
4353
4354
4355 func (c *ObjectsPatchCall) Header() http.Header {
4356 if c.header_ == nil {
4357 c.header_ = make(http.Header)
4358 }
4359 return c.header_
4360 }
4361
4362 func (c *ObjectsPatchCall) doRequest(alt string) (*http.Response, error) {
4363 reqHeaders := make(http.Header)
4364 reqHeaders.Set("x-goog-api-client", "gl-go/1.13.7 gdcl/20200203")
4365 for k, v := range c.header_ {
4366 reqHeaders[k] = v
4367 }
4368 reqHeaders.Set("User-Agent", c.s.userAgent())
4369 var body io.Reader = nil
4370 body, err := googleapi.WithoutDataWrapper.JSONReader(c.object2)
4371 if err != nil {
4372 return nil, err
4373 }
4374 reqHeaders.Set("Content-Type", "application/json")
4375 c.urlParams_.Set("alt", alt)
4376 c.urlParams_.Set("prettyPrint", "false")
4377 urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o/{object}")
4378 urls += "?" + c.urlParams_.Encode()
4379 req, err := http.NewRequest("PATCH", urls, body)
4380 if err != nil {
4381 return nil, err
4382 }
4383 req.Header = reqHeaders
4384 googleapi.Expand(req.URL, map[string]string{
4385 "bucket": c.bucket,
4386 "object": c.object,
4387 })
4388 return gensupport.SendRequest(c.ctx_, c.s.client, req)
4389 }
4390
4391
4392
4393
4394
4395
4396
4397
4398 func (c *ObjectsPatchCall) Do(opts ...googleapi.CallOption) (*Object, error) {
4399 gensupport.SetOptions(c.urlParams_, opts...)
4400 res, err := c.doRequest("json")
4401 if res != nil && res.StatusCode == http.StatusNotModified {
4402 if res.Body != nil {
4403 res.Body.Close()
4404 }
4405 return nil, &googleapi.Error{
4406 Code: res.StatusCode,
4407 Header: res.Header,
4408 }
4409 }
4410 if err != nil {
4411 return nil, err
4412 }
4413 defer googleapi.CloseBody(res)
4414 if err := googleapi.CheckResponse(res); err != nil {
4415 return nil, err
4416 }
4417 ret := &Object{
4418 ServerResponse: googleapi.ServerResponse{
4419 Header: res.Header,
4420 HTTPStatusCode: res.StatusCode,
4421 },
4422 }
4423 target := &ret
4424 if err := gensupport.DecodeResponse(target, res); err != nil {
4425 return nil, err
4426 }
4427 return ret, nil
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476 }
4477
4478
4479
4480 type ObjectsUpdateCall struct {
4481 s *Service
4482 bucket string
4483 object string
4484 object2 *Object
4485 urlParams_ gensupport.URLParams
4486 ctx_ context.Context
4487 header_ http.Header
4488 }
4489
4490
4491 func (r *ObjectsService) Update(bucket string, object string, object2 *Object) *ObjectsUpdateCall {
4492 c := &ObjectsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
4493 c.bucket = bucket
4494 c.object = object
4495 c.object2 = object2
4496 return c
4497 }
4498
4499
4500
4501
4502
4503
4504
4505
4506 func (c *ObjectsUpdateCall) Projection(projection string) *ObjectsUpdateCall {
4507 c.urlParams_.Set("projection", projection)
4508 return c
4509 }
4510
4511
4512
4513
4514 func (c *ObjectsUpdateCall) Fields(s ...googleapi.Field) *ObjectsUpdateCall {
4515 c.urlParams_.Set("fields", googleapi.CombineFields(s))
4516 return c
4517 }
4518
4519
4520
4521
4522 func (c *ObjectsUpdateCall) Context(ctx context.Context) *ObjectsUpdateCall {
4523 c.ctx_ = ctx
4524 return c
4525 }
4526
4527
4528
4529 func (c *ObjectsUpdateCall) Header() http.Header {
4530 if c.header_ == nil {
4531 c.header_ = make(http.Header)
4532 }
4533 return c.header_
4534 }
4535
4536 func (c *ObjectsUpdateCall) doRequest(alt string) (*http.Response, error) {
4537 reqHeaders := make(http.Header)
4538 reqHeaders.Set("x-goog-api-client", "gl-go/1.13.7 gdcl/20200203")
4539 for k, v := range c.header_ {
4540 reqHeaders[k] = v
4541 }
4542 reqHeaders.Set("User-Agent", c.s.userAgent())
4543 var body io.Reader = nil
4544 body, err := googleapi.WithoutDataWrapper.JSONReader(c.object2)
4545 if err != nil {
4546 return nil, err
4547 }
4548 reqHeaders.Set("Content-Type", "application/json")
4549 c.urlParams_.Set("alt", alt)
4550 c.urlParams_.Set("prettyPrint", "false")
4551 urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o/{object}")
4552 urls += "?" + c.urlParams_.Encode()
4553 req, err := http.NewRequest("PUT", urls, body)
4554 if err != nil {
4555 return nil, err
4556 }
4557 req.Header = reqHeaders
4558 googleapi.Expand(req.URL, map[string]string{
4559 "bucket": c.bucket,
4560 "object": c.object,
4561 })
4562 return gensupport.SendRequest(c.ctx_, c.s.client, req)
4563 }
4564
4565
4566
4567
4568 func (c *ObjectsUpdateCall) Download(opts ...googleapi.CallOption) (*http.Response, error) {
4569 gensupport.SetOptions(c.urlParams_, opts...)
4570 res, err := c.doRequest("media")
4571 if err != nil {
4572 return nil, err
4573 }
4574 if err := googleapi.CheckMediaResponse(res); err != nil {
4575 res.Body.Close()
4576 return nil, err
4577 }
4578 return res, nil
4579 }
4580
4581
4582
4583
4584
4585
4586
4587
4588 func (c *ObjectsUpdateCall) Do(opts ...googleapi.CallOption) (*Object, error) {
4589 gensupport.SetOptions(c.urlParams_, opts...)
4590 res, err := c.doRequest("json")
4591 if res != nil && res.StatusCode == http.StatusNotModified {
4592 if res.Body != nil {
4593 res.Body.Close()
4594 }
4595 return nil, &googleapi.Error{
4596 Code: res.StatusCode,
4597 Header: res.Header,
4598 }
4599 }
4600 if err != nil {
4601 return nil, err
4602 }
4603 defer googleapi.CloseBody(res)
4604 if err := googleapi.CheckResponse(res); err != nil {
4605 return nil, err
4606 }
4607 ret := &Object{
4608 ServerResponse: googleapi.ServerResponse{
4609 Header: res.Header,
4610 HTTPStatusCode: res.StatusCode,
4611 },
4612 }
4613 target := &ret
4614 if err := gensupport.DecodeResponse(target, res); err != nil {
4615 return nil, err
4616 }
4617 return ret, nil
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667 }
4668
View as plain text