1// Copyright 2020 Google LLC. 2// Use of this source code is governed by a BSD-style 3// license that can be found in the LICENSE file. 4 5// Code generated file. DO NOT EDIT. 6 7// Package storage provides access to the Cloud Storage JSON API. 8// 9// This package is DEPRECATED. Use package cloud.google.com/go/storage instead. 10// 11// For product documentation, see: https://developers.google.com/storage/docs/json_api/ 12// 13// Creating a client 14// 15// Usage example: 16// 17// import "google.golang.org/api/storage/v1beta1" 18// ... 19// ctx := context.Background() 20// storageService, err := storage.NewService(ctx) 21// 22// In this example, Google Application Default Credentials are used for authentication. 23// 24// For information on how to create and obtain Application Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials. 25// 26// Other authentication options 27// 28// By default, all available scopes (see "Constants") are used to authenticate. To restrict scopes, use option.WithScopes: 29// 30// storageService, err := storage.NewService(ctx, option.WithScopes(storage.DevstorageReadWriteScope)) 31// 32// To use an API key for authentication (note: some APIs do not support API keys), use option.WithAPIKey: 33// 34// storageService, err := storage.NewService(ctx, option.WithAPIKey("AIza...")) 35// 36// To use an OAuth token (e.g., a user token obtained via a three-legged OAuth flow), use option.WithTokenSource: 37// 38// config := &oauth2.Config{...} 39// // ... 40// token, err := config.Exchange(ctx, ...) 41// storageService, err := storage.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token))) 42// 43// See https://godoc.org/google.golang.org/api/option/ for details on options. 44package storage // import "google.golang.org/api/storage/v1beta1" 45 46import ( 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// Always reference these packages, just in case the auto-generated code 65// below doesn't. 66var _ = bytes.NewBuffer 67var _ = strconv.Itoa 68var _ = fmt.Sprintf 69var _ = json.NewDecoder 70var _ = io.Copy 71var _ = url.Parse 72var _ = gensupport.MarshalJSON 73var _ = googleapi.Version 74var _ = errors.New 75var _ = strings.Replace 76var _ = context.Canceled 77 78const apiId = "storage:v1beta1" 79const apiName = "storage" 80const apiVersion = "v1beta1" 81const basePath = "https://www.googleapis.com/storage/v1beta1/" 82 83// OAuth2 scopes used by this API. 84const ( 85 // Manage your data and permissions in Google Cloud Storage 86 DevstorageFullControlScope = "https://www.googleapis.com/auth/devstorage.full_control" 87 88 // View your data in Google Cloud Storage 89 DevstorageReadOnlyScope = "https://www.googleapis.com/auth/devstorage.read_only" 90 91 // Manage your data in Google Cloud Storage 92 DevstorageReadWriteScope = "https://www.googleapis.com/auth/devstorage.read_write" 93) 94 95// NewService creates a new Service. 96func 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 // NOTE: prepend, so we don't override user-specified scopes. 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// New creates a new Service. It uses the provided http.Client for requests. 119// 120// Deprecated: please use NewService instead. 121// To provide a custom HTTP client, use option.WithHTTPClient. 122// If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead. 123func 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 135type Service struct { 136 client *http.Client 137 BasePath string // API endpoint base URL 138 UserAgent string // optional additional User-Agent fragment 139 140 BucketAccessControls *BucketAccessControlsService 141 142 Buckets *BucketsService 143 144 ObjectAccessControls *ObjectAccessControlsService 145 146 Objects *ObjectsService 147} 148 149func (s *Service) userAgent() string { 150 if s.UserAgent == "" { 151 return googleapi.UserAgent 152 } 153 return googleapi.UserAgent + " " + s.UserAgent 154} 155 156func NewBucketAccessControlsService(s *Service) *BucketAccessControlsService { 157 rs := &BucketAccessControlsService{s: s} 158 return rs 159} 160 161type BucketAccessControlsService struct { 162 s *Service 163} 164 165func NewBucketsService(s *Service) *BucketsService { 166 rs := &BucketsService{s: s} 167 return rs 168} 169 170type BucketsService struct { 171 s *Service 172} 173 174func NewObjectAccessControlsService(s *Service) *ObjectAccessControlsService { 175 rs := &ObjectAccessControlsService{s: s} 176 return rs 177} 178 179type ObjectAccessControlsService struct { 180 s *Service 181} 182 183func NewObjectsService(s *Service) *ObjectsService { 184 rs := &ObjectsService{s: s} 185 return rs 186} 187 188type ObjectsService struct { 189 s *Service 190} 191 192// Bucket: A bucket. 193type Bucket struct { 194 // Acl: Access controls on the bucket. 195 Acl []*BucketAccessControl `json:"acl,omitempty"` 196 197 // DefaultObjectAcl: Default access controls to apply to new objects 198 // when no ACL is provided. 199 DefaultObjectAcl []*ObjectAccessControl `json:"defaultObjectAcl,omitempty"` 200 201 // Id: The name of the bucket. 202 Id string `json:"id,omitempty"` 203 204 // Kind: The kind of item this is. For buckets, this is always 205 // storage#bucket. 206 Kind string `json:"kind,omitempty"` 207 208 // Location: The location of the bucket. Object data for objects in the 209 // bucket resides in physical storage in this location. Can be US or EU. 210 // Defaults to US. 211 Location string `json:"location,omitempty"` 212 213 // Owner: The owner of the bucket. This will always be the project 214 // team's owner group. 215 Owner *BucketOwner `json:"owner,omitempty"` 216 217 // ProjectId: The project the bucket belongs to. 218 ProjectId uint64 `json:"projectId,omitempty,string"` 219 220 // SelfLink: The URI of this bucket. 221 SelfLink string `json:"selfLink,omitempty"` 222 223 // TimeCreated: Creation time of the bucket in RFC 3339 format. 224 TimeCreated string `json:"timeCreated,omitempty"` 225 226 // Website: The bucket's website configuration. 227 Website *BucketWebsite `json:"website,omitempty"` 228 229 // ServerResponse contains the HTTP response code and headers from the 230 // server. 231 googleapi.ServerResponse `json:"-"` 232 233 // ForceSendFields is a list of field names (e.g. "Acl") to 234 // unconditionally include in API requests. By default, fields with 235 // empty values are omitted from API requests. However, any non-pointer, 236 // non-interface field appearing in ForceSendFields will be sent to the 237 // server regardless of whether the field is empty or not. This may be 238 // used to include empty fields in Patch requests. 239 ForceSendFields []string `json:"-"` 240 241 // NullFields is a list of field names (e.g. "Acl") to include in API 242 // requests with the JSON null value. By default, fields with empty 243 // values are omitted from API requests. However, any field with an 244 // empty value appearing in NullFields will be sent to the server as 245 // null. It is an error if a field in this list has a non-empty value. 246 // This may be used to include null fields in Patch requests. 247 NullFields []string `json:"-"` 248} 249 250func (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// BucketOwner: The owner of the bucket. This will always be the project 257// team's owner group. 258type BucketOwner struct { 259 // Entity: The entity, in the form group-groupId. 260 Entity string `json:"entity,omitempty"` 261 262 // EntityId: The ID for the entity. 263 EntityId string `json:"entityId,omitempty"` 264 265 // ForceSendFields is a list of field names (e.g. "Entity") to 266 // unconditionally include in API requests. By default, fields with 267 // empty values are omitted from API requests. However, any non-pointer, 268 // non-interface field appearing in ForceSendFields will be sent to the 269 // server regardless of whether the field is empty or not. This may be 270 // used to include empty fields in Patch requests. 271 ForceSendFields []string `json:"-"` 272 273 // NullFields is a list of field names (e.g. "Entity") to include in API 274 // requests with the JSON null value. By default, fields with empty 275 // values are omitted from API requests. However, any field with an 276 // empty value appearing in NullFields will be sent to the server as 277 // null. It is an error if a field in this list has a non-empty value. 278 // This may be used to include null fields in Patch requests. 279 NullFields []string `json:"-"` 280} 281 282func (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// BucketWebsite: The bucket's website configuration. 289type BucketWebsite struct { 290 // MainPageSuffix: Behaves as the bucket's directory index where missing 291 // objects are treated as potential directories. 292 MainPageSuffix string `json:"mainPageSuffix,omitempty"` 293 294 // NotFoundPage: The custom object to return when a requested resource 295 // is not found. 296 NotFoundPage string `json:"notFoundPage,omitempty"` 297 298 // ForceSendFields is a list of field names (e.g. "MainPageSuffix") to 299 // unconditionally include in API requests. By default, fields with 300 // empty values are omitted from API requests. However, any non-pointer, 301 // non-interface field appearing in ForceSendFields will be sent to the 302 // server regardless of whether the field is empty or not. This may be 303 // used to include empty fields in Patch requests. 304 ForceSendFields []string `json:"-"` 305 306 // NullFields is a list of field names (e.g. "MainPageSuffix") to 307 // include in API requests with the JSON null value. By default, fields 308 // with empty values are omitted from API requests. However, any field 309 // with an empty value appearing in NullFields will be sent to the 310 // server as null. It is an error if a field in this list has a 311 // non-empty value. This may be used to include null fields in Patch 312 // requests. 313 NullFields []string `json:"-"` 314} 315 316func (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// BucketAccessControl: An access-control entry. 323type BucketAccessControl struct { 324 // Bucket: The name of the bucket. 325 Bucket string `json:"bucket,omitempty"` 326 327 // Domain: The domain associated with the entity, if any. 328 Domain string `json:"domain,omitempty"` 329 330 // Email: The email address associated with the entity, if any. 331 Email string `json:"email,omitempty"` 332 333 // Entity: The entity holding the permission, in one of the following 334 // forms: 335 // - user-userId 336 // - user-email 337 // - group-groupId 338 // - group-email 339 // - domain-domain 340 // - allUsers 341 // - allAuthenticatedUsers Examples: 342 // - The user liz@example.com would be user-liz@example.com. 343 // - The group example@googlegroups.com would be 344 // group-example@googlegroups.com. 345 // - To refer to all members of the Google Apps for Business domain 346 // example.com, the entity would be domain-example.com. 347 Entity string `json:"entity,omitempty"` 348 349 // EntityId: The ID for the entity, if any. 350 EntityId string `json:"entityId,omitempty"` 351 352 // Id: The ID of the access-control entry. 353 Id string `json:"id,omitempty"` 354 355 // Kind: The kind of item this is. For bucket access control entries, 356 // this is always storage#bucketAccessControl. 357 Kind string `json:"kind,omitempty"` 358 359 // Role: The access permission for the entity. Can be READER, WRITER, or 360 // OWNER. 361 Role string `json:"role,omitempty"` 362 363 // SelfLink: The link to this access-control entry. 364 SelfLink string `json:"selfLink,omitempty"` 365 366 // ServerResponse contains the HTTP response code and headers from the 367 // server. 368 googleapi.ServerResponse `json:"-"` 369 370 // ForceSendFields is a list of field names (e.g. "Bucket") to 371 // unconditionally include in API requests. By default, fields with 372 // empty values are omitted from API requests. However, any non-pointer, 373 // non-interface field appearing in ForceSendFields will be sent to the 374 // server regardless of whether the field is empty or not. This may be 375 // used to include empty fields in Patch requests. 376 ForceSendFields []string `json:"-"` 377 378 // NullFields is a list of field names (e.g. "Bucket") to include in API 379 // requests with the JSON null value. By default, fields with empty 380 // values are omitted from API requests. However, any field with an 381 // empty value appearing in NullFields will be sent to the server as 382 // null. It is an error if a field in this list has a non-empty value. 383 // This may be used to include null fields in Patch requests. 384 NullFields []string `json:"-"` 385} 386 387func (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// BucketAccessControls: An access-control list. 394type BucketAccessControls struct { 395 // Items: The list of items. 396 Items []*BucketAccessControl `json:"items,omitempty"` 397 398 // Kind: The kind of item this is. For lists of bucket access control 399 // entries, this is always storage#bucketAccessControls. 400 Kind string `json:"kind,omitempty"` 401 402 // ServerResponse contains the HTTP response code and headers from the 403 // server. 404 googleapi.ServerResponse `json:"-"` 405 406 // ForceSendFields is a list of field names (e.g. "Items") to 407 // unconditionally include in API requests. By default, fields with 408 // empty values are omitted from API requests. However, any non-pointer, 409 // non-interface field appearing in ForceSendFields will be sent to the 410 // server regardless of whether the field is empty or not. This may be 411 // used to include empty fields in Patch requests. 412 ForceSendFields []string `json:"-"` 413 414 // NullFields is a list of field names (e.g. "Items") to include in API 415 // requests with the JSON null value. By default, fields with empty 416 // values are omitted from API requests. However, any field with an 417 // empty value appearing in NullFields will be sent to the server as 418 // null. It is an error if a field in this list has a non-empty value. 419 // This may be used to include null fields in Patch requests. 420 NullFields []string `json:"-"` 421} 422 423func (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// Buckets: A list of buckets. 430type Buckets struct { 431 // Items: The list of items. 432 Items []*Bucket `json:"items,omitempty"` 433 434 // Kind: The kind of item this is. For lists of buckets, this is always 435 // storage#buckets. 436 Kind string `json:"kind,omitempty"` 437 438 // NextPageToken: The continuation token, used to page through large 439 // result sets. Provide this value in a subsequent request to return the 440 // next page of results. 441 NextPageToken string `json:"nextPageToken,omitempty"` 442 443 // ServerResponse contains the HTTP response code and headers from the 444 // server. 445 googleapi.ServerResponse `json:"-"` 446 447 // ForceSendFields is a list of field names (e.g. "Items") to 448 // unconditionally include in API requests. By default, fields with 449 // empty values are omitted from API requests. However, any non-pointer, 450 // non-interface field appearing in ForceSendFields will be sent to the 451 // server regardless of whether the field is empty or not. This may be 452 // used to include empty fields in Patch requests. 453 ForceSendFields []string `json:"-"` 454 455 // NullFields is a list of field names (e.g. "Items") to include in API 456 // requests with the JSON null value. By default, fields with empty 457 // values are omitted from API requests. However, any field with an 458 // empty value appearing in NullFields will be sent to the server as 459 // null. It is an error if a field in this list has a non-empty value. 460 // This may be used to include null fields in Patch requests. 461 NullFields []string `json:"-"` 462} 463 464func (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// Object: An object. 471type Object struct { 472 // Acl: Access controls on the object. 473 Acl []*ObjectAccessControl `json:"acl,omitempty"` 474 475 // Bucket: The bucket containing this object. 476 Bucket string `json:"bucket,omitempty"` 477 478 // CacheControl: Cache-Control directive for the object data. 479 CacheControl string `json:"cacheControl,omitempty"` 480 481 // ContentDisposition: Content-Disposition of the object data. 482 ContentDisposition string `json:"contentDisposition,omitempty"` 483 484 // ContentEncoding: Content-Encoding of the object data. 485 ContentEncoding string `json:"contentEncoding,omitempty"` 486 487 // ContentLanguage: Content-Language of the object data. 488 ContentLanguage string `json:"contentLanguage,omitempty"` 489 490 // Id: The ID of the object. 491 Id string `json:"id,omitempty"` 492 493 // Kind: The kind of item this is. For objects, this is always 494 // storage#object. 495 Kind string `json:"kind,omitempty"` 496 497 // Media: Object media data. Provided on your behalf when uploading raw 498 // media or multipart/related with an auxiliary media part. 499 Media *ObjectMedia `json:"media,omitempty"` 500 501 // Metadata: User-provided metadata, in key/value pairs. 502 Metadata map[string]string `json:"metadata,omitempty"` 503 504 // Name: The name of this object. Required if not specified by URL 505 // parameter. 506 Name string `json:"name,omitempty"` 507 508 // Owner: The owner of the object. This will always be the uploader of 509 // the object. 510 Owner *ObjectOwner `json:"owner,omitempty"` 511 512 // SelfLink: The link to this object. 513 SelfLink string `json:"selfLink,omitempty"` 514 515 // ServerResponse contains the HTTP response code and headers from the 516 // server. 517 googleapi.ServerResponse `json:"-"` 518 519 // ForceSendFields is a list of field names (e.g. "Acl") to 520 // unconditionally include in API requests. By default, fields with 521 // empty values are omitted from API requests. However, any non-pointer, 522 // non-interface field appearing in ForceSendFields will be sent to the 523 // server regardless of whether the field is empty or not. This may be 524 // used to include empty fields in Patch requests. 525 ForceSendFields []string `json:"-"` 526 527 // NullFields is a list of field names (e.g. "Acl") to include in API 528 // requests with the JSON null value. By default, fields with empty 529 // values are omitted from API requests. However, any field with an 530 // empty value appearing in NullFields will be sent to the server as 531 // null. It is an error if a field in this list has a non-empty value. 532 // This may be used to include null fields in Patch requests. 533 NullFields []string `json:"-"` 534} 535 536func (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// ObjectMedia: Object media data. Provided on your behalf when 543// uploading raw media or multipart/related with an auxiliary media 544// part. 545type ObjectMedia struct { 546 // Algorithm: Hash algorithm used. Currently only MD5 is supported. 547 // Required if a hash is provided. 548 Algorithm string `json:"algorithm,omitempty"` 549 550 // ContentType: Content-Type of the object data. 551 ContentType string `json:"contentType,omitempty"` 552 553 // Data: URL-safe Base64-encoded data. This property can be used to 554 // insert objects under 64KB in size, and will only be returned in 555 // response to the get method for objects so created. When this resource 556 // is returned in response to the list method, this property is omitted. 557 Data string `json:"data,omitempty"` 558 559 // Hash: Hash of the data. Required if a hash algorithm is provided. 560 Hash string `json:"hash,omitempty"` 561 562 // Length: Content-Length of the data in bytes. 563 Length uint64 `json:"length,omitempty,string"` 564 565 // Link: Media download link. 566 Link string `json:"link,omitempty"` 567 568 // TimeCreated: Creation time of the data in RFC 3339 format. 569 TimeCreated string `json:"timeCreated,omitempty"` 570 571 // ForceSendFields is a list of field names (e.g. "Algorithm") to 572 // unconditionally include in API requests. By default, fields with 573 // empty values are omitted from API requests. However, any non-pointer, 574 // non-interface field appearing in ForceSendFields will be sent to the 575 // server regardless of whether the field is empty or not. This may be 576 // used to include empty fields in Patch requests. 577 ForceSendFields []string `json:"-"` 578 579 // NullFields is a list of field names (e.g. "Algorithm") to include in 580 // API requests with the JSON null value. By default, fields with empty 581 // values are omitted from API requests. However, any field with an 582 // empty value appearing in NullFields will be sent to the server as 583 // null. It is an error if a field in this list has a non-empty value. 584 // This may be used to include null fields in Patch requests. 585 NullFields []string `json:"-"` 586} 587 588func (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// ObjectOwner: The owner of the object. This will always be the 595// uploader of the object. 596type ObjectOwner struct { 597 // Entity: The entity, in the form user-userId. 598 Entity string `json:"entity,omitempty"` 599 600 // EntityId: The ID for the entity. 601 EntityId string `json:"entityId,omitempty"` 602 603 // ForceSendFields is a list of field names (e.g. "Entity") to 604 // unconditionally include in API requests. By default, fields with 605 // empty values are omitted from API requests. However, any non-pointer, 606 // non-interface field appearing in ForceSendFields will be sent to the 607 // server regardless of whether the field is empty or not. This may be 608 // used to include empty fields in Patch requests. 609 ForceSendFields []string `json:"-"` 610 611 // NullFields is a list of field names (e.g. "Entity") to include in API 612 // requests with the JSON null value. By default, fields with empty 613 // values are omitted from API requests. However, any field with an 614 // empty value appearing in NullFields will be sent to the server as 615 // null. It is an error if a field in this list has a non-empty value. 616 // This may be used to include null fields in Patch requests. 617 NullFields []string `json:"-"` 618} 619 620func (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// ObjectAccessControl: An access-control entry. 627type ObjectAccessControl struct { 628 // Bucket: The name of the bucket. 629 Bucket string `json:"bucket,omitempty"` 630 631 // Domain: The domain associated with the entity, if any. 632 Domain string `json:"domain,omitempty"` 633 634 // Email: The email address associated with the entity, if any. 635 Email string `json:"email,omitempty"` 636 637 // Entity: The entity holding the permission, in one of the following 638 // forms: 639 // - user-userId 640 // - user-email 641 // - group-groupId 642 // - group-email 643 // - domain-domain 644 // - allUsers 645 // - allAuthenticatedUsers Examples: 646 // - The user liz@example.com would be user-liz@example.com. 647 // - The group example@googlegroups.com would be 648 // group-example@googlegroups.com. 649 // - To refer to all members of the Google Apps for Business domain 650 // example.com, the entity would be domain-example.com. 651 Entity string `json:"entity,omitempty"` 652 653 // EntityId: The ID for the entity, if any. 654 EntityId string `json:"entityId,omitempty"` 655 656 // Id: The ID of the access-control entry. 657 Id string `json:"id,omitempty"` 658 659 // Kind: The kind of item this is. For object access control entries, 660 // this is always storage#objectAccessControl. 661 Kind string `json:"kind,omitempty"` 662 663 // Object: The name of the object. 664 Object string `json:"object,omitempty"` 665 666 // Role: The access permission for the entity. Can be READER or OWNER. 667 Role string `json:"role,omitempty"` 668 669 // SelfLink: The link to this access-control entry. 670 SelfLink string `json:"selfLink,omitempty"` 671 672 // ServerResponse contains the HTTP response code and headers from the 673 // server. 674 googleapi.ServerResponse `json:"-"` 675 676 // ForceSendFields is a list of field names (e.g. "Bucket") to 677 // unconditionally include in API requests. By default, fields with 678 // empty values are omitted from API requests. However, any non-pointer, 679 // non-interface field appearing in ForceSendFields will be sent to the 680 // server regardless of whether the field is empty or not. This may be 681 // used to include empty fields in Patch requests. 682 ForceSendFields []string `json:"-"` 683 684 // NullFields is a list of field names (e.g. "Bucket") to include in API 685 // requests with the JSON null value. By default, fields with empty 686 // values are omitted from API requests. However, any field with an 687 // empty value appearing in NullFields will be sent to the server as 688 // null. It is an error if a field in this list has a non-empty value. 689 // This may be used to include null fields in Patch requests. 690 NullFields []string `json:"-"` 691} 692 693func (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// ObjectAccessControls: An access-control list. 700type ObjectAccessControls struct { 701 // Items: The list of items. 702 Items []*ObjectAccessControl `json:"items,omitempty"` 703 704 // Kind: The kind of item this is. For lists of object access control 705 // entries, this is always storage#objectAccessControls. 706 Kind string `json:"kind,omitempty"` 707 708 // ServerResponse contains the HTTP response code and headers from the 709 // server. 710 googleapi.ServerResponse `json:"-"` 711 712 // ForceSendFields is a list of field names (e.g. "Items") to 713 // unconditionally include in API requests. By default, fields with 714 // empty values are omitted from API requests. However, any non-pointer, 715 // non-interface field appearing in ForceSendFields will be sent to the 716 // server regardless of whether the field is empty or not. This may be 717 // used to include empty fields in Patch requests. 718 ForceSendFields []string `json:"-"` 719 720 // NullFields is a list of field names (e.g. "Items") to include in API 721 // requests with the JSON null value. By default, fields with empty 722 // values are omitted from API requests. However, any field with an 723 // empty value appearing in NullFields will be sent to the server as 724 // null. It is an error if a field in this list has a non-empty value. 725 // This may be used to include null fields in Patch requests. 726 NullFields []string `json:"-"` 727} 728 729func (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// Objects: A list of objects. 736type Objects struct { 737 // Items: The list of items. 738 Items []*Object `json:"items,omitempty"` 739 740 // Kind: The kind of item this is. For lists of objects, this is always 741 // storage#objects. 742 Kind string `json:"kind,omitempty"` 743 744 // NextPageToken: The continuation token, used to page through large 745 // result sets. Provide this value in a subsequent request to return the 746 // next page of results. 747 NextPageToken string `json:"nextPageToken,omitempty"` 748 749 // Prefixes: The list of prefixes of objects matching-but-not-listed up 750 // to and including the requested delimiter. 751 Prefixes []string `json:"prefixes,omitempty"` 752 753 // ServerResponse contains the HTTP response code and headers from the 754 // server. 755 googleapi.ServerResponse `json:"-"` 756 757 // ForceSendFields is a list of field names (e.g. "Items") to 758 // unconditionally include in API requests. By default, fields with 759 // empty values are omitted from API requests. However, any non-pointer, 760 // non-interface field appearing in ForceSendFields will be sent to the 761 // server regardless of whether the field is empty or not. This may be 762 // used to include empty fields in Patch requests. 763 ForceSendFields []string `json:"-"` 764 765 // NullFields is a list of field names (e.g. "Items") to include in API 766 // requests with the JSON null value. By default, fields with empty 767 // values are omitted from API requests. However, any field with an 768 // empty value appearing in NullFields will be sent to the server as 769 // null. It is an error if a field in this list has a non-empty value. 770 // This may be used to include null fields in Patch requests. 771 NullFields []string `json:"-"` 772} 773 774func (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// method id "storage.bucketAccessControls.delete": 781 782type 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// Delete: Deletes the ACL entry for the specified entity on the 792// specified bucket. 793func (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// Fields allows partial responses to be retrieved. See 801// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 802// for more information. 803func (c *BucketAccessControlsDeleteCall) Fields(s ...googleapi.Field) *BucketAccessControlsDeleteCall { 804 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 805 return c 806} 807 808// Context sets the context to be used in this call's Do method. Any 809// pending HTTP request will be aborted if the provided context is 810// canceled. 811func (c *BucketAccessControlsDeleteCall) Context(ctx context.Context) *BucketAccessControlsDeleteCall { 812 c.ctx_ = ctx 813 return c 814} 815 816// Header returns an http.Header that can be modified by the caller to 817// add HTTP headers to the request. 818func (c *BucketAccessControlsDeleteCall) Header() http.Header { 819 if c.header_ == nil { 820 c.header_ = make(http.Header) 821 } 822 return c.header_ 823} 824 825func (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// Do executes the "storage.bucketAccessControls.delete" call. 850func (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 // "description": "Deletes the ACL entry for the specified entity on the specified bucket.", 863 // "httpMethod": "DELETE", 864 // "id": "storage.bucketAccessControls.delete", 865 // "parameterOrder": [ 866 // "bucket", 867 // "entity" 868 // ], 869 // "parameters": { 870 // "bucket": { 871 // "description": "Name of a bucket.", 872 // "location": "path", 873 // "required": true, 874 // "type": "string" 875 // }, 876 // "entity": { 877 // "description": "The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.", 878 // "location": "path", 879 // "required": true, 880 // "type": "string" 881 // } 882 // }, 883 // "path": "b/{bucket}/acl/{entity}", 884 // "scopes": [ 885 // "https://www.googleapis.com/auth/devstorage.full_control" 886 // ] 887 // } 888 889} 890 891// method id "storage.bucketAccessControls.get": 892 893type 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// Get: Returns the ACL entry for the specified entity on the specified 904// bucket. 905func (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// Fields allows partial responses to be retrieved. See 913// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 914// for more information. 915func (c *BucketAccessControlsGetCall) Fields(s ...googleapi.Field) *BucketAccessControlsGetCall { 916 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 917 return c 918} 919 920// IfNoneMatch sets the optional parameter which makes the operation 921// fail if the object's ETag matches the given value. This is useful for 922// getting updates only after the object has changed since the last 923// request. Use googleapi.IsNotModified to check whether the response 924// error from Do is the result of In-None-Match. 925func (c *BucketAccessControlsGetCall) IfNoneMatch(entityTag string) *BucketAccessControlsGetCall { 926 c.ifNoneMatch_ = entityTag 927 return c 928} 929 930// Context sets the context to be used in this call's Do method. Any 931// pending HTTP request will be aborted if the provided context is 932// canceled. 933func (c *BucketAccessControlsGetCall) Context(ctx context.Context) *BucketAccessControlsGetCall { 934 c.ctx_ = ctx 935 return c 936} 937 938// Header returns an http.Header that can be modified by the caller to 939// add HTTP headers to the request. 940func (c *BucketAccessControlsGetCall) Header() http.Header { 941 if c.header_ == nil { 942 c.header_ = make(http.Header) 943 } 944 return c.header_ 945} 946 947func (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// Do executes the "storage.bucketAccessControls.get" call. 975// Exactly one of *BucketAccessControl or error will be non-nil. Any 976// non-2xx status code is an error. Response headers are in either 977// *BucketAccessControl.ServerResponse.Header or (if a response was 978// returned at all) in error.(*googleapi.Error).Header. Use 979// googleapi.IsNotModified to check whether the returned error was 980// because http.StatusNotModified was returned. 981func (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 // "description": "Returns the ACL entry for the specified entity on the specified bucket.", 1013 // "httpMethod": "GET", 1014 // "id": "storage.bucketAccessControls.get", 1015 // "parameterOrder": [ 1016 // "bucket", 1017 // "entity" 1018 // ], 1019 // "parameters": { 1020 // "bucket": { 1021 // "description": "Name of a bucket.", 1022 // "location": "path", 1023 // "required": true, 1024 // "type": "string" 1025 // }, 1026 // "entity": { 1027 // "description": "The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.", 1028 // "location": "path", 1029 // "required": true, 1030 // "type": "string" 1031 // } 1032 // }, 1033 // "path": "b/{bucket}/acl/{entity}", 1034 // "response": { 1035 // "$ref": "BucketAccessControl" 1036 // }, 1037 // "scopes": [ 1038 // "https://www.googleapis.com/auth/devstorage.full_control" 1039 // ] 1040 // } 1041 1042} 1043 1044// method id "storage.bucketAccessControls.insert": 1045 1046type 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// Insert: Creates a new ACL entry on the specified bucket. 1056func (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// Fields allows partial responses to be retrieved. See 1064// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1065// for more information. 1066func (c *BucketAccessControlsInsertCall) Fields(s ...googleapi.Field) *BucketAccessControlsInsertCall { 1067 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1068 return c 1069} 1070 1071// Context sets the context to be used in this call's Do method. Any 1072// pending HTTP request will be aborted if the provided context is 1073// canceled. 1074func (c *BucketAccessControlsInsertCall) Context(ctx context.Context) *BucketAccessControlsInsertCall { 1075 c.ctx_ = ctx 1076 return c 1077} 1078 1079// Header returns an http.Header that can be modified by the caller to 1080// add HTTP headers to the request. 1081func (c *BucketAccessControlsInsertCall) Header() http.Header { 1082 if c.header_ == nil { 1083 c.header_ = make(http.Header) 1084 } 1085 return c.header_ 1086} 1087 1088func (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// Do executes the "storage.bucketAccessControls.insert" call. 1117// Exactly one of *BucketAccessControl or error will be non-nil. Any 1118// non-2xx status code is an error. Response headers are in either 1119// *BucketAccessControl.ServerResponse.Header or (if a response was 1120// returned at all) in error.(*googleapi.Error).Header. Use 1121// googleapi.IsNotModified to check whether the returned error was 1122// because http.StatusNotModified was returned. 1123func (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 // "description": "Creates a new ACL entry on the specified bucket.", 1155 // "httpMethod": "POST", 1156 // "id": "storage.bucketAccessControls.insert", 1157 // "parameterOrder": [ 1158 // "bucket" 1159 // ], 1160 // "parameters": { 1161 // "bucket": { 1162 // "description": "Name of a bucket.", 1163 // "location": "path", 1164 // "required": true, 1165 // "type": "string" 1166 // } 1167 // }, 1168 // "path": "b/{bucket}/acl", 1169 // "request": { 1170 // "$ref": "BucketAccessControl" 1171 // }, 1172 // "response": { 1173 // "$ref": "BucketAccessControl" 1174 // }, 1175 // "scopes": [ 1176 // "https://www.googleapis.com/auth/devstorage.full_control" 1177 // ] 1178 // } 1179 1180} 1181 1182// method id "storage.bucketAccessControls.list": 1183 1184type 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// List: Retrieves ACL entries on the specified bucket. 1194func (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// Fields allows partial responses to be retrieved. See 1201// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1202// for more information. 1203func (c *BucketAccessControlsListCall) Fields(s ...googleapi.Field) *BucketAccessControlsListCall { 1204 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1205 return c 1206} 1207 1208// IfNoneMatch sets the optional parameter which makes the operation 1209// fail if the object's ETag matches the given value. This is useful for 1210// getting updates only after the object has changed since the last 1211// request. Use googleapi.IsNotModified to check whether the response 1212// error from Do is the result of In-None-Match. 1213func (c *BucketAccessControlsListCall) IfNoneMatch(entityTag string) *BucketAccessControlsListCall { 1214 c.ifNoneMatch_ = entityTag 1215 return c 1216} 1217 1218// Context sets the context to be used in this call's Do method. Any 1219// pending HTTP request will be aborted if the provided context is 1220// canceled. 1221func (c *BucketAccessControlsListCall) Context(ctx context.Context) *BucketAccessControlsListCall { 1222 c.ctx_ = ctx 1223 return c 1224} 1225 1226// Header returns an http.Header that can be modified by the caller to 1227// add HTTP headers to the request. 1228func (c *BucketAccessControlsListCall) Header() http.Header { 1229 if c.header_ == nil { 1230 c.header_ = make(http.Header) 1231 } 1232 return c.header_ 1233} 1234 1235func (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// Do executes the "storage.bucketAccessControls.list" call. 1262// Exactly one of *BucketAccessControls or error will be non-nil. Any 1263// non-2xx status code is an error. Response headers are in either 1264// *BucketAccessControls.ServerResponse.Header or (if a response was 1265// returned at all) in error.(*googleapi.Error).Header. Use 1266// googleapi.IsNotModified to check whether the returned error was 1267// because http.StatusNotModified was returned. 1268func (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 // "description": "Retrieves ACL entries on the specified bucket.", 1300 // "httpMethod": "GET", 1301 // "id": "storage.bucketAccessControls.list", 1302 // "parameterOrder": [ 1303 // "bucket" 1304 // ], 1305 // "parameters": { 1306 // "bucket": { 1307 // "description": "Name of a bucket.", 1308 // "location": "path", 1309 // "required": true, 1310 // "type": "string" 1311 // } 1312 // }, 1313 // "path": "b/{bucket}/acl", 1314 // "response": { 1315 // "$ref": "BucketAccessControls" 1316 // }, 1317 // "scopes": [ 1318 // "https://www.googleapis.com/auth/devstorage.full_control" 1319 // ] 1320 // } 1321 1322} 1323 1324// method id "storage.bucketAccessControls.patch": 1325 1326type 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// Patch: Updates an ACL entry on the specified bucket. This method 1337// supports patch semantics. 1338func (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// Fields allows partial responses to be retrieved. See 1347// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1348// for more information. 1349func (c *BucketAccessControlsPatchCall) Fields(s ...googleapi.Field) *BucketAccessControlsPatchCall { 1350 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1351 return c 1352} 1353 1354// Context sets the context to be used in this call's Do method. Any 1355// pending HTTP request will be aborted if the provided context is 1356// canceled. 1357func (c *BucketAccessControlsPatchCall) Context(ctx context.Context) *BucketAccessControlsPatchCall { 1358 c.ctx_ = ctx 1359 return c 1360} 1361 1362// Header returns an http.Header that can be modified by the caller to 1363// add HTTP headers to the request. 1364func (c *BucketAccessControlsPatchCall) Header() http.Header { 1365 if c.header_ == nil { 1366 c.header_ = make(http.Header) 1367 } 1368 return c.header_ 1369} 1370 1371func (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// Do executes the "storage.bucketAccessControls.patch" call. 1401// Exactly one of *BucketAccessControl or error will be non-nil. Any 1402// non-2xx status code is an error. Response headers are in either 1403// *BucketAccessControl.ServerResponse.Header or (if a response was 1404// returned at all) in error.(*googleapi.Error).Header. Use 1405// googleapi.IsNotModified to check whether the returned error was 1406// because http.StatusNotModified was returned. 1407func (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 // "description": "Updates an ACL entry on the specified bucket. This method supports patch semantics.", 1439 // "httpMethod": "PATCH", 1440 // "id": "storage.bucketAccessControls.patch", 1441 // "parameterOrder": [ 1442 // "bucket", 1443 // "entity" 1444 // ], 1445 // "parameters": { 1446 // "bucket": { 1447 // "description": "Name of a bucket.", 1448 // "location": "path", 1449 // "required": true, 1450 // "type": "string" 1451 // }, 1452 // "entity": { 1453 // "description": "The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.", 1454 // "location": "path", 1455 // "required": true, 1456 // "type": "string" 1457 // } 1458 // }, 1459 // "path": "b/{bucket}/acl/{entity}", 1460 // "request": { 1461 // "$ref": "BucketAccessControl" 1462 // }, 1463 // "response": { 1464 // "$ref": "BucketAccessControl" 1465 // }, 1466 // "scopes": [ 1467 // "https://www.googleapis.com/auth/devstorage.full_control" 1468 // ] 1469 // } 1470 1471} 1472 1473// method id "storage.bucketAccessControls.update": 1474 1475type 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// Update: Updates an ACL entry on the specified bucket. 1486func (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// Fields allows partial responses to be retrieved. See 1495// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1496// for more information. 1497func (c *BucketAccessControlsUpdateCall) Fields(s ...googleapi.Field) *BucketAccessControlsUpdateCall { 1498 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1499 return c 1500} 1501 1502// Context sets the context to be used in this call's Do method. Any 1503// pending HTTP request will be aborted if the provided context is 1504// canceled. 1505func (c *BucketAccessControlsUpdateCall) Context(ctx context.Context) *BucketAccessControlsUpdateCall { 1506 c.ctx_ = ctx 1507 return c 1508} 1509 1510// Header returns an http.Header that can be modified by the caller to 1511// add HTTP headers to the request. 1512func (c *BucketAccessControlsUpdateCall) Header() http.Header { 1513 if c.header_ == nil { 1514 c.header_ = make(http.Header) 1515 } 1516 return c.header_ 1517} 1518 1519func (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// Do executes the "storage.bucketAccessControls.update" call. 1549// Exactly one of *BucketAccessControl or error will be non-nil. Any 1550// non-2xx status code is an error. Response headers are in either 1551// *BucketAccessControl.ServerResponse.Header or (if a response was 1552// returned at all) in error.(*googleapi.Error).Header. Use 1553// googleapi.IsNotModified to check whether the returned error was 1554// because http.StatusNotModified was returned. 1555func (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 // "description": "Updates an ACL entry on the specified bucket.", 1587 // "httpMethod": "PUT", 1588 // "id": "storage.bucketAccessControls.update", 1589 // "parameterOrder": [ 1590 // "bucket", 1591 // "entity" 1592 // ], 1593 // "parameters": { 1594 // "bucket": { 1595 // "description": "Name of a bucket.", 1596 // "location": "path", 1597 // "required": true, 1598 // "type": "string" 1599 // }, 1600 // "entity": { 1601 // "description": "The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.", 1602 // "location": "path", 1603 // "required": true, 1604 // "type": "string" 1605 // } 1606 // }, 1607 // "path": "b/{bucket}/acl/{entity}", 1608 // "request": { 1609 // "$ref": "BucketAccessControl" 1610 // }, 1611 // "response": { 1612 // "$ref": "BucketAccessControl" 1613 // }, 1614 // "scopes": [ 1615 // "https://www.googleapis.com/auth/devstorage.full_control" 1616 // ] 1617 // } 1618 1619} 1620 1621// method id "storage.buckets.delete": 1622 1623type BucketsDeleteCall struct { 1624 s *Service 1625 bucket string 1626 urlParams_ gensupport.URLParams 1627 ctx_ context.Context 1628 header_ http.Header 1629} 1630 1631// Delete: Deletes an empty bucket. 1632func (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// Fields allows partial responses to be retrieved. See 1639// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1640// for more information. 1641func (c *BucketsDeleteCall) Fields(s ...googleapi.Field) *BucketsDeleteCall { 1642 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1643 return c 1644} 1645 1646// Context sets the context to be used in this call's Do method. Any 1647// pending HTTP request will be aborted if the provided context is 1648// canceled. 1649func (c *BucketsDeleteCall) Context(ctx context.Context) *BucketsDeleteCall { 1650 c.ctx_ = ctx 1651 return c 1652} 1653 1654// Header returns an http.Header that can be modified by the caller to 1655// add HTTP headers to the request. 1656func (c *BucketsDeleteCall) Header() http.Header { 1657 if c.header_ == nil { 1658 c.header_ = make(http.Header) 1659 } 1660 return c.header_ 1661} 1662 1663func (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// Do executes the "storage.buckets.delete" call. 1687func (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 // "description": "Deletes an empty bucket.", 1700 // "httpMethod": "DELETE", 1701 // "id": "storage.buckets.delete", 1702 // "parameterOrder": [ 1703 // "bucket" 1704 // ], 1705 // "parameters": { 1706 // "bucket": { 1707 // "description": "Name of a bucket.", 1708 // "location": "path", 1709 // "required": true, 1710 // "type": "string" 1711 // } 1712 // }, 1713 // "path": "b/{bucket}", 1714 // "scopes": [ 1715 // "https://www.googleapis.com/auth/devstorage.full_control", 1716 // "https://www.googleapis.com/auth/devstorage.read_write" 1717 // ] 1718 // } 1719 1720} 1721 1722// method id "storage.buckets.get": 1723 1724type 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// Get: Returns metadata for the specified bucket. 1734func (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// Projection sets the optional parameter "projection": Set of 1741// properties to return. Defaults to no_acl. 1742// 1743// Possible values: 1744// "full" - Include all properties. 1745// "no_acl" - Omit acl and defaultObjectAcl properties. 1746func (c *BucketsGetCall) Projection(projection string) *BucketsGetCall { 1747 c.urlParams_.Set("projection", projection) 1748 return c 1749} 1750 1751// Fields allows partial responses to be retrieved. See 1752// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1753// for more information. 1754func (c *BucketsGetCall) Fields(s ...googleapi.Field) *BucketsGetCall { 1755 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1756 return c 1757} 1758 1759// IfNoneMatch sets the optional parameter which makes the operation 1760// fail if the object's ETag matches the given value. This is useful for 1761// getting updates only after the object has changed since the last 1762// request. Use googleapi.IsNotModified to check whether the response 1763// error from Do is the result of In-None-Match. 1764func (c *BucketsGetCall) IfNoneMatch(entityTag string) *BucketsGetCall { 1765 c.ifNoneMatch_ = entityTag 1766 return c 1767} 1768 1769// Context sets the context to be used in this call's Do method. Any 1770// pending HTTP request will be aborted if the provided context is 1771// canceled. 1772func (c *BucketsGetCall) Context(ctx context.Context) *BucketsGetCall { 1773 c.ctx_ = ctx 1774 return c 1775} 1776 1777// Header returns an http.Header that can be modified by the caller to 1778// add HTTP headers to the request. 1779func (c *BucketsGetCall) Header() http.Header { 1780 if c.header_ == nil { 1781 c.header_ = make(http.Header) 1782 } 1783 return c.header_ 1784} 1785 1786func (c *BucketsGetCall) doRequest(alt string) (*http.Response, error) { 1787 reqHeaders := make(http.Header) 1788 reqHeaders.Set("x-goog-api-client", "gl-go/1.13.7 gdcl/20200203") 1789 for k, v := range c.header_ { 1790 reqHeaders[k] = v 1791 } 1792 reqHeaders.Set("User-Agent", c.s.userAgent()) 1793 if c.ifNoneMatch_ != "" { 1794 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 1795 } 1796 var body io.Reader = nil 1797 c.urlParams_.Set("alt", alt) 1798 c.urlParams_.Set("prettyPrint", "false") 1799 urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}") 1800 urls += "?" + c.urlParams_.Encode() 1801 req, err := http.NewRequest("GET", urls, body) 1802 if err != nil { 1803 return nil, err 1804 } 1805 req.Header = reqHeaders 1806 googleapi.Expand(req.URL, map[string]string{ 1807 "bucket": c.bucket, 1808 }) 1809 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1810} 1811 1812// Do executes the "storage.buckets.get" call. 1813// Exactly one of *Bucket or error will be non-nil. Any non-2xx status 1814// code is an error. Response headers are in either 1815// *Bucket.ServerResponse.Header or (if a response was returned at all) 1816// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 1817// check whether the returned error was because http.StatusNotModified 1818// was returned. 1819func (c *BucketsGetCall) Do(opts ...googleapi.CallOption) (*Bucket, error) { 1820 gensupport.SetOptions(c.urlParams_, opts...) 1821 res, err := c.doRequest("json") 1822 if res != nil && res.StatusCode == http.StatusNotModified { 1823 if res.Body != nil { 1824 res.Body.Close() 1825 } 1826 return nil, &googleapi.Error{ 1827 Code: res.StatusCode, 1828 Header: res.Header, 1829 } 1830 } 1831 if err != nil { 1832 return nil, err 1833 } 1834 defer googleapi.CloseBody(res) 1835 if err := googleapi.CheckResponse(res); err != nil { 1836 return nil, err 1837 } 1838 ret := &Bucket{ 1839 ServerResponse: googleapi.ServerResponse{ 1840 Header: res.Header, 1841 HTTPStatusCode: res.StatusCode, 1842 }, 1843 } 1844 target := &ret 1845 if err := gensupport.DecodeResponse(target, res); err != nil { 1846 return nil, err 1847 } 1848 return ret, nil 1849 // { 1850 // "description": "Returns metadata for the specified bucket.", 1851 // "httpMethod": "GET", 1852 // "id": "storage.buckets.get", 1853 // "parameterOrder": [ 1854 // "bucket" 1855 // ], 1856 // "parameters": { 1857 // "bucket": { 1858 // "description": "Name of a bucket.", 1859 // "location": "path", 1860 // "required": true, 1861 // "type": "string" 1862 // }, 1863 // "projection": { 1864 // "description": "Set of properties to return. Defaults to no_acl.", 1865 // "enum": [ 1866 // "full", 1867 // "no_acl" 1868 // ], 1869 // "enumDescriptions": [ 1870 // "Include all properties.", 1871 // "Omit acl and defaultObjectAcl properties." 1872 // ], 1873 // "location": "query", 1874 // "type": "string" 1875 // } 1876 // }, 1877 // "path": "b/{bucket}", 1878 // "response": { 1879 // "$ref": "Bucket" 1880 // }, 1881 // "scopes": [ 1882 // "https://www.googleapis.com/auth/devstorage.full_control", 1883 // "https://www.googleapis.com/auth/devstorage.read_only", 1884 // "https://www.googleapis.com/auth/devstorage.read_write" 1885 // ] 1886 // } 1887 1888} 1889 1890// method id "storage.buckets.insert": 1891 1892type BucketsInsertCall struct { 1893 s *Service 1894 bucket *Bucket 1895 urlParams_ gensupport.URLParams 1896 ctx_ context.Context 1897 header_ http.Header 1898} 1899 1900// Insert: Creates a new bucket. 1901func (r *BucketsService) Insert(bucket *Bucket) *BucketsInsertCall { 1902 c := &BucketsInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1903 c.bucket = bucket 1904 return c 1905} 1906 1907// Projection sets the optional parameter "projection": Set of 1908// properties to return. Defaults to no_acl, unless the bucket resource 1909// specifies acl or defaultObjectAcl properties, when it defaults to 1910// full. 1911// 1912// Possible values: 1913// "full" - Include all properties. 1914// "no_acl" - Omit acl and defaultObjectAcl properties. 1915func (c *BucketsInsertCall) Projection(projection string) *BucketsInsertCall { 1916 c.urlParams_.Set("projection", projection) 1917 return c 1918} 1919 1920// Fields allows partial responses to be retrieved. See 1921// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1922// for more information. 1923func (c *BucketsInsertCall) Fields(s ...googleapi.Field) *BucketsInsertCall { 1924 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1925 return c 1926} 1927 1928// Context sets the context to be used in this call's Do method. Any 1929// pending HTTP request will be aborted if the provided context is 1930// canceled. 1931func (c *BucketsInsertCall) Context(ctx context.Context) *BucketsInsertCall { 1932 c.ctx_ = ctx 1933 return c 1934} 1935 1936// Header returns an http.Header that can be modified by the caller to 1937// add HTTP headers to the request. 1938func (c *BucketsInsertCall) Header() http.Header { 1939 if c.header_ == nil { 1940 c.header_ = make(http.Header) 1941 } 1942 return c.header_ 1943} 1944 1945func (c *BucketsInsertCall) doRequest(alt string) (*http.Response, error) { 1946 reqHeaders := make(http.Header) 1947 reqHeaders.Set("x-goog-api-client", "gl-go/1.13.7 gdcl/20200203") 1948 for k, v := range c.header_ { 1949 reqHeaders[k] = v 1950 } 1951 reqHeaders.Set("User-Agent", c.s.userAgent()) 1952 var body io.Reader = nil 1953 body, err := googleapi.WithoutDataWrapper.JSONReader(c.bucket) 1954 if err != nil { 1955 return nil, err 1956 } 1957 reqHeaders.Set("Content-Type", "application/json") 1958 c.urlParams_.Set("alt", alt) 1959 c.urlParams_.Set("prettyPrint", "false") 1960 urls := googleapi.ResolveRelative(c.s.BasePath, "b") 1961 urls += "?" + c.urlParams_.Encode() 1962 req, err := http.NewRequest("POST", urls, body) 1963 if err != nil { 1964 return nil, err 1965 } 1966 req.Header = reqHeaders 1967 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1968} 1969 1970// Do executes the "storage.buckets.insert" call. 1971// Exactly one of *Bucket or error will be non-nil. Any non-2xx status 1972// code is an error. Response headers are in either 1973// *Bucket.ServerResponse.Header or (if a response was returned at all) 1974// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 1975// check whether the returned error was because http.StatusNotModified 1976// was returned. 1977func (c *BucketsInsertCall) Do(opts ...googleapi.CallOption) (*Bucket, error) { 1978 gensupport.SetOptions(c.urlParams_, opts...) 1979 res, err := c.doRequest("json") 1980 if res != nil && res.StatusCode == http.StatusNotModified { 1981 if res.Body != nil { 1982 res.Body.Close() 1983 } 1984 return nil, &googleapi.Error{ 1985 Code: res.StatusCode, 1986 Header: res.Header, 1987 } 1988 } 1989 if err != nil { 1990 return nil, err 1991 } 1992 defer googleapi.CloseBody(res) 1993 if err := googleapi.CheckResponse(res); err != nil { 1994 return nil, err 1995 } 1996 ret := &Bucket{ 1997 ServerResponse: googleapi.ServerResponse{ 1998 Header: res.Header, 1999 HTTPStatusCode: res.StatusCode, 2000 }, 2001 } 2002 target := &ret 2003 if err := gensupport.DecodeResponse(target, res); err != nil { 2004 return nil, err 2005 } 2006 return ret, nil 2007 // { 2008 // "description": "Creates a new bucket.", 2009 // "httpMethod": "POST", 2010 // "id": "storage.buckets.insert", 2011 // "parameters": { 2012 // "projection": { 2013 // "description": "Set of properties to return. Defaults to no_acl, unless the bucket resource specifies acl or defaultObjectAcl properties, when it defaults to full.", 2014 // "enum": [ 2015 // "full", 2016 // "no_acl" 2017 // ], 2018 // "enumDescriptions": [ 2019 // "Include all properties.", 2020 // "Omit acl and defaultObjectAcl properties." 2021 // ], 2022 // "location": "query", 2023 // "type": "string" 2024 // } 2025 // }, 2026 // "path": "b", 2027 // "request": { 2028 // "$ref": "Bucket" 2029 // }, 2030 // "response": { 2031 // "$ref": "Bucket" 2032 // }, 2033 // "scopes": [ 2034 // "https://www.googleapis.com/auth/devstorage.full_control", 2035 // "https://www.googleapis.com/auth/devstorage.read_write" 2036 // ] 2037 // } 2038 2039} 2040 2041// method id "storage.buckets.list": 2042 2043type BucketsListCall struct { 2044 s *Service 2045 urlParams_ gensupport.URLParams 2046 ifNoneMatch_ string 2047 ctx_ context.Context 2048 header_ http.Header 2049} 2050 2051// List: Retrieves a list of buckets for a given project. 2052func (r *BucketsService) List(projectId uint64) *BucketsListCall { 2053 c := &BucketsListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2054 c.urlParams_.Set("projectId", fmt.Sprint(projectId)) 2055 return c 2056} 2057 2058// MaxResults sets the optional parameter "max-results": Maximum number 2059// of buckets to return. 2060func (c *BucketsListCall) MaxResults(maxResults int64) *BucketsListCall { 2061 c.urlParams_.Set("max-results", fmt.Sprint(maxResults)) 2062 return c 2063} 2064 2065// PageToken sets the optional parameter "pageToken": A 2066// previously-returned page token representing part of the larger set of 2067// results to view. 2068func (c *BucketsListCall) PageToken(pageToken string) *BucketsListCall { 2069 c.urlParams_.Set("pageToken", pageToken) 2070 return c 2071} 2072 2073// Projection sets the optional parameter "projection": Set of 2074// properties to return. Defaults to no_acl. 2075// 2076// Possible values: 2077// "full" - Include all properties. 2078// "no_acl" - Omit acl and defaultObjectAcl properties. 2079func (c *BucketsListCall) Projection(projection string) *BucketsListCall { 2080 c.urlParams_.Set("projection", projection) 2081 return c 2082} 2083 2084// Fields allows partial responses to be retrieved. See 2085// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 2086// for more information. 2087func (c *BucketsListCall) Fields(s ...googleapi.Field) *BucketsListCall { 2088 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2089 return c 2090} 2091 2092// IfNoneMatch sets the optional parameter which makes the operation 2093// fail if the object's ETag matches the given value. This is useful for 2094// getting updates only after the object has changed since the last 2095// request. Use googleapi.IsNotModified to check whether the response 2096// error from Do is the result of In-None-Match. 2097func (c *BucketsListCall) IfNoneMatch(entityTag string) *BucketsListCall { 2098 c.ifNoneMatch_ = entityTag 2099 return c 2100} 2101 2102// Context sets the context to be used in this call's Do method. Any 2103// pending HTTP request will be aborted if the provided context is 2104// canceled. 2105func (c *BucketsListCall) Context(ctx context.Context) *BucketsListCall { 2106 c.ctx_ = ctx 2107 return c 2108} 2109 2110// Header returns an http.Header that can be modified by the caller to 2111// add HTTP headers to the request. 2112func (c *BucketsListCall) Header() http.Header { 2113 if c.header_ == nil { 2114 c.header_ = make(http.Header) 2115 } 2116 return c.header_ 2117} 2118 2119func (c *BucketsListCall) doRequest(alt string) (*http.Response, error) { 2120 reqHeaders := make(http.Header) 2121 reqHeaders.Set("x-goog-api-client", "gl-go/1.13.7 gdcl/20200203") 2122 for k, v := range c.header_ { 2123 reqHeaders[k] = v 2124 } 2125 reqHeaders.Set("User-Agent", c.s.userAgent()) 2126 if c.ifNoneMatch_ != "" { 2127 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 2128 } 2129 var body io.Reader = nil 2130 c.urlParams_.Set("alt", alt) 2131 c.urlParams_.Set("prettyPrint", "false") 2132 urls := googleapi.ResolveRelative(c.s.BasePath, "b") 2133 urls += "?" + c.urlParams_.Encode() 2134 req, err := http.NewRequest("GET", urls, body) 2135 if err != nil { 2136 return nil, err 2137 } 2138 req.Header = reqHeaders 2139 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2140} 2141 2142// Do executes the "storage.buckets.list" call. 2143// Exactly one of *Buckets or error will be non-nil. Any non-2xx status 2144// code is an error. Response headers are in either 2145// *Buckets.ServerResponse.Header or (if a response was returned at all) 2146// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 2147// check whether the returned error was because http.StatusNotModified 2148// was returned. 2149func (c *BucketsListCall) Do(opts ...googleapi.CallOption) (*Buckets, error) { 2150 gensupport.SetOptions(c.urlParams_, opts...) 2151 res, err := c.doRequest("json") 2152 if res != nil && res.StatusCode == http.StatusNotModified { 2153 if res.Body != nil { 2154 res.Body.Close() 2155 } 2156 return nil, &googleapi.Error{ 2157 Code: res.StatusCode, 2158 Header: res.Header, 2159 } 2160 } 2161 if err != nil { 2162 return nil, err 2163 } 2164 defer googleapi.CloseBody(res) 2165 if err := googleapi.CheckResponse(res); err != nil { 2166 return nil, err 2167 } 2168 ret := &Buckets{ 2169 ServerResponse: googleapi.ServerResponse{ 2170 Header: res.Header, 2171 HTTPStatusCode: res.StatusCode, 2172 }, 2173 } 2174 target := &ret 2175 if err := gensupport.DecodeResponse(target, res); err != nil { 2176 return nil, err 2177 } 2178 return ret, nil 2179 // { 2180 // "description": "Retrieves a list of buckets for a given project.", 2181 // "httpMethod": "GET", 2182 // "id": "storage.buckets.list", 2183 // "parameterOrder": [ 2184 // "projectId" 2185 // ], 2186 // "parameters": { 2187 // "max-results": { 2188 // "description": "Maximum number of buckets to return.", 2189 // "format": "uint32", 2190 // "location": "query", 2191 // "minimum": "0", 2192 // "type": "integer" 2193 // }, 2194 // "pageToken": { 2195 // "description": "A previously-returned page token representing part of the larger set of results to view.", 2196 // "location": "query", 2197 // "type": "string" 2198 // }, 2199 // "projectId": { 2200 // "description": "A valid API project identifier.", 2201 // "format": "uint64", 2202 // "location": "query", 2203 // "required": true, 2204 // "type": "string" 2205 // }, 2206 // "projection": { 2207 // "description": "Set of properties to return. Defaults to no_acl.", 2208 // "enum": [ 2209 // "full", 2210 // "no_acl" 2211 // ], 2212 // "enumDescriptions": [ 2213 // "Include all properties.", 2214 // "Omit acl and defaultObjectAcl properties." 2215 // ], 2216 // "location": "query", 2217 // "type": "string" 2218 // } 2219 // }, 2220 // "path": "b", 2221 // "response": { 2222 // "$ref": "Buckets" 2223 // }, 2224 // "scopes": [ 2225 // "https://www.googleapis.com/auth/devstorage.full_control", 2226 // "https://www.googleapis.com/auth/devstorage.read_only", 2227 // "https://www.googleapis.com/auth/devstorage.read_write" 2228 // ] 2229 // } 2230 2231} 2232 2233// Pages invokes f for each page of results. 2234// A non-nil error returned from f will halt the iteration. 2235// The provided context supersedes any context provided to the Context method. 2236func (c *BucketsListCall) Pages(ctx context.Context, f func(*Buckets) error) error { 2237 c.ctx_ = ctx 2238 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 2239 for { 2240 x, err := c.Do() 2241 if err != nil { 2242 return err 2243 } 2244 if err := f(x); err != nil { 2245 return err 2246 } 2247 if x.NextPageToken == "" { 2248 return nil 2249 } 2250 c.PageToken(x.NextPageToken) 2251 } 2252} 2253 2254// method id "storage.buckets.patch": 2255 2256type BucketsPatchCall struct { 2257 s *Service 2258 bucket string 2259 bucket2 *Bucket 2260 urlParams_ gensupport.URLParams 2261 ctx_ context.Context 2262 header_ http.Header 2263} 2264 2265// Patch: Updates a bucket. This method supports patch semantics. 2266func (r *BucketsService) Patch(bucket string, bucket2 *Bucket) *BucketsPatchCall { 2267 c := &BucketsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2268 c.bucket = bucket 2269 c.bucket2 = bucket2 2270 return c 2271} 2272 2273// Projection sets the optional parameter "projection": Set of 2274// properties to return. Defaults to full. 2275// 2276// Possible values: 2277// "full" - Include all properties. 2278// "no_acl" - Omit acl and defaultObjectAcl properties. 2279func (c *BucketsPatchCall) Projection(projection string) *BucketsPatchCall { 2280 c.urlParams_.Set("projection", projection) 2281 return c 2282} 2283 2284// Fields allows partial responses to be retrieved. See 2285// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 2286// for more information. 2287func (c *BucketsPatchCall) Fields(s ...googleapi.Field) *BucketsPatchCall { 2288 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2289 return c 2290} 2291 2292// Context sets the context to be used in this call's Do method. Any 2293// pending HTTP request will be aborted if the provided context is 2294// canceled. 2295func (c *BucketsPatchCall) Context(ctx context.Context) *BucketsPatchCall { 2296 c.ctx_ = ctx 2297 return c 2298} 2299 2300// Header returns an http.Header that can be modified by the caller to 2301// add HTTP headers to the request. 2302func (c *BucketsPatchCall) Header() http.Header { 2303 if c.header_ == nil { 2304 c.header_ = make(http.Header) 2305 } 2306 return c.header_ 2307} 2308 2309func (c *BucketsPatchCall) doRequest(alt string) (*http.Response, error) { 2310 reqHeaders := make(http.Header) 2311 reqHeaders.Set("x-goog-api-client", "gl-go/1.13.7 gdcl/20200203") 2312 for k, v := range c.header_ { 2313 reqHeaders[k] = v 2314 } 2315 reqHeaders.Set("User-Agent", c.s.userAgent()) 2316 var body io.Reader = nil 2317 body, err := googleapi.WithoutDataWrapper.JSONReader(c.bucket2) 2318 if err != nil { 2319 return nil, err 2320 } 2321 reqHeaders.Set("Content-Type", "application/json") 2322 c.urlParams_.Set("alt", alt) 2323 c.urlParams_.Set("prettyPrint", "false") 2324 urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}") 2325 urls += "?" + c.urlParams_.Encode() 2326 req, err := http.NewRequest("PATCH", urls, body) 2327 if err != nil { 2328 return nil, err 2329 } 2330 req.Header = reqHeaders 2331 googleapi.Expand(req.URL, map[string]string{ 2332 "bucket": c.bucket, 2333 }) 2334 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2335} 2336 2337// Do executes the "storage.buckets.patch" call. 2338// Exactly one of *Bucket or error will be non-nil. Any non-2xx status 2339// code is an error. Response headers are in either 2340// *Bucket.ServerResponse.Header or (if a response was returned at all) 2341// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 2342// check whether the returned error was because http.StatusNotModified 2343// was returned. 2344func (c *BucketsPatchCall) Do(opts ...googleapi.CallOption) (*Bucket, error) { 2345 gensupport.SetOptions(c.urlParams_, opts...) 2346 res, err := c.doRequest("json") 2347 if res != nil && res.StatusCode == http.StatusNotModified { 2348 if res.Body != nil { 2349 res.Body.Close() 2350 } 2351 return nil, &googleapi.Error{ 2352 Code: res.StatusCode, 2353 Header: res.Header, 2354 } 2355 } 2356 if err != nil { 2357 return nil, err 2358 } 2359 defer googleapi.CloseBody(res) 2360 if err := googleapi.CheckResponse(res); err != nil { 2361 return nil, err 2362 } 2363 ret := &Bucket{ 2364 ServerResponse: googleapi.ServerResponse{ 2365 Header: res.Header, 2366 HTTPStatusCode: res.StatusCode, 2367 }, 2368 } 2369 target := &ret 2370 if err := gensupport.DecodeResponse(target, res); err != nil { 2371 return nil, err 2372 } 2373 return ret, nil 2374 // { 2375 // "description": "Updates a bucket. This method supports patch semantics.", 2376 // "httpMethod": "PATCH", 2377 // "id": "storage.buckets.patch", 2378 // "parameterOrder": [ 2379 // "bucket" 2380 // ], 2381 // "parameters": { 2382 // "bucket": { 2383 // "description": "Name of a bucket.", 2384 // "location": "path", 2385 // "required": true, 2386 // "type": "string" 2387 // }, 2388 // "projection": { 2389 // "description": "Set of properties to return. Defaults to full.", 2390 // "enum": [ 2391 // "full", 2392 // "no_acl" 2393 // ], 2394 // "enumDescriptions": [ 2395 // "Include all properties.", 2396 // "Omit acl and defaultObjectAcl properties." 2397 // ], 2398 // "location": "query", 2399 // "type": "string" 2400 // } 2401 // }, 2402 // "path": "b/{bucket}", 2403 // "request": { 2404 // "$ref": "Bucket" 2405 // }, 2406 // "response": { 2407 // "$ref": "Bucket" 2408 // }, 2409 // "scopes": [ 2410 // "https://www.googleapis.com/auth/devstorage.full_control", 2411 // "https://www.googleapis.com/auth/devstorage.read_write" 2412 // ] 2413 // } 2414 2415} 2416 2417// method id "storage.buckets.update": 2418 2419type BucketsUpdateCall struct { 2420 s *Service 2421 bucket string 2422 bucket2 *Bucket 2423 urlParams_ gensupport.URLParams 2424 ctx_ context.Context 2425 header_ http.Header 2426} 2427 2428// Update: Updates a bucket. 2429func (r *BucketsService) Update(bucket string, bucket2 *Bucket) *BucketsUpdateCall { 2430 c := &BucketsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2431 c.bucket = bucket 2432 c.bucket2 = bucket2 2433 return c 2434} 2435 2436// Projection sets the optional parameter "projection": Set of 2437// properties to return. Defaults to full. 2438// 2439// Possible values: 2440// "full" - Include all properties. 2441// "no_acl" - Omit acl and defaultObjectAcl properties. 2442func (c *BucketsUpdateCall) Projection(projection string) *BucketsUpdateCall { 2443 c.urlParams_.Set("projection", projection) 2444 return c 2445} 2446 2447// Fields allows partial responses to be retrieved. See 2448// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 2449// for more information. 2450func (c *BucketsUpdateCall) Fields(s ...googleapi.Field) *BucketsUpdateCall { 2451 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2452 return c 2453} 2454 2455// Context sets the context to be used in this call's Do method. Any 2456// pending HTTP request will be aborted if the provided context is 2457// canceled. 2458func (c *BucketsUpdateCall) Context(ctx context.Context) *BucketsUpdateCall { 2459 c.ctx_ = ctx 2460 return c 2461} 2462 2463// Header returns an http.Header that can be modified by the caller to 2464// add HTTP headers to the request. 2465func (c *BucketsUpdateCall) Header() http.Header { 2466 if c.header_ == nil { 2467 c.header_ = make(http.Header) 2468 } 2469 return c.header_ 2470} 2471 2472func (c *BucketsUpdateCall) doRequest(alt string) (*http.Response, error) { 2473 reqHeaders := make(http.Header) 2474 reqHeaders.Set("x-goog-api-client", "gl-go/1.13.7 gdcl/20200203") 2475 for k, v := range c.header_ { 2476 reqHeaders[k] = v 2477 } 2478 reqHeaders.Set("User-Agent", c.s.userAgent()) 2479 var body io.Reader = nil 2480 body, err := googleapi.WithoutDataWrapper.JSONReader(c.bucket2) 2481 if err != nil { 2482 return nil, err 2483 } 2484 reqHeaders.Set("Content-Type", "application/json") 2485 c.urlParams_.Set("alt", alt) 2486 c.urlParams_.Set("prettyPrint", "false") 2487 urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}") 2488 urls += "?" + c.urlParams_.Encode() 2489 req, err := http.NewRequest("PUT", urls, body) 2490 if err != nil { 2491 return nil, err 2492 } 2493 req.Header = reqHeaders 2494 googleapi.Expand(req.URL, map[string]string{ 2495 "bucket": c.bucket, 2496 }) 2497 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2498} 2499 2500// Do executes the "storage.buckets.update" call. 2501// Exactly one of *Bucket or error will be non-nil. Any non-2xx status 2502// code is an error. Response headers are in either 2503// *Bucket.ServerResponse.Header or (if a response was returned at all) 2504// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 2505// check whether the returned error was because http.StatusNotModified 2506// was returned. 2507func (c *BucketsUpdateCall) Do(opts ...googleapi.CallOption) (*Bucket, error) { 2508 gensupport.SetOptions(c.urlParams_, opts...) 2509 res, err := c.doRequest("json") 2510 if res != nil && res.StatusCode == http.StatusNotModified { 2511 if res.Body != nil { 2512 res.Body.Close() 2513 } 2514 return nil, &googleapi.Error{ 2515 Code: res.StatusCode, 2516 Header: res.Header, 2517 } 2518 } 2519 if err != nil { 2520 return nil, err 2521 } 2522 defer googleapi.CloseBody(res) 2523 if err := googleapi.CheckResponse(res); err != nil { 2524 return nil, err 2525 } 2526 ret := &Bucket{ 2527 ServerResponse: googleapi.ServerResponse{ 2528 Header: res.Header, 2529 HTTPStatusCode: res.StatusCode, 2530 }, 2531 } 2532 target := &ret 2533 if err := gensupport.DecodeResponse(target, res); err != nil { 2534 return nil, err 2535 } 2536 return ret, nil 2537 // { 2538 // "description": "Updates a bucket.", 2539 // "httpMethod": "PUT", 2540 // "id": "storage.buckets.update", 2541 // "parameterOrder": [ 2542 // "bucket" 2543 // ], 2544 // "parameters": { 2545 // "bucket": { 2546 // "description": "Name of a bucket.", 2547 // "location": "path", 2548 // "required": true, 2549 // "type": "string" 2550 // }, 2551 // "projection": { 2552 // "description": "Set of properties to return. Defaults to full.", 2553 // "enum": [ 2554 // "full", 2555 // "no_acl" 2556 // ], 2557 // "enumDescriptions": [ 2558 // "Include all properties.", 2559 // "Omit acl and defaultObjectAcl properties." 2560 // ], 2561 // "location": "query", 2562 // "type": "string" 2563 // } 2564 // }, 2565 // "path": "b/{bucket}", 2566 // "request": { 2567 // "$ref": "Bucket" 2568 // }, 2569 // "response": { 2570 // "$ref": "Bucket" 2571 // }, 2572 // "scopes": [ 2573 // "https://www.googleapis.com/auth/devstorage.full_control", 2574 // "https://www.googleapis.com/auth/devstorage.read_write" 2575 // ] 2576 // } 2577 2578} 2579 2580// method id "storage.objectAccessControls.delete": 2581 2582type ObjectAccessControlsDeleteCall struct { 2583 s *Service 2584 bucket string 2585 object string 2586 entity string 2587 urlParams_ gensupport.URLParams 2588 ctx_ context.Context 2589 header_ http.Header 2590} 2591 2592// Delete: Deletes the ACL entry for the specified entity on the 2593// specified object. 2594func (r *ObjectAccessControlsService) Delete(bucket string, object string, entity string) *ObjectAccessControlsDeleteCall { 2595 c := &ObjectAccessControlsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2596 c.bucket = bucket 2597 c.object = object 2598 c.entity = entity 2599 return c 2600} 2601 2602// Fields allows partial responses to be retrieved. See 2603// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 2604// for more information. 2605func (c *ObjectAccessControlsDeleteCall) Fields(s ...googleapi.Field) *ObjectAccessControlsDeleteCall { 2606 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2607 return c 2608} 2609 2610// Context sets the context to be used in this call's Do method. Any 2611// pending HTTP request will be aborted if the provided context is 2612// canceled. 2613func (c *ObjectAccessControlsDeleteCall) Context(ctx context.Context) *ObjectAccessControlsDeleteCall { 2614 c.ctx_ = ctx 2615 return c 2616} 2617 2618// Header returns an http.Header that can be modified by the caller to 2619// add HTTP headers to the request. 2620func (c *ObjectAccessControlsDeleteCall) Header() http.Header { 2621 if c.header_ == nil { 2622 c.header_ = make(http.Header) 2623 } 2624 return c.header_ 2625} 2626 2627func (c *ObjectAccessControlsDeleteCall) doRequest(alt string) (*http.Response, error) { 2628 reqHeaders := make(http.Header) 2629 reqHeaders.Set("x-goog-api-client", "gl-go/1.13.7 gdcl/20200203") 2630 for k, v := range c.header_ { 2631 reqHeaders[k] = v 2632 } 2633 reqHeaders.Set("User-Agent", c.s.userAgent()) 2634 var body io.Reader = nil 2635 c.urlParams_.Set("alt", alt) 2636 c.urlParams_.Set("prettyPrint", "false") 2637 urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o/{object}/acl/{entity}") 2638 urls += "?" + c.urlParams_.Encode() 2639 req, err := http.NewRequest("DELETE", urls, body) 2640 if err != nil { 2641 return nil, err 2642 } 2643 req.Header = reqHeaders 2644 googleapi.Expand(req.URL, map[string]string{ 2645 "bucket": c.bucket, 2646 "object": c.object, 2647 "entity": c.entity, 2648 }) 2649 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2650} 2651 2652// Do executes the "storage.objectAccessControls.delete" call. 2653func (c *ObjectAccessControlsDeleteCall) Do(opts ...googleapi.CallOption) error { 2654 gensupport.SetOptions(c.urlParams_, opts...) 2655 res, err := c.doRequest("json") 2656 if err != nil { 2657 return err 2658 } 2659 defer googleapi.CloseBody(res) 2660 if err := googleapi.CheckResponse(res); err != nil { 2661 return err 2662 } 2663 return nil 2664 // { 2665 // "description": "Deletes the ACL entry for the specified entity on the specified object.", 2666 // "httpMethod": "DELETE", 2667 // "id": "storage.objectAccessControls.delete", 2668 // "parameterOrder": [ 2669 // "bucket", 2670 // "object", 2671 // "entity" 2672 // ], 2673 // "parameters": { 2674 // "bucket": { 2675 // "description": "Name of a bucket.", 2676 // "location": "path", 2677 // "required": true, 2678 // "type": "string" 2679 // }, 2680 // "entity": { 2681 // "description": "The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.", 2682 // "location": "path", 2683 // "required": true, 2684 // "type": "string" 2685 // }, 2686 // "object": { 2687 // "description": "Name of the object.", 2688 // "location": "path", 2689 // "required": true, 2690 // "type": "string" 2691 // } 2692 // }, 2693 // "path": "b/{bucket}/o/{object}/acl/{entity}", 2694 // "scopes": [ 2695 // "https://www.googleapis.com/auth/devstorage.full_control" 2696 // ] 2697 // } 2698 2699} 2700 2701// method id "storage.objectAccessControls.get": 2702 2703type ObjectAccessControlsGetCall struct { 2704 s *Service 2705 bucket string 2706 object string 2707 entity string 2708 urlParams_ gensupport.URLParams 2709 ifNoneMatch_ string 2710 ctx_ context.Context 2711 header_ http.Header 2712} 2713 2714// Get: Returns the ACL entry for the specified entity on the specified 2715// object. 2716func (r *ObjectAccessControlsService) Get(bucket string, object string, entity string) *ObjectAccessControlsGetCall { 2717 c := &ObjectAccessControlsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2718 c.bucket = bucket 2719 c.object = object 2720 c.entity = entity 2721 return c 2722} 2723 2724// Fields allows partial responses to be retrieved. See 2725// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 2726// for more information. 2727func (c *ObjectAccessControlsGetCall) Fields(s ...googleapi.Field) *ObjectAccessControlsGetCall { 2728 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2729 return c 2730} 2731 2732// IfNoneMatch sets the optional parameter which makes the operation 2733// fail if the object's ETag matches the given value. This is useful for 2734// getting updates only after the object has changed since the last 2735// request. Use googleapi.IsNotModified to check whether the response 2736// error from Do is the result of In-None-Match. 2737func (c *ObjectAccessControlsGetCall) IfNoneMatch(entityTag string) *ObjectAccessControlsGetCall { 2738 c.ifNoneMatch_ = entityTag 2739 return c 2740} 2741 2742// Context sets the context to be used in this call's Do method. Any 2743// pending HTTP request will be aborted if the provided context is 2744// canceled. 2745func (c *ObjectAccessControlsGetCall) Context(ctx context.Context) *ObjectAccessControlsGetCall { 2746 c.ctx_ = ctx 2747 return c 2748} 2749 2750// Header returns an http.Header that can be modified by the caller to 2751// add HTTP headers to the request. 2752func (c *ObjectAccessControlsGetCall) Header() http.Header { 2753 if c.header_ == nil { 2754 c.header_ = make(http.Header) 2755 } 2756 return c.header_ 2757} 2758 2759func (c *ObjectAccessControlsGetCall) doRequest(alt string) (*http.Response, error) { 2760 reqHeaders := make(http.Header) 2761 reqHeaders.Set("x-goog-api-client", "gl-go/1.13.7 gdcl/20200203") 2762 for k, v := range c.header_ { 2763 reqHeaders[k] = v 2764 } 2765 reqHeaders.Set("User-Agent", c.s.userAgent()) 2766 if c.ifNoneMatch_ != "" { 2767 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 2768 } 2769 var body io.Reader = nil 2770 c.urlParams_.Set("alt", alt) 2771 c.urlParams_.Set("prettyPrint", "false") 2772 urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o/{object}/acl/{entity}") 2773 urls += "?" + c.urlParams_.Encode() 2774 req, err := http.NewRequest("GET", urls, body) 2775 if err != nil { 2776 return nil, err 2777 } 2778 req.Header = reqHeaders 2779 googleapi.Expand(req.URL, map[string]string{ 2780 "bucket": c.bucket, 2781 "object": c.object, 2782 "entity": c.entity, 2783 }) 2784 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2785} 2786 2787// Do executes the "storage.objectAccessControls.get" call. 2788// Exactly one of *ObjectAccessControl or error will be non-nil. Any 2789// non-2xx status code is an error. Response headers are in either 2790// *ObjectAccessControl.ServerResponse.Header or (if a response was 2791// returned at all) in error.(*googleapi.Error).Header. Use 2792// googleapi.IsNotModified to check whether the returned error was 2793// because http.StatusNotModified was returned. 2794func (c *ObjectAccessControlsGetCall) Do(opts ...googleapi.CallOption) (*ObjectAccessControl, error) { 2795 gensupport.SetOptions(c.urlParams_, opts...) 2796 res, err := c.doRequest("json") 2797 if res != nil && res.StatusCode == http.StatusNotModified { 2798 if res.Body != nil { 2799 res.Body.Close() 2800 } 2801 return nil, &googleapi.Error{ 2802 Code: res.StatusCode, 2803 Header: res.Header, 2804 } 2805 } 2806 if err != nil { 2807 return nil, err 2808 } 2809 defer googleapi.CloseBody(res) 2810 if err := googleapi.CheckResponse(res); err != nil { 2811 return nil, err 2812 } 2813 ret := &ObjectAccessControl{ 2814 ServerResponse: googleapi.ServerResponse{ 2815 Header: res.Header, 2816 HTTPStatusCode: res.StatusCode, 2817 }, 2818 } 2819 target := &ret 2820 if err := gensupport.DecodeResponse(target, res); err != nil { 2821 return nil, err 2822 } 2823 return ret, nil 2824 // { 2825 // "description": "Returns the ACL entry for the specified entity on the specified object.", 2826 // "httpMethod": "GET", 2827 // "id": "storage.objectAccessControls.get", 2828 // "parameterOrder": [ 2829 // "bucket", 2830 // "object", 2831 // "entity" 2832 // ], 2833 // "parameters": { 2834 // "bucket": { 2835 // "description": "Name of a bucket.", 2836 // "location": "path", 2837 // "required": true, 2838 // "type": "string" 2839 // }, 2840 // "entity": { 2841 // "description": "The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.", 2842 // "location": "path", 2843 // "required": true, 2844 // "type": "string" 2845 // }, 2846 // "object": { 2847 // "description": "Name of the object.", 2848 // "location": "path", 2849 // "required": true, 2850 // "type": "string" 2851 // } 2852 // }, 2853 // "path": "b/{bucket}/o/{object}/acl/{entity}", 2854 // "response": { 2855 // "$ref": "ObjectAccessControl" 2856 // }, 2857 // "scopes": [ 2858 // "https://www.googleapis.com/auth/devstorage.full_control" 2859 // ] 2860 // } 2861 2862} 2863 2864// method id "storage.objectAccessControls.insert": 2865 2866type ObjectAccessControlsInsertCall struct { 2867 s *Service 2868 bucket string 2869 object string 2870 objectaccesscontrol *ObjectAccessControl 2871 urlParams_ gensupport.URLParams 2872 ctx_ context.Context 2873 header_ http.Header 2874} 2875 2876// Insert: Creates a new ACL entry on the specified object. 2877func (r *ObjectAccessControlsService) Insert(bucket string, object string, objectaccesscontrol *ObjectAccessControl) *ObjectAccessControlsInsertCall { 2878 c := &ObjectAccessControlsInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2879 c.bucket = bucket 2880 c.object = object 2881 c.objectaccesscontrol = objectaccesscontrol 2882 return c 2883} 2884 2885// Fields allows partial responses to be retrieved. See 2886// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 2887// for more information. 2888func (c *ObjectAccessControlsInsertCall) Fields(s ...googleapi.Field) *ObjectAccessControlsInsertCall { 2889 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2890 return c 2891} 2892 2893// Context sets the context to be used in this call's Do method. Any 2894// pending HTTP request will be aborted if the provided context is 2895// canceled. 2896func (c *ObjectAccessControlsInsertCall) Context(ctx context.Context) *ObjectAccessControlsInsertCall { 2897 c.ctx_ = ctx 2898 return c 2899} 2900 2901// Header returns an http.Header that can be modified by the caller to 2902// add HTTP headers to the request. 2903func (c *ObjectAccessControlsInsertCall) Header() http.Header { 2904 if c.header_ == nil { 2905 c.header_ = make(http.Header) 2906 } 2907 return c.header_ 2908} 2909 2910func (c *ObjectAccessControlsInsertCall) doRequest(alt string) (*http.Response, error) { 2911 reqHeaders := make(http.Header) 2912 reqHeaders.Set("x-goog-api-client", "gl-go/1.13.7 gdcl/20200203") 2913 for k, v := range c.header_ { 2914 reqHeaders[k] = v 2915 } 2916 reqHeaders.Set("User-Agent", c.s.userAgent()) 2917 var body io.Reader = nil 2918 body, err := googleapi.WithoutDataWrapper.JSONReader(c.objectaccesscontrol) 2919 if err != nil { 2920 return nil, err 2921 } 2922 reqHeaders.Set("Content-Type", "application/json") 2923 c.urlParams_.Set("alt", alt) 2924 c.urlParams_.Set("prettyPrint", "false") 2925 urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o/{object}/acl") 2926 urls += "?" + c.urlParams_.Encode() 2927 req, err := http.NewRequest("POST", urls, body) 2928 if err != nil { 2929 return nil, err 2930 } 2931 req.Header = reqHeaders 2932 googleapi.Expand(req.URL, map[string]string{ 2933 "bucket": c.bucket, 2934 "object": c.object, 2935 }) 2936 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2937} 2938 2939// Do executes the "storage.objectAccessControls.insert" call. 2940// Exactly one of *ObjectAccessControl or error will be non-nil. Any 2941// non-2xx status code is an error. Response headers are in either 2942// *ObjectAccessControl.ServerResponse.Header or (if a response was 2943// returned at all) in error.(*googleapi.Error).Header. Use 2944// googleapi.IsNotModified to check whether the returned error was 2945// because http.StatusNotModified was returned. 2946func (c *ObjectAccessControlsInsertCall) Do(opts ...googleapi.CallOption) (*ObjectAccessControl, error) { 2947 gensupport.SetOptions(c.urlParams_, opts...) 2948 res, err := c.doRequest("json") 2949 if res != nil && res.StatusCode == http.StatusNotModified { 2950 if res.Body != nil { 2951 res.Body.Close() 2952 } 2953 return nil, &googleapi.Error{ 2954 Code: res.StatusCode, 2955 Header: res.Header, 2956 } 2957 } 2958 if err != nil { 2959 return nil, err 2960 } 2961 defer googleapi.CloseBody(res) 2962 if err := googleapi.CheckResponse(res); err != nil { 2963 return nil, err 2964 } 2965 ret := &ObjectAccessControl{ 2966 ServerResponse: googleapi.ServerResponse{ 2967 Header: res.Header, 2968 HTTPStatusCode: res.StatusCode, 2969 }, 2970 } 2971 target := &ret 2972 if err := gensupport.DecodeResponse(target, res); err != nil { 2973 return nil, err 2974 } 2975 return ret, nil 2976 // { 2977 // "description": "Creates a new ACL entry on the specified object.", 2978 // "httpMethod": "POST", 2979 // "id": "storage.objectAccessControls.insert", 2980 // "parameterOrder": [ 2981 // "bucket", 2982 // "object" 2983 // ], 2984 // "parameters": { 2985 // "bucket": { 2986 // "description": "Name of a bucket.", 2987 // "location": "path", 2988 // "required": true, 2989 // "type": "string" 2990 // }, 2991 // "object": { 2992 // "description": "Name of the object.", 2993 // "location": "path", 2994 // "required": true, 2995 // "type": "string" 2996 // } 2997 // }, 2998 // "path": "b/{bucket}/o/{object}/acl", 2999 // "request": { 3000 // "$ref": "ObjectAccessControl" 3001 // }, 3002 // "response": { 3003 // "$ref": "ObjectAccessControl" 3004 // }, 3005 // "scopes": [ 3006 // "https://www.googleapis.com/auth/devstorage.full_control" 3007 // ] 3008 // } 3009 3010} 3011 3012// method id "storage.objectAccessControls.list": 3013 3014type ObjectAccessControlsListCall struct { 3015 s *Service 3016 bucket string 3017 object string 3018 urlParams_ gensupport.URLParams 3019 ifNoneMatch_ string 3020 ctx_ context.Context 3021 header_ http.Header 3022} 3023 3024// List: Retrieves ACL entries on the specified object. 3025func (r *ObjectAccessControlsService) List(bucket string, object string) *ObjectAccessControlsListCall { 3026 c := &ObjectAccessControlsListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 3027 c.bucket = bucket 3028 c.object = object 3029 return c 3030} 3031 3032// Fields allows partial responses to be retrieved. See 3033// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 3034// for more information. 3035func (c *ObjectAccessControlsListCall) Fields(s ...googleapi.Field) *ObjectAccessControlsListCall { 3036 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 3037 return c 3038} 3039 3040// IfNoneMatch sets the optional parameter which makes the operation 3041// fail if the object's ETag matches the given value. This is useful for 3042// getting updates only after the object has changed since the last 3043// request. Use googleapi.IsNotModified to check whether the response 3044// error from Do is the result of In-None-Match. 3045func (c *ObjectAccessControlsListCall) IfNoneMatch(entityTag string) *ObjectAccessControlsListCall { 3046 c.ifNoneMatch_ = entityTag 3047 return c 3048} 3049 3050// Context sets the context to be used in this call's Do method. Any 3051// pending HTTP request will be aborted if the provided context is 3052// canceled. 3053func (c *ObjectAccessControlsListCall) Context(ctx context.Context) *ObjectAccessControlsListCall { 3054 c.ctx_ = ctx 3055 return c 3056} 3057 3058// Header returns an http.Header that can be modified by the caller to 3059// add HTTP headers to the request. 3060func (c *ObjectAccessControlsListCall) Header() http.Header { 3061 if c.header_ == nil { 3062 c.header_ = make(http.Header) 3063 } 3064 return c.header_ 3065} 3066 3067func (c *ObjectAccessControlsListCall) doRequest(alt string) (*http.Response, error) { 3068 reqHeaders := make(http.Header) 3069 reqHeaders.Set("x-goog-api-client", "gl-go/1.13.7 gdcl/20200203") 3070 for k, v := range c.header_ { 3071 reqHeaders[k] = v 3072 } 3073 reqHeaders.Set("User-Agent", c.s.userAgent()) 3074 if c.ifNoneMatch_ != "" { 3075 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 3076 } 3077 var body io.Reader = nil 3078 c.urlParams_.Set("alt", alt) 3079 c.urlParams_.Set("prettyPrint", "false") 3080 urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o/{object}/acl") 3081 urls += "?" + c.urlParams_.Encode() 3082 req, err := http.NewRequest("GET", urls, body) 3083 if err != nil { 3084 return nil, err 3085 } 3086 req.Header = reqHeaders 3087 googleapi.Expand(req.URL, map[string]string{ 3088 "bucket": c.bucket, 3089 "object": c.object, 3090 }) 3091 return gensupport.SendRequest(c.ctx_, c.s.client, req) 3092} 3093 3094// Do executes the "storage.objectAccessControls.list" call. 3095// Exactly one of *ObjectAccessControls or error will be non-nil. Any 3096// non-2xx status code is an error. Response headers are in either 3097// *ObjectAccessControls.ServerResponse.Header or (if a response was 3098// returned at all) in error.(*googleapi.Error).Header. Use 3099// googleapi.IsNotModified to check whether the returned error was 3100// because http.StatusNotModified was returned. 3101func (c *ObjectAccessControlsListCall) Do(opts ...googleapi.CallOption) (*ObjectAccessControls, error) { 3102 gensupport.SetOptions(c.urlParams_, opts...) 3103 res, err := c.doRequest("json") 3104 if res != nil && res.StatusCode == http.StatusNotModified { 3105 if res.Body != nil { 3106 res.Body.Close() 3107 } 3108 return nil, &googleapi.Error{ 3109 Code: res.StatusCode, 3110 Header: res.Header, 3111 } 3112 } 3113 if err != nil { 3114 return nil, err 3115 } 3116 defer googleapi.CloseBody(res) 3117 if err := googleapi.CheckResponse(res); err != nil { 3118 return nil, err 3119 } 3120 ret := &ObjectAccessControls{ 3121 ServerResponse: googleapi.ServerResponse{ 3122 Header: res.Header, 3123 HTTPStatusCode: res.StatusCode, 3124 }, 3125 } 3126 target := &ret 3127 if err := gensupport.DecodeResponse(target, res); err != nil { 3128 return nil, err 3129 } 3130 return ret, nil 3131 // { 3132 // "description": "Retrieves ACL entries on the specified object.", 3133 // "httpMethod": "GET", 3134 // "id": "storage.objectAccessControls.list", 3135 // "parameterOrder": [ 3136 // "bucket", 3137 // "object" 3138 // ], 3139 // "parameters": { 3140 // "bucket": { 3141 // "description": "Name of a bucket.", 3142 // "location": "path", 3143 // "required": true, 3144 // "type": "string" 3145 // }, 3146 // "object": { 3147 // "description": "Name of the object.", 3148 // "location": "path", 3149 // "required": true, 3150 // "type": "string" 3151 // } 3152 // }, 3153 // "path": "b/{bucket}/o/{object}/acl", 3154 // "response": { 3155 // "$ref": "ObjectAccessControls" 3156 // }, 3157 // "scopes": [ 3158 // "https://www.googleapis.com/auth/devstorage.full_control" 3159 // ] 3160 // } 3161 3162} 3163 3164// method id "storage.objectAccessControls.patch": 3165 3166type ObjectAccessControlsPatchCall struct { 3167 s *Service 3168 bucket string 3169 object string 3170 entity string 3171 objectaccesscontrol *ObjectAccessControl 3172 urlParams_ gensupport.URLParams 3173 ctx_ context.Context 3174 header_ http.Header 3175} 3176 3177// Patch: Updates an ACL entry on the specified object. This method 3178// supports patch semantics. 3179func (r *ObjectAccessControlsService) Patch(bucket string, object string, entity string, objectaccesscontrol *ObjectAccessControl) *ObjectAccessControlsPatchCall { 3180 c := &ObjectAccessControlsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)} 3181 c.bucket = bucket 3182 c.object = object 3183 c.entity = entity 3184 c.objectaccesscontrol = objectaccesscontrol 3185 return c 3186} 3187 3188// Fields allows partial responses to be retrieved. See 3189// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 3190// for more information. 3191func (c *ObjectAccessControlsPatchCall) Fields(s ...googleapi.Field) *ObjectAccessControlsPatchCall { 3192 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 3193 return c 3194} 3195 3196// Context sets the context to be used in this call's Do method. Any 3197// pending HTTP request will be aborted if the provided context is 3198// canceled. 3199func (c *ObjectAccessControlsPatchCall) Context(ctx context.Context) *ObjectAccessControlsPatchCall { 3200 c.ctx_ = ctx 3201 return c 3202} 3203 3204// Header returns an http.Header that can be modified by the caller to 3205// add HTTP headers to the request. 3206func (c *ObjectAccessControlsPatchCall) Header() http.Header { 3207 if c.header_ == nil { 3208 c.header_ = make(http.Header) 3209 } 3210 return c.header_ 3211} 3212 3213func (c *ObjectAccessControlsPatchCall) doRequest(alt string) (*http.Response, error) { 3214 reqHeaders := make(http.Header) 3215 reqHeaders.Set("x-goog-api-client", "gl-go/1.13.7 gdcl/20200203") 3216 for k, v := range c.header_ { 3217 reqHeaders[k] = v 3218 } 3219 reqHeaders.Set("User-Agent", c.s.userAgent()) 3220 var body io.Reader = nil 3221 body, err := googleapi.WithoutDataWrapper.JSONReader(c.objectaccesscontrol) 3222 if err != nil { 3223 return nil, err 3224 } 3225 reqHeaders.Set("Content-Type", "application/json") 3226 c.urlParams_.Set("alt", alt) 3227 c.urlParams_.Set("prettyPrint", "false") 3228 urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o/{object}/acl/{entity}") 3229 urls += "?" + c.urlParams_.Encode() 3230 req, err := http.NewRequest("PATCH", urls, body) 3231 if err != nil { 3232 return nil, err 3233 } 3234 req.Header = reqHeaders 3235 googleapi.Expand(req.URL, map[string]string{ 3236 "bucket": c.bucket, 3237 "object": c.object, 3238 "entity": c.entity, 3239 }) 3240 return gensupport.SendRequest(c.ctx_, c.s.client, req) 3241} 3242 3243// Do executes the "storage.objectAccessControls.patch" call. 3244// Exactly one of *ObjectAccessControl or error will be non-nil. Any 3245// non-2xx status code is an error. Response headers are in either 3246// *ObjectAccessControl.ServerResponse.Header or (if a response was 3247// returned at all) in error.(*googleapi.Error).Header. Use 3248// googleapi.IsNotModified to check whether the returned error was 3249// because http.StatusNotModified was returned. 3250func (c *ObjectAccessControlsPatchCall) Do(opts ...googleapi.CallOption) (*ObjectAccessControl, error) { 3251 gensupport.SetOptions(c.urlParams_, opts...) 3252 res, err := c.doRequest("json") 3253 if res != nil && res.StatusCode == http.StatusNotModified { 3254 if res.Body != nil { 3255 res.Body.Close() 3256 } 3257 return nil, &googleapi.Error{ 3258 Code: res.StatusCode, 3259 Header: res.Header, 3260 } 3261 } 3262 if err != nil { 3263 return nil, err 3264 } 3265 defer googleapi.CloseBody(res) 3266 if err := googleapi.CheckResponse(res); err != nil { 3267 return nil, err 3268 } 3269 ret := &ObjectAccessControl{ 3270 ServerResponse: googleapi.ServerResponse{ 3271 Header: res.Header, 3272 HTTPStatusCode: res.StatusCode, 3273 }, 3274 } 3275 target := &ret 3276 if err := gensupport.DecodeResponse(target, res); err != nil { 3277 return nil, err 3278 } 3279 return ret, nil 3280 // { 3281 // "description": "Updates an ACL entry on the specified object. This method supports patch semantics.", 3282 // "httpMethod": "PATCH", 3283 // "id": "storage.objectAccessControls.patch", 3284 // "parameterOrder": [ 3285 // "bucket", 3286 // "object", 3287 // "entity" 3288 // ], 3289 // "parameters": { 3290 // "bucket": { 3291 // "description": "Name of a bucket.", 3292 // "location": "path", 3293 // "required": true, 3294 // "type": "string" 3295 // }, 3296 // "entity": { 3297 // "description": "The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.", 3298 // "location": "path", 3299 // "required": true, 3300 // "type": "string" 3301 // }, 3302 // "object": { 3303 // "description": "Name of the object.", 3304 // "location": "path", 3305 // "required": true, 3306 // "type": "string" 3307 // } 3308 // }, 3309 // "path": "b/{bucket}/o/{object}/acl/{entity}", 3310 // "request": { 3311 // "$ref": "ObjectAccessControl" 3312 // }, 3313 // "response": { 3314 // "$ref": "ObjectAccessControl" 3315 // }, 3316 // "scopes": [ 3317 // "https://www.googleapis.com/auth/devstorage.full_control" 3318 // ] 3319 // } 3320 3321} 3322 3323// method id "storage.objectAccessControls.update": 3324 3325type ObjectAccessControlsUpdateCall struct { 3326 s *Service 3327 bucket string 3328 object string 3329 entity string 3330 objectaccesscontrol *ObjectAccessControl 3331 urlParams_ gensupport.URLParams 3332 ctx_ context.Context 3333 header_ http.Header 3334} 3335 3336// Update: Updates an ACL entry on the specified object. 3337func (r *ObjectAccessControlsService) Update(bucket string, object string, entity string, objectaccesscontrol *ObjectAccessControl) *ObjectAccessControlsUpdateCall { 3338 c := &ObjectAccessControlsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 3339 c.bucket = bucket 3340 c.object = object 3341 c.entity = entity 3342 c.objectaccesscontrol = objectaccesscontrol 3343 return c 3344} 3345 3346// Fields allows partial responses to be retrieved. See 3347// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 3348// for more information. 3349func (c *ObjectAccessControlsUpdateCall) Fields(s ...googleapi.Field) *ObjectAccessControlsUpdateCall { 3350 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 3351 return c 3352} 3353 3354// Context sets the context to be used in this call's Do method. Any 3355// pending HTTP request will be aborted if the provided context is 3356// canceled. 3357func (c *ObjectAccessControlsUpdateCall) Context(ctx context.Context) *ObjectAccessControlsUpdateCall { 3358 c.ctx_ = ctx 3359 return c 3360} 3361 3362// Header returns an http.Header that can be modified by the caller to 3363// add HTTP headers to the request. 3364func (c *ObjectAccessControlsUpdateCall) Header() http.Header { 3365 if c.header_ == nil { 3366 c.header_ = make(http.Header) 3367 } 3368 return c.header_ 3369} 3370 3371func (c *ObjectAccessControlsUpdateCall) doRequest(alt string) (*http.Response, error) { 3372 reqHeaders := make(http.Header) 3373 reqHeaders.Set("x-goog-api-client", "gl-go/1.13.7 gdcl/20200203") 3374 for k, v := range c.header_ { 3375 reqHeaders[k] = v 3376 } 3377 reqHeaders.Set("User-Agent", c.s.userAgent()) 3378 var body io.Reader = nil 3379 body, err := googleapi.WithoutDataWrapper.JSONReader(c.objectaccesscontrol) 3380 if err != nil { 3381 return nil, err 3382 } 3383 reqHeaders.Set("Content-Type", "application/json") 3384 c.urlParams_.Set("alt", alt) 3385 c.urlParams_.Set("prettyPrint", "false") 3386 urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o/{object}/acl/{entity}") 3387 urls += "?" + c.urlParams_.Encode() 3388 req, err := http.NewRequest("PUT", urls, body) 3389 if err != nil { 3390 return nil, err 3391 } 3392 req.Header = reqHeaders 3393 googleapi.Expand(req.URL, map[string]string{ 3394 "bucket": c.bucket, 3395 "object": c.object, 3396 "entity": c.entity, 3397 }) 3398 return gensupport.SendRequest(c.ctx_, c.s.client, req) 3399} 3400 3401// Do executes the "storage.objectAccessControls.update" call. 3402// Exactly one of *ObjectAccessControl or error will be non-nil. Any 3403// non-2xx status code is an error. Response headers are in either 3404// *ObjectAccessControl.ServerResponse.Header or (if a response was 3405// returned at all) in error.(*googleapi.Error).Header. Use 3406// googleapi.IsNotModified to check whether the returned error was 3407// because http.StatusNotModified was returned. 3408func (c *ObjectAccessControlsUpdateCall) Do(opts ...googleapi.CallOption) (*ObjectAccessControl, error) { 3409 gensupport.SetOptions(c.urlParams_, opts...) 3410 res, err := c.doRequest("json") 3411 if res != nil && res.StatusCode == http.StatusNotModified { 3412 if res.Body != nil { 3413 res.Body.Close() 3414 } 3415 return nil, &googleapi.Error{ 3416 Code: res.StatusCode, 3417 Header: res.Header, 3418 } 3419 } 3420 if err != nil { 3421 return nil, err 3422 } 3423 defer googleapi.CloseBody(res) 3424 if err := googleapi.CheckResponse(res); err != nil { 3425 return nil, err 3426 } 3427 ret := &ObjectAccessControl{ 3428 ServerResponse: googleapi.ServerResponse{ 3429 Header: res.Header, 3430 HTTPStatusCode: res.StatusCode, 3431 }, 3432 } 3433 target := &ret 3434 if err := gensupport.DecodeResponse(target, res); err != nil { 3435 return nil, err 3436 } 3437 return ret, nil 3438 // { 3439 // "description": "Updates an ACL entry on the specified object.", 3440 // "httpMethod": "PUT", 3441 // "id": "storage.objectAccessControls.update", 3442 // "parameterOrder": [ 3443 // "bucket", 3444 // "object", 3445 // "entity" 3446 // ], 3447 // "parameters": { 3448 // "bucket": { 3449 // "description": "Name of a bucket.", 3450 // "location": "path", 3451 // "required": true, 3452 // "type": "string" 3453 // }, 3454 // "entity": { 3455 // "description": "The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.", 3456 // "location": "path", 3457 // "required": true, 3458 // "type": "string" 3459 // }, 3460 // "object": { 3461 // "description": "Name of the object.", 3462 // "location": "path", 3463 // "required": true, 3464 // "type": "string" 3465 // } 3466 // }, 3467 // "path": "b/{bucket}/o/{object}/acl/{entity}", 3468 // "request": { 3469 // "$ref": "ObjectAccessControl" 3470 // }, 3471 // "response": { 3472 // "$ref": "ObjectAccessControl" 3473 // }, 3474 // "scopes": [ 3475 // "https://www.googleapis.com/auth/devstorage.full_control" 3476 // ] 3477 // } 3478 3479} 3480 3481// method id "storage.objects.delete": 3482 3483type ObjectsDeleteCall struct { 3484 s *Service 3485 bucket string 3486 object string 3487 urlParams_ gensupport.URLParams 3488 ctx_ context.Context 3489 header_ http.Header 3490} 3491 3492// Delete: Deletes data blobs and associated metadata. 3493func (r *ObjectsService) Delete(bucket string, object string) *ObjectsDeleteCall { 3494 c := &ObjectsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 3495 c.bucket = bucket 3496 c.object = object 3497 return c 3498} 3499 3500// Fields allows partial responses to be retrieved. See 3501// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 3502// for more information. 3503func (c *ObjectsDeleteCall) Fields(s ...googleapi.Field) *ObjectsDeleteCall { 3504 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 3505 return c 3506} 3507 3508// Context sets the context to be used in this call's Do method. Any 3509// pending HTTP request will be aborted if the provided context is 3510// canceled. 3511func (c *ObjectsDeleteCall) Context(ctx context.Context) *ObjectsDeleteCall { 3512 c.ctx_ = ctx 3513 return c 3514} 3515 3516// Header returns an http.Header that can be modified by the caller to 3517// add HTTP headers to the request. 3518func (c *ObjectsDeleteCall) Header() http.Header { 3519 if c.header_ == nil { 3520 c.header_ = make(http.Header) 3521 } 3522 return c.header_ 3523} 3524 3525func (c *ObjectsDeleteCall) doRequest(alt string) (*http.Response, error) { 3526 reqHeaders := make(http.Header) 3527 reqHeaders.Set("x-goog-api-client", "gl-go/1.13.7 gdcl/20200203") 3528 for k, v := range c.header_ { 3529 reqHeaders[k] = v 3530 } 3531 reqHeaders.Set("User-Agent", c.s.userAgent()) 3532 var body io.Reader = nil 3533 c.urlParams_.Set("alt", alt) 3534 c.urlParams_.Set("prettyPrint", "false") 3535 urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o/{object}") 3536 urls += "?" + c.urlParams_.Encode() 3537 req, err := http.NewRequest("DELETE", urls, body) 3538 if err != nil { 3539 return nil, err 3540 } 3541 req.Header = reqHeaders 3542 googleapi.Expand(req.URL, map[string]string{ 3543 "bucket": c.bucket, 3544 "object": c.object, 3545 }) 3546 return gensupport.SendRequest(c.ctx_, c.s.client, req) 3547} 3548 3549// Do executes the "storage.objects.delete" call. 3550func (c *ObjectsDeleteCall) Do(opts ...googleapi.CallOption) error { 3551 gensupport.SetOptions(c.urlParams_, opts...) 3552 res, err := c.doRequest("json") 3553 if err != nil { 3554 return err 3555 } 3556 defer googleapi.CloseBody(res) 3557 if err := googleapi.CheckResponse(res); err != nil { 3558 return err 3559 } 3560 return nil 3561 // { 3562 // "description": "Deletes data blobs and associated metadata.", 3563 // "httpMethod": "DELETE", 3564 // "id": "storage.objects.delete", 3565 // "parameterOrder": [ 3566 // "bucket", 3567 // "object" 3568 // ], 3569 // "parameters": { 3570 // "bucket": { 3571 // "description": "Name of the bucket in which the object resides.", 3572 // "location": "path", 3573 // "required": true, 3574 // "type": "string" 3575 // }, 3576 // "object": { 3577 // "description": "Name of the object.", 3578 // "location": "path", 3579 // "required": true, 3580 // "type": "string" 3581 // } 3582 // }, 3583 // "path": "b/{bucket}/o/{object}", 3584 // "scopes": [ 3585 // "https://www.googleapis.com/auth/devstorage.full_control", 3586 // "https://www.googleapis.com/auth/devstorage.read_write" 3587 // ] 3588 // } 3589 3590} 3591 3592// method id "storage.objects.get": 3593 3594type ObjectsGetCall struct { 3595 s *Service 3596 bucket string 3597 object string 3598 urlParams_ gensupport.URLParams 3599 ifNoneMatch_ string 3600 ctx_ context.Context 3601 header_ http.Header 3602} 3603 3604// Get: Retrieves objects or their associated metadata. 3605func (r *ObjectsService) Get(bucket string, object string) *ObjectsGetCall { 3606 c := &ObjectsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 3607 c.bucket = bucket 3608 c.object = object 3609 return c 3610} 3611 3612// Projection sets the optional parameter "projection": Set of 3613// properties to return. Defaults to no_acl. 3614// 3615// Possible values: 3616// "full" - Include all properties. 3617// "no_acl" - Omit the acl property. 3618func (c *ObjectsGetCall) Projection(projection string) *ObjectsGetCall { 3619 c.urlParams_.Set("projection", projection) 3620 return c 3621} 3622 3623// Fields allows partial responses to be retrieved. See 3624// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 3625// for more information. 3626func (c *ObjectsGetCall) Fields(s ...googleapi.Field) *ObjectsGetCall { 3627 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 3628 return c 3629} 3630 3631// IfNoneMatch sets the optional parameter which makes the operation 3632// fail if the object's ETag matches the given value. This is useful for 3633// getting updates only after the object has changed since the last 3634// request. Use googleapi.IsNotModified to check whether the response 3635// error from Do is the result of In-None-Match. 3636func (c *ObjectsGetCall) IfNoneMatch(entityTag string) *ObjectsGetCall { 3637 c.ifNoneMatch_ = entityTag 3638 return c 3639} 3640 3641// Context sets the context to be used in this call's Do and Download 3642// methods. Any pending HTTP request will be aborted if the provided 3643// context is canceled. 3644func (c *ObjectsGetCall) Context(ctx context.Context) *ObjectsGetCall { 3645 c.ctx_ = ctx 3646 return c 3647} 3648 3649// Header returns an http.Header that can be modified by the caller to 3650// add HTTP headers to the request. 3651func (c *ObjectsGetCall) Header() http.Header { 3652 if c.header_ == nil { 3653 c.header_ = make(http.Header) 3654 } 3655 return c.header_ 3656} 3657 3658func (c *ObjectsGetCall) doRequest(alt string) (*http.Response, error) { 3659 reqHeaders := make(http.Header) 3660 reqHeaders.Set("x-goog-api-client", "gl-go/1.13.7 gdcl/20200203") 3661 for k, v := range c.header_ { 3662 reqHeaders[k] = v 3663 } 3664 reqHeaders.Set("User-Agent", c.s.userAgent()) 3665 if c.ifNoneMatch_ != "" { 3666 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 3667 } 3668 var body io.Reader = nil 3669 c.urlParams_.Set("alt", alt) 3670 c.urlParams_.Set("prettyPrint", "false") 3671 urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o/{object}") 3672 urls += "?" + c.urlParams_.Encode() 3673 req, err := http.NewRequest("GET", urls, body) 3674 if err != nil { 3675 return nil, err 3676 } 3677 req.Header = reqHeaders 3678 googleapi.Expand(req.URL, map[string]string{ 3679 "bucket": c.bucket, 3680 "object": c.object, 3681 }) 3682 return gensupport.SendRequest(c.ctx_, c.s.client, req) 3683} 3684 3685// Download fetches the API endpoint's "media" value, instead of the normal 3686// API response value. If the returned error is nil, the Response is guaranteed to 3687// have a 2xx status code. Callers must close the Response.Body as usual. 3688func (c *ObjectsGetCall) Download(opts ...googleapi.CallOption) (*http.Response, error) { 3689 gensupport.SetOptions(c.urlParams_, opts...) 3690 res, err := c.doRequest("media") 3691 if err != nil { 3692 return nil, err 3693 } 3694 if err := googleapi.CheckMediaResponse(res); err != nil { 3695 res.Body.Close() 3696 return nil, err 3697 } 3698 return res, nil 3699} 3700 3701// Do executes the "storage.objects.get" call. 3702// Exactly one of *Object or error will be non-nil. Any non-2xx status 3703// code is an error. Response headers are in either 3704// *Object.ServerResponse.Header or (if a response was returned at all) 3705// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 3706// check whether the returned error was because http.StatusNotModified 3707// was returned. 3708func (c *ObjectsGetCall) Do(opts ...googleapi.CallOption) (*Object, error) { 3709 gensupport.SetOptions(c.urlParams_, opts...) 3710 res, err := c.doRequest("json") 3711 if res != nil && res.StatusCode == http.StatusNotModified { 3712 if res.Body != nil { 3713 res.Body.Close() 3714 } 3715 return nil, &googleapi.Error{ 3716 Code: res.StatusCode, 3717 Header: res.Header, 3718 } 3719 } 3720 if err != nil { 3721 return nil, err 3722 } 3723 defer googleapi.CloseBody(res) 3724 if err := googleapi.CheckResponse(res); err != nil { 3725 return nil, err 3726 } 3727 ret := &Object{ 3728 ServerResponse: googleapi.ServerResponse{ 3729 Header: res.Header, 3730 HTTPStatusCode: res.StatusCode, 3731 }, 3732 } 3733 target := &ret 3734 if err := gensupport.DecodeResponse(target, res); err != nil { 3735 return nil, err 3736 } 3737 return ret, nil 3738 // { 3739 // "description": "Retrieves objects or their associated metadata.", 3740 // "httpMethod": "GET", 3741 // "id": "storage.objects.get", 3742 // "parameterOrder": [ 3743 // "bucket", 3744 // "object" 3745 // ], 3746 // "parameters": { 3747 // "bucket": { 3748 // "description": "Name of the bucket in which the object resides.", 3749 // "location": "path", 3750 // "required": true, 3751 // "type": "string" 3752 // }, 3753 // "object": { 3754 // "description": "Name of the object.", 3755 // "location": "path", 3756 // "required": true, 3757 // "type": "string" 3758 // }, 3759 // "projection": { 3760 // "description": "Set of properties to return. Defaults to no_acl.", 3761 // "enum": [ 3762 // "full", 3763 // "no_acl" 3764 // ], 3765 // "enumDescriptions": [ 3766 // "Include all properties.", 3767 // "Omit the acl property." 3768 // ], 3769 // "location": "query", 3770 // "type": "string" 3771 // } 3772 // }, 3773 // "path": "b/{bucket}/o/{object}", 3774 // "response": { 3775 // "$ref": "Object" 3776 // }, 3777 // "scopes": [ 3778 // "https://www.googleapis.com/auth/devstorage.full_control", 3779 // "https://www.googleapis.com/auth/devstorage.read_only", 3780 // "https://www.googleapis.com/auth/devstorage.read_write" 3781 // ], 3782 // "supportsMediaDownload": true 3783 // } 3784 3785} 3786 3787// method id "storage.objects.insert": 3788 3789type ObjectsInsertCall struct { 3790 s *Service 3791 bucket string 3792 object *Object 3793 urlParams_ gensupport.URLParams 3794 mediaInfo_ *gensupport.MediaInfo 3795 ctx_ context.Context 3796 header_ http.Header 3797} 3798 3799// Insert: Stores new data blobs and associated metadata. 3800func (r *ObjectsService) Insert(bucket string, object *Object) *ObjectsInsertCall { 3801 c := &ObjectsInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)} 3802 c.bucket = bucket 3803 c.object = object 3804 return c 3805} 3806 3807// Name sets the optional parameter "name": Name of the object. Required 3808// when the object metadata is not otherwise provided. Overrides the 3809// object metadata's name value, if any. 3810func (c *ObjectsInsertCall) Name(name string) *ObjectsInsertCall { 3811 c.urlParams_.Set("name", name) 3812 return c 3813} 3814 3815// Projection sets the optional parameter "projection": Set of 3816// properties to return. Defaults to no_acl, unless the object resource 3817// specifies the acl property, when it defaults to full. 3818// 3819// Possible values: 3820// "full" - Include all properties. 3821// "no_acl" - Omit the acl property. 3822func (c *ObjectsInsertCall) Projection(projection string) *ObjectsInsertCall { 3823 c.urlParams_.Set("projection", projection) 3824 return c 3825} 3826 3827// Media specifies the media to upload in one or more chunks. The chunk 3828// size may be controlled by supplying a MediaOption generated by 3829// googleapi.ChunkSize. The chunk size defaults to 3830// googleapi.DefaultUploadChunkSize.The Content-Type header used in the 3831// upload request will be determined by sniffing the contents of r, 3832// unless a MediaOption generated by googleapi.ContentType is 3833// supplied. 3834// At most one of Media and ResumableMedia may be set. 3835func (c *ObjectsInsertCall) Media(r io.Reader, options ...googleapi.MediaOption) *ObjectsInsertCall { 3836 c.mediaInfo_ = gensupport.NewInfoFromMedia(r, options) 3837 return c 3838} 3839 3840// ResumableMedia specifies the media to upload in chunks and can be 3841// canceled with ctx. 3842// 3843// Deprecated: use Media instead. 3844// 3845// At most one of Media and ResumableMedia may be set. mediaType 3846// identifies the MIME media type of the upload, such as "image/png". If 3847// mediaType is "", it will be auto-detected. The provided ctx will 3848// supersede any context previously provided to the Context method. 3849func (c *ObjectsInsertCall) ResumableMedia(ctx context.Context, r io.ReaderAt, size int64, mediaType string) *ObjectsInsertCall { 3850 c.ctx_ = ctx 3851 c.mediaInfo_ = gensupport.NewInfoFromResumableMedia(r, size, mediaType) 3852 return c 3853} 3854 3855// ProgressUpdater provides a callback function that will be called 3856// after every chunk. It should be a low-latency function in order to 3857// not slow down the upload operation. This should only be called when 3858// using ResumableMedia (as opposed to Media). 3859func (c *ObjectsInsertCall) ProgressUpdater(pu googleapi.ProgressUpdater) *ObjectsInsertCall { 3860 c.mediaInfo_.SetProgressUpdater(pu) 3861 return c 3862} 3863 3864// Fields allows partial responses to be retrieved. See 3865// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 3866// for more information. 3867func (c *ObjectsInsertCall) Fields(s ...googleapi.Field) *ObjectsInsertCall { 3868 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 3869 return c 3870} 3871 3872// Context sets the context to be used in this call's Do method. Any 3873// pending HTTP request will be aborted if the provided context is 3874// canceled. 3875// This context will supersede any context previously provided to the 3876// ResumableMedia method. 3877func (c *ObjectsInsertCall) Context(ctx context.Context) *ObjectsInsertCall { 3878 c.ctx_ = ctx 3879 return c 3880} 3881 3882// Header returns an http.Header that can be modified by the caller to 3883// add HTTP headers to the request. 3884func (c *ObjectsInsertCall) Header() http.Header { 3885 if c.header_ == nil { 3886 c.header_ = make(http.Header) 3887 } 3888 return c.header_ 3889} 3890 3891func (c *ObjectsInsertCall) doRequest(alt string) (*http.Response, error) { 3892 reqHeaders := make(http.Header) 3893 reqHeaders.Set("x-goog-api-client", "gl-go/1.13.7 gdcl/20200203") 3894 for k, v := range c.header_ { 3895 reqHeaders[k] = v 3896 } 3897 reqHeaders.Set("User-Agent", c.s.userAgent()) 3898 var body io.Reader = nil 3899 body, err := googleapi.WithoutDataWrapper.JSONReader(c.object) 3900 if err != nil { 3901 return nil, err 3902 } 3903 reqHeaders.Set("Content-Type", "application/json") 3904 c.urlParams_.Set("alt", alt) 3905 c.urlParams_.Set("prettyPrint", "false") 3906 urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o") 3907 if c.mediaInfo_ != nil { 3908 urls = googleapi.ResolveRelative(c.s.BasePath, "/upload/storage/v1beta1/b/{bucket}/o") 3909 c.urlParams_.Set("uploadType", c.mediaInfo_.UploadType()) 3910 } 3911 if body == nil { 3912 body = new(bytes.Buffer) 3913 reqHeaders.Set("Content-Type", "application/json") 3914 } 3915 body, getBody, cleanup := c.mediaInfo_.UploadRequest(reqHeaders, body) 3916 defer cleanup() 3917 urls += "?" + c.urlParams_.Encode() 3918 req, err := http.NewRequest("POST", urls, body) 3919 if err != nil { 3920 return nil, err 3921 } 3922 req.Header = reqHeaders 3923 req.GetBody = getBody 3924 googleapi.Expand(req.URL, map[string]string{ 3925 "bucket": c.bucket, 3926 }) 3927 return gensupport.SendRequest(c.ctx_, c.s.client, req) 3928} 3929 3930// Do executes the "storage.objects.insert" call. 3931// Exactly one of *Object or error will be non-nil. Any non-2xx status 3932// code is an error. Response headers are in either 3933// *Object.ServerResponse.Header or (if a response was returned at all) 3934// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 3935// check whether the returned error was because http.StatusNotModified 3936// was returned. 3937func (c *ObjectsInsertCall) Do(opts ...googleapi.CallOption) (*Object, error) { 3938 gensupport.SetOptions(c.urlParams_, opts...) 3939 res, err := c.doRequest("json") 3940 if res != nil && res.StatusCode == http.StatusNotModified { 3941 if res.Body != nil { 3942 res.Body.Close() 3943 } 3944 return nil, &googleapi.Error{ 3945 Code: res.StatusCode, 3946 Header: res.Header, 3947 } 3948 } 3949 if err != nil { 3950 return nil, err 3951 } 3952 defer googleapi.CloseBody(res) 3953 if err := googleapi.CheckResponse(res); err != nil { 3954 return nil, err 3955 } 3956 rx := c.mediaInfo_.ResumableUpload(res.Header.Get("Location")) 3957 if rx != nil { 3958 rx.Client = c.s.client 3959 rx.UserAgent = c.s.userAgent() 3960 ctx := c.ctx_ 3961 if ctx == nil { 3962 ctx = context.TODO() 3963 } 3964 res, err = rx.Upload(ctx) 3965 if err != nil { 3966 return nil, err 3967 } 3968 defer res.Body.Close() 3969 if err := googleapi.CheckResponse(res); err != nil { 3970 return nil, err 3971 } 3972 } 3973 ret := &Object{ 3974 ServerResponse: googleapi.ServerResponse{ 3975 Header: res.Header, 3976 HTTPStatusCode: res.StatusCode, 3977 }, 3978 } 3979 target := &ret 3980 if err := gensupport.DecodeResponse(target, res); err != nil { 3981 return nil, err 3982 } 3983 return ret, nil 3984 // { 3985 // "description": "Stores new data blobs and associated metadata.", 3986 // "httpMethod": "POST", 3987 // "id": "storage.objects.insert", 3988 // "mediaUpload": { 3989 // "accept": [ 3990 // "*/*" 3991 // ], 3992 // "protocols": { 3993 // "resumable": { 3994 // "multipart": true, 3995 // "path": "/resumable/upload/storage/v1beta1/b/{bucket}/o" 3996 // }, 3997 // "simple": { 3998 // "multipart": true, 3999 // "path": "/upload/storage/v1beta1/b/{bucket}/o" 4000 // } 4001 // } 4002 // }, 4003 // "parameterOrder": [ 4004 // "bucket" 4005 // ], 4006 // "parameters": { 4007 // "bucket": { 4008 // "description": "Name of the bucket in which to store the new object. Overrides the provided object metadata's bucket value, if any.", 4009 // "location": "path", 4010 // "required": true, 4011 // "type": "string" 4012 // }, 4013 // "name": { 4014 // "description": "Name of the object. Required when the object metadata is not otherwise provided. Overrides the object metadata's name value, if any.", 4015 // "location": "query", 4016 // "type": "string" 4017 // }, 4018 // "projection": { 4019 // "description": "Set of properties to return. Defaults to no_acl, unless the object resource specifies the acl property, when it defaults to full.", 4020 // "enum": [ 4021 // "full", 4022 // "no_acl" 4023 // ], 4024 // "enumDescriptions": [ 4025 // "Include all properties.", 4026 // "Omit the acl property." 4027 // ], 4028 // "location": "query", 4029 // "type": "string" 4030 // } 4031 // }, 4032 // "path": "b/{bucket}/o", 4033 // "request": { 4034 // "$ref": "Object" 4035 // }, 4036 // "response": { 4037 // "$ref": "Object" 4038 // }, 4039 // "scopes": [ 4040 // "https://www.googleapis.com/auth/devstorage.full_control", 4041 // "https://www.googleapis.com/auth/devstorage.read_write" 4042 // ], 4043 // "supportsMediaDownload": true, 4044 // "supportsMediaUpload": true 4045 // } 4046 4047} 4048 4049// method id "storage.objects.list": 4050 4051type ObjectsListCall struct { 4052 s *Service 4053 bucket string 4054 urlParams_ gensupport.URLParams 4055 ifNoneMatch_ string 4056 ctx_ context.Context 4057 header_ http.Header 4058} 4059 4060// List: Retrieves a list of objects matching the criteria. 4061func (r *ObjectsService) List(bucket string) *ObjectsListCall { 4062 c := &ObjectsListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 4063 c.bucket = bucket 4064 return c 4065} 4066 4067// Delimiter sets the optional parameter "delimiter": Returns results in 4068// a directory-like mode. items will contain only objects whose names, 4069// aside from the prefix, do not contain delimiter. Objects whose names, 4070// aside from the prefix, contain delimiter will have their name, 4071// truncated after the delimiter, returned in prefixes. Duplicate 4072// prefixes are omitted. 4073func (c *ObjectsListCall) Delimiter(delimiter string) *ObjectsListCall { 4074 c.urlParams_.Set("delimiter", delimiter) 4075 return c 4076} 4077 4078// MaxResults sets the optional parameter "max-results": Maximum number 4079// of items plus prefixes to return. As duplicate prefixes are omitted, 4080// fewer total results may be returned than requested. 4081func (c *ObjectsListCall) MaxResults(maxResults int64) *ObjectsListCall { 4082 c.urlParams_.Set("max-results", fmt.Sprint(maxResults)) 4083 return c 4084} 4085 4086// PageToken sets the optional parameter "pageToken": A 4087// previously-returned page token representing part of the larger set of 4088// results to view. 4089func (c *ObjectsListCall) PageToken(pageToken string) *ObjectsListCall { 4090 c.urlParams_.Set("pageToken", pageToken) 4091 return c 4092} 4093 4094// Prefix sets the optional parameter "prefix": Filter results to 4095// objects whose names begin with this prefix. 4096func (c *ObjectsListCall) Prefix(prefix string) *ObjectsListCall { 4097 c.urlParams_.Set("prefix", prefix) 4098 return c 4099} 4100 4101// Projection sets the optional parameter "projection": Set of 4102// properties to return. Defaults to no_acl. 4103// 4104// Possible values: 4105// "full" - Include all properties. 4106// "no_acl" - Omit the acl property. 4107func (c *ObjectsListCall) Projection(projection string) *ObjectsListCall { 4108 c.urlParams_.Set("projection", projection) 4109 return c 4110} 4111 4112// Fields allows partial responses to be retrieved. See 4113// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 4114// for more information. 4115func (c *ObjectsListCall) Fields(s ...googleapi.Field) *ObjectsListCall { 4116 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 4117 return c 4118} 4119 4120// IfNoneMatch sets the optional parameter which makes the operation 4121// fail if the object's ETag matches the given value. This is useful for 4122// getting updates only after the object has changed since the last 4123// request. Use googleapi.IsNotModified to check whether the response 4124// error from Do is the result of In-None-Match. 4125func (c *ObjectsListCall) IfNoneMatch(entityTag string) *ObjectsListCall { 4126 c.ifNoneMatch_ = entityTag 4127 return c 4128} 4129 4130// Context sets the context to be used in this call's Do method. Any 4131// pending HTTP request will be aborted if the provided context is 4132// canceled. 4133func (c *ObjectsListCall) Context(ctx context.Context) *ObjectsListCall { 4134 c.ctx_ = ctx 4135 return c 4136} 4137 4138// Header returns an http.Header that can be modified by the caller to 4139// add HTTP headers to the request. 4140func (c *ObjectsListCall) Header() http.Header { 4141 if c.header_ == nil { 4142 c.header_ = make(http.Header) 4143 } 4144 return c.header_ 4145} 4146 4147func (c *ObjectsListCall) doRequest(alt string) (*http.Response, error) { 4148 reqHeaders := make(http.Header) 4149 reqHeaders.Set("x-goog-api-client", "gl-go/1.13.7 gdcl/20200203") 4150 for k, v := range c.header_ { 4151 reqHeaders[k] = v 4152 } 4153 reqHeaders.Set("User-Agent", c.s.userAgent()) 4154 if c.ifNoneMatch_ != "" { 4155 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 4156 } 4157 var body io.Reader = nil 4158 c.urlParams_.Set("alt", alt) 4159 c.urlParams_.Set("prettyPrint", "false") 4160 urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o") 4161 urls += "?" + c.urlParams_.Encode() 4162 req, err := http.NewRequest("GET", urls, body) 4163 if err != nil { 4164 return nil, err 4165 } 4166 req.Header = reqHeaders 4167 googleapi.Expand(req.URL, map[string]string{ 4168 "bucket": c.bucket, 4169 }) 4170 return gensupport.SendRequest(c.ctx_, c.s.client, req) 4171} 4172 4173// Do executes the "storage.objects.list" call. 4174// Exactly one of *Objects or error will be non-nil. Any non-2xx status 4175// code is an error. Response headers are in either 4176// *Objects.ServerResponse.Header or (if a response was returned at all) 4177// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 4178// check whether the returned error was because http.StatusNotModified 4179// was returned. 4180func (c *ObjectsListCall) Do(opts ...googleapi.CallOption) (*Objects, error) { 4181 gensupport.SetOptions(c.urlParams_, opts...) 4182 res, err := c.doRequest("json") 4183 if res != nil && res.StatusCode == http.StatusNotModified { 4184 if res.Body != nil { 4185 res.Body.Close() 4186 } 4187 return nil, &googleapi.Error{ 4188 Code: res.StatusCode, 4189 Header: res.Header, 4190 } 4191 } 4192 if err != nil { 4193 return nil, err 4194 } 4195 defer googleapi.CloseBody(res) 4196 if err := googleapi.CheckResponse(res); err != nil { 4197 return nil, err 4198 } 4199 ret := &Objects{ 4200 ServerResponse: googleapi.ServerResponse{ 4201 Header: res.Header, 4202 HTTPStatusCode: res.StatusCode, 4203 }, 4204 } 4205 target := &ret 4206 if err := gensupport.DecodeResponse(target, res); err != nil { 4207 return nil, err 4208 } 4209 return ret, nil 4210 // { 4211 // "description": "Retrieves a list of objects matching the criteria.", 4212 // "httpMethod": "GET", 4213 // "id": "storage.objects.list", 4214 // "parameterOrder": [ 4215 // "bucket" 4216 // ], 4217 // "parameters": { 4218 // "bucket": { 4219 // "description": "Name of the bucket in which to look for objects.", 4220 // "location": "path", 4221 // "required": true, 4222 // "type": "string" 4223 // }, 4224 // "delimiter": { 4225 // "description": "Returns results in a directory-like mode. items will contain only objects whose names, aside from the prefix, do not contain delimiter. Objects whose names, aside from the prefix, contain delimiter will have their name, truncated after the delimiter, returned in prefixes. Duplicate prefixes are omitted.", 4226 // "location": "query", 4227 // "type": "string" 4228 // }, 4229 // "max-results": { 4230 // "description": "Maximum number of items plus prefixes to return. As duplicate prefixes are omitted, fewer total results may be returned than requested.", 4231 // "format": "uint32", 4232 // "location": "query", 4233 // "minimum": "0", 4234 // "type": "integer" 4235 // }, 4236 // "pageToken": { 4237 // "description": "A previously-returned page token representing part of the larger set of results to view.", 4238 // "location": "query", 4239 // "type": "string" 4240 // }, 4241 // "prefix": { 4242 // "description": "Filter results to objects whose names begin with this prefix.", 4243 // "location": "query", 4244 // "type": "string" 4245 // }, 4246 // "projection": { 4247 // "description": "Set of properties to return. Defaults to no_acl.", 4248 // "enum": [ 4249 // "full", 4250 // "no_acl" 4251 // ], 4252 // "enumDescriptions": [ 4253 // "Include all properties.", 4254 // "Omit the acl property." 4255 // ], 4256 // "location": "query", 4257 // "type": "string" 4258 // } 4259 // }, 4260 // "path": "b/{bucket}/o", 4261 // "response": { 4262 // "$ref": "Objects" 4263 // }, 4264 // "scopes": [ 4265 // "https://www.googleapis.com/auth/devstorage.full_control", 4266 // "https://www.googleapis.com/auth/devstorage.read_only", 4267 // "https://www.googleapis.com/auth/devstorage.read_write" 4268 // ], 4269 // "supportsSubscription": true 4270 // } 4271 4272} 4273 4274// Pages invokes f for each page of results. 4275// A non-nil error returned from f will halt the iteration. 4276// The provided context supersedes any context provided to the Context method. 4277func (c *ObjectsListCall) Pages(ctx context.Context, f func(*Objects) error) error { 4278 c.ctx_ = ctx 4279 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 4280 for { 4281 x, err := c.Do() 4282 if err != nil { 4283 return err 4284 } 4285 if err := f(x); err != nil { 4286 return err 4287 } 4288 if x.NextPageToken == "" { 4289 return nil 4290 } 4291 c.PageToken(x.NextPageToken) 4292 } 4293} 4294 4295// method id "storage.objects.patch": 4296 4297type ObjectsPatchCall struct { 4298 s *Service 4299 bucket string 4300 object string 4301 object2 *Object 4302 urlParams_ gensupport.URLParams 4303 ctx_ context.Context 4304 header_ http.Header 4305} 4306 4307// Patch: Updates a data blob's associated metadata. This method 4308// supports patch semantics. 4309func (r *ObjectsService) Patch(bucket string, object string, object2 *Object) *ObjectsPatchCall { 4310 c := &ObjectsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)} 4311 c.bucket = bucket 4312 c.object = object 4313 c.object2 = object2 4314 return c 4315} 4316 4317// Projection sets the optional parameter "projection": Set of 4318// properties to return. Defaults to full. 4319// 4320// Possible values: 4321// "full" - Include all properties. 4322// "no_acl" - Omit the acl property. 4323func (c *ObjectsPatchCall) Projection(projection string) *ObjectsPatchCall { 4324 c.urlParams_.Set("projection", projection) 4325 return c 4326} 4327 4328// Fields allows partial responses to be retrieved. See 4329// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 4330// for more information. 4331func (c *ObjectsPatchCall) Fields(s ...googleapi.Field) *ObjectsPatchCall { 4332 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 4333 return c 4334} 4335 4336// Context sets the context to be used in this call's Do method. Any 4337// pending HTTP request will be aborted if the provided context is 4338// canceled. 4339func (c *ObjectsPatchCall) Context(ctx context.Context) *ObjectsPatchCall { 4340 c.ctx_ = ctx 4341 return c 4342} 4343 4344// Header returns an http.Header that can be modified by the caller to 4345// add HTTP headers to the request. 4346func (c *ObjectsPatchCall) Header() http.Header { 4347 if c.header_ == nil { 4348 c.header_ = make(http.Header) 4349 } 4350 return c.header_ 4351} 4352 4353func (c *ObjectsPatchCall) doRequest(alt string) (*http.Response, error) { 4354 reqHeaders := make(http.Header) 4355 reqHeaders.Set("x-goog-api-client", "gl-go/1.13.7 gdcl/20200203") 4356 for k, v := range c.header_ { 4357 reqHeaders[k] = v 4358 } 4359 reqHeaders.Set("User-Agent", c.s.userAgent()) 4360 var body io.Reader = nil 4361 body, err := googleapi.WithoutDataWrapper.JSONReader(c.object2) 4362 if err != nil { 4363 return nil, err 4364 } 4365 reqHeaders.Set("Content-Type", "application/json") 4366 c.urlParams_.Set("alt", alt) 4367 c.urlParams_.Set("prettyPrint", "false") 4368 urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o/{object}") 4369 urls += "?" + c.urlParams_.Encode() 4370 req, err := http.NewRequest("PATCH", urls, body) 4371 if err != nil { 4372 return nil, err 4373 } 4374 req.Header = reqHeaders 4375 googleapi.Expand(req.URL, map[string]string{ 4376 "bucket": c.bucket, 4377 "object": c.object, 4378 }) 4379 return gensupport.SendRequest(c.ctx_, c.s.client, req) 4380} 4381 4382// Do executes the "storage.objects.patch" call. 4383// Exactly one of *Object or error will be non-nil. Any non-2xx status 4384// code is an error. Response headers are in either 4385// *Object.ServerResponse.Header or (if a response was returned at all) 4386// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 4387// check whether the returned error was because http.StatusNotModified 4388// was returned. 4389func (c *ObjectsPatchCall) Do(opts ...googleapi.CallOption) (*Object, error) { 4390 gensupport.SetOptions(c.urlParams_, opts...) 4391 res, err := c.doRequest("json") 4392 if res != nil && res.StatusCode == http.StatusNotModified { 4393 if res.Body != nil { 4394 res.Body.Close() 4395 } 4396 return nil, &googleapi.Error{ 4397 Code: res.StatusCode, 4398 Header: res.Header, 4399 } 4400 } 4401 if err != nil { 4402 return nil, err 4403 } 4404 defer googleapi.CloseBody(res) 4405 if err := googleapi.CheckResponse(res); err != nil { 4406 return nil, err 4407 } 4408 ret := &Object{ 4409 ServerResponse: googleapi.ServerResponse{ 4410 Header: res.Header, 4411 HTTPStatusCode: res.StatusCode, 4412 }, 4413 } 4414 target := &ret 4415 if err := gensupport.DecodeResponse(target, res); err != nil { 4416 return nil, err 4417 } 4418 return ret, nil 4419 // { 4420 // "description": "Updates a data blob's associated metadata. This method supports patch semantics.", 4421 // "httpMethod": "PATCH", 4422 // "id": "storage.objects.patch", 4423 // "parameterOrder": [ 4424 // "bucket", 4425 // "object" 4426 // ], 4427 // "parameters": { 4428 // "bucket": { 4429 // "description": "Name of the bucket in which the object resides.", 4430 // "location": "path", 4431 // "required": true, 4432 // "type": "string" 4433 // }, 4434 // "object": { 4435 // "description": "Name of the object.", 4436 // "location": "path", 4437 // "required": true, 4438 // "type": "string" 4439 // }, 4440 // "projection": { 4441 // "description": "Set of properties to return. Defaults to full.", 4442 // "enum": [ 4443 // "full", 4444 // "no_acl" 4445 // ], 4446 // "enumDescriptions": [ 4447 // "Include all properties.", 4448 // "Omit the acl property." 4449 // ], 4450 // "location": "query", 4451 // "type": "string" 4452 // } 4453 // }, 4454 // "path": "b/{bucket}/o/{object}", 4455 // "request": { 4456 // "$ref": "Object" 4457 // }, 4458 // "response": { 4459 // "$ref": "Object" 4460 // }, 4461 // "scopes": [ 4462 // "https://www.googleapis.com/auth/devstorage.full_control", 4463 // "https://www.googleapis.com/auth/devstorage.read_write" 4464 // ] 4465 // } 4466 4467} 4468 4469// method id "storage.objects.update": 4470 4471type ObjectsUpdateCall struct { 4472 s *Service 4473 bucket string 4474 object string 4475 object2 *Object 4476 urlParams_ gensupport.URLParams 4477 ctx_ context.Context 4478 header_ http.Header 4479} 4480 4481// Update: Updates a data blob's associated metadata. 4482func (r *ObjectsService) Update(bucket string, object string, object2 *Object) *ObjectsUpdateCall { 4483 c := &ObjectsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 4484 c.bucket = bucket 4485 c.object = object 4486 c.object2 = object2 4487 return c 4488} 4489 4490// Projection sets the optional parameter "projection": Set of 4491// properties to return. Defaults to full. 4492// 4493// Possible values: 4494// "full" - Include all properties. 4495// "no_acl" - Omit the acl property. 4496func (c *ObjectsUpdateCall) Projection(projection string) *ObjectsUpdateCall { 4497 c.urlParams_.Set("projection", projection) 4498 return c 4499} 4500 4501// Fields allows partial responses to be retrieved. See 4502// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 4503// for more information. 4504func (c *ObjectsUpdateCall) Fields(s ...googleapi.Field) *ObjectsUpdateCall { 4505 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 4506 return c 4507} 4508 4509// Context sets the context to be used in this call's Do and Download 4510// methods. Any pending HTTP request will be aborted if the provided 4511// context is canceled. 4512func (c *ObjectsUpdateCall) Context(ctx context.Context) *ObjectsUpdateCall { 4513 c.ctx_ = ctx 4514 return c 4515} 4516 4517// Header returns an http.Header that can be modified by the caller to 4518// add HTTP headers to the request. 4519func (c *ObjectsUpdateCall) Header() http.Header { 4520 if c.header_ == nil { 4521 c.header_ = make(http.Header) 4522 } 4523 return c.header_ 4524} 4525 4526func (c *ObjectsUpdateCall) doRequest(alt string) (*http.Response, error) { 4527 reqHeaders := make(http.Header) 4528 reqHeaders.Set("x-goog-api-client", "gl-go/1.13.7 gdcl/20200203") 4529 for k, v := range c.header_ { 4530 reqHeaders[k] = v 4531 } 4532 reqHeaders.Set("User-Agent", c.s.userAgent()) 4533 var body io.Reader = nil 4534 body, err := googleapi.WithoutDataWrapper.JSONReader(c.object2) 4535 if err != nil { 4536 return nil, err 4537 } 4538 reqHeaders.Set("Content-Type", "application/json") 4539 c.urlParams_.Set("alt", alt) 4540 c.urlParams_.Set("prettyPrint", "false") 4541 urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o/{object}") 4542 urls += "?" + c.urlParams_.Encode() 4543 req, err := http.NewRequest("PUT", urls, body) 4544 if err != nil { 4545 return nil, err 4546 } 4547 req.Header = reqHeaders 4548 googleapi.Expand(req.URL, map[string]string{ 4549 "bucket": c.bucket, 4550 "object": c.object, 4551 }) 4552 return gensupport.SendRequest(c.ctx_, c.s.client, req) 4553} 4554 4555// Download fetches the API endpoint's "media" value, instead of the normal 4556// API response value. If the returned error is nil, the Response is guaranteed to 4557// have a 2xx status code. Callers must close the Response.Body as usual. 4558func (c *ObjectsUpdateCall) Download(opts ...googleapi.CallOption) (*http.Response, error) { 4559 gensupport.SetOptions(c.urlParams_, opts...) 4560 res, err := c.doRequest("media") 4561 if err != nil { 4562 return nil, err 4563 } 4564 if err := googleapi.CheckMediaResponse(res); err != nil { 4565 res.Body.Close() 4566 return nil, err 4567 } 4568 return res, nil 4569} 4570 4571// Do executes the "storage.objects.update" call. 4572// Exactly one of *Object or error will be non-nil. Any non-2xx status 4573// code is an error. Response headers are in either 4574// *Object.ServerResponse.Header or (if a response was returned at all) 4575// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 4576// check whether the returned error was because http.StatusNotModified 4577// was returned. 4578func (c *ObjectsUpdateCall) Do(opts ...googleapi.CallOption) (*Object, error) { 4579 gensupport.SetOptions(c.urlParams_, opts...) 4580 res, err := c.doRequest("json") 4581 if res != nil && res.StatusCode == http.StatusNotModified { 4582 if res.Body != nil { 4583 res.Body.Close() 4584 } 4585 return nil, &googleapi.Error{ 4586 Code: res.StatusCode, 4587 Header: res.Header, 4588 } 4589 } 4590 if err != nil { 4591 return nil, err 4592 } 4593 defer googleapi.CloseBody(res) 4594 if err := googleapi.CheckResponse(res); err != nil { 4595 return nil, err 4596 } 4597 ret := &Object{ 4598 ServerResponse: googleapi.ServerResponse{ 4599 Header: res.Header, 4600 HTTPStatusCode: res.StatusCode, 4601 }, 4602 } 4603 target := &ret 4604 if err := gensupport.DecodeResponse(target, res); err != nil { 4605 return nil, err 4606 } 4607 return ret, nil 4608 // { 4609 // "description": "Updates a data blob's associated metadata.", 4610 // "httpMethod": "PUT", 4611 // "id": "storage.objects.update", 4612 // "parameterOrder": [ 4613 // "bucket", 4614 // "object" 4615 // ], 4616 // "parameters": { 4617 // "bucket": { 4618 // "description": "Name of the bucket in which the object resides.", 4619 // "location": "path", 4620 // "required": true, 4621 // "type": "string" 4622 // }, 4623 // "object": { 4624 // "description": "Name of the object.", 4625 // "location": "path", 4626 // "required": true, 4627 // "type": "string" 4628 // }, 4629 // "projection": { 4630 // "description": "Set of properties to return. Defaults to full.", 4631 // "enum": [ 4632 // "full", 4633 // "no_acl" 4634 // ], 4635 // "enumDescriptions": [ 4636 // "Include all properties.", 4637 // "Omit the acl property." 4638 // ], 4639 // "location": "query", 4640 // "type": "string" 4641 // } 4642 // }, 4643 // "path": "b/{bucket}/o/{object}", 4644 // "request": { 4645 // "$ref": "Object" 4646 // }, 4647 // "response": { 4648 // "$ref": "Object" 4649 // }, 4650 // "scopes": [ 4651 // "https://www.googleapis.com/auth/devstorage.full_control", 4652 // "https://www.googleapis.com/auth/devstorage.read_write" 4653 // ], 4654 // "supportsMediaDownload": true 4655 // } 4656 4657} 4658