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/v1" 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/v1" 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 internaloption "google.golang.org/api/option/internaloption" 62 htransport "google.golang.org/api/transport/http" 63) 64 65// Always reference these packages, just in case the auto-generated code 66// below doesn't. 67var _ = bytes.NewBuffer 68var _ = strconv.Itoa 69var _ = fmt.Sprintf 70var _ = json.NewDecoder 71var _ = io.Copy 72var _ = url.Parse 73var _ = gensupport.MarshalJSON 74var _ = googleapi.Version 75var _ = errors.New 76var _ = strings.Replace 77var _ = context.Canceled 78var _ = internaloption.WithDefaultEndpoint 79 80const apiId = "storage:v1" 81const apiName = "storage" 82const apiVersion = "v1" 83const basePath = "https://storage.googleapis.com/storage/v1/" 84 85// OAuth2 scopes used by this API. 86const ( 87 // View and manage your data across Google Cloud Platform services 88 CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platform" 89 90 // View your data across Google Cloud Platform services 91 CloudPlatformReadOnlyScope = "https://www.googleapis.com/auth/cloud-platform.read-only" 92 93 // Manage your data and permissions in Google Cloud Storage 94 DevstorageFullControlScope = "https://www.googleapis.com/auth/devstorage.full_control" 95 96 // View your data in Google Cloud Storage 97 DevstorageReadOnlyScope = "https://www.googleapis.com/auth/devstorage.read_only" 98 99 // Manage your data in Google Cloud Storage 100 DevstorageReadWriteScope = "https://www.googleapis.com/auth/devstorage.read_write" 101) 102 103// NewService creates a new Service. 104func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) { 105 scopesOption := option.WithScopes( 106 "https://www.googleapis.com/auth/cloud-platform", 107 "https://www.googleapis.com/auth/cloud-platform.read-only", 108 "https://www.googleapis.com/auth/devstorage.full_control", 109 "https://www.googleapis.com/auth/devstorage.read_only", 110 "https://www.googleapis.com/auth/devstorage.read_write", 111 ) 112 // NOTE: prepend, so we don't override user-specified scopes. 113 opts = append([]option.ClientOption{scopesOption}, opts...) 114 opts = append(opts, internaloption.WithDefaultEndpoint(basePath)) 115 client, endpoint, err := htransport.NewClient(ctx, opts...) 116 if err != nil { 117 return nil, err 118 } 119 s, err := New(client) 120 if err != nil { 121 return nil, err 122 } 123 if endpoint != "" { 124 s.BasePath = endpoint 125 } 126 return s, nil 127} 128 129// New creates a new Service. It uses the provided http.Client for requests. 130// 131// Deprecated: please use NewService instead. 132// To provide a custom HTTP client, use option.WithHTTPClient. 133// If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead. 134func New(client *http.Client) (*Service, error) { 135 if client == nil { 136 return nil, errors.New("client is nil") 137 } 138 s := &Service{client: client, BasePath: basePath} 139 s.BucketAccessControls = NewBucketAccessControlsService(s) 140 s.Buckets = NewBucketsService(s) 141 s.Channels = NewChannelsService(s) 142 s.DefaultObjectAccessControls = NewDefaultObjectAccessControlsService(s) 143 s.Notifications = NewNotificationsService(s) 144 s.ObjectAccessControls = NewObjectAccessControlsService(s) 145 s.Objects = NewObjectsService(s) 146 s.Projects = NewProjectsService(s) 147 return s, nil 148} 149 150type Service struct { 151 client *http.Client 152 BasePath string // API endpoint base URL 153 UserAgent string // optional additional User-Agent fragment 154 155 BucketAccessControls *BucketAccessControlsService 156 157 Buckets *BucketsService 158 159 Channels *ChannelsService 160 161 DefaultObjectAccessControls *DefaultObjectAccessControlsService 162 163 Notifications *NotificationsService 164 165 ObjectAccessControls *ObjectAccessControlsService 166 167 Objects *ObjectsService 168 169 Projects *ProjectsService 170} 171 172func (s *Service) userAgent() string { 173 if s.UserAgent == "" { 174 return googleapi.UserAgent 175 } 176 return googleapi.UserAgent + " " + s.UserAgent 177} 178 179func NewBucketAccessControlsService(s *Service) *BucketAccessControlsService { 180 rs := &BucketAccessControlsService{s: s} 181 return rs 182} 183 184type BucketAccessControlsService struct { 185 s *Service 186} 187 188func NewBucketsService(s *Service) *BucketsService { 189 rs := &BucketsService{s: s} 190 return rs 191} 192 193type BucketsService struct { 194 s *Service 195} 196 197func NewChannelsService(s *Service) *ChannelsService { 198 rs := &ChannelsService{s: s} 199 return rs 200} 201 202type ChannelsService struct { 203 s *Service 204} 205 206func NewDefaultObjectAccessControlsService(s *Service) *DefaultObjectAccessControlsService { 207 rs := &DefaultObjectAccessControlsService{s: s} 208 return rs 209} 210 211type DefaultObjectAccessControlsService struct { 212 s *Service 213} 214 215func NewNotificationsService(s *Service) *NotificationsService { 216 rs := &NotificationsService{s: s} 217 return rs 218} 219 220type NotificationsService struct { 221 s *Service 222} 223 224func NewObjectAccessControlsService(s *Service) *ObjectAccessControlsService { 225 rs := &ObjectAccessControlsService{s: s} 226 return rs 227} 228 229type ObjectAccessControlsService struct { 230 s *Service 231} 232 233func NewObjectsService(s *Service) *ObjectsService { 234 rs := &ObjectsService{s: s} 235 return rs 236} 237 238type ObjectsService struct { 239 s *Service 240} 241 242func NewProjectsService(s *Service) *ProjectsService { 243 rs := &ProjectsService{s: s} 244 rs.HmacKeys = NewProjectsHmacKeysService(s) 245 rs.ServiceAccount = NewProjectsServiceAccountService(s) 246 return rs 247} 248 249type ProjectsService struct { 250 s *Service 251 252 HmacKeys *ProjectsHmacKeysService 253 254 ServiceAccount *ProjectsServiceAccountService 255} 256 257func NewProjectsHmacKeysService(s *Service) *ProjectsHmacKeysService { 258 rs := &ProjectsHmacKeysService{s: s} 259 return rs 260} 261 262type ProjectsHmacKeysService struct { 263 s *Service 264} 265 266func NewProjectsServiceAccountService(s *Service) *ProjectsServiceAccountService { 267 rs := &ProjectsServiceAccountService{s: s} 268 return rs 269} 270 271type ProjectsServiceAccountService struct { 272 s *Service 273} 274 275// Bucket: A bucket. 276type Bucket struct { 277 // Acl: Access controls on the bucket. 278 Acl []*BucketAccessControl `json:"acl,omitempty"` 279 280 // Billing: The bucket's billing configuration. 281 Billing *BucketBilling `json:"billing,omitempty"` 282 283 // Cors: The bucket's Cross-Origin Resource Sharing (CORS) 284 // configuration. 285 Cors []*BucketCors `json:"cors,omitempty"` 286 287 // DefaultEventBasedHold: The default value for event-based hold on 288 // newly created objects in this bucket. Event-based hold is a way to 289 // retain objects indefinitely until an event occurs, signified by the 290 // hold's release. After being released, such objects will be subject to 291 // bucket-level retention (if any). One sample use case of this flag is 292 // for banks to hold loan documents for at least 3 years after loan is 293 // paid in full. Here, bucket-level retention is 3 years and the event 294 // is loan being paid in full. In this example, these objects will be 295 // held intact for any number of years until the event has occurred 296 // (event-based hold on the object is released) and then 3 more years 297 // after that. That means retention duration of the objects begins from 298 // the moment event-based hold transitioned from true to false. Objects 299 // under event-based hold cannot be deleted, overwritten or archived 300 // until the hold is removed. 301 DefaultEventBasedHold bool `json:"defaultEventBasedHold,omitempty"` 302 303 // DefaultObjectAcl: Default access controls to apply to new objects 304 // when no ACL is provided. 305 DefaultObjectAcl []*ObjectAccessControl `json:"defaultObjectAcl,omitempty"` 306 307 // Encryption: Encryption configuration for a bucket. 308 Encryption *BucketEncryption `json:"encryption,omitempty"` 309 310 // Etag: HTTP 1.1 Entity tag for the bucket. 311 Etag string `json:"etag,omitempty"` 312 313 // IamConfiguration: The bucket's IAM configuration. 314 IamConfiguration *BucketIamConfiguration `json:"iamConfiguration,omitempty"` 315 316 // Id: The ID of the bucket. For buckets, the id and name properties are 317 // the same. 318 Id string `json:"id,omitempty"` 319 320 // Kind: The kind of item this is. For buckets, this is always 321 // storage#bucket. 322 Kind string `json:"kind,omitempty"` 323 324 // Labels: User-provided labels, in key/value pairs. 325 Labels map[string]string `json:"labels,omitempty"` 326 327 // Lifecycle: The bucket's lifecycle configuration. See lifecycle 328 // management for more information. 329 Lifecycle *BucketLifecycle `json:"lifecycle,omitempty"` 330 331 // Location: The location of the bucket. Object data for objects in the 332 // bucket resides in physical storage within this region. Defaults to 333 // US. See the developer's guide for the authoritative list. 334 Location string `json:"location,omitempty"` 335 336 // LocationType: The type of the bucket location. 337 LocationType string `json:"locationType,omitempty"` 338 339 // Logging: The bucket's logging configuration, which defines the 340 // destination bucket and optional name prefix for the current bucket's 341 // logs. 342 Logging *BucketLogging `json:"logging,omitempty"` 343 344 // Metageneration: The metadata generation of this bucket. 345 Metageneration int64 `json:"metageneration,omitempty,string"` 346 347 // Name: The name of the bucket. 348 Name string `json:"name,omitempty"` 349 350 // Owner: The owner of the bucket. This is always the project team's 351 // owner group. 352 Owner *BucketOwner `json:"owner,omitempty"` 353 354 // ProjectNumber: The project number of the project the bucket belongs 355 // to. 356 ProjectNumber uint64 `json:"projectNumber,omitempty,string"` 357 358 // RetentionPolicy: The bucket's retention policy. The retention policy 359 // enforces a minimum retention time for all objects contained in the 360 // bucket, based on their creation time. Any attempt to overwrite or 361 // delete objects younger than the retention period will result in a 362 // PERMISSION_DENIED error. An unlocked retention policy can be modified 363 // or removed from the bucket via a storage.buckets.update operation. A 364 // locked retention policy cannot be removed or shortened in duration 365 // for the lifetime of the bucket. Attempting to remove or decrease 366 // period of a locked retention policy will result in a 367 // PERMISSION_DENIED error. 368 RetentionPolicy *BucketRetentionPolicy `json:"retentionPolicy,omitempty"` 369 370 // SelfLink: The URI of this bucket. 371 SelfLink string `json:"selfLink,omitempty"` 372 373 // StorageClass: The bucket's default storage class, used whenever no 374 // storageClass is specified for a newly-created object. This defines 375 // how objects in the bucket are stored and determines the SLA and the 376 // cost of storage. Values include MULTI_REGIONAL, REGIONAL, STANDARD, 377 // NEARLINE, COLDLINE, ARCHIVE, and DURABLE_REDUCED_AVAILABILITY. If 378 // this value is not specified when the bucket is created, it will 379 // default to STANDARD. For more information, see storage classes. 380 StorageClass string `json:"storageClass,omitempty"` 381 382 // TimeCreated: The creation time of the bucket in RFC 3339 format. 383 TimeCreated string `json:"timeCreated,omitempty"` 384 385 // Updated: The modification time of the bucket in RFC 3339 format. 386 Updated string `json:"updated,omitempty"` 387 388 // Versioning: The bucket's versioning configuration. 389 Versioning *BucketVersioning `json:"versioning,omitempty"` 390 391 // Website: The bucket's website configuration, controlling how the 392 // service behaves when accessing bucket contents as a web site. See the 393 // Static Website Examples for more information. 394 Website *BucketWebsite `json:"website,omitempty"` 395 396 // ZoneAffinity: The zone or zones from which the bucket is intended to 397 // use zonal quota. Requests for data from outside the specified 398 // affinities are still allowed but won't be able to use zonal quota. 399 // The zone or zones need to be within the bucket location otherwise the 400 // requests will fail with a 400 Bad Request response. 401 ZoneAffinity []string `json:"zoneAffinity,omitempty"` 402 403 // ZoneSeparation: If set, objects placed in this bucket are required to 404 // be separated by disaster domain. 405 ZoneSeparation bool `json:"zoneSeparation,omitempty"` 406 407 // ServerResponse contains the HTTP response code and headers from the 408 // server. 409 googleapi.ServerResponse `json:"-"` 410 411 // ForceSendFields is a list of field names (e.g. "Acl") to 412 // unconditionally include in API requests. By default, fields with 413 // empty values are omitted from API requests. However, any non-pointer, 414 // non-interface field appearing in ForceSendFields will be sent to the 415 // server regardless of whether the field is empty or not. This may be 416 // used to include empty fields in Patch requests. 417 ForceSendFields []string `json:"-"` 418 419 // NullFields is a list of field names (e.g. "Acl") to include in API 420 // requests with the JSON null value. By default, fields with empty 421 // values are omitted from API requests. However, any field with an 422 // empty value appearing in NullFields will be sent to the server as 423 // null. It is an error if a field in this list has a non-empty value. 424 // This may be used to include null fields in Patch requests. 425 NullFields []string `json:"-"` 426} 427 428func (s *Bucket) MarshalJSON() ([]byte, error) { 429 type NoMethod Bucket 430 raw := NoMethod(*s) 431 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 432} 433 434// BucketBilling: The bucket's billing configuration. 435type BucketBilling struct { 436 // RequesterPays: When set to true, Requester Pays is enabled for this 437 // bucket. 438 RequesterPays bool `json:"requesterPays,omitempty"` 439 440 // ForceSendFields is a list of field names (e.g. "RequesterPays") to 441 // unconditionally include in API requests. By default, fields with 442 // empty values are omitted from API requests. However, any non-pointer, 443 // non-interface field appearing in ForceSendFields will be sent to the 444 // server regardless of whether the field is empty or not. This may be 445 // used to include empty fields in Patch requests. 446 ForceSendFields []string `json:"-"` 447 448 // NullFields is a list of field names (e.g. "RequesterPays") to include 449 // in API requests with the JSON null value. By default, fields with 450 // empty values are omitted from API requests. However, any field with 451 // an empty value appearing in NullFields will be sent to the server as 452 // null. It is an error if a field in this list has a non-empty value. 453 // This may be used to include null fields in Patch requests. 454 NullFields []string `json:"-"` 455} 456 457func (s *BucketBilling) MarshalJSON() ([]byte, error) { 458 type NoMethod BucketBilling 459 raw := NoMethod(*s) 460 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 461} 462 463type BucketCors struct { 464 // MaxAgeSeconds: The value, in seconds, to return in the 465 // Access-Control-Max-Age header used in preflight responses. 466 MaxAgeSeconds int64 `json:"maxAgeSeconds,omitempty"` 467 468 // Method: The list of HTTP methods on which to include CORS response 469 // headers, (GET, OPTIONS, POST, etc) Note: "*" is permitted in the list 470 // of methods, and means "any method". 471 Method []string `json:"method,omitempty"` 472 473 // Origin: The list of Origins eligible to receive CORS response 474 // headers. Note: "*" is permitted in the list of origins, and means 475 // "any Origin". 476 Origin []string `json:"origin,omitempty"` 477 478 // ResponseHeader: The list of HTTP headers other than the simple 479 // response headers to give permission for the user-agent to share 480 // across domains. 481 ResponseHeader []string `json:"responseHeader,omitempty"` 482 483 // ForceSendFields is a list of field names (e.g. "MaxAgeSeconds") to 484 // unconditionally include in API requests. By default, fields with 485 // empty values are omitted from API requests. However, any non-pointer, 486 // non-interface field appearing in ForceSendFields will be sent to the 487 // server regardless of whether the field is empty or not. This may be 488 // used to include empty fields in Patch requests. 489 ForceSendFields []string `json:"-"` 490 491 // NullFields is a list of field names (e.g. "MaxAgeSeconds") to include 492 // in API requests with the JSON null value. By default, fields with 493 // empty values are omitted from API requests. However, any field with 494 // an empty value appearing in NullFields will be sent to the server as 495 // null. It is an error if a field in this list has a non-empty value. 496 // This may be used to include null fields in Patch requests. 497 NullFields []string `json:"-"` 498} 499 500func (s *BucketCors) MarshalJSON() ([]byte, error) { 501 type NoMethod BucketCors 502 raw := NoMethod(*s) 503 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 504} 505 506// BucketEncryption: Encryption configuration for a bucket. 507type BucketEncryption struct { 508 // DefaultKmsKeyName: A Cloud KMS key that will be used to encrypt 509 // objects inserted into this bucket, if no encryption method is 510 // specified. 511 DefaultKmsKeyName string `json:"defaultKmsKeyName,omitempty"` 512 513 // ForceSendFields is a list of field names (e.g. "DefaultKmsKeyName") 514 // to unconditionally include in API requests. By default, fields with 515 // empty values are omitted from API requests. However, any non-pointer, 516 // non-interface field appearing in ForceSendFields will be sent to the 517 // server regardless of whether the field is empty or not. This may be 518 // used to include empty fields in Patch requests. 519 ForceSendFields []string `json:"-"` 520 521 // NullFields is a list of field names (e.g. "DefaultKmsKeyName") to 522 // include in API requests with the JSON null value. By default, fields 523 // with empty values are omitted from API requests. However, any field 524 // with an empty value appearing in NullFields will be sent to the 525 // server as null. It is an error if a field in this list has a 526 // non-empty value. This may be used to include null fields in Patch 527 // requests. 528 NullFields []string `json:"-"` 529} 530 531func (s *BucketEncryption) MarshalJSON() ([]byte, error) { 532 type NoMethod BucketEncryption 533 raw := NoMethod(*s) 534 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 535} 536 537// BucketIamConfiguration: The bucket's IAM configuration. 538type BucketIamConfiguration struct { 539 // BucketPolicyOnly: The bucket's uniform bucket-level access 540 // configuration. The feature was formerly known as Bucket Policy Only. 541 // For backward compatibility, this field will be populated with 542 // identical information as the uniformBucketLevelAccess field. We 543 // recommend using the uniformBucketLevelAccess field to enable and 544 // disable the feature. 545 BucketPolicyOnly *BucketIamConfigurationBucketPolicyOnly `json:"bucketPolicyOnly,omitempty"` 546 547 // UniformBucketLevelAccess: The bucket's uniform bucket-level access 548 // configuration. 549 UniformBucketLevelAccess *BucketIamConfigurationUniformBucketLevelAccess `json:"uniformBucketLevelAccess,omitempty"` 550 551 // ForceSendFields is a list of field names (e.g. "BucketPolicyOnly") to 552 // unconditionally include in API requests. By default, fields with 553 // empty values are omitted from API requests. However, any non-pointer, 554 // non-interface field appearing in ForceSendFields will be sent to the 555 // server regardless of whether the field is empty or not. This may be 556 // used to include empty fields in Patch requests. 557 ForceSendFields []string `json:"-"` 558 559 // NullFields is a list of field names (e.g. "BucketPolicyOnly") to 560 // include in API requests with the JSON null value. By default, fields 561 // with empty values are omitted from API requests. However, any field 562 // with an empty value appearing in NullFields will be sent to the 563 // server as null. It is an error if a field in this list has a 564 // non-empty value. This may be used to include null fields in Patch 565 // requests. 566 NullFields []string `json:"-"` 567} 568 569func (s *BucketIamConfiguration) MarshalJSON() ([]byte, error) { 570 type NoMethod BucketIamConfiguration 571 raw := NoMethod(*s) 572 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 573} 574 575// BucketIamConfigurationBucketPolicyOnly: The bucket's uniform 576// bucket-level access configuration. The feature was formerly known as 577// Bucket Policy Only. For backward compatibility, this field will be 578// populated with identical information as the uniformBucketLevelAccess 579// field. We recommend using the uniformBucketLevelAccess field to 580// enable and disable the feature. 581type BucketIamConfigurationBucketPolicyOnly struct { 582 // Enabled: If set, access is controlled only by bucket-level or above 583 // IAM policies. 584 Enabled bool `json:"enabled,omitempty"` 585 586 // LockedTime: The deadline for changing 587 // iamConfiguration.bucketPolicyOnly.enabled from true to false in RFC 588 // 3339 format. iamConfiguration.bucketPolicyOnly.enabled may be changed 589 // from true to false until the locked time, after which the field is 590 // immutable. 591 LockedTime string `json:"lockedTime,omitempty"` 592 593 // ForceSendFields is a list of field names (e.g. "Enabled") to 594 // unconditionally include in API requests. By default, fields with 595 // empty values are omitted from API requests. However, any non-pointer, 596 // non-interface field appearing in ForceSendFields will be sent to the 597 // server regardless of whether the field is empty or not. This may be 598 // used to include empty fields in Patch requests. 599 ForceSendFields []string `json:"-"` 600 601 // NullFields is a list of field names (e.g. "Enabled") to include in 602 // API requests with the JSON null value. By default, fields with empty 603 // values are omitted from API requests. However, any field with an 604 // empty value appearing in NullFields will be sent to the server as 605 // null. It is an error if a field in this list has a non-empty value. 606 // This may be used to include null fields in Patch requests. 607 NullFields []string `json:"-"` 608} 609 610func (s *BucketIamConfigurationBucketPolicyOnly) MarshalJSON() ([]byte, error) { 611 type NoMethod BucketIamConfigurationBucketPolicyOnly 612 raw := NoMethod(*s) 613 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 614} 615 616// BucketIamConfigurationUniformBucketLevelAccess: The bucket's uniform 617// bucket-level access configuration. 618type BucketIamConfigurationUniformBucketLevelAccess struct { 619 // Enabled: If set, access is controlled only by bucket-level or above 620 // IAM policies. 621 Enabled bool `json:"enabled,omitempty"` 622 623 // LockedTime: The deadline for changing 624 // iamConfiguration.uniformBucketLevelAccess.enabled from true to false 625 // in RFC 3339 format. 626 // iamConfiguration.uniformBucketLevelAccess.enabled may be changed from 627 // true to false until the locked time, after which the field is 628 // immutable. 629 LockedTime string `json:"lockedTime,omitempty"` 630 631 // ForceSendFields is a list of field names (e.g. "Enabled") to 632 // unconditionally include in API requests. By default, fields with 633 // empty values are omitted from API requests. However, any non-pointer, 634 // non-interface field appearing in ForceSendFields will be sent to the 635 // server regardless of whether the field is empty or not. This may be 636 // used to include empty fields in Patch requests. 637 ForceSendFields []string `json:"-"` 638 639 // NullFields is a list of field names (e.g. "Enabled") to include in 640 // API requests with the JSON null value. By default, fields with empty 641 // values are omitted from API requests. However, any field with an 642 // empty value appearing in NullFields will be sent to the server as 643 // null. It is an error if a field in this list has a non-empty value. 644 // This may be used to include null fields in Patch requests. 645 NullFields []string `json:"-"` 646} 647 648func (s *BucketIamConfigurationUniformBucketLevelAccess) MarshalJSON() ([]byte, error) { 649 type NoMethod BucketIamConfigurationUniformBucketLevelAccess 650 raw := NoMethod(*s) 651 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 652} 653 654// BucketLifecycle: The bucket's lifecycle configuration. See lifecycle 655// management for more information. 656type BucketLifecycle struct { 657 // Rule: A lifecycle management rule, which is made of an action to take 658 // and the condition(s) under which the action will be taken. 659 Rule []*BucketLifecycleRule `json:"rule,omitempty"` 660 661 // ForceSendFields is a list of field names (e.g. "Rule") to 662 // unconditionally include in API requests. By default, fields with 663 // empty values are omitted from API requests. However, any non-pointer, 664 // non-interface field appearing in ForceSendFields will be sent to the 665 // server regardless of whether the field is empty or not. This may be 666 // used to include empty fields in Patch requests. 667 ForceSendFields []string `json:"-"` 668 669 // NullFields is a list of field names (e.g. "Rule") to include in API 670 // requests with the JSON null value. By default, fields with empty 671 // values are omitted from API requests. However, any field with an 672 // empty value appearing in NullFields will be sent to the server as 673 // null. It is an error if a field in this list has a non-empty value. 674 // This may be used to include null fields in Patch requests. 675 NullFields []string `json:"-"` 676} 677 678func (s *BucketLifecycle) MarshalJSON() ([]byte, error) { 679 type NoMethod BucketLifecycle 680 raw := NoMethod(*s) 681 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 682} 683 684type BucketLifecycleRule struct { 685 // Action: The action to take. 686 Action *BucketLifecycleRuleAction `json:"action,omitempty"` 687 688 // Condition: The condition(s) under which the action will be taken. 689 Condition *BucketLifecycleRuleCondition `json:"condition,omitempty"` 690 691 // ForceSendFields is a list of field names (e.g. "Action") to 692 // unconditionally include in API requests. By default, fields with 693 // empty values are omitted from API requests. However, any non-pointer, 694 // non-interface field appearing in ForceSendFields will be sent to the 695 // server regardless of whether the field is empty or not. This may be 696 // used to include empty fields in Patch requests. 697 ForceSendFields []string `json:"-"` 698 699 // NullFields is a list of field names (e.g. "Action") to include in API 700 // requests with the JSON null value. By default, fields with empty 701 // values are omitted from API requests. However, any field with an 702 // empty value appearing in NullFields will be sent to the server as 703 // null. It is an error if a field in this list has a non-empty value. 704 // This may be used to include null fields in Patch requests. 705 NullFields []string `json:"-"` 706} 707 708func (s *BucketLifecycleRule) MarshalJSON() ([]byte, error) { 709 type NoMethod BucketLifecycleRule 710 raw := NoMethod(*s) 711 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 712} 713 714// BucketLifecycleRuleAction: The action to take. 715type BucketLifecycleRuleAction struct { 716 // StorageClass: Target storage class. Required iff the type of the 717 // action is SetStorageClass. 718 StorageClass string `json:"storageClass,omitempty"` 719 720 // Type: Type of the action. Currently, only Delete and SetStorageClass 721 // are supported. 722 Type string `json:"type,omitempty"` 723 724 // ForceSendFields is a list of field names (e.g. "StorageClass") to 725 // unconditionally include in API requests. By default, fields with 726 // empty values are omitted from API requests. However, any non-pointer, 727 // non-interface field appearing in ForceSendFields will be sent to the 728 // server regardless of whether the field is empty or not. This may be 729 // used to include empty fields in Patch requests. 730 ForceSendFields []string `json:"-"` 731 732 // NullFields is a list of field names (e.g. "StorageClass") to include 733 // in API requests with the JSON null value. By default, fields with 734 // empty values are omitted from API requests. However, any field with 735 // an empty value appearing in NullFields will be sent to the server as 736 // null. It is an error if a field in this list has a non-empty value. 737 // This may be used to include null fields in Patch requests. 738 NullFields []string `json:"-"` 739} 740 741func (s *BucketLifecycleRuleAction) MarshalJSON() ([]byte, error) { 742 type NoMethod BucketLifecycleRuleAction 743 raw := NoMethod(*s) 744 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 745} 746 747// BucketLifecycleRuleCondition: The condition(s) under which the action 748// will be taken. 749type BucketLifecycleRuleCondition struct { 750 // Age: Age of an object (in days). This condition is satisfied when an 751 // object reaches the specified age. 752 Age int64 `json:"age,omitempty"` 753 754 // CreatedBefore: A date in RFC 3339 format with only the date part (for 755 // instance, "2013-01-15"). This condition is satisfied when an object 756 // is created before midnight of the specified date in UTC. 757 CreatedBefore string `json:"createdBefore,omitempty"` 758 759 // CustomTimeBefore: A timestamp in RFC 3339 format. This condition is 760 // satisfied when the custom time on an object is before this timestamp. 761 CustomTimeBefore string `json:"customTimeBefore,omitempty"` 762 763 // DaysSinceCustomTime: Number of days elapsed since the user-specified 764 // timestamp set on an object. The condition is satisfied if the days 765 // elapsed is at least this number. If no custom timestamp is specified 766 // on an object, the condition does not apply. 767 DaysSinceCustomTime int64 `json:"daysSinceCustomTime,omitempty"` 768 769 // DaysSinceNoncurrentTime: Number of days elapsed since the noncurrent 770 // timestamp of an object. The condition is satisfied if the days 771 // elapsed is at least this number. This condition is relevant only for 772 // versioned objects. The value of the field must be a nonnegative 773 // integer. If it's zero, the object version will become eligible for 774 // Lifecycle action as soon as it becomes noncurrent. 775 DaysSinceNoncurrentTime int64 `json:"daysSinceNoncurrentTime,omitempty"` 776 777 // IsLive: Relevant only for versioned objects. If the value is true, 778 // this condition matches live objects; if the value is false, it 779 // matches archived objects. 780 IsLive *bool `json:"isLive,omitempty"` 781 782 // MatchesPattern: A regular expression that satisfies the RE2 syntax. 783 // This condition is satisfied when the name of the object matches the 784 // RE2 pattern. Note: This feature is currently in the "Early Access" 785 // launch stage and is only available to a whitelisted set of users; 786 // that means that this feature may be changed in backward-incompatible 787 // ways and that it is not guaranteed to be released. 788 MatchesPattern string `json:"matchesPattern,omitempty"` 789 790 // MatchesStorageClass: Objects having any of the storage classes 791 // specified by this condition will be matched. Values include 792 // MULTI_REGIONAL, REGIONAL, NEARLINE, COLDLINE, ARCHIVE, STANDARD, and 793 // DURABLE_REDUCED_AVAILABILITY. 794 MatchesStorageClass []string `json:"matchesStorageClass,omitempty"` 795 796 // NoncurrentTimeBefore: A timestamp in RFC 3339 format. This condition 797 // is satisfied when the noncurrent time on an object is before this 798 // timestamp. This condition is relevant only for versioned objects. 799 NoncurrentTimeBefore string `json:"noncurrentTimeBefore,omitempty"` 800 801 // NumNewerVersions: Relevant only for versioned objects. If the value 802 // is N, this condition is satisfied when there are at least N versions 803 // (including the live version) newer than this version of the object. 804 NumNewerVersions int64 `json:"numNewerVersions,omitempty"` 805 806 // ForceSendFields is a list of field names (e.g. "Age") to 807 // unconditionally include in API requests. By default, fields with 808 // empty values are omitted from API requests. However, any non-pointer, 809 // non-interface field appearing in ForceSendFields will be sent to the 810 // server regardless of whether the field is empty or not. This may be 811 // used to include empty fields in Patch requests. 812 ForceSendFields []string `json:"-"` 813 814 // NullFields is a list of field names (e.g. "Age") to include in API 815 // requests with the JSON null value. By default, fields with empty 816 // values are omitted from API requests. However, any field with an 817 // empty value appearing in NullFields will be sent to the server as 818 // null. It is an error if a field in this list has a non-empty value. 819 // This may be used to include null fields in Patch requests. 820 NullFields []string `json:"-"` 821} 822 823func (s *BucketLifecycleRuleCondition) MarshalJSON() ([]byte, error) { 824 type NoMethod BucketLifecycleRuleCondition 825 raw := NoMethod(*s) 826 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 827} 828 829// BucketLogging: The bucket's logging configuration, which defines the 830// destination bucket and optional name prefix for the current bucket's 831// logs. 832type BucketLogging struct { 833 // LogBucket: The destination bucket where the current bucket's logs 834 // should be placed. 835 LogBucket string `json:"logBucket,omitempty"` 836 837 // LogObjectPrefix: A prefix for log object names. 838 LogObjectPrefix string `json:"logObjectPrefix,omitempty"` 839 840 // ForceSendFields is a list of field names (e.g. "LogBucket") to 841 // unconditionally include in API requests. By default, fields with 842 // empty values are omitted from API requests. However, any non-pointer, 843 // non-interface field appearing in ForceSendFields will be sent to the 844 // server regardless of whether the field is empty or not. This may be 845 // used to include empty fields in Patch requests. 846 ForceSendFields []string `json:"-"` 847 848 // NullFields is a list of field names (e.g. "LogBucket") to include in 849 // API requests with the JSON null value. By default, fields with empty 850 // values are omitted from API requests. However, any field with an 851 // empty value appearing in NullFields will be sent to the server as 852 // null. It is an error if a field in this list has a non-empty value. 853 // This may be used to include null fields in Patch requests. 854 NullFields []string `json:"-"` 855} 856 857func (s *BucketLogging) MarshalJSON() ([]byte, error) { 858 type NoMethod BucketLogging 859 raw := NoMethod(*s) 860 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 861} 862 863// BucketOwner: The owner of the bucket. This is always the project 864// team's owner group. 865type BucketOwner struct { 866 // Entity: The entity, in the form project-owner-projectId. 867 Entity string `json:"entity,omitempty"` 868 869 // EntityId: The ID for the entity. 870 EntityId string `json:"entityId,omitempty"` 871 872 // ForceSendFields is a list of field names (e.g. "Entity") to 873 // unconditionally include in API requests. By default, fields with 874 // empty values are omitted from API requests. However, any non-pointer, 875 // non-interface field appearing in ForceSendFields will be sent to the 876 // server regardless of whether the field is empty or not. This may be 877 // used to include empty fields in Patch requests. 878 ForceSendFields []string `json:"-"` 879 880 // NullFields is a list of field names (e.g. "Entity") to include in API 881 // requests with the JSON null value. By default, fields with empty 882 // values are omitted from API requests. However, any field with an 883 // empty value appearing in NullFields will be sent to the server as 884 // null. It is an error if a field in this list has a non-empty value. 885 // This may be used to include null fields in Patch requests. 886 NullFields []string `json:"-"` 887} 888 889func (s *BucketOwner) MarshalJSON() ([]byte, error) { 890 type NoMethod BucketOwner 891 raw := NoMethod(*s) 892 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 893} 894 895// BucketRetentionPolicy: The bucket's retention policy. The retention 896// policy enforces a minimum retention time for all objects contained in 897// the bucket, based on their creation time. Any attempt to overwrite or 898// delete objects younger than the retention period will result in a 899// PERMISSION_DENIED error. An unlocked retention policy can be modified 900// or removed from the bucket via a storage.buckets.update operation. A 901// locked retention policy cannot be removed or shortened in duration 902// for the lifetime of the bucket. Attempting to remove or decrease 903// period of a locked retention policy will result in a 904// PERMISSION_DENIED error. 905type BucketRetentionPolicy struct { 906 // EffectiveTime: Server-determined value that indicates the time from 907 // which policy was enforced and effective. This value is in RFC 3339 908 // format. 909 EffectiveTime string `json:"effectiveTime,omitempty"` 910 911 // IsLocked: Once locked, an object retention policy cannot be modified. 912 IsLocked bool `json:"isLocked,omitempty"` 913 914 // RetentionPeriod: The duration in seconds that objects need to be 915 // retained. Retention duration must be greater than zero and less than 916 // 100 years. Note that enforcement of retention periods less than a day 917 // is not guaranteed. Such periods should only be used for testing 918 // purposes. 919 RetentionPeriod int64 `json:"retentionPeriod,omitempty,string"` 920 921 // ForceSendFields is a list of field names (e.g. "EffectiveTime") to 922 // unconditionally include in API requests. By default, fields with 923 // empty values are omitted from API requests. However, any non-pointer, 924 // non-interface field appearing in ForceSendFields will be sent to the 925 // server regardless of whether the field is empty or not. This may be 926 // used to include empty fields in Patch requests. 927 ForceSendFields []string `json:"-"` 928 929 // NullFields is a list of field names (e.g. "EffectiveTime") to include 930 // in API requests with the JSON null value. By default, fields with 931 // empty values are omitted from API requests. However, any field with 932 // an empty value appearing in NullFields will be sent to the server as 933 // null. It is an error if a field in this list has a non-empty value. 934 // This may be used to include null fields in Patch requests. 935 NullFields []string `json:"-"` 936} 937 938func (s *BucketRetentionPolicy) MarshalJSON() ([]byte, error) { 939 type NoMethod BucketRetentionPolicy 940 raw := NoMethod(*s) 941 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 942} 943 944// BucketVersioning: The bucket's versioning configuration. 945type BucketVersioning struct { 946 // Enabled: While set to true, versioning is fully enabled for this 947 // bucket. 948 Enabled bool `json:"enabled,omitempty"` 949 950 // ForceSendFields is a list of field names (e.g. "Enabled") to 951 // unconditionally include in API requests. By default, fields with 952 // empty values are omitted from API requests. However, any non-pointer, 953 // non-interface field appearing in ForceSendFields will be sent to the 954 // server regardless of whether the field is empty or not. This may be 955 // used to include empty fields in Patch requests. 956 ForceSendFields []string `json:"-"` 957 958 // NullFields is a list of field names (e.g. "Enabled") to include in 959 // API requests with the JSON null value. By default, fields with empty 960 // values are omitted from API requests. However, any field with an 961 // empty value appearing in NullFields will be sent to the server as 962 // null. It is an error if a field in this list has a non-empty value. 963 // This may be used to include null fields in Patch requests. 964 NullFields []string `json:"-"` 965} 966 967func (s *BucketVersioning) MarshalJSON() ([]byte, error) { 968 type NoMethod BucketVersioning 969 raw := NoMethod(*s) 970 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 971} 972 973// BucketWebsite: The bucket's website configuration, controlling how 974// the service behaves when accessing bucket contents as a web site. See 975// the Static Website Examples for more information. 976type BucketWebsite struct { 977 // MainPageSuffix: If the requested object path is missing, the service 978 // will ensure the path has a trailing '/', append this suffix, and 979 // attempt to retrieve the resulting object. This allows the creation of 980 // index.html objects to represent directory pages. 981 MainPageSuffix string `json:"mainPageSuffix,omitempty"` 982 983 // NotFoundPage: If the requested object path is missing, and any 984 // mainPageSuffix object is missing, if applicable, the service will 985 // return the named object from this bucket as the content for a 404 Not 986 // Found result. 987 NotFoundPage string `json:"notFoundPage,omitempty"` 988 989 // ForceSendFields is a list of field names (e.g. "MainPageSuffix") to 990 // unconditionally include in API requests. By default, fields with 991 // empty values are omitted from API requests. However, any non-pointer, 992 // non-interface field appearing in ForceSendFields will be sent to the 993 // server regardless of whether the field is empty or not. This may be 994 // used to include empty fields in Patch requests. 995 ForceSendFields []string `json:"-"` 996 997 // NullFields is a list of field names (e.g. "MainPageSuffix") to 998 // include in API requests with the JSON null value. By default, fields 999 // with empty values are omitted from API requests. However, any field 1000 // with an empty value appearing in NullFields will be sent to the 1001 // server as null. It is an error if a field in this list has a 1002 // non-empty value. This may be used to include null fields in Patch 1003 // requests. 1004 NullFields []string `json:"-"` 1005} 1006 1007func (s *BucketWebsite) MarshalJSON() ([]byte, error) { 1008 type NoMethod BucketWebsite 1009 raw := NoMethod(*s) 1010 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1011} 1012 1013// BucketAccessControl: An access-control entry. 1014type BucketAccessControl struct { 1015 // Bucket: The name of the bucket. 1016 Bucket string `json:"bucket,omitempty"` 1017 1018 // Domain: The domain associated with the entity, if any. 1019 Domain string `json:"domain,omitempty"` 1020 1021 // Email: The email address associated with the entity, if any. 1022 Email string `json:"email,omitempty"` 1023 1024 // Entity: The entity holding the permission, in one of the following 1025 // forms: 1026 // - user-userId 1027 // - user-email 1028 // - group-groupId 1029 // - group-email 1030 // - domain-domain 1031 // - project-team-projectId 1032 // - allUsers 1033 // - allAuthenticatedUsers Examples: 1034 // - The user liz@example.com would be user-liz@example.com. 1035 // - The group example@googlegroups.com would be 1036 // group-example@googlegroups.com. 1037 // - To refer to all members of the Google Apps for Business domain 1038 // example.com, the entity would be domain-example.com. 1039 Entity string `json:"entity,omitempty"` 1040 1041 // EntityId: The ID for the entity, if any. 1042 EntityId string `json:"entityId,omitempty"` 1043 1044 // Etag: HTTP 1.1 Entity tag for the access-control entry. 1045 Etag string `json:"etag,omitempty"` 1046 1047 // Id: The ID of the access-control entry. 1048 Id string `json:"id,omitempty"` 1049 1050 // Kind: The kind of item this is. For bucket access control entries, 1051 // this is always storage#bucketAccessControl. 1052 Kind string `json:"kind,omitempty"` 1053 1054 // ProjectTeam: The project team associated with the entity, if any. 1055 ProjectTeam *BucketAccessControlProjectTeam `json:"projectTeam,omitempty"` 1056 1057 // Role: The access permission for the entity. 1058 Role string `json:"role,omitempty"` 1059 1060 // SelfLink: The link to this access-control entry. 1061 SelfLink string `json:"selfLink,omitempty"` 1062 1063 // ServerResponse contains the HTTP response code and headers from the 1064 // server. 1065 googleapi.ServerResponse `json:"-"` 1066 1067 // ForceSendFields is a list of field names (e.g. "Bucket") to 1068 // unconditionally include in API requests. By default, fields with 1069 // empty values are omitted from API requests. However, any non-pointer, 1070 // non-interface field appearing in ForceSendFields will be sent to the 1071 // server regardless of whether the field is empty or not. This may be 1072 // used to include empty fields in Patch requests. 1073 ForceSendFields []string `json:"-"` 1074 1075 // NullFields is a list of field names (e.g. "Bucket") to include in API 1076 // requests with the JSON null value. By default, fields with empty 1077 // values are omitted from API requests. However, any field with an 1078 // empty value appearing in NullFields will be sent to the server as 1079 // null. It is an error if a field in this list has a non-empty value. 1080 // This may be used to include null fields in Patch requests. 1081 NullFields []string `json:"-"` 1082} 1083 1084func (s *BucketAccessControl) MarshalJSON() ([]byte, error) { 1085 type NoMethod BucketAccessControl 1086 raw := NoMethod(*s) 1087 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1088} 1089 1090// BucketAccessControlProjectTeam: The project team associated with the 1091// entity, if any. 1092type BucketAccessControlProjectTeam struct { 1093 // ProjectNumber: The project number. 1094 ProjectNumber string `json:"projectNumber,omitempty"` 1095 1096 // Team: The team. 1097 Team string `json:"team,omitempty"` 1098 1099 // ForceSendFields is a list of field names (e.g. "ProjectNumber") to 1100 // unconditionally include in API requests. By default, fields with 1101 // empty values are omitted from API requests. However, any non-pointer, 1102 // non-interface field appearing in ForceSendFields will be sent to the 1103 // server regardless of whether the field is empty or not. This may be 1104 // used to include empty fields in Patch requests. 1105 ForceSendFields []string `json:"-"` 1106 1107 // NullFields is a list of field names (e.g. "ProjectNumber") to include 1108 // in API requests with the JSON null value. By default, fields with 1109 // empty values are omitted from API requests. However, any field with 1110 // an empty value appearing in NullFields will be sent to the server as 1111 // null. It is an error if a field in this list has a non-empty value. 1112 // This may be used to include null fields in Patch requests. 1113 NullFields []string `json:"-"` 1114} 1115 1116func (s *BucketAccessControlProjectTeam) MarshalJSON() ([]byte, error) { 1117 type NoMethod BucketAccessControlProjectTeam 1118 raw := NoMethod(*s) 1119 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1120} 1121 1122// BucketAccessControls: An access-control list. 1123type BucketAccessControls struct { 1124 // Items: The list of items. 1125 Items []*BucketAccessControl `json:"items,omitempty"` 1126 1127 // Kind: The kind of item this is. For lists of bucket access control 1128 // entries, this is always storage#bucketAccessControls. 1129 Kind string `json:"kind,omitempty"` 1130 1131 // ServerResponse contains the HTTP response code and headers from the 1132 // server. 1133 googleapi.ServerResponse `json:"-"` 1134 1135 // ForceSendFields is a list of field names (e.g. "Items") to 1136 // unconditionally include in API requests. By default, fields with 1137 // empty values are omitted from API requests. However, any non-pointer, 1138 // non-interface field appearing in ForceSendFields will be sent to the 1139 // server regardless of whether the field is empty or not. This may be 1140 // used to include empty fields in Patch requests. 1141 ForceSendFields []string `json:"-"` 1142 1143 // NullFields is a list of field names (e.g. "Items") to include in API 1144 // requests with the JSON null value. By default, fields with empty 1145 // values are omitted from API requests. However, any field with an 1146 // empty value appearing in NullFields will be sent to the server as 1147 // null. It is an error if a field in this list has a non-empty value. 1148 // This may be used to include null fields in Patch requests. 1149 NullFields []string `json:"-"` 1150} 1151 1152func (s *BucketAccessControls) MarshalJSON() ([]byte, error) { 1153 type NoMethod BucketAccessControls 1154 raw := NoMethod(*s) 1155 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1156} 1157 1158// Buckets: A list of buckets. 1159type Buckets struct { 1160 // Items: The list of items. 1161 Items []*Bucket `json:"items,omitempty"` 1162 1163 // Kind: The kind of item this is. For lists of buckets, this is always 1164 // storage#buckets. 1165 Kind string `json:"kind,omitempty"` 1166 1167 // NextPageToken: The continuation token, used to page through large 1168 // result sets. Provide this value in a subsequent request to return the 1169 // next page of results. 1170 NextPageToken string `json:"nextPageToken,omitempty"` 1171 1172 // ServerResponse contains the HTTP response code and headers from the 1173 // server. 1174 googleapi.ServerResponse `json:"-"` 1175 1176 // ForceSendFields is a list of field names (e.g. "Items") to 1177 // unconditionally include in API requests. By default, fields with 1178 // empty values are omitted from API requests. However, any non-pointer, 1179 // non-interface field appearing in ForceSendFields will be sent to the 1180 // server regardless of whether the field is empty or not. This may be 1181 // used to include empty fields in Patch requests. 1182 ForceSendFields []string `json:"-"` 1183 1184 // NullFields is a list of field names (e.g. "Items") to include in API 1185 // requests with the JSON null value. By default, fields with empty 1186 // values are omitted from API requests. However, any field with an 1187 // empty value appearing in NullFields will be sent to the server as 1188 // null. It is an error if a field in this list has a non-empty value. 1189 // This may be used to include null fields in Patch requests. 1190 NullFields []string `json:"-"` 1191} 1192 1193func (s *Buckets) MarshalJSON() ([]byte, error) { 1194 type NoMethod Buckets 1195 raw := NoMethod(*s) 1196 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1197} 1198 1199// Channel: An notification channel used to watch for resource changes. 1200type Channel struct { 1201 // Address: The address where notifications are delivered for this 1202 // channel. 1203 Address string `json:"address,omitempty"` 1204 1205 // Expiration: Date and time of notification channel expiration, 1206 // expressed as a Unix timestamp, in milliseconds. Optional. 1207 Expiration int64 `json:"expiration,omitempty,string"` 1208 1209 // Id: A UUID or similar unique string that identifies this channel. 1210 Id string `json:"id,omitempty"` 1211 1212 // Kind: Identifies this as a notification channel used to watch for 1213 // changes to a resource, which is "api#channel". 1214 Kind string `json:"kind,omitempty"` 1215 1216 // Params: Additional parameters controlling delivery channel behavior. 1217 // Optional. 1218 Params map[string]string `json:"params,omitempty"` 1219 1220 // Payload: A Boolean value to indicate whether payload is wanted. 1221 // Optional. 1222 Payload bool `json:"payload,omitempty"` 1223 1224 // ResourceId: An opaque ID that identifies the resource being watched 1225 // on this channel. Stable across different API versions. 1226 ResourceId string `json:"resourceId,omitempty"` 1227 1228 // ResourceUri: A version-specific identifier for the watched resource. 1229 ResourceUri string `json:"resourceUri,omitempty"` 1230 1231 // Token: An arbitrary string delivered to the target address with each 1232 // notification delivered over this channel. Optional. 1233 Token string `json:"token,omitempty"` 1234 1235 // Type: The type of delivery mechanism used for this channel. 1236 Type string `json:"type,omitempty"` 1237 1238 // ServerResponse contains the HTTP response code and headers from the 1239 // server. 1240 googleapi.ServerResponse `json:"-"` 1241 1242 // ForceSendFields is a list of field names (e.g. "Address") to 1243 // unconditionally include in API requests. By default, fields with 1244 // empty values are omitted from API requests. However, any non-pointer, 1245 // non-interface field appearing in ForceSendFields will be sent to the 1246 // server regardless of whether the field is empty or not. This may be 1247 // used to include empty fields in Patch requests. 1248 ForceSendFields []string `json:"-"` 1249 1250 // NullFields is a list of field names (e.g. "Address") to include in 1251 // API requests with the JSON null value. By default, fields with empty 1252 // values are omitted from API requests. However, any field with an 1253 // empty value appearing in NullFields will be sent to the server as 1254 // null. It is an error if a field in this list has a non-empty value. 1255 // This may be used to include null fields in Patch requests. 1256 NullFields []string `json:"-"` 1257} 1258 1259func (s *Channel) MarshalJSON() ([]byte, error) { 1260 type NoMethod Channel 1261 raw := NoMethod(*s) 1262 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1263} 1264 1265// ComposeRequest: A Compose request. 1266type ComposeRequest struct { 1267 // Destination: Properties of the resulting object. 1268 Destination *Object `json:"destination,omitempty"` 1269 1270 // Kind: The kind of item this is. 1271 Kind string `json:"kind,omitempty"` 1272 1273 // SourceObjects: The list of source objects that will be concatenated 1274 // into a single object. 1275 SourceObjects []*ComposeRequestSourceObjects `json:"sourceObjects,omitempty"` 1276 1277 // ForceSendFields is a list of field names (e.g. "Destination") to 1278 // unconditionally include in API requests. By default, fields with 1279 // empty values are omitted from API requests. However, any non-pointer, 1280 // non-interface field appearing in ForceSendFields will be sent to the 1281 // server regardless of whether the field is empty or not. This may be 1282 // used to include empty fields in Patch requests. 1283 ForceSendFields []string `json:"-"` 1284 1285 // NullFields is a list of field names (e.g. "Destination") to include 1286 // in API requests with the JSON null value. By default, fields with 1287 // empty values are omitted from API requests. However, any field with 1288 // an empty value appearing in NullFields will be sent to the server as 1289 // null. It is an error if a field in this list has a non-empty value. 1290 // This may be used to include null fields in Patch requests. 1291 NullFields []string `json:"-"` 1292} 1293 1294func (s *ComposeRequest) MarshalJSON() ([]byte, error) { 1295 type NoMethod ComposeRequest 1296 raw := NoMethod(*s) 1297 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1298} 1299 1300type ComposeRequestSourceObjects struct { 1301 // Generation: The generation of this object to use as the source. 1302 Generation int64 `json:"generation,omitempty,string"` 1303 1304 // Name: The source object's name. All source objects must reside in the 1305 // same bucket. 1306 Name string `json:"name,omitempty"` 1307 1308 // ObjectPreconditions: Conditions that must be met for this operation 1309 // to execute. 1310 ObjectPreconditions *ComposeRequestSourceObjectsObjectPreconditions `json:"objectPreconditions,omitempty"` 1311 1312 // ForceSendFields is a list of field names (e.g. "Generation") to 1313 // unconditionally include in API requests. By default, fields with 1314 // empty values are omitted from API requests. However, any non-pointer, 1315 // non-interface field appearing in ForceSendFields will be sent to the 1316 // server regardless of whether the field is empty or not. This may be 1317 // used to include empty fields in Patch requests. 1318 ForceSendFields []string `json:"-"` 1319 1320 // NullFields is a list of field names (e.g. "Generation") to include in 1321 // API requests with the JSON null value. By default, fields with empty 1322 // values are omitted from API requests. However, any field with an 1323 // empty value appearing in NullFields will be sent to the server as 1324 // null. It is an error if a field in this list has a non-empty value. 1325 // This may be used to include null fields in Patch requests. 1326 NullFields []string `json:"-"` 1327} 1328 1329func (s *ComposeRequestSourceObjects) MarshalJSON() ([]byte, error) { 1330 type NoMethod ComposeRequestSourceObjects 1331 raw := NoMethod(*s) 1332 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1333} 1334 1335// ComposeRequestSourceObjectsObjectPreconditions: Conditions that must 1336// be met for this operation to execute. 1337type ComposeRequestSourceObjectsObjectPreconditions struct { 1338 // IfGenerationMatch: Only perform the composition if the generation of 1339 // the source object that would be used matches this value. If this 1340 // value and a generation are both specified, they must be the same 1341 // value or the call will fail. 1342 IfGenerationMatch int64 `json:"ifGenerationMatch,omitempty,string"` 1343 1344 // ForceSendFields is a list of field names (e.g. "IfGenerationMatch") 1345 // to unconditionally include in API requests. By default, fields with 1346 // empty values are omitted from API requests. However, any non-pointer, 1347 // non-interface field appearing in ForceSendFields will be sent to the 1348 // server regardless of whether the field is empty or not. This may be 1349 // used to include empty fields in Patch requests. 1350 ForceSendFields []string `json:"-"` 1351 1352 // NullFields is a list of field names (e.g. "IfGenerationMatch") to 1353 // include in API requests with the JSON null value. By default, fields 1354 // with empty values are omitted from API requests. However, any field 1355 // with an empty value appearing in NullFields will be sent to the 1356 // server as null. It is an error if a field in this list has a 1357 // non-empty value. This may be used to include null fields in Patch 1358 // requests. 1359 NullFields []string `json:"-"` 1360} 1361 1362func (s *ComposeRequestSourceObjectsObjectPreconditions) MarshalJSON() ([]byte, error) { 1363 type NoMethod ComposeRequestSourceObjectsObjectPreconditions 1364 raw := NoMethod(*s) 1365 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1366} 1367 1368// Expr: Represents an expression text. Example: title: "User account 1369// presence" description: "Determines whether the request has a user 1370// account" expression: "size(request.user) > 0" 1371type Expr struct { 1372 // Description: An optional description of the expression. This is a 1373 // longer text which describes the expression, e.g. when hovered over it 1374 // in a UI. 1375 Description string `json:"description,omitempty"` 1376 1377 // Expression: Textual representation of an expression in Common 1378 // Expression Language syntax. The application context of the containing 1379 // message determines which well-known feature set of CEL is supported. 1380 Expression string `json:"expression,omitempty"` 1381 1382 // Location: An optional string indicating the location of the 1383 // expression for error reporting, e.g. a file name and a position in 1384 // the file. 1385 Location string `json:"location,omitempty"` 1386 1387 // Title: An optional title for the expression, i.e. a short string 1388 // describing its purpose. This can be used e.g. in UIs which allow to 1389 // enter the expression. 1390 Title string `json:"title,omitempty"` 1391 1392 // ForceSendFields is a list of field names (e.g. "Description") to 1393 // unconditionally include in API requests. By default, fields with 1394 // empty values are omitted from API requests. However, any non-pointer, 1395 // non-interface field appearing in ForceSendFields will be sent to the 1396 // server regardless of whether the field is empty or not. This may be 1397 // used to include empty fields in Patch requests. 1398 ForceSendFields []string `json:"-"` 1399 1400 // NullFields is a list of field names (e.g. "Description") to include 1401 // in API requests with the JSON null value. By default, fields with 1402 // empty values are omitted from API requests. However, any field with 1403 // an empty value appearing in NullFields will be sent to the server as 1404 // null. It is an error if a field in this list has a non-empty value. 1405 // This may be used to include null fields in Patch requests. 1406 NullFields []string `json:"-"` 1407} 1408 1409func (s *Expr) MarshalJSON() ([]byte, error) { 1410 type NoMethod Expr 1411 raw := NoMethod(*s) 1412 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1413} 1414 1415// HmacKey: JSON template to produce a JSON-style HMAC Key resource for 1416// Create responses. 1417type HmacKey struct { 1418 // Kind: The kind of item this is. For HMAC keys, this is always 1419 // storage#hmacKey. 1420 Kind string `json:"kind,omitempty"` 1421 1422 // Metadata: Key metadata. 1423 Metadata *HmacKeyMetadata `json:"metadata,omitempty"` 1424 1425 // Secret: HMAC secret key material. 1426 Secret string `json:"secret,omitempty"` 1427 1428 // ServerResponse contains the HTTP response code and headers from the 1429 // server. 1430 googleapi.ServerResponse `json:"-"` 1431 1432 // ForceSendFields is a list of field names (e.g. "Kind") to 1433 // unconditionally include in API requests. By default, fields with 1434 // empty values are omitted from API requests. However, any non-pointer, 1435 // non-interface field appearing in ForceSendFields will be sent to the 1436 // server regardless of whether the field is empty or not. This may be 1437 // used to include empty fields in Patch requests. 1438 ForceSendFields []string `json:"-"` 1439 1440 // NullFields is a list of field names (e.g. "Kind") to include in API 1441 // requests with the JSON null value. By default, fields with empty 1442 // values are omitted from API requests. However, any field with an 1443 // empty value appearing in NullFields will be sent to the server as 1444 // null. It is an error if a field in this list has a non-empty value. 1445 // This may be used to include null fields in Patch requests. 1446 NullFields []string `json:"-"` 1447} 1448 1449func (s *HmacKey) MarshalJSON() ([]byte, error) { 1450 type NoMethod HmacKey 1451 raw := NoMethod(*s) 1452 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1453} 1454 1455// HmacKeyMetadata: JSON template to produce a JSON-style HMAC Key 1456// metadata resource. 1457type HmacKeyMetadata struct { 1458 // AccessId: The ID of the HMAC Key. 1459 AccessId string `json:"accessId,omitempty"` 1460 1461 // Etag: HTTP 1.1 Entity tag for the HMAC key. 1462 Etag string `json:"etag,omitempty"` 1463 1464 // Id: The ID of the HMAC key, including the Project ID and the Access 1465 // ID. 1466 Id string `json:"id,omitempty"` 1467 1468 // Kind: The kind of item this is. For HMAC Key metadata, this is always 1469 // storage#hmacKeyMetadata. 1470 Kind string `json:"kind,omitempty"` 1471 1472 // ProjectId: Project ID owning the service account to which the key 1473 // authenticates. 1474 ProjectId string `json:"projectId,omitempty"` 1475 1476 // SelfLink: The link to this resource. 1477 SelfLink string `json:"selfLink,omitempty"` 1478 1479 // ServiceAccountEmail: The email address of the key's associated 1480 // service account. 1481 ServiceAccountEmail string `json:"serviceAccountEmail,omitempty"` 1482 1483 // State: The state of the key. Can be one of ACTIVE, INACTIVE, or 1484 // DELETED. 1485 State string `json:"state,omitempty"` 1486 1487 // TimeCreated: The creation time of the HMAC key in RFC 3339 format. 1488 TimeCreated string `json:"timeCreated,omitempty"` 1489 1490 // Updated: The last modification time of the HMAC key metadata in RFC 1491 // 3339 format. 1492 Updated string `json:"updated,omitempty"` 1493 1494 // ServerResponse contains the HTTP response code and headers from the 1495 // server. 1496 googleapi.ServerResponse `json:"-"` 1497 1498 // ForceSendFields is a list of field names (e.g. "AccessId") to 1499 // unconditionally include in API requests. By default, fields with 1500 // empty values are omitted from API requests. However, any non-pointer, 1501 // non-interface field appearing in ForceSendFields will be sent to the 1502 // server regardless of whether the field is empty or not. This may be 1503 // used to include empty fields in Patch requests. 1504 ForceSendFields []string `json:"-"` 1505 1506 // NullFields is a list of field names (e.g. "AccessId") to include in 1507 // API requests with the JSON null value. By default, fields with empty 1508 // values are omitted from API requests. However, any field with an 1509 // empty value appearing in NullFields will be sent to the server as 1510 // null. It is an error if a field in this list has a non-empty value. 1511 // This may be used to include null fields in Patch requests. 1512 NullFields []string `json:"-"` 1513} 1514 1515func (s *HmacKeyMetadata) MarshalJSON() ([]byte, error) { 1516 type NoMethod HmacKeyMetadata 1517 raw := NoMethod(*s) 1518 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1519} 1520 1521// HmacKeysMetadata: A list of hmacKeys. 1522type HmacKeysMetadata struct { 1523 // Items: The list of items. 1524 Items []*HmacKeyMetadata `json:"items,omitempty"` 1525 1526 // Kind: The kind of item this is. For lists of hmacKeys, this is always 1527 // storage#hmacKeysMetadata. 1528 Kind string `json:"kind,omitempty"` 1529 1530 // NextPageToken: The continuation token, used to page through large 1531 // result sets. Provide this value in a subsequent request to return the 1532 // next page of results. 1533 NextPageToken string `json:"nextPageToken,omitempty"` 1534 1535 // ServerResponse contains the HTTP response code and headers from the 1536 // server. 1537 googleapi.ServerResponse `json:"-"` 1538 1539 // ForceSendFields is a list of field names (e.g. "Items") to 1540 // unconditionally include in API requests. By default, fields with 1541 // empty values are omitted from API requests. However, any non-pointer, 1542 // non-interface field appearing in ForceSendFields will be sent to the 1543 // server regardless of whether the field is empty or not. This may be 1544 // used to include empty fields in Patch requests. 1545 ForceSendFields []string `json:"-"` 1546 1547 // NullFields is a list of field names (e.g. "Items") to include in API 1548 // requests with the JSON null value. By default, fields with empty 1549 // values are omitted from API requests. However, any field with an 1550 // empty value appearing in NullFields will be sent to the server as 1551 // null. It is an error if a field in this list has a non-empty value. 1552 // This may be used to include null fields in Patch requests. 1553 NullFields []string `json:"-"` 1554} 1555 1556func (s *HmacKeysMetadata) MarshalJSON() ([]byte, error) { 1557 type NoMethod HmacKeysMetadata 1558 raw := NoMethod(*s) 1559 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1560} 1561 1562// Notification: A subscription to receive Google PubSub notifications. 1563type Notification struct { 1564 // CustomAttributes: An optional list of additional attributes to attach 1565 // to each Cloud PubSub message published for this notification 1566 // subscription. 1567 CustomAttributes map[string]string `json:"custom_attributes,omitempty"` 1568 1569 // Etag: HTTP 1.1 Entity tag for this subscription notification. 1570 Etag string `json:"etag,omitempty"` 1571 1572 // EventTypes: If present, only send notifications about listed event 1573 // types. If empty, sent notifications for all event types. 1574 EventTypes []string `json:"event_types,omitempty"` 1575 1576 // Id: The ID of the notification. 1577 Id string `json:"id,omitempty"` 1578 1579 // Kind: The kind of item this is. For notifications, this is always 1580 // storage#notification. 1581 Kind string `json:"kind,omitempty"` 1582 1583 // ObjectNamePrefix: If present, only apply this notification 1584 // configuration to object names that begin with this prefix. 1585 ObjectNamePrefix string `json:"object_name_prefix,omitempty"` 1586 1587 // PayloadFormat: The desired content of the Payload. 1588 PayloadFormat string `json:"payload_format,omitempty"` 1589 1590 // SelfLink: The canonical URL of this notification. 1591 SelfLink string `json:"selfLink,omitempty"` 1592 1593 // Topic: The Cloud PubSub topic to which this subscription publishes. 1594 // Formatted as: 1595 // '//pubsub.googleapis.com/projects/{project-identifier}/topics/{my-topi 1596 // c}' 1597 Topic string `json:"topic,omitempty"` 1598 1599 // ServerResponse contains the HTTP response code and headers from the 1600 // server. 1601 googleapi.ServerResponse `json:"-"` 1602 1603 // ForceSendFields is a list of field names (e.g. "CustomAttributes") to 1604 // unconditionally include in API requests. By default, fields with 1605 // empty values are omitted from API requests. However, any non-pointer, 1606 // non-interface field appearing in ForceSendFields will be sent to the 1607 // server regardless of whether the field is empty or not. This may be 1608 // used to include empty fields in Patch requests. 1609 ForceSendFields []string `json:"-"` 1610 1611 // NullFields is a list of field names (e.g. "CustomAttributes") to 1612 // include in API requests with the JSON null value. By default, fields 1613 // with empty values are omitted from API requests. However, any field 1614 // with an empty value appearing in NullFields will be sent to the 1615 // server as null. It is an error if a field in this list has a 1616 // non-empty value. This may be used to include null fields in Patch 1617 // requests. 1618 NullFields []string `json:"-"` 1619} 1620 1621func (s *Notification) MarshalJSON() ([]byte, error) { 1622 type NoMethod Notification 1623 raw := NoMethod(*s) 1624 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1625} 1626 1627// Notifications: A list of notification subscriptions. 1628type Notifications struct { 1629 // Items: The list of items. 1630 Items []*Notification `json:"items,omitempty"` 1631 1632 // Kind: The kind of item this is. For lists of notifications, this is 1633 // always storage#notifications. 1634 Kind string `json:"kind,omitempty"` 1635 1636 // ServerResponse contains the HTTP response code and headers from the 1637 // server. 1638 googleapi.ServerResponse `json:"-"` 1639 1640 // ForceSendFields is a list of field names (e.g. "Items") to 1641 // unconditionally include in API requests. By default, fields with 1642 // empty values are omitted from API requests. However, any non-pointer, 1643 // non-interface field appearing in ForceSendFields will be sent to the 1644 // server regardless of whether the field is empty or not. This may be 1645 // used to include empty fields in Patch requests. 1646 ForceSendFields []string `json:"-"` 1647 1648 // NullFields is a list of field names (e.g. "Items") to include in API 1649 // requests with the JSON null value. By default, fields with empty 1650 // values are omitted from API requests. However, any field with an 1651 // empty value appearing in NullFields will be sent to the server as 1652 // null. It is an error if a field in this list has a non-empty value. 1653 // This may be used to include null fields in Patch requests. 1654 NullFields []string `json:"-"` 1655} 1656 1657func (s *Notifications) MarshalJSON() ([]byte, error) { 1658 type NoMethod Notifications 1659 raw := NoMethod(*s) 1660 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1661} 1662 1663// Object: An object. 1664type Object struct { 1665 // Acl: Access controls on the object. 1666 Acl []*ObjectAccessControl `json:"acl,omitempty"` 1667 1668 // Bucket: The name of the bucket containing this object. 1669 Bucket string `json:"bucket,omitempty"` 1670 1671 // CacheControl: Cache-Control directive for the object data. If 1672 // omitted, and the object is accessible to all anonymous users, the 1673 // default will be public, max-age=3600. 1674 CacheControl string `json:"cacheControl,omitempty"` 1675 1676 // ComponentCount: Number of underlying components that make up this 1677 // object. Components are accumulated by compose operations. 1678 ComponentCount int64 `json:"componentCount,omitempty"` 1679 1680 // ContentDisposition: Content-Disposition of the object data. 1681 ContentDisposition string `json:"contentDisposition,omitempty"` 1682 1683 // ContentEncoding: Content-Encoding of the object data. 1684 ContentEncoding string `json:"contentEncoding,omitempty"` 1685 1686 // ContentLanguage: Content-Language of the object data. 1687 ContentLanguage string `json:"contentLanguage,omitempty"` 1688 1689 // ContentType: Content-Type of the object data. If an object is stored 1690 // without a Content-Type, it is served as application/octet-stream. 1691 ContentType string `json:"contentType,omitempty"` 1692 1693 // Crc32c: CRC32c checksum, as described in RFC 4960, Appendix B; 1694 // encoded using base64 in big-endian byte order. For more information 1695 // about using the CRC32c checksum, see Hashes and ETags: Best 1696 // Practices. 1697 Crc32c string `json:"crc32c,omitempty"` 1698 1699 // CustomTime: A timestamp in RFC 3339 format specified by the user for 1700 // an object. 1701 CustomTime string `json:"customTime,omitempty"` 1702 1703 // CustomerEncryption: Metadata of customer-supplied encryption key, if 1704 // the object is encrypted by such a key. 1705 CustomerEncryption *ObjectCustomerEncryption `json:"customerEncryption,omitempty"` 1706 1707 // Etag: HTTP 1.1 Entity tag for the object. 1708 Etag string `json:"etag,omitempty"` 1709 1710 // EventBasedHold: Whether an object is under event-based hold. 1711 // Event-based hold is a way to retain objects until an event occurs, 1712 // which is signified by the hold's release (i.e. this value is set to 1713 // false). After being released (set to false), such objects will be 1714 // subject to bucket-level retention (if any). One sample use case of 1715 // this flag is for banks to hold loan documents for at least 3 years 1716 // after loan is paid in full. Here, bucket-level retention is 3 years 1717 // and the event is the loan being paid in full. In this example, these 1718 // objects will be held intact for any number of years until the event 1719 // has occurred (event-based hold on the object is released) and then 3 1720 // more years after that. That means retention duration of the objects 1721 // begins from the moment event-based hold transitioned from true to 1722 // false. 1723 EventBasedHold bool `json:"eventBasedHold,omitempty"` 1724 1725 // Generation: The content generation of this object. Used for object 1726 // versioning. 1727 Generation int64 `json:"generation,omitempty,string"` 1728 1729 // Id: The ID of the object, including the bucket name, object name, and 1730 // generation number. 1731 Id string `json:"id,omitempty"` 1732 1733 // Kind: The kind of item this is. For objects, this is always 1734 // storage#object. 1735 Kind string `json:"kind,omitempty"` 1736 1737 // KmsKeyName: Cloud KMS Key used to encrypt this object, if the object 1738 // is encrypted by such a key. 1739 KmsKeyName string `json:"kmsKeyName,omitempty"` 1740 1741 // Md5Hash: MD5 hash of the data; encoded using base64. For more 1742 // information about using the MD5 hash, see Hashes and ETags: Best 1743 // Practices. 1744 Md5Hash string `json:"md5Hash,omitempty"` 1745 1746 // MediaLink: Media download link. 1747 MediaLink string `json:"mediaLink,omitempty"` 1748 1749 // Metadata: User-provided metadata, in key/value pairs. 1750 Metadata map[string]string `json:"metadata,omitempty"` 1751 1752 // Metageneration: The version of the metadata for this object at this 1753 // generation. Used for preconditions and for detecting changes in 1754 // metadata. A metageneration number is only meaningful in the context 1755 // of a particular generation of a particular object. 1756 Metageneration int64 `json:"metageneration,omitempty,string"` 1757 1758 // Name: The name of the object. Required if not specified by URL 1759 // parameter. 1760 Name string `json:"name,omitempty"` 1761 1762 // Owner: The owner of the object. This will always be the uploader of 1763 // the object. 1764 Owner *ObjectOwner `json:"owner,omitempty"` 1765 1766 // RetentionExpirationTime: A server-determined value that specifies the 1767 // earliest time that the object's retention period expires. This value 1768 // is in RFC 3339 format. Note 1: This field is not provided for objects 1769 // with an active event-based hold, since retention expiration is 1770 // unknown until the hold is removed. Note 2: This value can be provided 1771 // even when temporary hold is set (so that the user can reason about 1772 // policy without having to first unset the temporary hold). 1773 RetentionExpirationTime string `json:"retentionExpirationTime,omitempty"` 1774 1775 // SelfLink: The link to this object. 1776 SelfLink string `json:"selfLink,omitempty"` 1777 1778 // Size: Content-Length of the data in bytes. 1779 Size uint64 `json:"size,omitempty,string"` 1780 1781 // StorageClass: Storage class of the object. 1782 StorageClass string `json:"storageClass,omitempty"` 1783 1784 // TemporaryHold: Whether an object is under temporary hold. While this 1785 // flag is set to true, the object is protected against deletion and 1786 // overwrites. A common use case of this flag is regulatory 1787 // investigations where objects need to be retained while the 1788 // investigation is ongoing. Note that unlike event-based hold, 1789 // temporary hold does not impact retention expiration time of an 1790 // object. 1791 TemporaryHold bool `json:"temporaryHold,omitempty"` 1792 1793 // TimeCreated: The creation time of the object in RFC 3339 format. 1794 TimeCreated string `json:"timeCreated,omitempty"` 1795 1796 // TimeDeleted: The deletion time of the object in RFC 3339 format. Will 1797 // be returned if and only if this version of the object has been 1798 // deleted. 1799 TimeDeleted string `json:"timeDeleted,omitempty"` 1800 1801 // TimeStorageClassUpdated: The time at which the object's storage class 1802 // was last changed. When the object is initially created, it will be 1803 // set to timeCreated. 1804 TimeStorageClassUpdated string `json:"timeStorageClassUpdated,omitempty"` 1805 1806 // Updated: The modification time of the object metadata in RFC 3339 1807 // format. 1808 Updated string `json:"updated,omitempty"` 1809 1810 // ServerResponse contains the HTTP response code and headers from the 1811 // server. 1812 googleapi.ServerResponse `json:"-"` 1813 1814 // ForceSendFields is a list of field names (e.g. "Acl") to 1815 // unconditionally include in API requests. By default, fields with 1816 // empty values are omitted from API requests. However, any non-pointer, 1817 // non-interface field appearing in ForceSendFields will be sent to the 1818 // server regardless of whether the field is empty or not. This may be 1819 // used to include empty fields in Patch requests. 1820 ForceSendFields []string `json:"-"` 1821 1822 // NullFields is a list of field names (e.g. "Acl") to include in API 1823 // requests with the JSON null value. By default, fields with empty 1824 // values are omitted from API requests. However, any field with an 1825 // empty value appearing in NullFields will be sent to the server as 1826 // null. It is an error if a field in this list has a non-empty value. 1827 // This may be used to include null fields in Patch requests. 1828 NullFields []string `json:"-"` 1829} 1830 1831func (s *Object) MarshalJSON() ([]byte, error) { 1832 type NoMethod Object 1833 raw := NoMethod(*s) 1834 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1835} 1836 1837// ObjectCustomerEncryption: Metadata of customer-supplied encryption 1838// key, if the object is encrypted by such a key. 1839type ObjectCustomerEncryption struct { 1840 // EncryptionAlgorithm: The encryption algorithm. 1841 EncryptionAlgorithm string `json:"encryptionAlgorithm,omitempty"` 1842 1843 // KeySha256: SHA256 hash value of the encryption key. 1844 KeySha256 string `json:"keySha256,omitempty"` 1845 1846 // ForceSendFields is a list of field names (e.g. "EncryptionAlgorithm") 1847 // to unconditionally include in API requests. By default, fields with 1848 // empty values are omitted from API requests. However, any non-pointer, 1849 // non-interface field appearing in ForceSendFields will be sent to the 1850 // server regardless of whether the field is empty or not. This may be 1851 // used to include empty fields in Patch requests. 1852 ForceSendFields []string `json:"-"` 1853 1854 // NullFields is a list of field names (e.g. "EncryptionAlgorithm") to 1855 // include in API requests with the JSON null value. By default, fields 1856 // with empty values are omitted from API requests. However, any field 1857 // with an empty value appearing in NullFields will be sent to the 1858 // server as null. It is an error if a field in this list has a 1859 // non-empty value. This may be used to include null fields in Patch 1860 // requests. 1861 NullFields []string `json:"-"` 1862} 1863 1864func (s *ObjectCustomerEncryption) MarshalJSON() ([]byte, error) { 1865 type NoMethod ObjectCustomerEncryption 1866 raw := NoMethod(*s) 1867 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1868} 1869 1870// ObjectOwner: The owner of the object. This will always be the 1871// uploader of the object. 1872type ObjectOwner struct { 1873 // Entity: The entity, in the form user-userId. 1874 Entity string `json:"entity,omitempty"` 1875 1876 // EntityId: The ID for the entity. 1877 EntityId string `json:"entityId,omitempty"` 1878 1879 // ForceSendFields is a list of field names (e.g. "Entity") to 1880 // unconditionally include in API requests. By default, fields with 1881 // empty values are omitted from API requests. However, any non-pointer, 1882 // non-interface field appearing in ForceSendFields will be sent to the 1883 // server regardless of whether the field is empty or not. This may be 1884 // used to include empty fields in Patch requests. 1885 ForceSendFields []string `json:"-"` 1886 1887 // NullFields is a list of field names (e.g. "Entity") to include in API 1888 // requests with the JSON null value. By default, fields with empty 1889 // values are omitted from API requests. However, any field with an 1890 // empty value appearing in NullFields will be sent to the server as 1891 // null. It is an error if a field in this list has a non-empty value. 1892 // This may be used to include null fields in Patch requests. 1893 NullFields []string `json:"-"` 1894} 1895 1896func (s *ObjectOwner) MarshalJSON() ([]byte, error) { 1897 type NoMethod ObjectOwner 1898 raw := NoMethod(*s) 1899 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1900} 1901 1902// ObjectAccessControl: An access-control entry. 1903type ObjectAccessControl struct { 1904 // Bucket: The name of the bucket. 1905 Bucket string `json:"bucket,omitempty"` 1906 1907 // Domain: The domain associated with the entity, if any. 1908 Domain string `json:"domain,omitempty"` 1909 1910 // Email: The email address associated with the entity, if any. 1911 Email string `json:"email,omitempty"` 1912 1913 // Entity: The entity holding the permission, in one of the following 1914 // forms: 1915 // - user-userId 1916 // - user-email 1917 // - group-groupId 1918 // - group-email 1919 // - domain-domain 1920 // - project-team-projectId 1921 // - allUsers 1922 // - allAuthenticatedUsers Examples: 1923 // - The user liz@example.com would be user-liz@example.com. 1924 // - The group example@googlegroups.com would be 1925 // group-example@googlegroups.com. 1926 // - To refer to all members of the Google Apps for Business domain 1927 // example.com, the entity would be domain-example.com. 1928 Entity string `json:"entity,omitempty"` 1929 1930 // EntityId: The ID for the entity, if any. 1931 EntityId string `json:"entityId,omitempty"` 1932 1933 // Etag: HTTP 1.1 Entity tag for the access-control entry. 1934 Etag string `json:"etag,omitempty"` 1935 1936 // Generation: The content generation of the object, if applied to an 1937 // object. 1938 Generation int64 `json:"generation,omitempty,string"` 1939 1940 // Id: The ID of the access-control entry. 1941 Id string `json:"id,omitempty"` 1942 1943 // Kind: The kind of item this is. For object access control entries, 1944 // this is always storage#objectAccessControl. 1945 Kind string `json:"kind,omitempty"` 1946 1947 // Object: The name of the object, if applied to an object. 1948 Object string `json:"object,omitempty"` 1949 1950 // ProjectTeam: The project team associated with the entity, if any. 1951 ProjectTeam *ObjectAccessControlProjectTeam `json:"projectTeam,omitempty"` 1952 1953 // Role: The access permission for the entity. 1954 Role string `json:"role,omitempty"` 1955 1956 // SelfLink: The link to this access-control entry. 1957 SelfLink string `json:"selfLink,omitempty"` 1958 1959 // ServerResponse contains the HTTP response code and headers from the 1960 // server. 1961 googleapi.ServerResponse `json:"-"` 1962 1963 // ForceSendFields is a list of field names (e.g. "Bucket") to 1964 // unconditionally include in API requests. By default, fields with 1965 // empty values are omitted from API requests. However, any non-pointer, 1966 // non-interface field appearing in ForceSendFields will be sent to the 1967 // server regardless of whether the field is empty or not. This may be 1968 // used to include empty fields in Patch requests. 1969 ForceSendFields []string `json:"-"` 1970 1971 // NullFields is a list of field names (e.g. "Bucket") to include in API 1972 // requests with the JSON null value. By default, fields with empty 1973 // values are omitted from API requests. However, any field with an 1974 // empty value appearing in NullFields will be sent to the server as 1975 // null. It is an error if a field in this list has a non-empty value. 1976 // This may be used to include null fields in Patch requests. 1977 NullFields []string `json:"-"` 1978} 1979 1980func (s *ObjectAccessControl) MarshalJSON() ([]byte, error) { 1981 type NoMethod ObjectAccessControl 1982 raw := NoMethod(*s) 1983 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1984} 1985 1986// ObjectAccessControlProjectTeam: The project team associated with the 1987// entity, if any. 1988type ObjectAccessControlProjectTeam struct { 1989 // ProjectNumber: The project number. 1990 ProjectNumber string `json:"projectNumber,omitempty"` 1991 1992 // Team: The team. 1993 Team string `json:"team,omitempty"` 1994 1995 // ForceSendFields is a list of field names (e.g. "ProjectNumber") to 1996 // unconditionally include in API requests. By default, fields with 1997 // empty values are omitted from API requests. However, any non-pointer, 1998 // non-interface field appearing in ForceSendFields will be sent to the 1999 // server regardless of whether the field is empty or not. This may be 2000 // used to include empty fields in Patch requests. 2001 ForceSendFields []string `json:"-"` 2002 2003 // NullFields is a list of field names (e.g. "ProjectNumber") to include 2004 // in API requests with the JSON null value. By default, fields with 2005 // empty values are omitted from API requests. However, any field with 2006 // an empty value appearing in NullFields will be sent to the server as 2007 // null. It is an error if a field in this list has a non-empty value. 2008 // This may be used to include null fields in Patch requests. 2009 NullFields []string `json:"-"` 2010} 2011 2012func (s *ObjectAccessControlProjectTeam) MarshalJSON() ([]byte, error) { 2013 type NoMethod ObjectAccessControlProjectTeam 2014 raw := NoMethod(*s) 2015 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2016} 2017 2018// ObjectAccessControls: An access-control list. 2019type ObjectAccessControls struct { 2020 // Items: The list of items. 2021 Items []*ObjectAccessControl `json:"items,omitempty"` 2022 2023 // Kind: The kind of item this is. For lists of object access control 2024 // entries, this is always storage#objectAccessControls. 2025 Kind string `json:"kind,omitempty"` 2026 2027 // ServerResponse contains the HTTP response code and headers from the 2028 // server. 2029 googleapi.ServerResponse `json:"-"` 2030 2031 // ForceSendFields is a list of field names (e.g. "Items") to 2032 // unconditionally include in API requests. By default, fields with 2033 // empty values are omitted from API requests. However, any non-pointer, 2034 // non-interface field appearing in ForceSendFields will be sent to the 2035 // server regardless of whether the field is empty or not. This may be 2036 // used to include empty fields in Patch requests. 2037 ForceSendFields []string `json:"-"` 2038 2039 // NullFields is a list of field names (e.g. "Items") to include in API 2040 // requests with the JSON null value. By default, fields with empty 2041 // values are omitted from API requests. However, any field with an 2042 // empty value appearing in NullFields will be sent to the server as 2043 // null. It is an error if a field in this list has a non-empty value. 2044 // This may be used to include null fields in Patch requests. 2045 NullFields []string `json:"-"` 2046} 2047 2048func (s *ObjectAccessControls) MarshalJSON() ([]byte, error) { 2049 type NoMethod ObjectAccessControls 2050 raw := NoMethod(*s) 2051 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2052} 2053 2054// Objects: A list of objects. 2055type Objects struct { 2056 // Items: The list of items. 2057 Items []*Object `json:"items,omitempty"` 2058 2059 // Kind: The kind of item this is. For lists of objects, this is always 2060 // storage#objects. 2061 Kind string `json:"kind,omitempty"` 2062 2063 // NextPageToken: The continuation token, used to page through large 2064 // result sets. Provide this value in a subsequent request to return the 2065 // next page of results. 2066 NextPageToken string `json:"nextPageToken,omitempty"` 2067 2068 // Prefixes: The list of prefixes of objects matching-but-not-listed up 2069 // to and including the requested delimiter. 2070 Prefixes []string `json:"prefixes,omitempty"` 2071 2072 // ServerResponse contains the HTTP response code and headers from the 2073 // server. 2074 googleapi.ServerResponse `json:"-"` 2075 2076 // ForceSendFields is a list of field names (e.g. "Items") to 2077 // unconditionally include in API requests. By default, fields with 2078 // empty values are omitted from API requests. However, any non-pointer, 2079 // non-interface field appearing in ForceSendFields will be sent to the 2080 // server regardless of whether the field is empty or not. This may be 2081 // used to include empty fields in Patch requests. 2082 ForceSendFields []string `json:"-"` 2083 2084 // NullFields is a list of field names (e.g. "Items") to include in API 2085 // requests with the JSON null value. By default, fields with empty 2086 // values are omitted from API requests. However, any field with an 2087 // empty value appearing in NullFields will be sent to the server as 2088 // null. It is an error if a field in this list has a non-empty value. 2089 // This may be used to include null fields in Patch requests. 2090 NullFields []string `json:"-"` 2091} 2092 2093func (s *Objects) MarshalJSON() ([]byte, error) { 2094 type NoMethod Objects 2095 raw := NoMethod(*s) 2096 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2097} 2098 2099// Policy: A bucket/object IAM policy. 2100type Policy struct { 2101 // Bindings: An association between a role, which comes with a set of 2102 // permissions, and members who may assume that role. 2103 Bindings []*PolicyBindings `json:"bindings,omitempty"` 2104 2105 // Etag: HTTP 1.1 Entity tag for the policy. 2106 Etag string `json:"etag,omitempty"` 2107 2108 // Kind: The kind of item this is. For policies, this is always 2109 // storage#policy. This field is ignored on input. 2110 Kind string `json:"kind,omitempty"` 2111 2112 // ResourceId: The ID of the resource to which this policy belongs. Will 2113 // be of the form projects/_/buckets/bucket for buckets, and 2114 // projects/_/buckets/bucket/objects/object for objects. A specific 2115 // generation may be specified by appending #generationNumber to the end 2116 // of the object name, e.g. 2117 // projects/_/buckets/my-bucket/objects/data.txt#17. The current 2118 // generation can be denoted with #0. This field is ignored on input. 2119 ResourceId string `json:"resourceId,omitempty"` 2120 2121 // Version: The IAM policy format version. 2122 Version int64 `json:"version,omitempty"` 2123 2124 // ServerResponse contains the HTTP response code and headers from the 2125 // server. 2126 googleapi.ServerResponse `json:"-"` 2127 2128 // ForceSendFields is a list of field names (e.g. "Bindings") to 2129 // unconditionally include in API requests. By default, fields with 2130 // empty values are omitted from API requests. However, any non-pointer, 2131 // non-interface field appearing in ForceSendFields will be sent to the 2132 // server regardless of whether the field is empty or not. This may be 2133 // used to include empty fields in Patch requests. 2134 ForceSendFields []string `json:"-"` 2135 2136 // NullFields is a list of field names (e.g. "Bindings") to include in 2137 // API requests with the JSON null value. By default, fields with empty 2138 // values are omitted from API requests. However, any field with an 2139 // empty value appearing in NullFields will be sent to the server as 2140 // null. It is an error if a field in this list has a non-empty value. 2141 // This may be used to include null fields in Patch requests. 2142 NullFields []string `json:"-"` 2143} 2144 2145func (s *Policy) MarshalJSON() ([]byte, error) { 2146 type NoMethod Policy 2147 raw := NoMethod(*s) 2148 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2149} 2150 2151type PolicyBindings struct { 2152 // Condition: The condition that is associated with this binding. NOTE: 2153 // an unsatisfied condition will not allow user access via current 2154 // binding. Different bindings, including their conditions, are examined 2155 // independently. 2156 Condition *Expr `json:"condition,omitempty"` 2157 2158 // Members: A collection of identifiers for members who may assume the 2159 // provided role. Recognized identifiers are as follows: 2160 // - allUsers — A special identifier that represents anyone on the 2161 // internet; with or without a Google account. 2162 // - allAuthenticatedUsers — A special identifier that represents 2163 // anyone who is authenticated with a Google account or a service 2164 // account. 2165 // - user:emailid — An email address that represents a specific 2166 // account. For example, user:alice@gmail.com or user:joe@example.com. 2167 // 2168 // - serviceAccount:emailid — An email address that represents a 2169 // service account. For example, 2170 // serviceAccount:my-other-app@appspot.gserviceaccount.com . 2171 // - group:emailid — An email address that represents a Google group. 2172 // For example, group:admins@example.com. 2173 // - domain:domain — A Google Apps domain name that represents all the 2174 // users of that domain. For example, domain:google.com or 2175 // domain:example.com. 2176 // - projectOwner:projectid — Owners of the given project. For 2177 // example, projectOwner:my-example-project 2178 // - projectEditor:projectid — Editors of the given project. For 2179 // example, projectEditor:my-example-project 2180 // - projectViewer:projectid — Viewers of the given project. For 2181 // example, projectViewer:my-example-project 2182 Members []string `json:"members,omitempty"` 2183 2184 // Role: The role to which members belong. Two types of roles are 2185 // supported: new IAM roles, which grant permissions that do not map 2186 // directly to those provided by ACLs, and legacy IAM roles, which do 2187 // map directly to ACL permissions. All roles are of the format 2188 // roles/storage.specificRole. 2189 // The new IAM roles are: 2190 // - roles/storage.admin — Full control of Google Cloud Storage 2191 // resources. 2192 // - roles/storage.objectViewer — Read-Only access to Google Cloud 2193 // Storage objects. 2194 // - roles/storage.objectCreator — Access to create objects in Google 2195 // Cloud Storage. 2196 // - roles/storage.objectAdmin — Full control of Google Cloud Storage 2197 // objects. The legacy IAM roles are: 2198 // - roles/storage.legacyObjectReader — Read-only access to objects 2199 // without listing. Equivalent to an ACL entry on an object with the 2200 // READER role. 2201 // - roles/storage.legacyObjectOwner — Read/write access to existing 2202 // objects without listing. Equivalent to an ACL entry on an object with 2203 // the OWNER role. 2204 // - roles/storage.legacyBucketReader — Read access to buckets with 2205 // object listing. Equivalent to an ACL entry on a bucket with the 2206 // READER role. 2207 // - roles/storage.legacyBucketWriter — Read access to buckets with 2208 // object listing/creation/deletion. Equivalent to an ACL entry on a 2209 // bucket with the WRITER role. 2210 // - roles/storage.legacyBucketOwner — Read and write access to 2211 // existing buckets with object listing/creation/deletion. Equivalent to 2212 // an ACL entry on a bucket with the OWNER role. 2213 Role string `json:"role,omitempty"` 2214 2215 // ForceSendFields is a list of field names (e.g. "Condition") to 2216 // unconditionally include in API requests. By default, fields with 2217 // empty values are omitted from API requests. However, any non-pointer, 2218 // non-interface field appearing in ForceSendFields will be sent to the 2219 // server regardless of whether the field is empty or not. This may be 2220 // used to include empty fields in Patch requests. 2221 ForceSendFields []string `json:"-"` 2222 2223 // NullFields is a list of field names (e.g. "Condition") to include in 2224 // API requests with the JSON null value. By default, fields with empty 2225 // values are omitted from API requests. However, any field with an 2226 // empty value appearing in NullFields will be sent to the server as 2227 // null. It is an error if a field in this list has a non-empty value. 2228 // This may be used to include null fields in Patch requests. 2229 NullFields []string `json:"-"` 2230} 2231 2232func (s *PolicyBindings) MarshalJSON() ([]byte, error) { 2233 type NoMethod PolicyBindings 2234 raw := NoMethod(*s) 2235 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2236} 2237 2238// RewriteResponse: A rewrite response. 2239type RewriteResponse struct { 2240 // Done: true if the copy is finished; otherwise, false if the copy is 2241 // in progress. This property is always present in the response. 2242 Done bool `json:"done,omitempty"` 2243 2244 // Kind: The kind of item this is. 2245 Kind string `json:"kind,omitempty"` 2246 2247 // ObjectSize: The total size of the object being copied in bytes. This 2248 // property is always present in the response. 2249 ObjectSize int64 `json:"objectSize,omitempty,string"` 2250 2251 // Resource: A resource containing the metadata for the copied-to 2252 // object. This property is present in the response only when copying 2253 // completes. 2254 Resource *Object `json:"resource,omitempty"` 2255 2256 // RewriteToken: A token to use in subsequent requests to continue 2257 // copying data. This token is present in the response only when there 2258 // is more data to copy. 2259 RewriteToken string `json:"rewriteToken,omitempty"` 2260 2261 // TotalBytesRewritten: The total bytes written so far, which can be 2262 // used to provide a waiting user with a progress indicator. This 2263 // property is always present in the response. 2264 TotalBytesRewritten int64 `json:"totalBytesRewritten,omitempty,string"` 2265 2266 // ServerResponse contains the HTTP response code and headers from the 2267 // server. 2268 googleapi.ServerResponse `json:"-"` 2269 2270 // ForceSendFields is a list of field names (e.g. "Done") to 2271 // unconditionally include in API requests. By default, fields with 2272 // empty values are omitted from API requests. However, any non-pointer, 2273 // non-interface field appearing in ForceSendFields will be sent to the 2274 // server regardless of whether the field is empty or not. This may be 2275 // used to include empty fields in Patch requests. 2276 ForceSendFields []string `json:"-"` 2277 2278 // NullFields is a list of field names (e.g. "Done") to include in API 2279 // requests with the JSON null value. By default, fields with empty 2280 // values are omitted from API requests. However, any field with an 2281 // empty value appearing in NullFields will be sent to the server as 2282 // null. It is an error if a field in this list has a non-empty value. 2283 // This may be used to include null fields in Patch requests. 2284 NullFields []string `json:"-"` 2285} 2286 2287func (s *RewriteResponse) MarshalJSON() ([]byte, error) { 2288 type NoMethod RewriteResponse 2289 raw := NoMethod(*s) 2290 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2291} 2292 2293// ServiceAccount: A subscription to receive Google PubSub 2294// notifications. 2295type ServiceAccount struct { 2296 // EmailAddress: The ID of the notification. 2297 EmailAddress string `json:"email_address,omitempty"` 2298 2299 // Kind: The kind of item this is. For notifications, this is always 2300 // storage#notification. 2301 Kind string `json:"kind,omitempty"` 2302 2303 // ServerResponse contains the HTTP response code and headers from the 2304 // server. 2305 googleapi.ServerResponse `json:"-"` 2306 2307 // ForceSendFields is a list of field names (e.g. "EmailAddress") to 2308 // unconditionally include in API requests. By default, fields with 2309 // empty values are omitted from API requests. However, any non-pointer, 2310 // non-interface field appearing in ForceSendFields will be sent to the 2311 // server regardless of whether the field is empty or not. This may be 2312 // used to include empty fields in Patch requests. 2313 ForceSendFields []string `json:"-"` 2314 2315 // NullFields is a list of field names (e.g. "EmailAddress") to include 2316 // in API requests with the JSON null value. By default, fields with 2317 // empty values are omitted from API requests. However, any field with 2318 // an empty value appearing in NullFields will be sent to the server as 2319 // null. It is an error if a field in this list has a non-empty value. 2320 // This may be used to include null fields in Patch requests. 2321 NullFields []string `json:"-"` 2322} 2323 2324func (s *ServiceAccount) MarshalJSON() ([]byte, error) { 2325 type NoMethod ServiceAccount 2326 raw := NoMethod(*s) 2327 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2328} 2329 2330// TestIamPermissionsResponse: A 2331// storage.(buckets|objects).testIamPermissions response. 2332type TestIamPermissionsResponse struct { 2333 // Kind: The kind of item this is. 2334 Kind string `json:"kind,omitempty"` 2335 2336 // Permissions: The permissions held by the caller. Permissions are 2337 // always of the format storage.resource.capability, where resource is 2338 // one of buckets or objects. The supported permissions are as follows: 2339 // 2340 // - storage.buckets.delete — Delete bucket. 2341 // - storage.buckets.get — Read bucket metadata. 2342 // - storage.buckets.getIamPolicy — Read bucket IAM policy. 2343 // - storage.buckets.create — Create bucket. 2344 // - storage.buckets.list — List buckets. 2345 // - storage.buckets.setIamPolicy — Update bucket IAM policy. 2346 // - storage.buckets.update — Update bucket metadata. 2347 // - storage.objects.delete — Delete object. 2348 // - storage.objects.get — Read object data and metadata. 2349 // - storage.objects.getIamPolicy — Read object IAM policy. 2350 // - storage.objects.create — Create object. 2351 // - storage.objects.list — List objects. 2352 // - storage.objects.setIamPolicy — Update object IAM policy. 2353 // - storage.objects.update — Update object metadata. 2354 Permissions []string `json:"permissions,omitempty"` 2355 2356 // ServerResponse contains the HTTP response code and headers from the 2357 // server. 2358 googleapi.ServerResponse `json:"-"` 2359 2360 // ForceSendFields is a list of field names (e.g. "Kind") to 2361 // unconditionally include in API requests. By default, fields with 2362 // empty values are omitted from API requests. However, any non-pointer, 2363 // non-interface field appearing in ForceSendFields will be sent to the 2364 // server regardless of whether the field is empty or not. This may be 2365 // used to include empty fields in Patch requests. 2366 ForceSendFields []string `json:"-"` 2367 2368 // NullFields is a list of field names (e.g. "Kind") to include in API 2369 // requests with the JSON null value. By default, fields with empty 2370 // values are omitted from API requests. However, any field with an 2371 // empty value appearing in NullFields will be sent to the server as 2372 // null. It is an error if a field in this list has a non-empty value. 2373 // This may be used to include null fields in Patch requests. 2374 NullFields []string `json:"-"` 2375} 2376 2377func (s *TestIamPermissionsResponse) MarshalJSON() ([]byte, error) { 2378 type NoMethod TestIamPermissionsResponse 2379 raw := NoMethod(*s) 2380 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2381} 2382 2383// method id "storage.bucketAccessControls.delete": 2384 2385type BucketAccessControlsDeleteCall struct { 2386 s *Service 2387 bucket string 2388 entity string 2389 urlParams_ gensupport.URLParams 2390 ctx_ context.Context 2391 header_ http.Header 2392} 2393 2394// Delete: Permanently deletes the ACL entry for the specified entity on 2395// the specified bucket. 2396func (r *BucketAccessControlsService) Delete(bucket string, entity string) *BucketAccessControlsDeleteCall { 2397 c := &BucketAccessControlsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2398 c.bucket = bucket 2399 c.entity = entity 2400 return c 2401} 2402 2403// ProvisionalUserProject sets the optional parameter 2404// "provisionalUserProject": The project to be billed for this request 2405// if the target bucket is requester-pays bucket. 2406func (c *BucketAccessControlsDeleteCall) ProvisionalUserProject(provisionalUserProject string) *BucketAccessControlsDeleteCall { 2407 c.urlParams_.Set("provisionalUserProject", provisionalUserProject) 2408 return c 2409} 2410 2411// UserProject sets the optional parameter "userProject": The project to 2412// be billed for this request. Required for Requester Pays buckets. 2413func (c *BucketAccessControlsDeleteCall) UserProject(userProject string) *BucketAccessControlsDeleteCall { 2414 c.urlParams_.Set("userProject", userProject) 2415 return c 2416} 2417 2418// Fields allows partial responses to be retrieved. See 2419// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 2420// for more information. 2421func (c *BucketAccessControlsDeleteCall) Fields(s ...googleapi.Field) *BucketAccessControlsDeleteCall { 2422 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2423 return c 2424} 2425 2426// Context sets the context to be used in this call's Do method. Any 2427// pending HTTP request will be aborted if the provided context is 2428// canceled. 2429func (c *BucketAccessControlsDeleteCall) Context(ctx context.Context) *BucketAccessControlsDeleteCall { 2430 c.ctx_ = ctx 2431 return c 2432} 2433 2434// Header returns an http.Header that can be modified by the caller to 2435// add HTTP headers to the request. 2436func (c *BucketAccessControlsDeleteCall) Header() http.Header { 2437 if c.header_ == nil { 2438 c.header_ = make(http.Header) 2439 } 2440 return c.header_ 2441} 2442 2443func (c *BucketAccessControlsDeleteCall) doRequest(alt string) (*http.Response, error) { 2444 reqHeaders := make(http.Header) 2445 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") 2446 for k, v := range c.header_ { 2447 reqHeaders[k] = v 2448 } 2449 reqHeaders.Set("User-Agent", c.s.userAgent()) 2450 var body io.Reader = nil 2451 c.urlParams_.Set("alt", alt) 2452 c.urlParams_.Set("prettyPrint", "false") 2453 urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/acl/{entity}") 2454 urls += "?" + c.urlParams_.Encode() 2455 req, err := http.NewRequest("DELETE", urls, body) 2456 if err != nil { 2457 return nil, err 2458 } 2459 req.Header = reqHeaders 2460 googleapi.Expand(req.URL, map[string]string{ 2461 "bucket": c.bucket, 2462 "entity": c.entity, 2463 }) 2464 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2465} 2466 2467// Do executes the "storage.bucketAccessControls.delete" call. 2468func (c *BucketAccessControlsDeleteCall) Do(opts ...googleapi.CallOption) error { 2469 gensupport.SetOptions(c.urlParams_, opts...) 2470 res, err := c.doRequest("json") 2471 if err != nil { 2472 return err 2473 } 2474 defer googleapi.CloseBody(res) 2475 if err := googleapi.CheckResponse(res); err != nil { 2476 return err 2477 } 2478 return nil 2479 // { 2480 // "description": "Permanently deletes the ACL entry for the specified entity on the specified bucket.", 2481 // "httpMethod": "DELETE", 2482 // "id": "storage.bucketAccessControls.delete", 2483 // "parameterOrder": [ 2484 // "bucket", 2485 // "entity" 2486 // ], 2487 // "parameters": { 2488 // "bucket": { 2489 // "description": "Name of a bucket.", 2490 // "location": "path", 2491 // "required": true, 2492 // "type": "string" 2493 // }, 2494 // "entity": { 2495 // "description": "The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.", 2496 // "location": "path", 2497 // "required": true, 2498 // "type": "string" 2499 // }, 2500 // "provisionalUserProject": { 2501 // "description": "The project to be billed for this request if the target bucket is requester-pays bucket.", 2502 // "location": "query", 2503 // "type": "string" 2504 // }, 2505 // "userProject": { 2506 // "description": "The project to be billed for this request. Required for Requester Pays buckets.", 2507 // "location": "query", 2508 // "type": "string" 2509 // } 2510 // }, 2511 // "path": "b/{bucket}/acl/{entity}", 2512 // "scopes": [ 2513 // "https://www.googleapis.com/auth/cloud-platform", 2514 // "https://www.googleapis.com/auth/devstorage.full_control" 2515 // ] 2516 // } 2517 2518} 2519 2520// method id "storage.bucketAccessControls.get": 2521 2522type BucketAccessControlsGetCall struct { 2523 s *Service 2524 bucket string 2525 entity string 2526 urlParams_ gensupport.URLParams 2527 ifNoneMatch_ string 2528 ctx_ context.Context 2529 header_ http.Header 2530} 2531 2532// Get: Returns the ACL entry for the specified entity on the specified 2533// bucket. 2534func (r *BucketAccessControlsService) Get(bucket string, entity string) *BucketAccessControlsGetCall { 2535 c := &BucketAccessControlsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2536 c.bucket = bucket 2537 c.entity = entity 2538 return c 2539} 2540 2541// ProvisionalUserProject sets the optional parameter 2542// "provisionalUserProject": The project to be billed for this request 2543// if the target bucket is requester-pays bucket. 2544func (c *BucketAccessControlsGetCall) ProvisionalUserProject(provisionalUserProject string) *BucketAccessControlsGetCall { 2545 c.urlParams_.Set("provisionalUserProject", provisionalUserProject) 2546 return c 2547} 2548 2549// UserProject sets the optional parameter "userProject": The project to 2550// be billed for this request. Required for Requester Pays buckets. 2551func (c *BucketAccessControlsGetCall) UserProject(userProject string) *BucketAccessControlsGetCall { 2552 c.urlParams_.Set("userProject", userProject) 2553 return c 2554} 2555 2556// Fields allows partial responses to be retrieved. See 2557// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 2558// for more information. 2559func (c *BucketAccessControlsGetCall) Fields(s ...googleapi.Field) *BucketAccessControlsGetCall { 2560 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2561 return c 2562} 2563 2564// IfNoneMatch sets the optional parameter which makes the operation 2565// fail if the object's ETag matches the given value. This is useful for 2566// getting updates only after the object has changed since the last 2567// request. Use googleapi.IsNotModified to check whether the response 2568// error from Do is the result of In-None-Match. 2569func (c *BucketAccessControlsGetCall) IfNoneMatch(entityTag string) *BucketAccessControlsGetCall { 2570 c.ifNoneMatch_ = entityTag 2571 return c 2572} 2573 2574// Context sets the context to be used in this call's Do method. Any 2575// pending HTTP request will be aborted if the provided context is 2576// canceled. 2577func (c *BucketAccessControlsGetCall) Context(ctx context.Context) *BucketAccessControlsGetCall { 2578 c.ctx_ = ctx 2579 return c 2580} 2581 2582// Header returns an http.Header that can be modified by the caller to 2583// add HTTP headers to the request. 2584func (c *BucketAccessControlsGetCall) Header() http.Header { 2585 if c.header_ == nil { 2586 c.header_ = make(http.Header) 2587 } 2588 return c.header_ 2589} 2590 2591func (c *BucketAccessControlsGetCall) doRequest(alt string) (*http.Response, error) { 2592 reqHeaders := make(http.Header) 2593 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") 2594 for k, v := range c.header_ { 2595 reqHeaders[k] = v 2596 } 2597 reqHeaders.Set("User-Agent", c.s.userAgent()) 2598 if c.ifNoneMatch_ != "" { 2599 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 2600 } 2601 var body io.Reader = nil 2602 c.urlParams_.Set("alt", alt) 2603 c.urlParams_.Set("prettyPrint", "false") 2604 urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/acl/{entity}") 2605 urls += "?" + c.urlParams_.Encode() 2606 req, err := http.NewRequest("GET", urls, body) 2607 if err != nil { 2608 return nil, err 2609 } 2610 req.Header = reqHeaders 2611 googleapi.Expand(req.URL, map[string]string{ 2612 "bucket": c.bucket, 2613 "entity": c.entity, 2614 }) 2615 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2616} 2617 2618// Do executes the "storage.bucketAccessControls.get" call. 2619// Exactly one of *BucketAccessControl or error will be non-nil. Any 2620// non-2xx status code is an error. Response headers are in either 2621// *BucketAccessControl.ServerResponse.Header or (if a response was 2622// returned at all) in error.(*googleapi.Error).Header. Use 2623// googleapi.IsNotModified to check whether the returned error was 2624// because http.StatusNotModified was returned. 2625func (c *BucketAccessControlsGetCall) Do(opts ...googleapi.CallOption) (*BucketAccessControl, error) { 2626 gensupport.SetOptions(c.urlParams_, opts...) 2627 res, err := c.doRequest("json") 2628 if res != nil && res.StatusCode == http.StatusNotModified { 2629 if res.Body != nil { 2630 res.Body.Close() 2631 } 2632 return nil, &googleapi.Error{ 2633 Code: res.StatusCode, 2634 Header: res.Header, 2635 } 2636 } 2637 if err != nil { 2638 return nil, err 2639 } 2640 defer googleapi.CloseBody(res) 2641 if err := googleapi.CheckResponse(res); err != nil { 2642 return nil, err 2643 } 2644 ret := &BucketAccessControl{ 2645 ServerResponse: googleapi.ServerResponse{ 2646 Header: res.Header, 2647 HTTPStatusCode: res.StatusCode, 2648 }, 2649 } 2650 target := &ret 2651 if err := gensupport.DecodeResponse(target, res); err != nil { 2652 return nil, err 2653 } 2654 return ret, nil 2655 // { 2656 // "description": "Returns the ACL entry for the specified entity on the specified bucket.", 2657 // "httpMethod": "GET", 2658 // "id": "storage.bucketAccessControls.get", 2659 // "parameterOrder": [ 2660 // "bucket", 2661 // "entity" 2662 // ], 2663 // "parameters": { 2664 // "bucket": { 2665 // "description": "Name of a bucket.", 2666 // "location": "path", 2667 // "required": true, 2668 // "type": "string" 2669 // }, 2670 // "entity": { 2671 // "description": "The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.", 2672 // "location": "path", 2673 // "required": true, 2674 // "type": "string" 2675 // }, 2676 // "provisionalUserProject": { 2677 // "description": "The project to be billed for this request if the target bucket is requester-pays bucket.", 2678 // "location": "query", 2679 // "type": "string" 2680 // }, 2681 // "userProject": { 2682 // "description": "The project to be billed for this request. Required for Requester Pays buckets.", 2683 // "location": "query", 2684 // "type": "string" 2685 // } 2686 // }, 2687 // "path": "b/{bucket}/acl/{entity}", 2688 // "response": { 2689 // "$ref": "BucketAccessControl" 2690 // }, 2691 // "scopes": [ 2692 // "https://www.googleapis.com/auth/cloud-platform", 2693 // "https://www.googleapis.com/auth/devstorage.full_control" 2694 // ] 2695 // } 2696 2697} 2698 2699// method id "storage.bucketAccessControls.insert": 2700 2701type BucketAccessControlsInsertCall struct { 2702 s *Service 2703 bucket string 2704 bucketaccesscontrol *BucketAccessControl 2705 urlParams_ gensupport.URLParams 2706 ctx_ context.Context 2707 header_ http.Header 2708} 2709 2710// Insert: Creates a new ACL entry on the specified bucket. 2711func (r *BucketAccessControlsService) Insert(bucket string, bucketaccesscontrol *BucketAccessControl) *BucketAccessControlsInsertCall { 2712 c := &BucketAccessControlsInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2713 c.bucket = bucket 2714 c.bucketaccesscontrol = bucketaccesscontrol 2715 return c 2716} 2717 2718// ProvisionalUserProject sets the optional parameter 2719// "provisionalUserProject": The project to be billed for this request 2720// if the target bucket is requester-pays bucket. 2721func (c *BucketAccessControlsInsertCall) ProvisionalUserProject(provisionalUserProject string) *BucketAccessControlsInsertCall { 2722 c.urlParams_.Set("provisionalUserProject", provisionalUserProject) 2723 return c 2724} 2725 2726// UserProject sets the optional parameter "userProject": The project to 2727// be billed for this request. Required for Requester Pays buckets. 2728func (c *BucketAccessControlsInsertCall) UserProject(userProject string) *BucketAccessControlsInsertCall { 2729 c.urlParams_.Set("userProject", userProject) 2730 return c 2731} 2732 2733// Fields allows partial responses to be retrieved. See 2734// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 2735// for more information. 2736func (c *BucketAccessControlsInsertCall) Fields(s ...googleapi.Field) *BucketAccessControlsInsertCall { 2737 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2738 return c 2739} 2740 2741// Context sets the context to be used in this call's Do method. Any 2742// pending HTTP request will be aborted if the provided context is 2743// canceled. 2744func (c *BucketAccessControlsInsertCall) Context(ctx context.Context) *BucketAccessControlsInsertCall { 2745 c.ctx_ = ctx 2746 return c 2747} 2748 2749// Header returns an http.Header that can be modified by the caller to 2750// add HTTP headers to the request. 2751func (c *BucketAccessControlsInsertCall) Header() http.Header { 2752 if c.header_ == nil { 2753 c.header_ = make(http.Header) 2754 } 2755 return c.header_ 2756} 2757 2758func (c *BucketAccessControlsInsertCall) doRequest(alt string) (*http.Response, error) { 2759 reqHeaders := make(http.Header) 2760 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") 2761 for k, v := range c.header_ { 2762 reqHeaders[k] = v 2763 } 2764 reqHeaders.Set("User-Agent", c.s.userAgent()) 2765 var body io.Reader = nil 2766 body, err := googleapi.WithoutDataWrapper.JSONReader(c.bucketaccesscontrol) 2767 if err != nil { 2768 return nil, err 2769 } 2770 reqHeaders.Set("Content-Type", "application/json") 2771 c.urlParams_.Set("alt", alt) 2772 c.urlParams_.Set("prettyPrint", "false") 2773 urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/acl") 2774 urls += "?" + c.urlParams_.Encode() 2775 req, err := http.NewRequest("POST", urls, body) 2776 if err != nil { 2777 return nil, err 2778 } 2779 req.Header = reqHeaders 2780 googleapi.Expand(req.URL, map[string]string{ 2781 "bucket": c.bucket, 2782 }) 2783 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2784} 2785 2786// Do executes the "storage.bucketAccessControls.insert" call. 2787// Exactly one of *BucketAccessControl or error will be non-nil. Any 2788// non-2xx status code is an error. Response headers are in either 2789// *BucketAccessControl.ServerResponse.Header or (if a response was 2790// returned at all) in error.(*googleapi.Error).Header. Use 2791// googleapi.IsNotModified to check whether the returned error was 2792// because http.StatusNotModified was returned. 2793func (c *BucketAccessControlsInsertCall) Do(opts ...googleapi.CallOption) (*BucketAccessControl, error) { 2794 gensupport.SetOptions(c.urlParams_, opts...) 2795 res, err := c.doRequest("json") 2796 if res != nil && res.StatusCode == http.StatusNotModified { 2797 if res.Body != nil { 2798 res.Body.Close() 2799 } 2800 return nil, &googleapi.Error{ 2801 Code: res.StatusCode, 2802 Header: res.Header, 2803 } 2804 } 2805 if err != nil { 2806 return nil, err 2807 } 2808 defer googleapi.CloseBody(res) 2809 if err := googleapi.CheckResponse(res); err != nil { 2810 return nil, err 2811 } 2812 ret := &BucketAccessControl{ 2813 ServerResponse: googleapi.ServerResponse{ 2814 Header: res.Header, 2815 HTTPStatusCode: res.StatusCode, 2816 }, 2817 } 2818 target := &ret 2819 if err := gensupport.DecodeResponse(target, res); err != nil { 2820 return nil, err 2821 } 2822 return ret, nil 2823 // { 2824 // "description": "Creates a new ACL entry on the specified bucket.", 2825 // "httpMethod": "POST", 2826 // "id": "storage.bucketAccessControls.insert", 2827 // "parameterOrder": [ 2828 // "bucket" 2829 // ], 2830 // "parameters": { 2831 // "bucket": { 2832 // "description": "Name of a bucket.", 2833 // "location": "path", 2834 // "required": true, 2835 // "type": "string" 2836 // }, 2837 // "provisionalUserProject": { 2838 // "description": "The project to be billed for this request if the target bucket is requester-pays bucket.", 2839 // "location": "query", 2840 // "type": "string" 2841 // }, 2842 // "userProject": { 2843 // "description": "The project to be billed for this request. Required for Requester Pays buckets.", 2844 // "location": "query", 2845 // "type": "string" 2846 // } 2847 // }, 2848 // "path": "b/{bucket}/acl", 2849 // "request": { 2850 // "$ref": "BucketAccessControl" 2851 // }, 2852 // "response": { 2853 // "$ref": "BucketAccessControl" 2854 // }, 2855 // "scopes": [ 2856 // "https://www.googleapis.com/auth/cloud-platform", 2857 // "https://www.googleapis.com/auth/devstorage.full_control" 2858 // ] 2859 // } 2860 2861} 2862 2863// method id "storage.bucketAccessControls.list": 2864 2865type BucketAccessControlsListCall struct { 2866 s *Service 2867 bucket string 2868 urlParams_ gensupport.URLParams 2869 ifNoneMatch_ string 2870 ctx_ context.Context 2871 header_ http.Header 2872} 2873 2874// List: Retrieves ACL entries on the specified bucket. 2875func (r *BucketAccessControlsService) List(bucket string) *BucketAccessControlsListCall { 2876 c := &BucketAccessControlsListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2877 c.bucket = bucket 2878 return c 2879} 2880 2881// ProvisionalUserProject sets the optional parameter 2882// "provisionalUserProject": The project to be billed for this request 2883// if the target bucket is requester-pays bucket. 2884func (c *BucketAccessControlsListCall) ProvisionalUserProject(provisionalUserProject string) *BucketAccessControlsListCall { 2885 c.urlParams_.Set("provisionalUserProject", provisionalUserProject) 2886 return c 2887} 2888 2889// UserProject sets the optional parameter "userProject": The project to 2890// be billed for this request. Required for Requester Pays buckets. 2891func (c *BucketAccessControlsListCall) UserProject(userProject string) *BucketAccessControlsListCall { 2892 c.urlParams_.Set("userProject", userProject) 2893 return c 2894} 2895 2896// Fields allows partial responses to be retrieved. See 2897// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 2898// for more information. 2899func (c *BucketAccessControlsListCall) Fields(s ...googleapi.Field) *BucketAccessControlsListCall { 2900 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2901 return c 2902} 2903 2904// IfNoneMatch sets the optional parameter which makes the operation 2905// fail if the object's ETag matches the given value. This is useful for 2906// getting updates only after the object has changed since the last 2907// request. Use googleapi.IsNotModified to check whether the response 2908// error from Do is the result of In-None-Match. 2909func (c *BucketAccessControlsListCall) IfNoneMatch(entityTag string) *BucketAccessControlsListCall { 2910 c.ifNoneMatch_ = entityTag 2911 return c 2912} 2913 2914// Context sets the context to be used in this call's Do method. Any 2915// pending HTTP request will be aborted if the provided context is 2916// canceled. 2917func (c *BucketAccessControlsListCall) Context(ctx context.Context) *BucketAccessControlsListCall { 2918 c.ctx_ = ctx 2919 return c 2920} 2921 2922// Header returns an http.Header that can be modified by the caller to 2923// add HTTP headers to the request. 2924func (c *BucketAccessControlsListCall) Header() http.Header { 2925 if c.header_ == nil { 2926 c.header_ = make(http.Header) 2927 } 2928 return c.header_ 2929} 2930 2931func (c *BucketAccessControlsListCall) doRequest(alt string) (*http.Response, error) { 2932 reqHeaders := make(http.Header) 2933 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") 2934 for k, v := range c.header_ { 2935 reqHeaders[k] = v 2936 } 2937 reqHeaders.Set("User-Agent", c.s.userAgent()) 2938 if c.ifNoneMatch_ != "" { 2939 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 2940 } 2941 var body io.Reader = nil 2942 c.urlParams_.Set("alt", alt) 2943 c.urlParams_.Set("prettyPrint", "false") 2944 urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/acl") 2945 urls += "?" + c.urlParams_.Encode() 2946 req, err := http.NewRequest("GET", urls, body) 2947 if err != nil { 2948 return nil, err 2949 } 2950 req.Header = reqHeaders 2951 googleapi.Expand(req.URL, map[string]string{ 2952 "bucket": c.bucket, 2953 }) 2954 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2955} 2956 2957// Do executes the "storage.bucketAccessControls.list" call. 2958// Exactly one of *BucketAccessControls or error will be non-nil. Any 2959// non-2xx status code is an error. Response headers are in either 2960// *BucketAccessControls.ServerResponse.Header or (if a response was 2961// returned at all) in error.(*googleapi.Error).Header. Use 2962// googleapi.IsNotModified to check whether the returned error was 2963// because http.StatusNotModified was returned. 2964func (c *BucketAccessControlsListCall) Do(opts ...googleapi.CallOption) (*BucketAccessControls, error) { 2965 gensupport.SetOptions(c.urlParams_, opts...) 2966 res, err := c.doRequest("json") 2967 if res != nil && res.StatusCode == http.StatusNotModified { 2968 if res.Body != nil { 2969 res.Body.Close() 2970 } 2971 return nil, &googleapi.Error{ 2972 Code: res.StatusCode, 2973 Header: res.Header, 2974 } 2975 } 2976 if err != nil { 2977 return nil, err 2978 } 2979 defer googleapi.CloseBody(res) 2980 if err := googleapi.CheckResponse(res); err != nil { 2981 return nil, err 2982 } 2983 ret := &BucketAccessControls{ 2984 ServerResponse: googleapi.ServerResponse{ 2985 Header: res.Header, 2986 HTTPStatusCode: res.StatusCode, 2987 }, 2988 } 2989 target := &ret 2990 if err := gensupport.DecodeResponse(target, res); err != nil { 2991 return nil, err 2992 } 2993 return ret, nil 2994 // { 2995 // "description": "Retrieves ACL entries on the specified bucket.", 2996 // "httpMethod": "GET", 2997 // "id": "storage.bucketAccessControls.list", 2998 // "parameterOrder": [ 2999 // "bucket" 3000 // ], 3001 // "parameters": { 3002 // "bucket": { 3003 // "description": "Name of a bucket.", 3004 // "location": "path", 3005 // "required": true, 3006 // "type": "string" 3007 // }, 3008 // "provisionalUserProject": { 3009 // "description": "The project to be billed for this request if the target bucket is requester-pays bucket.", 3010 // "location": "query", 3011 // "type": "string" 3012 // }, 3013 // "userProject": { 3014 // "description": "The project to be billed for this request. Required for Requester Pays buckets.", 3015 // "location": "query", 3016 // "type": "string" 3017 // } 3018 // }, 3019 // "path": "b/{bucket}/acl", 3020 // "response": { 3021 // "$ref": "BucketAccessControls" 3022 // }, 3023 // "scopes": [ 3024 // "https://www.googleapis.com/auth/cloud-platform", 3025 // "https://www.googleapis.com/auth/devstorage.full_control" 3026 // ] 3027 // } 3028 3029} 3030 3031// method id "storage.bucketAccessControls.patch": 3032 3033type BucketAccessControlsPatchCall struct { 3034 s *Service 3035 bucket string 3036 entity string 3037 bucketaccesscontrol *BucketAccessControl 3038 urlParams_ gensupport.URLParams 3039 ctx_ context.Context 3040 header_ http.Header 3041} 3042 3043// Patch: Patches an ACL entry on the specified bucket. 3044func (r *BucketAccessControlsService) Patch(bucket string, entity string, bucketaccesscontrol *BucketAccessControl) *BucketAccessControlsPatchCall { 3045 c := &BucketAccessControlsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)} 3046 c.bucket = bucket 3047 c.entity = entity 3048 c.bucketaccesscontrol = bucketaccesscontrol 3049 return c 3050} 3051 3052// ProvisionalUserProject sets the optional parameter 3053// "provisionalUserProject": The project to be billed for this request 3054// if the target bucket is requester-pays bucket. 3055func (c *BucketAccessControlsPatchCall) ProvisionalUserProject(provisionalUserProject string) *BucketAccessControlsPatchCall { 3056 c.urlParams_.Set("provisionalUserProject", provisionalUserProject) 3057 return c 3058} 3059 3060// UserProject sets the optional parameter "userProject": The project to 3061// be billed for this request. Required for Requester Pays buckets. 3062func (c *BucketAccessControlsPatchCall) UserProject(userProject string) *BucketAccessControlsPatchCall { 3063 c.urlParams_.Set("userProject", userProject) 3064 return c 3065} 3066 3067// Fields allows partial responses to be retrieved. See 3068// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 3069// for more information. 3070func (c *BucketAccessControlsPatchCall) Fields(s ...googleapi.Field) *BucketAccessControlsPatchCall { 3071 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 3072 return c 3073} 3074 3075// Context sets the context to be used in this call's Do method. Any 3076// pending HTTP request will be aborted if the provided context is 3077// canceled. 3078func (c *BucketAccessControlsPatchCall) Context(ctx context.Context) *BucketAccessControlsPatchCall { 3079 c.ctx_ = ctx 3080 return c 3081} 3082 3083// Header returns an http.Header that can be modified by the caller to 3084// add HTTP headers to the request. 3085func (c *BucketAccessControlsPatchCall) Header() http.Header { 3086 if c.header_ == nil { 3087 c.header_ = make(http.Header) 3088 } 3089 return c.header_ 3090} 3091 3092func (c *BucketAccessControlsPatchCall) doRequest(alt string) (*http.Response, error) { 3093 reqHeaders := make(http.Header) 3094 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") 3095 for k, v := range c.header_ { 3096 reqHeaders[k] = v 3097 } 3098 reqHeaders.Set("User-Agent", c.s.userAgent()) 3099 var body io.Reader = nil 3100 body, err := googleapi.WithoutDataWrapper.JSONReader(c.bucketaccesscontrol) 3101 if err != nil { 3102 return nil, err 3103 } 3104 reqHeaders.Set("Content-Type", "application/json") 3105 c.urlParams_.Set("alt", alt) 3106 c.urlParams_.Set("prettyPrint", "false") 3107 urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/acl/{entity}") 3108 urls += "?" + c.urlParams_.Encode() 3109 req, err := http.NewRequest("PATCH", urls, body) 3110 if err != nil { 3111 return nil, err 3112 } 3113 req.Header = reqHeaders 3114 googleapi.Expand(req.URL, map[string]string{ 3115 "bucket": c.bucket, 3116 "entity": c.entity, 3117 }) 3118 return gensupport.SendRequest(c.ctx_, c.s.client, req) 3119} 3120 3121// Do executes the "storage.bucketAccessControls.patch" call. 3122// Exactly one of *BucketAccessControl or error will be non-nil. Any 3123// non-2xx status code is an error. Response headers are in either 3124// *BucketAccessControl.ServerResponse.Header or (if a response was 3125// returned at all) in error.(*googleapi.Error).Header. Use 3126// googleapi.IsNotModified to check whether the returned error was 3127// because http.StatusNotModified was returned. 3128func (c *BucketAccessControlsPatchCall) Do(opts ...googleapi.CallOption) (*BucketAccessControl, error) { 3129 gensupport.SetOptions(c.urlParams_, opts...) 3130 res, err := c.doRequest("json") 3131 if res != nil && res.StatusCode == http.StatusNotModified { 3132 if res.Body != nil { 3133 res.Body.Close() 3134 } 3135 return nil, &googleapi.Error{ 3136 Code: res.StatusCode, 3137 Header: res.Header, 3138 } 3139 } 3140 if err != nil { 3141 return nil, err 3142 } 3143 defer googleapi.CloseBody(res) 3144 if err := googleapi.CheckResponse(res); err != nil { 3145 return nil, err 3146 } 3147 ret := &BucketAccessControl{ 3148 ServerResponse: googleapi.ServerResponse{ 3149 Header: res.Header, 3150 HTTPStatusCode: res.StatusCode, 3151 }, 3152 } 3153 target := &ret 3154 if err := gensupport.DecodeResponse(target, res); err != nil { 3155 return nil, err 3156 } 3157 return ret, nil 3158 // { 3159 // "description": "Patches an ACL entry on the specified bucket.", 3160 // "httpMethod": "PATCH", 3161 // "id": "storage.bucketAccessControls.patch", 3162 // "parameterOrder": [ 3163 // "bucket", 3164 // "entity" 3165 // ], 3166 // "parameters": { 3167 // "bucket": { 3168 // "description": "Name of a bucket.", 3169 // "location": "path", 3170 // "required": true, 3171 // "type": "string" 3172 // }, 3173 // "entity": { 3174 // "description": "The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.", 3175 // "location": "path", 3176 // "required": true, 3177 // "type": "string" 3178 // }, 3179 // "provisionalUserProject": { 3180 // "description": "The project to be billed for this request if the target bucket is requester-pays bucket.", 3181 // "location": "query", 3182 // "type": "string" 3183 // }, 3184 // "userProject": { 3185 // "description": "The project to be billed for this request. Required for Requester Pays buckets.", 3186 // "location": "query", 3187 // "type": "string" 3188 // } 3189 // }, 3190 // "path": "b/{bucket}/acl/{entity}", 3191 // "request": { 3192 // "$ref": "BucketAccessControl" 3193 // }, 3194 // "response": { 3195 // "$ref": "BucketAccessControl" 3196 // }, 3197 // "scopes": [ 3198 // "https://www.googleapis.com/auth/cloud-platform", 3199 // "https://www.googleapis.com/auth/devstorage.full_control" 3200 // ] 3201 // } 3202 3203} 3204 3205// method id "storage.bucketAccessControls.update": 3206 3207type BucketAccessControlsUpdateCall struct { 3208 s *Service 3209 bucket string 3210 entity string 3211 bucketaccesscontrol *BucketAccessControl 3212 urlParams_ gensupport.URLParams 3213 ctx_ context.Context 3214 header_ http.Header 3215} 3216 3217// Update: Updates an ACL entry on the specified bucket. 3218func (r *BucketAccessControlsService) Update(bucket string, entity string, bucketaccesscontrol *BucketAccessControl) *BucketAccessControlsUpdateCall { 3219 c := &BucketAccessControlsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 3220 c.bucket = bucket 3221 c.entity = entity 3222 c.bucketaccesscontrol = bucketaccesscontrol 3223 return c 3224} 3225 3226// ProvisionalUserProject sets the optional parameter 3227// "provisionalUserProject": The project to be billed for this request 3228// if the target bucket is requester-pays bucket. 3229func (c *BucketAccessControlsUpdateCall) ProvisionalUserProject(provisionalUserProject string) *BucketAccessControlsUpdateCall { 3230 c.urlParams_.Set("provisionalUserProject", provisionalUserProject) 3231 return c 3232} 3233 3234// UserProject sets the optional parameter "userProject": The project to 3235// be billed for this request. Required for Requester Pays buckets. 3236func (c *BucketAccessControlsUpdateCall) UserProject(userProject string) *BucketAccessControlsUpdateCall { 3237 c.urlParams_.Set("userProject", userProject) 3238 return c 3239} 3240 3241// Fields allows partial responses to be retrieved. See 3242// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 3243// for more information. 3244func (c *BucketAccessControlsUpdateCall) Fields(s ...googleapi.Field) *BucketAccessControlsUpdateCall { 3245 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 3246 return c 3247} 3248 3249// Context sets the context to be used in this call's Do method. Any 3250// pending HTTP request will be aborted if the provided context is 3251// canceled. 3252func (c *BucketAccessControlsUpdateCall) Context(ctx context.Context) *BucketAccessControlsUpdateCall { 3253 c.ctx_ = ctx 3254 return c 3255} 3256 3257// Header returns an http.Header that can be modified by the caller to 3258// add HTTP headers to the request. 3259func (c *BucketAccessControlsUpdateCall) Header() http.Header { 3260 if c.header_ == nil { 3261 c.header_ = make(http.Header) 3262 } 3263 return c.header_ 3264} 3265 3266func (c *BucketAccessControlsUpdateCall) doRequest(alt string) (*http.Response, error) { 3267 reqHeaders := make(http.Header) 3268 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") 3269 for k, v := range c.header_ { 3270 reqHeaders[k] = v 3271 } 3272 reqHeaders.Set("User-Agent", c.s.userAgent()) 3273 var body io.Reader = nil 3274 body, err := googleapi.WithoutDataWrapper.JSONReader(c.bucketaccesscontrol) 3275 if err != nil { 3276 return nil, err 3277 } 3278 reqHeaders.Set("Content-Type", "application/json") 3279 c.urlParams_.Set("alt", alt) 3280 c.urlParams_.Set("prettyPrint", "false") 3281 urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/acl/{entity}") 3282 urls += "?" + c.urlParams_.Encode() 3283 req, err := http.NewRequest("PUT", urls, body) 3284 if err != nil { 3285 return nil, err 3286 } 3287 req.Header = reqHeaders 3288 googleapi.Expand(req.URL, map[string]string{ 3289 "bucket": c.bucket, 3290 "entity": c.entity, 3291 }) 3292 return gensupport.SendRequest(c.ctx_, c.s.client, req) 3293} 3294 3295// Do executes the "storage.bucketAccessControls.update" call. 3296// Exactly one of *BucketAccessControl or error will be non-nil. Any 3297// non-2xx status code is an error. Response headers are in either 3298// *BucketAccessControl.ServerResponse.Header or (if a response was 3299// returned at all) in error.(*googleapi.Error).Header. Use 3300// googleapi.IsNotModified to check whether the returned error was 3301// because http.StatusNotModified was returned. 3302func (c *BucketAccessControlsUpdateCall) Do(opts ...googleapi.CallOption) (*BucketAccessControl, error) { 3303 gensupport.SetOptions(c.urlParams_, opts...) 3304 res, err := c.doRequest("json") 3305 if res != nil && res.StatusCode == http.StatusNotModified { 3306 if res.Body != nil { 3307 res.Body.Close() 3308 } 3309 return nil, &googleapi.Error{ 3310 Code: res.StatusCode, 3311 Header: res.Header, 3312 } 3313 } 3314 if err != nil { 3315 return nil, err 3316 } 3317 defer googleapi.CloseBody(res) 3318 if err := googleapi.CheckResponse(res); err != nil { 3319 return nil, err 3320 } 3321 ret := &BucketAccessControl{ 3322 ServerResponse: googleapi.ServerResponse{ 3323 Header: res.Header, 3324 HTTPStatusCode: res.StatusCode, 3325 }, 3326 } 3327 target := &ret 3328 if err := gensupport.DecodeResponse(target, res); err != nil { 3329 return nil, err 3330 } 3331 return ret, nil 3332 // { 3333 // "description": "Updates an ACL entry on the specified bucket.", 3334 // "httpMethod": "PUT", 3335 // "id": "storage.bucketAccessControls.update", 3336 // "parameterOrder": [ 3337 // "bucket", 3338 // "entity" 3339 // ], 3340 // "parameters": { 3341 // "bucket": { 3342 // "description": "Name of a bucket.", 3343 // "location": "path", 3344 // "required": true, 3345 // "type": "string" 3346 // }, 3347 // "entity": { 3348 // "description": "The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.", 3349 // "location": "path", 3350 // "required": true, 3351 // "type": "string" 3352 // }, 3353 // "provisionalUserProject": { 3354 // "description": "The project to be billed for this request if the target bucket is requester-pays bucket.", 3355 // "location": "query", 3356 // "type": "string" 3357 // }, 3358 // "userProject": { 3359 // "description": "The project to be billed for this request. Required for Requester Pays buckets.", 3360 // "location": "query", 3361 // "type": "string" 3362 // } 3363 // }, 3364 // "path": "b/{bucket}/acl/{entity}", 3365 // "request": { 3366 // "$ref": "BucketAccessControl" 3367 // }, 3368 // "response": { 3369 // "$ref": "BucketAccessControl" 3370 // }, 3371 // "scopes": [ 3372 // "https://www.googleapis.com/auth/cloud-platform", 3373 // "https://www.googleapis.com/auth/devstorage.full_control" 3374 // ] 3375 // } 3376 3377} 3378 3379// method id "storage.buckets.delete": 3380 3381type BucketsDeleteCall struct { 3382 s *Service 3383 bucket string 3384 urlParams_ gensupport.URLParams 3385 ctx_ context.Context 3386 header_ http.Header 3387} 3388 3389// Delete: Permanently deletes an empty bucket. 3390func (r *BucketsService) Delete(bucket string) *BucketsDeleteCall { 3391 c := &BucketsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 3392 c.bucket = bucket 3393 return c 3394} 3395 3396// IfMetagenerationMatch sets the optional parameter 3397// "ifMetagenerationMatch": If set, only deletes the bucket if its 3398// metageneration matches this value. 3399func (c *BucketsDeleteCall) IfMetagenerationMatch(ifMetagenerationMatch int64) *BucketsDeleteCall { 3400 c.urlParams_.Set("ifMetagenerationMatch", fmt.Sprint(ifMetagenerationMatch)) 3401 return c 3402} 3403 3404// IfMetagenerationNotMatch sets the optional parameter 3405// "ifMetagenerationNotMatch": If set, only deletes the bucket if its 3406// metageneration does not match this value. 3407func (c *BucketsDeleteCall) IfMetagenerationNotMatch(ifMetagenerationNotMatch int64) *BucketsDeleteCall { 3408 c.urlParams_.Set("ifMetagenerationNotMatch", fmt.Sprint(ifMetagenerationNotMatch)) 3409 return c 3410} 3411 3412// ProvisionalUserProject sets the optional parameter 3413// "provisionalUserProject": The project to be billed for this request 3414// if the target bucket is requester-pays bucket. 3415func (c *BucketsDeleteCall) ProvisionalUserProject(provisionalUserProject string) *BucketsDeleteCall { 3416 c.urlParams_.Set("provisionalUserProject", provisionalUserProject) 3417 return c 3418} 3419 3420// UserProject sets the optional parameter "userProject": The project to 3421// be billed for this request. Required for Requester Pays buckets. 3422func (c *BucketsDeleteCall) UserProject(userProject string) *BucketsDeleteCall { 3423 c.urlParams_.Set("userProject", userProject) 3424 return c 3425} 3426 3427// Fields allows partial responses to be retrieved. See 3428// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 3429// for more information. 3430func (c *BucketsDeleteCall) Fields(s ...googleapi.Field) *BucketsDeleteCall { 3431 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 3432 return c 3433} 3434 3435// Context sets the context to be used in this call's Do method. Any 3436// pending HTTP request will be aborted if the provided context is 3437// canceled. 3438func (c *BucketsDeleteCall) Context(ctx context.Context) *BucketsDeleteCall { 3439 c.ctx_ = ctx 3440 return c 3441} 3442 3443// Header returns an http.Header that can be modified by the caller to 3444// add HTTP headers to the request. 3445func (c *BucketsDeleteCall) Header() http.Header { 3446 if c.header_ == nil { 3447 c.header_ = make(http.Header) 3448 } 3449 return c.header_ 3450} 3451 3452func (c *BucketsDeleteCall) doRequest(alt string) (*http.Response, error) { 3453 reqHeaders := make(http.Header) 3454 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") 3455 for k, v := range c.header_ { 3456 reqHeaders[k] = v 3457 } 3458 reqHeaders.Set("User-Agent", c.s.userAgent()) 3459 var body io.Reader = nil 3460 c.urlParams_.Set("alt", alt) 3461 c.urlParams_.Set("prettyPrint", "false") 3462 urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}") 3463 urls += "?" + c.urlParams_.Encode() 3464 req, err := http.NewRequest("DELETE", urls, body) 3465 if err != nil { 3466 return nil, err 3467 } 3468 req.Header = reqHeaders 3469 googleapi.Expand(req.URL, map[string]string{ 3470 "bucket": c.bucket, 3471 }) 3472 return gensupport.SendRequest(c.ctx_, c.s.client, req) 3473} 3474 3475// Do executes the "storage.buckets.delete" call. 3476func (c *BucketsDeleteCall) Do(opts ...googleapi.CallOption) error { 3477 gensupport.SetOptions(c.urlParams_, opts...) 3478 res, err := c.doRequest("json") 3479 if err != nil { 3480 return err 3481 } 3482 defer googleapi.CloseBody(res) 3483 if err := googleapi.CheckResponse(res); err != nil { 3484 return err 3485 } 3486 return nil 3487 // { 3488 // "description": "Permanently deletes an empty bucket.", 3489 // "httpMethod": "DELETE", 3490 // "id": "storage.buckets.delete", 3491 // "parameterOrder": [ 3492 // "bucket" 3493 // ], 3494 // "parameters": { 3495 // "bucket": { 3496 // "description": "Name of a bucket.", 3497 // "location": "path", 3498 // "required": true, 3499 // "type": "string" 3500 // }, 3501 // "ifMetagenerationMatch": { 3502 // "description": "If set, only deletes the bucket if its metageneration matches this value.", 3503 // "format": "int64", 3504 // "location": "query", 3505 // "type": "string" 3506 // }, 3507 // "ifMetagenerationNotMatch": { 3508 // "description": "If set, only deletes the bucket if its metageneration does not match this value.", 3509 // "format": "int64", 3510 // "location": "query", 3511 // "type": "string" 3512 // }, 3513 // "provisionalUserProject": { 3514 // "description": "The project to be billed for this request if the target bucket is requester-pays bucket.", 3515 // "location": "query", 3516 // "type": "string" 3517 // }, 3518 // "userProject": { 3519 // "description": "The project to be billed for this request. Required for Requester Pays buckets.", 3520 // "location": "query", 3521 // "type": "string" 3522 // } 3523 // }, 3524 // "path": "b/{bucket}", 3525 // "scopes": [ 3526 // "https://www.googleapis.com/auth/cloud-platform", 3527 // "https://www.googleapis.com/auth/devstorage.full_control", 3528 // "https://www.googleapis.com/auth/devstorage.read_write" 3529 // ] 3530 // } 3531 3532} 3533 3534// method id "storage.buckets.get": 3535 3536type BucketsGetCall struct { 3537 s *Service 3538 bucket string 3539 urlParams_ gensupport.URLParams 3540 ifNoneMatch_ string 3541 ctx_ context.Context 3542 header_ http.Header 3543} 3544 3545// Get: Returns metadata for the specified bucket. 3546func (r *BucketsService) Get(bucket string) *BucketsGetCall { 3547 c := &BucketsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 3548 c.bucket = bucket 3549 return c 3550} 3551 3552// IfMetagenerationMatch sets the optional parameter 3553// "ifMetagenerationMatch": Makes the return of the bucket metadata 3554// conditional on whether the bucket's current metageneration matches 3555// the given value. 3556func (c *BucketsGetCall) IfMetagenerationMatch(ifMetagenerationMatch int64) *BucketsGetCall { 3557 c.urlParams_.Set("ifMetagenerationMatch", fmt.Sprint(ifMetagenerationMatch)) 3558 return c 3559} 3560 3561// IfMetagenerationNotMatch sets the optional parameter 3562// "ifMetagenerationNotMatch": Makes the return of the bucket metadata 3563// conditional on whether the bucket's current metageneration does not 3564// match the given value. 3565func (c *BucketsGetCall) IfMetagenerationNotMatch(ifMetagenerationNotMatch int64) *BucketsGetCall { 3566 c.urlParams_.Set("ifMetagenerationNotMatch", fmt.Sprint(ifMetagenerationNotMatch)) 3567 return c 3568} 3569 3570// Projection sets the optional parameter "projection": Set of 3571// properties to return. Defaults to noAcl. 3572// 3573// Possible values: 3574// "full" - Include all properties. 3575// "noAcl" - Omit owner, acl and defaultObjectAcl properties. 3576func (c *BucketsGetCall) Projection(projection string) *BucketsGetCall { 3577 c.urlParams_.Set("projection", projection) 3578 return c 3579} 3580 3581// ProvisionalUserProject sets the optional parameter 3582// "provisionalUserProject": The project to be billed for this request 3583// if the target bucket is requester-pays bucket. 3584func (c *BucketsGetCall) ProvisionalUserProject(provisionalUserProject string) *BucketsGetCall { 3585 c.urlParams_.Set("provisionalUserProject", provisionalUserProject) 3586 return c 3587} 3588 3589// UserProject sets the optional parameter "userProject": The project to 3590// be billed for this request. Required for Requester Pays buckets. 3591func (c *BucketsGetCall) UserProject(userProject string) *BucketsGetCall { 3592 c.urlParams_.Set("userProject", userProject) 3593 return c 3594} 3595 3596// Fields allows partial responses to be retrieved. See 3597// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 3598// for more information. 3599func (c *BucketsGetCall) Fields(s ...googleapi.Field) *BucketsGetCall { 3600 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 3601 return c 3602} 3603 3604// IfNoneMatch sets the optional parameter which makes the operation 3605// fail if the object's ETag matches the given value. This is useful for 3606// getting updates only after the object has changed since the last 3607// request. Use googleapi.IsNotModified to check whether the response 3608// error from Do is the result of In-None-Match. 3609func (c *BucketsGetCall) IfNoneMatch(entityTag string) *BucketsGetCall { 3610 c.ifNoneMatch_ = entityTag 3611 return c 3612} 3613 3614// Context sets the context to be used in this call's Do method. Any 3615// pending HTTP request will be aborted if the provided context is 3616// canceled. 3617func (c *BucketsGetCall) Context(ctx context.Context) *BucketsGetCall { 3618 c.ctx_ = ctx 3619 return c 3620} 3621 3622// Header returns an http.Header that can be modified by the caller to 3623// add HTTP headers to the request. 3624func (c *BucketsGetCall) Header() http.Header { 3625 if c.header_ == nil { 3626 c.header_ = make(http.Header) 3627 } 3628 return c.header_ 3629} 3630 3631func (c *BucketsGetCall) doRequest(alt string) (*http.Response, error) { 3632 reqHeaders := make(http.Header) 3633 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") 3634 for k, v := range c.header_ { 3635 reqHeaders[k] = v 3636 } 3637 reqHeaders.Set("User-Agent", c.s.userAgent()) 3638 if c.ifNoneMatch_ != "" { 3639 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 3640 } 3641 var body io.Reader = nil 3642 c.urlParams_.Set("alt", alt) 3643 c.urlParams_.Set("prettyPrint", "false") 3644 urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}") 3645 urls += "?" + c.urlParams_.Encode() 3646 req, err := http.NewRequest("GET", urls, body) 3647 if err != nil { 3648 return nil, err 3649 } 3650 req.Header = reqHeaders 3651 googleapi.Expand(req.URL, map[string]string{ 3652 "bucket": c.bucket, 3653 }) 3654 return gensupport.SendRequest(c.ctx_, c.s.client, req) 3655} 3656 3657// Do executes the "storage.buckets.get" call. 3658// Exactly one of *Bucket or error will be non-nil. Any non-2xx status 3659// code is an error. Response headers are in either 3660// *Bucket.ServerResponse.Header or (if a response was returned at all) 3661// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 3662// check whether the returned error was because http.StatusNotModified 3663// was returned. 3664func (c *BucketsGetCall) Do(opts ...googleapi.CallOption) (*Bucket, error) { 3665 gensupport.SetOptions(c.urlParams_, opts...) 3666 res, err := c.doRequest("json") 3667 if res != nil && res.StatusCode == http.StatusNotModified { 3668 if res.Body != nil { 3669 res.Body.Close() 3670 } 3671 return nil, &googleapi.Error{ 3672 Code: res.StatusCode, 3673 Header: res.Header, 3674 } 3675 } 3676 if err != nil { 3677 return nil, err 3678 } 3679 defer googleapi.CloseBody(res) 3680 if err := googleapi.CheckResponse(res); err != nil { 3681 return nil, err 3682 } 3683 ret := &Bucket{ 3684 ServerResponse: googleapi.ServerResponse{ 3685 Header: res.Header, 3686 HTTPStatusCode: res.StatusCode, 3687 }, 3688 } 3689 target := &ret 3690 if err := gensupport.DecodeResponse(target, res); err != nil { 3691 return nil, err 3692 } 3693 return ret, nil 3694 // { 3695 // "description": "Returns metadata for the specified bucket.", 3696 // "httpMethod": "GET", 3697 // "id": "storage.buckets.get", 3698 // "parameterOrder": [ 3699 // "bucket" 3700 // ], 3701 // "parameters": { 3702 // "bucket": { 3703 // "description": "Name of a bucket.", 3704 // "location": "path", 3705 // "required": true, 3706 // "type": "string" 3707 // }, 3708 // "ifMetagenerationMatch": { 3709 // "description": "Makes the return of the bucket metadata conditional on whether the bucket's current metageneration matches the given value.", 3710 // "format": "int64", 3711 // "location": "query", 3712 // "type": "string" 3713 // }, 3714 // "ifMetagenerationNotMatch": { 3715 // "description": "Makes the return of the bucket metadata conditional on whether the bucket's current metageneration does not match the given value.", 3716 // "format": "int64", 3717 // "location": "query", 3718 // "type": "string" 3719 // }, 3720 // "projection": { 3721 // "description": "Set of properties to return. Defaults to noAcl.", 3722 // "enum": [ 3723 // "full", 3724 // "noAcl" 3725 // ], 3726 // "enumDescriptions": [ 3727 // "Include all properties.", 3728 // "Omit owner, acl and defaultObjectAcl properties." 3729 // ], 3730 // "location": "query", 3731 // "type": "string" 3732 // }, 3733 // "provisionalUserProject": { 3734 // "description": "The project to be billed for this request if the target bucket is requester-pays bucket.", 3735 // "location": "query", 3736 // "type": "string" 3737 // }, 3738 // "userProject": { 3739 // "description": "The project to be billed for this request. Required for Requester Pays buckets.", 3740 // "location": "query", 3741 // "type": "string" 3742 // } 3743 // }, 3744 // "path": "b/{bucket}", 3745 // "response": { 3746 // "$ref": "Bucket" 3747 // }, 3748 // "scopes": [ 3749 // "https://www.googleapis.com/auth/cloud-platform", 3750 // "https://www.googleapis.com/auth/cloud-platform.read-only", 3751 // "https://www.googleapis.com/auth/devstorage.full_control", 3752 // "https://www.googleapis.com/auth/devstorage.read_only", 3753 // "https://www.googleapis.com/auth/devstorage.read_write" 3754 // ] 3755 // } 3756 3757} 3758 3759// method id "storage.buckets.getIamPolicy": 3760 3761type BucketsGetIamPolicyCall struct { 3762 s *Service 3763 bucket string 3764 urlParams_ gensupport.URLParams 3765 ifNoneMatch_ string 3766 ctx_ context.Context 3767 header_ http.Header 3768} 3769 3770// GetIamPolicy: Returns an IAM policy for the specified bucket. 3771func (r *BucketsService) GetIamPolicy(bucket string) *BucketsGetIamPolicyCall { 3772 c := &BucketsGetIamPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)} 3773 c.bucket = bucket 3774 return c 3775} 3776 3777// OptionsRequestedPolicyVersion sets the optional parameter 3778// "optionsRequestedPolicyVersion": The IAM policy format version to be 3779// returned. If the optionsRequestedPolicyVersion is for an older 3780// version that doesn't support part of the requested IAM policy, the 3781// request fails. 3782func (c *BucketsGetIamPolicyCall) OptionsRequestedPolicyVersion(optionsRequestedPolicyVersion int64) *BucketsGetIamPolicyCall { 3783 c.urlParams_.Set("optionsRequestedPolicyVersion", fmt.Sprint(optionsRequestedPolicyVersion)) 3784 return c 3785} 3786 3787// ProvisionalUserProject sets the optional parameter 3788// "provisionalUserProject": The project to be billed for this request 3789// if the target bucket is requester-pays bucket. 3790func (c *BucketsGetIamPolicyCall) ProvisionalUserProject(provisionalUserProject string) *BucketsGetIamPolicyCall { 3791 c.urlParams_.Set("provisionalUserProject", provisionalUserProject) 3792 return c 3793} 3794 3795// UserProject sets the optional parameter "userProject": The project to 3796// be billed for this request. Required for Requester Pays buckets. 3797func (c *BucketsGetIamPolicyCall) UserProject(userProject string) *BucketsGetIamPolicyCall { 3798 c.urlParams_.Set("userProject", userProject) 3799 return c 3800} 3801 3802// Fields allows partial responses to be retrieved. See 3803// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 3804// for more information. 3805func (c *BucketsGetIamPolicyCall) Fields(s ...googleapi.Field) *BucketsGetIamPolicyCall { 3806 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 3807 return c 3808} 3809 3810// IfNoneMatch sets the optional parameter which makes the operation 3811// fail if the object's ETag matches the given value. This is useful for 3812// getting updates only after the object has changed since the last 3813// request. Use googleapi.IsNotModified to check whether the response 3814// error from Do is the result of In-None-Match. 3815func (c *BucketsGetIamPolicyCall) IfNoneMatch(entityTag string) *BucketsGetIamPolicyCall { 3816 c.ifNoneMatch_ = entityTag 3817 return c 3818} 3819 3820// Context sets the context to be used in this call's Do method. Any 3821// pending HTTP request will be aborted if the provided context is 3822// canceled. 3823func (c *BucketsGetIamPolicyCall) Context(ctx context.Context) *BucketsGetIamPolicyCall { 3824 c.ctx_ = ctx 3825 return c 3826} 3827 3828// Header returns an http.Header that can be modified by the caller to 3829// add HTTP headers to the request. 3830func (c *BucketsGetIamPolicyCall) Header() http.Header { 3831 if c.header_ == nil { 3832 c.header_ = make(http.Header) 3833 } 3834 return c.header_ 3835} 3836 3837func (c *BucketsGetIamPolicyCall) doRequest(alt string) (*http.Response, error) { 3838 reqHeaders := make(http.Header) 3839 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") 3840 for k, v := range c.header_ { 3841 reqHeaders[k] = v 3842 } 3843 reqHeaders.Set("User-Agent", c.s.userAgent()) 3844 if c.ifNoneMatch_ != "" { 3845 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 3846 } 3847 var body io.Reader = nil 3848 c.urlParams_.Set("alt", alt) 3849 c.urlParams_.Set("prettyPrint", "false") 3850 urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/iam") 3851 urls += "?" + c.urlParams_.Encode() 3852 req, err := http.NewRequest("GET", urls, body) 3853 if err != nil { 3854 return nil, err 3855 } 3856 req.Header = reqHeaders 3857 googleapi.Expand(req.URL, map[string]string{ 3858 "bucket": c.bucket, 3859 }) 3860 return gensupport.SendRequest(c.ctx_, c.s.client, req) 3861} 3862 3863// Do executes the "storage.buckets.getIamPolicy" call. 3864// Exactly one of *Policy or error will be non-nil. Any non-2xx status 3865// code is an error. Response headers are in either 3866// *Policy.ServerResponse.Header or (if a response was returned at all) 3867// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 3868// check whether the returned error was because http.StatusNotModified 3869// was returned. 3870func (c *BucketsGetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Policy, error) { 3871 gensupport.SetOptions(c.urlParams_, opts...) 3872 res, err := c.doRequest("json") 3873 if res != nil && res.StatusCode == http.StatusNotModified { 3874 if res.Body != nil { 3875 res.Body.Close() 3876 } 3877 return nil, &googleapi.Error{ 3878 Code: res.StatusCode, 3879 Header: res.Header, 3880 } 3881 } 3882 if err != nil { 3883 return nil, err 3884 } 3885 defer googleapi.CloseBody(res) 3886 if err := googleapi.CheckResponse(res); err != nil { 3887 return nil, err 3888 } 3889 ret := &Policy{ 3890 ServerResponse: googleapi.ServerResponse{ 3891 Header: res.Header, 3892 HTTPStatusCode: res.StatusCode, 3893 }, 3894 } 3895 target := &ret 3896 if err := gensupport.DecodeResponse(target, res); err != nil { 3897 return nil, err 3898 } 3899 return ret, nil 3900 // { 3901 // "description": "Returns an IAM policy for the specified bucket.", 3902 // "httpMethod": "GET", 3903 // "id": "storage.buckets.getIamPolicy", 3904 // "parameterOrder": [ 3905 // "bucket" 3906 // ], 3907 // "parameters": { 3908 // "bucket": { 3909 // "description": "Name of a bucket.", 3910 // "location": "path", 3911 // "required": true, 3912 // "type": "string" 3913 // }, 3914 // "optionsRequestedPolicyVersion": { 3915 // "description": "The IAM policy format version to be returned. If the optionsRequestedPolicyVersion is for an older version that doesn't support part of the requested IAM policy, the request fails.", 3916 // "format": "int32", 3917 // "location": "query", 3918 // "minimum": "1", 3919 // "type": "integer" 3920 // }, 3921 // "provisionalUserProject": { 3922 // "description": "The project to be billed for this request if the target bucket is requester-pays bucket.", 3923 // "location": "query", 3924 // "type": "string" 3925 // }, 3926 // "userProject": { 3927 // "description": "The project to be billed for this request. Required for Requester Pays buckets.", 3928 // "location": "query", 3929 // "type": "string" 3930 // } 3931 // }, 3932 // "path": "b/{bucket}/iam", 3933 // "response": { 3934 // "$ref": "Policy" 3935 // }, 3936 // "scopes": [ 3937 // "https://www.googleapis.com/auth/cloud-platform", 3938 // "https://www.googleapis.com/auth/devstorage.full_control" 3939 // ] 3940 // } 3941 3942} 3943 3944// method id "storage.buckets.insert": 3945 3946type BucketsInsertCall struct { 3947 s *Service 3948 bucket *Bucket 3949 urlParams_ gensupport.URLParams 3950 ctx_ context.Context 3951 header_ http.Header 3952} 3953 3954// Insert: Creates a new bucket. 3955func (r *BucketsService) Insert(projectid string, bucket *Bucket) *BucketsInsertCall { 3956 c := &BucketsInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)} 3957 c.urlParams_.Set("project", projectid) 3958 c.bucket = bucket 3959 return c 3960} 3961 3962// PredefinedAcl sets the optional parameter "predefinedAcl": Apply a 3963// predefined set of access controls to this bucket. 3964// 3965// Possible values: 3966// "authenticatedRead" - Project team owners get OWNER access, and 3967// allAuthenticatedUsers get READER access. 3968// "private" - Project team owners get OWNER access. 3969// "projectPrivate" - Project team members get access according to 3970// their roles. 3971// "publicRead" - Project team owners get OWNER access, and allUsers 3972// get READER access. 3973// "publicReadWrite" - Project team owners get OWNER access, and 3974// allUsers get WRITER access. 3975func (c *BucketsInsertCall) PredefinedAcl(predefinedAcl string) *BucketsInsertCall { 3976 c.urlParams_.Set("predefinedAcl", predefinedAcl) 3977 return c 3978} 3979 3980// PredefinedDefaultObjectAcl sets the optional parameter 3981// "predefinedDefaultObjectAcl": Apply a predefined set of default 3982// object access controls to this bucket. 3983// 3984// Possible values: 3985// "authenticatedRead" - Object owner gets OWNER access, and 3986// allAuthenticatedUsers get READER access. 3987// "bucketOwnerFullControl" - Object owner gets OWNER access, and 3988// project team owners get OWNER access. 3989// "bucketOwnerRead" - Object owner gets OWNER access, and project 3990// team owners get READER access. 3991// "private" - Object owner gets OWNER access. 3992// "projectPrivate" - Object owner gets OWNER access, and project team 3993// members get access according to their roles. 3994// "publicRead" - Object owner gets OWNER access, and allUsers get 3995// READER access. 3996func (c *BucketsInsertCall) PredefinedDefaultObjectAcl(predefinedDefaultObjectAcl string) *BucketsInsertCall { 3997 c.urlParams_.Set("predefinedDefaultObjectAcl", predefinedDefaultObjectAcl) 3998 return c 3999} 4000 4001// Projection sets the optional parameter "projection": Set of 4002// properties to return. Defaults to noAcl, unless the bucket resource 4003// specifies acl or defaultObjectAcl properties, when it defaults to 4004// full. 4005// 4006// Possible values: 4007// "full" - Include all properties. 4008// "noAcl" - Omit owner, acl and defaultObjectAcl properties. 4009func (c *BucketsInsertCall) Projection(projection string) *BucketsInsertCall { 4010 c.urlParams_.Set("projection", projection) 4011 return c 4012} 4013 4014// ProvisionalUserProject sets the optional parameter 4015// "provisionalUserProject": The project to be billed for this request 4016// if the target bucket is requester-pays bucket. 4017func (c *BucketsInsertCall) ProvisionalUserProject(provisionalUserProject string) *BucketsInsertCall { 4018 c.urlParams_.Set("provisionalUserProject", provisionalUserProject) 4019 return c 4020} 4021 4022// UserProject sets the optional parameter "userProject": The project to 4023// be billed for this request. 4024func (c *BucketsInsertCall) UserProject(userProject string) *BucketsInsertCall { 4025 c.urlParams_.Set("userProject", userProject) 4026 return c 4027} 4028 4029// Fields allows partial responses to be retrieved. See 4030// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 4031// for more information. 4032func (c *BucketsInsertCall) Fields(s ...googleapi.Field) *BucketsInsertCall { 4033 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 4034 return c 4035} 4036 4037// Context sets the context to be used in this call's Do method. Any 4038// pending HTTP request will be aborted if the provided context is 4039// canceled. 4040func (c *BucketsInsertCall) Context(ctx context.Context) *BucketsInsertCall { 4041 c.ctx_ = ctx 4042 return c 4043} 4044 4045// Header returns an http.Header that can be modified by the caller to 4046// add HTTP headers to the request. 4047func (c *BucketsInsertCall) Header() http.Header { 4048 if c.header_ == nil { 4049 c.header_ = make(http.Header) 4050 } 4051 return c.header_ 4052} 4053 4054func (c *BucketsInsertCall) doRequest(alt string) (*http.Response, error) { 4055 reqHeaders := make(http.Header) 4056 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") 4057 for k, v := range c.header_ { 4058 reqHeaders[k] = v 4059 } 4060 reqHeaders.Set("User-Agent", c.s.userAgent()) 4061 var body io.Reader = nil 4062 body, err := googleapi.WithoutDataWrapper.JSONReader(c.bucket) 4063 if err != nil { 4064 return nil, err 4065 } 4066 reqHeaders.Set("Content-Type", "application/json") 4067 c.urlParams_.Set("alt", alt) 4068 c.urlParams_.Set("prettyPrint", "false") 4069 urls := googleapi.ResolveRelative(c.s.BasePath, "b") 4070 urls += "?" + c.urlParams_.Encode() 4071 req, err := http.NewRequest("POST", urls, body) 4072 if err != nil { 4073 return nil, err 4074 } 4075 req.Header = reqHeaders 4076 return gensupport.SendRequest(c.ctx_, c.s.client, req) 4077} 4078 4079// Do executes the "storage.buckets.insert" call. 4080// Exactly one of *Bucket or error will be non-nil. Any non-2xx status 4081// code is an error. Response headers are in either 4082// *Bucket.ServerResponse.Header or (if a response was returned at all) 4083// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 4084// check whether the returned error was because http.StatusNotModified 4085// was returned. 4086func (c *BucketsInsertCall) Do(opts ...googleapi.CallOption) (*Bucket, error) { 4087 gensupport.SetOptions(c.urlParams_, opts...) 4088 res, err := c.doRequest("json") 4089 if res != nil && res.StatusCode == http.StatusNotModified { 4090 if res.Body != nil { 4091 res.Body.Close() 4092 } 4093 return nil, &googleapi.Error{ 4094 Code: res.StatusCode, 4095 Header: res.Header, 4096 } 4097 } 4098 if err != nil { 4099 return nil, err 4100 } 4101 defer googleapi.CloseBody(res) 4102 if err := googleapi.CheckResponse(res); err != nil { 4103 return nil, err 4104 } 4105 ret := &Bucket{ 4106 ServerResponse: googleapi.ServerResponse{ 4107 Header: res.Header, 4108 HTTPStatusCode: res.StatusCode, 4109 }, 4110 } 4111 target := &ret 4112 if err := gensupport.DecodeResponse(target, res); err != nil { 4113 return nil, err 4114 } 4115 return ret, nil 4116 // { 4117 // "description": "Creates a new bucket.", 4118 // "httpMethod": "POST", 4119 // "id": "storage.buckets.insert", 4120 // "parameterOrder": [ 4121 // "project" 4122 // ], 4123 // "parameters": { 4124 // "predefinedAcl": { 4125 // "description": "Apply a predefined set of access controls to this bucket.", 4126 // "enum": [ 4127 // "authenticatedRead", 4128 // "private", 4129 // "projectPrivate", 4130 // "publicRead", 4131 // "publicReadWrite" 4132 // ], 4133 // "enumDescriptions": [ 4134 // "Project team owners get OWNER access, and allAuthenticatedUsers get READER access.", 4135 // "Project team owners get OWNER access.", 4136 // "Project team members get access according to their roles.", 4137 // "Project team owners get OWNER access, and allUsers get READER access.", 4138 // "Project team owners get OWNER access, and allUsers get WRITER access." 4139 // ], 4140 // "location": "query", 4141 // "type": "string" 4142 // }, 4143 // "predefinedDefaultObjectAcl": { 4144 // "description": "Apply a predefined set of default object access controls to this bucket.", 4145 // "enum": [ 4146 // "authenticatedRead", 4147 // "bucketOwnerFullControl", 4148 // "bucketOwnerRead", 4149 // "private", 4150 // "projectPrivate", 4151 // "publicRead" 4152 // ], 4153 // "enumDescriptions": [ 4154 // "Object owner gets OWNER access, and allAuthenticatedUsers get READER access.", 4155 // "Object owner gets OWNER access, and project team owners get OWNER access.", 4156 // "Object owner gets OWNER access, and project team owners get READER access.", 4157 // "Object owner gets OWNER access.", 4158 // "Object owner gets OWNER access, and project team members get access according to their roles.", 4159 // "Object owner gets OWNER access, and allUsers get READER access." 4160 // ], 4161 // "location": "query", 4162 // "type": "string" 4163 // }, 4164 // "project": { 4165 // "description": "A valid API project identifier.", 4166 // "location": "query", 4167 // "required": true, 4168 // "type": "string" 4169 // }, 4170 // "projection": { 4171 // "description": "Set of properties to return. Defaults to noAcl, unless the bucket resource specifies acl or defaultObjectAcl properties, when it defaults to full.", 4172 // "enum": [ 4173 // "full", 4174 // "noAcl" 4175 // ], 4176 // "enumDescriptions": [ 4177 // "Include all properties.", 4178 // "Omit owner, acl and defaultObjectAcl properties." 4179 // ], 4180 // "location": "query", 4181 // "type": "string" 4182 // }, 4183 // "provisionalUserProject": { 4184 // "description": "The project to be billed for this request if the target bucket is requester-pays bucket.", 4185 // "location": "query", 4186 // "type": "string" 4187 // }, 4188 // "userProject": { 4189 // "description": "The project to be billed for this request.", 4190 // "location": "query", 4191 // "type": "string" 4192 // } 4193 // }, 4194 // "path": "b", 4195 // "request": { 4196 // "$ref": "Bucket" 4197 // }, 4198 // "response": { 4199 // "$ref": "Bucket" 4200 // }, 4201 // "scopes": [ 4202 // "https://www.googleapis.com/auth/cloud-platform", 4203 // "https://www.googleapis.com/auth/devstorage.full_control", 4204 // "https://www.googleapis.com/auth/devstorage.read_write" 4205 // ] 4206 // } 4207 4208} 4209 4210// method id "storage.buckets.list": 4211 4212type BucketsListCall struct { 4213 s *Service 4214 urlParams_ gensupport.URLParams 4215 ifNoneMatch_ string 4216 ctx_ context.Context 4217 header_ http.Header 4218} 4219 4220// List: Retrieves a list of buckets for a given project. 4221func (r *BucketsService) List(projectid string) *BucketsListCall { 4222 c := &BucketsListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 4223 c.urlParams_.Set("project", projectid) 4224 return c 4225} 4226 4227// MaxResults sets the optional parameter "maxResults": Maximum number 4228// of buckets to return in a single response. The service will use this 4229// parameter or 1,000 items, whichever is smaller. 4230func (c *BucketsListCall) MaxResults(maxResults int64) *BucketsListCall { 4231 c.urlParams_.Set("maxResults", fmt.Sprint(maxResults)) 4232 return c 4233} 4234 4235// PageToken sets the optional parameter "pageToken": A 4236// previously-returned page token representing part of the larger set of 4237// results to view. 4238func (c *BucketsListCall) PageToken(pageToken string) *BucketsListCall { 4239 c.urlParams_.Set("pageToken", pageToken) 4240 return c 4241} 4242 4243// Prefix sets the optional parameter "prefix": Filter results to 4244// buckets whose names begin with this prefix. 4245func (c *BucketsListCall) Prefix(prefix string) *BucketsListCall { 4246 c.urlParams_.Set("prefix", prefix) 4247 return c 4248} 4249 4250// Projection sets the optional parameter "projection": Set of 4251// properties to return. Defaults to noAcl. 4252// 4253// Possible values: 4254// "full" - Include all properties. 4255// "noAcl" - Omit owner, acl and defaultObjectAcl properties. 4256func (c *BucketsListCall) Projection(projection string) *BucketsListCall { 4257 c.urlParams_.Set("projection", projection) 4258 return c 4259} 4260 4261// ProvisionalUserProject sets the optional parameter 4262// "provisionalUserProject": The project to be billed for this request 4263// if the target bucket is requester-pays bucket. 4264func (c *BucketsListCall) ProvisionalUserProject(provisionalUserProject string) *BucketsListCall { 4265 c.urlParams_.Set("provisionalUserProject", provisionalUserProject) 4266 return c 4267} 4268 4269// UserProject sets the optional parameter "userProject": The project to 4270// be billed for this request. 4271func (c *BucketsListCall) UserProject(userProject string) *BucketsListCall { 4272 c.urlParams_.Set("userProject", userProject) 4273 return c 4274} 4275 4276// Fields allows partial responses to be retrieved. See 4277// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 4278// for more information. 4279func (c *BucketsListCall) Fields(s ...googleapi.Field) *BucketsListCall { 4280 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 4281 return c 4282} 4283 4284// IfNoneMatch sets the optional parameter which makes the operation 4285// fail if the object's ETag matches the given value. This is useful for 4286// getting updates only after the object has changed since the last 4287// request. Use googleapi.IsNotModified to check whether the response 4288// error from Do is the result of In-None-Match. 4289func (c *BucketsListCall) IfNoneMatch(entityTag string) *BucketsListCall { 4290 c.ifNoneMatch_ = entityTag 4291 return c 4292} 4293 4294// Context sets the context to be used in this call's Do method. Any 4295// pending HTTP request will be aborted if the provided context is 4296// canceled. 4297func (c *BucketsListCall) Context(ctx context.Context) *BucketsListCall { 4298 c.ctx_ = ctx 4299 return c 4300} 4301 4302// Header returns an http.Header that can be modified by the caller to 4303// add HTTP headers to the request. 4304func (c *BucketsListCall) Header() http.Header { 4305 if c.header_ == nil { 4306 c.header_ = make(http.Header) 4307 } 4308 return c.header_ 4309} 4310 4311func (c *BucketsListCall) doRequest(alt string) (*http.Response, error) { 4312 reqHeaders := make(http.Header) 4313 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") 4314 for k, v := range c.header_ { 4315 reqHeaders[k] = v 4316 } 4317 reqHeaders.Set("User-Agent", c.s.userAgent()) 4318 if c.ifNoneMatch_ != "" { 4319 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 4320 } 4321 var body io.Reader = nil 4322 c.urlParams_.Set("alt", alt) 4323 c.urlParams_.Set("prettyPrint", "false") 4324 urls := googleapi.ResolveRelative(c.s.BasePath, "b") 4325 urls += "?" + c.urlParams_.Encode() 4326 req, err := http.NewRequest("GET", urls, body) 4327 if err != nil { 4328 return nil, err 4329 } 4330 req.Header = reqHeaders 4331 return gensupport.SendRequest(c.ctx_, c.s.client, req) 4332} 4333 4334// Do executes the "storage.buckets.list" call. 4335// Exactly one of *Buckets or error will be non-nil. Any non-2xx status 4336// code is an error. Response headers are in either 4337// *Buckets.ServerResponse.Header or (if a response was returned at all) 4338// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 4339// check whether the returned error was because http.StatusNotModified 4340// was returned. 4341func (c *BucketsListCall) Do(opts ...googleapi.CallOption) (*Buckets, error) { 4342 gensupport.SetOptions(c.urlParams_, opts...) 4343 res, err := c.doRequest("json") 4344 if res != nil && res.StatusCode == http.StatusNotModified { 4345 if res.Body != nil { 4346 res.Body.Close() 4347 } 4348 return nil, &googleapi.Error{ 4349 Code: res.StatusCode, 4350 Header: res.Header, 4351 } 4352 } 4353 if err != nil { 4354 return nil, err 4355 } 4356 defer googleapi.CloseBody(res) 4357 if err := googleapi.CheckResponse(res); err != nil { 4358 return nil, err 4359 } 4360 ret := &Buckets{ 4361 ServerResponse: googleapi.ServerResponse{ 4362 Header: res.Header, 4363 HTTPStatusCode: res.StatusCode, 4364 }, 4365 } 4366 target := &ret 4367 if err := gensupport.DecodeResponse(target, res); err != nil { 4368 return nil, err 4369 } 4370 return ret, nil 4371 // { 4372 // "description": "Retrieves a list of buckets for a given project.", 4373 // "httpMethod": "GET", 4374 // "id": "storage.buckets.list", 4375 // "parameterOrder": [ 4376 // "project" 4377 // ], 4378 // "parameters": { 4379 // "maxResults": { 4380 // "default": "1000", 4381 // "description": "Maximum number of buckets to return in a single response. The service will use this parameter or 1,000 items, whichever is smaller.", 4382 // "format": "uint32", 4383 // "location": "query", 4384 // "minimum": "0", 4385 // "type": "integer" 4386 // }, 4387 // "pageToken": { 4388 // "description": "A previously-returned page token representing part of the larger set of results to view.", 4389 // "location": "query", 4390 // "type": "string" 4391 // }, 4392 // "prefix": { 4393 // "description": "Filter results to buckets whose names begin with this prefix.", 4394 // "location": "query", 4395 // "type": "string" 4396 // }, 4397 // "project": { 4398 // "description": "A valid API project identifier.", 4399 // "location": "query", 4400 // "required": true, 4401 // "type": "string" 4402 // }, 4403 // "projection": { 4404 // "description": "Set of properties to return. Defaults to noAcl.", 4405 // "enum": [ 4406 // "full", 4407 // "noAcl" 4408 // ], 4409 // "enumDescriptions": [ 4410 // "Include all properties.", 4411 // "Omit owner, acl and defaultObjectAcl properties." 4412 // ], 4413 // "location": "query", 4414 // "type": "string" 4415 // }, 4416 // "provisionalUserProject": { 4417 // "description": "The project to be billed for this request if the target bucket is requester-pays bucket.", 4418 // "location": "query", 4419 // "type": "string" 4420 // }, 4421 // "userProject": { 4422 // "description": "The project to be billed for this request.", 4423 // "location": "query", 4424 // "type": "string" 4425 // } 4426 // }, 4427 // "path": "b", 4428 // "response": { 4429 // "$ref": "Buckets" 4430 // }, 4431 // "scopes": [ 4432 // "https://www.googleapis.com/auth/cloud-platform", 4433 // "https://www.googleapis.com/auth/cloud-platform.read-only", 4434 // "https://www.googleapis.com/auth/devstorage.full_control", 4435 // "https://www.googleapis.com/auth/devstorage.read_only", 4436 // "https://www.googleapis.com/auth/devstorage.read_write" 4437 // ] 4438 // } 4439 4440} 4441 4442// Pages invokes f for each page of results. 4443// A non-nil error returned from f will halt the iteration. 4444// The provided context supersedes any context provided to the Context method. 4445func (c *BucketsListCall) Pages(ctx context.Context, f func(*Buckets) error) error { 4446 c.ctx_ = ctx 4447 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 4448 for { 4449 x, err := c.Do() 4450 if err != nil { 4451 return err 4452 } 4453 if err := f(x); err != nil { 4454 return err 4455 } 4456 if x.NextPageToken == "" { 4457 return nil 4458 } 4459 c.PageToken(x.NextPageToken) 4460 } 4461} 4462 4463// method id "storage.buckets.lockRetentionPolicy": 4464 4465type BucketsLockRetentionPolicyCall struct { 4466 s *Service 4467 bucket string 4468 urlParams_ gensupport.URLParams 4469 ctx_ context.Context 4470 header_ http.Header 4471} 4472 4473// LockRetentionPolicy: Locks retention policy on a bucket. 4474func (r *BucketsService) LockRetentionPolicy(bucket string, ifMetagenerationMatch int64) *BucketsLockRetentionPolicyCall { 4475 c := &BucketsLockRetentionPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)} 4476 c.bucket = bucket 4477 c.urlParams_.Set("ifMetagenerationMatch", fmt.Sprint(ifMetagenerationMatch)) 4478 return c 4479} 4480 4481// ProvisionalUserProject sets the optional parameter 4482// "provisionalUserProject": The project to be billed for this request 4483// if the target bucket is requester-pays bucket. 4484func (c *BucketsLockRetentionPolicyCall) ProvisionalUserProject(provisionalUserProject string) *BucketsLockRetentionPolicyCall { 4485 c.urlParams_.Set("provisionalUserProject", provisionalUserProject) 4486 return c 4487} 4488 4489// UserProject sets the optional parameter "userProject": The project to 4490// be billed for this request. Required for Requester Pays buckets. 4491func (c *BucketsLockRetentionPolicyCall) UserProject(userProject string) *BucketsLockRetentionPolicyCall { 4492 c.urlParams_.Set("userProject", userProject) 4493 return c 4494} 4495 4496// Fields allows partial responses to be retrieved. See 4497// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 4498// for more information. 4499func (c *BucketsLockRetentionPolicyCall) Fields(s ...googleapi.Field) *BucketsLockRetentionPolicyCall { 4500 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 4501 return c 4502} 4503 4504// Context sets the context to be used in this call's Do method. Any 4505// pending HTTP request will be aborted if the provided context is 4506// canceled. 4507func (c *BucketsLockRetentionPolicyCall) Context(ctx context.Context) *BucketsLockRetentionPolicyCall { 4508 c.ctx_ = ctx 4509 return c 4510} 4511 4512// Header returns an http.Header that can be modified by the caller to 4513// add HTTP headers to the request. 4514func (c *BucketsLockRetentionPolicyCall) Header() http.Header { 4515 if c.header_ == nil { 4516 c.header_ = make(http.Header) 4517 } 4518 return c.header_ 4519} 4520 4521func (c *BucketsLockRetentionPolicyCall) doRequest(alt string) (*http.Response, error) { 4522 reqHeaders := make(http.Header) 4523 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") 4524 for k, v := range c.header_ { 4525 reqHeaders[k] = v 4526 } 4527 reqHeaders.Set("User-Agent", c.s.userAgent()) 4528 var body io.Reader = nil 4529 c.urlParams_.Set("alt", alt) 4530 c.urlParams_.Set("prettyPrint", "false") 4531 urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/lockRetentionPolicy") 4532 urls += "?" + c.urlParams_.Encode() 4533 req, err := http.NewRequest("POST", urls, body) 4534 if err != nil { 4535 return nil, err 4536 } 4537 req.Header = reqHeaders 4538 googleapi.Expand(req.URL, map[string]string{ 4539 "bucket": c.bucket, 4540 }) 4541 return gensupport.SendRequest(c.ctx_, c.s.client, req) 4542} 4543 4544// Do executes the "storage.buckets.lockRetentionPolicy" call. 4545// Exactly one of *Bucket or error will be non-nil. Any non-2xx status 4546// code is an error. Response headers are in either 4547// *Bucket.ServerResponse.Header or (if a response was returned at all) 4548// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 4549// check whether the returned error was because http.StatusNotModified 4550// was returned. 4551func (c *BucketsLockRetentionPolicyCall) Do(opts ...googleapi.CallOption) (*Bucket, error) { 4552 gensupport.SetOptions(c.urlParams_, opts...) 4553 res, err := c.doRequest("json") 4554 if res != nil && res.StatusCode == http.StatusNotModified { 4555 if res.Body != nil { 4556 res.Body.Close() 4557 } 4558 return nil, &googleapi.Error{ 4559 Code: res.StatusCode, 4560 Header: res.Header, 4561 } 4562 } 4563 if err != nil { 4564 return nil, err 4565 } 4566 defer googleapi.CloseBody(res) 4567 if err := googleapi.CheckResponse(res); err != nil { 4568 return nil, err 4569 } 4570 ret := &Bucket{ 4571 ServerResponse: googleapi.ServerResponse{ 4572 Header: res.Header, 4573 HTTPStatusCode: res.StatusCode, 4574 }, 4575 } 4576 target := &ret 4577 if err := gensupport.DecodeResponse(target, res); err != nil { 4578 return nil, err 4579 } 4580 return ret, nil 4581 // { 4582 // "description": "Locks retention policy on a bucket.", 4583 // "httpMethod": "POST", 4584 // "id": "storage.buckets.lockRetentionPolicy", 4585 // "parameterOrder": [ 4586 // "bucket", 4587 // "ifMetagenerationMatch" 4588 // ], 4589 // "parameters": { 4590 // "bucket": { 4591 // "description": "Name of a bucket.", 4592 // "location": "path", 4593 // "required": true, 4594 // "type": "string" 4595 // }, 4596 // "ifMetagenerationMatch": { 4597 // "description": "Makes the operation conditional on whether bucket's current metageneration matches the given value.", 4598 // "format": "int64", 4599 // "location": "query", 4600 // "required": true, 4601 // "type": "string" 4602 // }, 4603 // "provisionalUserProject": { 4604 // "description": "The project to be billed for this request if the target bucket is requester-pays bucket.", 4605 // "location": "query", 4606 // "type": "string" 4607 // }, 4608 // "userProject": { 4609 // "description": "The project to be billed for this request. Required for Requester Pays buckets.", 4610 // "location": "query", 4611 // "type": "string" 4612 // } 4613 // }, 4614 // "path": "b/{bucket}/lockRetentionPolicy", 4615 // "response": { 4616 // "$ref": "Bucket" 4617 // }, 4618 // "scopes": [ 4619 // "https://www.googleapis.com/auth/cloud-platform", 4620 // "https://www.googleapis.com/auth/devstorage.full_control", 4621 // "https://www.googleapis.com/auth/devstorage.read_write" 4622 // ] 4623 // } 4624 4625} 4626 4627// method id "storage.buckets.patch": 4628 4629type BucketsPatchCall struct { 4630 s *Service 4631 bucket string 4632 bucket2 *Bucket 4633 urlParams_ gensupport.URLParams 4634 ctx_ context.Context 4635 header_ http.Header 4636} 4637 4638// Patch: Patches a bucket. Changes to the bucket will be readable 4639// immediately after writing, but configuration changes may take time to 4640// propagate. 4641func (r *BucketsService) Patch(bucket string, bucket2 *Bucket) *BucketsPatchCall { 4642 c := &BucketsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)} 4643 c.bucket = bucket 4644 c.bucket2 = bucket2 4645 return c 4646} 4647 4648// IfMetagenerationMatch sets the optional parameter 4649// "ifMetagenerationMatch": Makes the return of the bucket metadata 4650// conditional on whether the bucket's current metageneration matches 4651// the given value. 4652func (c *BucketsPatchCall) IfMetagenerationMatch(ifMetagenerationMatch int64) *BucketsPatchCall { 4653 c.urlParams_.Set("ifMetagenerationMatch", fmt.Sprint(ifMetagenerationMatch)) 4654 return c 4655} 4656 4657// IfMetagenerationNotMatch sets the optional parameter 4658// "ifMetagenerationNotMatch": Makes the return of the bucket metadata 4659// conditional on whether the bucket's current metageneration does not 4660// match the given value. 4661func (c *BucketsPatchCall) IfMetagenerationNotMatch(ifMetagenerationNotMatch int64) *BucketsPatchCall { 4662 c.urlParams_.Set("ifMetagenerationNotMatch", fmt.Sprint(ifMetagenerationNotMatch)) 4663 return c 4664} 4665 4666// PredefinedAcl sets the optional parameter "predefinedAcl": Apply a 4667// predefined set of access controls to this bucket. 4668// 4669// Possible values: 4670// "authenticatedRead" - Project team owners get OWNER access, and 4671// allAuthenticatedUsers get READER access. 4672// "private" - Project team owners get OWNER access. 4673// "projectPrivate" - Project team members get access according to 4674// their roles. 4675// "publicRead" - Project team owners get OWNER access, and allUsers 4676// get READER access. 4677// "publicReadWrite" - Project team owners get OWNER access, and 4678// allUsers get WRITER access. 4679func (c *BucketsPatchCall) PredefinedAcl(predefinedAcl string) *BucketsPatchCall { 4680 c.urlParams_.Set("predefinedAcl", predefinedAcl) 4681 return c 4682} 4683 4684// PredefinedDefaultObjectAcl sets the optional parameter 4685// "predefinedDefaultObjectAcl": Apply a predefined set of default 4686// object access controls to this bucket. 4687// 4688// Possible values: 4689// "authenticatedRead" - Object owner gets OWNER access, and 4690// allAuthenticatedUsers get READER access. 4691// "bucketOwnerFullControl" - Object owner gets OWNER access, and 4692// project team owners get OWNER access. 4693// "bucketOwnerRead" - Object owner gets OWNER access, and project 4694// team owners get READER access. 4695// "private" - Object owner gets OWNER access. 4696// "projectPrivate" - Object owner gets OWNER access, and project team 4697// members get access according to their roles. 4698// "publicRead" - Object owner gets OWNER access, and allUsers get 4699// READER access. 4700func (c *BucketsPatchCall) PredefinedDefaultObjectAcl(predefinedDefaultObjectAcl string) *BucketsPatchCall { 4701 c.urlParams_.Set("predefinedDefaultObjectAcl", predefinedDefaultObjectAcl) 4702 return c 4703} 4704 4705// Projection sets the optional parameter "projection": Set of 4706// properties to return. Defaults to full. 4707// 4708// Possible values: 4709// "full" - Include all properties. 4710// "noAcl" - Omit owner, acl and defaultObjectAcl properties. 4711func (c *BucketsPatchCall) Projection(projection string) *BucketsPatchCall { 4712 c.urlParams_.Set("projection", projection) 4713 return c 4714} 4715 4716// ProvisionalUserProject sets the optional parameter 4717// "provisionalUserProject": The project to be billed for this request 4718// if the target bucket is requester-pays bucket. 4719func (c *BucketsPatchCall) ProvisionalUserProject(provisionalUserProject string) *BucketsPatchCall { 4720 c.urlParams_.Set("provisionalUserProject", provisionalUserProject) 4721 return c 4722} 4723 4724// UserProject sets the optional parameter "userProject": The project to 4725// be billed for this request. Required for Requester Pays buckets. 4726func (c *BucketsPatchCall) UserProject(userProject string) *BucketsPatchCall { 4727 c.urlParams_.Set("userProject", userProject) 4728 return c 4729} 4730 4731// Fields allows partial responses to be retrieved. See 4732// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 4733// for more information. 4734func (c *BucketsPatchCall) Fields(s ...googleapi.Field) *BucketsPatchCall { 4735 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 4736 return c 4737} 4738 4739// Context sets the context to be used in this call's Do method. Any 4740// pending HTTP request will be aborted if the provided context is 4741// canceled. 4742func (c *BucketsPatchCall) Context(ctx context.Context) *BucketsPatchCall { 4743 c.ctx_ = ctx 4744 return c 4745} 4746 4747// Header returns an http.Header that can be modified by the caller to 4748// add HTTP headers to the request. 4749func (c *BucketsPatchCall) Header() http.Header { 4750 if c.header_ == nil { 4751 c.header_ = make(http.Header) 4752 } 4753 return c.header_ 4754} 4755 4756func (c *BucketsPatchCall) doRequest(alt string) (*http.Response, error) { 4757 reqHeaders := make(http.Header) 4758 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") 4759 for k, v := range c.header_ { 4760 reqHeaders[k] = v 4761 } 4762 reqHeaders.Set("User-Agent", c.s.userAgent()) 4763 var body io.Reader = nil 4764 body, err := googleapi.WithoutDataWrapper.JSONReader(c.bucket2) 4765 if err != nil { 4766 return nil, err 4767 } 4768 reqHeaders.Set("Content-Type", "application/json") 4769 c.urlParams_.Set("alt", alt) 4770 c.urlParams_.Set("prettyPrint", "false") 4771 urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}") 4772 urls += "?" + c.urlParams_.Encode() 4773 req, err := http.NewRequest("PATCH", urls, body) 4774 if err != nil { 4775 return nil, err 4776 } 4777 req.Header = reqHeaders 4778 googleapi.Expand(req.URL, map[string]string{ 4779 "bucket": c.bucket, 4780 }) 4781 return gensupport.SendRequest(c.ctx_, c.s.client, req) 4782} 4783 4784// Do executes the "storage.buckets.patch" call. 4785// Exactly one of *Bucket or error will be non-nil. Any non-2xx status 4786// code is an error. Response headers are in either 4787// *Bucket.ServerResponse.Header or (if a response was returned at all) 4788// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 4789// check whether the returned error was because http.StatusNotModified 4790// was returned. 4791func (c *BucketsPatchCall) Do(opts ...googleapi.CallOption) (*Bucket, error) { 4792 gensupport.SetOptions(c.urlParams_, opts...) 4793 res, err := c.doRequest("json") 4794 if res != nil && res.StatusCode == http.StatusNotModified { 4795 if res.Body != nil { 4796 res.Body.Close() 4797 } 4798 return nil, &googleapi.Error{ 4799 Code: res.StatusCode, 4800 Header: res.Header, 4801 } 4802 } 4803 if err != nil { 4804 return nil, err 4805 } 4806 defer googleapi.CloseBody(res) 4807 if err := googleapi.CheckResponse(res); err != nil { 4808 return nil, err 4809 } 4810 ret := &Bucket{ 4811 ServerResponse: googleapi.ServerResponse{ 4812 Header: res.Header, 4813 HTTPStatusCode: res.StatusCode, 4814 }, 4815 } 4816 target := &ret 4817 if err := gensupport.DecodeResponse(target, res); err != nil { 4818 return nil, err 4819 } 4820 return ret, nil 4821 // { 4822 // "description": "Patches a bucket. Changes to the bucket will be readable immediately after writing, but configuration changes may take time to propagate.", 4823 // "httpMethod": "PATCH", 4824 // "id": "storage.buckets.patch", 4825 // "parameterOrder": [ 4826 // "bucket" 4827 // ], 4828 // "parameters": { 4829 // "bucket": { 4830 // "description": "Name of a bucket.", 4831 // "location": "path", 4832 // "required": true, 4833 // "type": "string" 4834 // }, 4835 // "ifMetagenerationMatch": { 4836 // "description": "Makes the return of the bucket metadata conditional on whether the bucket's current metageneration matches the given value.", 4837 // "format": "int64", 4838 // "location": "query", 4839 // "type": "string" 4840 // }, 4841 // "ifMetagenerationNotMatch": { 4842 // "description": "Makes the return of the bucket metadata conditional on whether the bucket's current metageneration does not match the given value.", 4843 // "format": "int64", 4844 // "location": "query", 4845 // "type": "string" 4846 // }, 4847 // "predefinedAcl": { 4848 // "description": "Apply a predefined set of access controls to this bucket.", 4849 // "enum": [ 4850 // "authenticatedRead", 4851 // "private", 4852 // "projectPrivate", 4853 // "publicRead", 4854 // "publicReadWrite" 4855 // ], 4856 // "enumDescriptions": [ 4857 // "Project team owners get OWNER access, and allAuthenticatedUsers get READER access.", 4858 // "Project team owners get OWNER access.", 4859 // "Project team members get access according to their roles.", 4860 // "Project team owners get OWNER access, and allUsers get READER access.", 4861 // "Project team owners get OWNER access, and allUsers get WRITER access." 4862 // ], 4863 // "location": "query", 4864 // "type": "string" 4865 // }, 4866 // "predefinedDefaultObjectAcl": { 4867 // "description": "Apply a predefined set of default object access controls to this bucket.", 4868 // "enum": [ 4869 // "authenticatedRead", 4870 // "bucketOwnerFullControl", 4871 // "bucketOwnerRead", 4872 // "private", 4873 // "projectPrivate", 4874 // "publicRead" 4875 // ], 4876 // "enumDescriptions": [ 4877 // "Object owner gets OWNER access, and allAuthenticatedUsers get READER access.", 4878 // "Object owner gets OWNER access, and project team owners get OWNER access.", 4879 // "Object owner gets OWNER access, and project team owners get READER access.", 4880 // "Object owner gets OWNER access.", 4881 // "Object owner gets OWNER access, and project team members get access according to their roles.", 4882 // "Object owner gets OWNER access, and allUsers get READER access." 4883 // ], 4884 // "location": "query", 4885 // "type": "string" 4886 // }, 4887 // "projection": { 4888 // "description": "Set of properties to return. Defaults to full.", 4889 // "enum": [ 4890 // "full", 4891 // "noAcl" 4892 // ], 4893 // "enumDescriptions": [ 4894 // "Include all properties.", 4895 // "Omit owner, acl and defaultObjectAcl properties." 4896 // ], 4897 // "location": "query", 4898 // "type": "string" 4899 // }, 4900 // "provisionalUserProject": { 4901 // "description": "The project to be billed for this request if the target bucket is requester-pays bucket.", 4902 // "location": "query", 4903 // "type": "string" 4904 // }, 4905 // "userProject": { 4906 // "description": "The project to be billed for this request. Required for Requester Pays buckets.", 4907 // "location": "query", 4908 // "type": "string" 4909 // } 4910 // }, 4911 // "path": "b/{bucket}", 4912 // "request": { 4913 // "$ref": "Bucket" 4914 // }, 4915 // "response": { 4916 // "$ref": "Bucket" 4917 // }, 4918 // "scopes": [ 4919 // "https://www.googleapis.com/auth/cloud-platform", 4920 // "https://www.googleapis.com/auth/devstorage.full_control" 4921 // ] 4922 // } 4923 4924} 4925 4926// method id "storage.buckets.setIamPolicy": 4927 4928type BucketsSetIamPolicyCall struct { 4929 s *Service 4930 bucket string 4931 policy *Policy 4932 urlParams_ gensupport.URLParams 4933 ctx_ context.Context 4934 header_ http.Header 4935} 4936 4937// SetIamPolicy: Updates an IAM policy for the specified bucket. 4938func (r *BucketsService) SetIamPolicy(bucket string, policy *Policy) *BucketsSetIamPolicyCall { 4939 c := &BucketsSetIamPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)} 4940 c.bucket = bucket 4941 c.policy = policy 4942 return c 4943} 4944 4945// ProvisionalUserProject sets the optional parameter 4946// "provisionalUserProject": The project to be billed for this request 4947// if the target bucket is requester-pays bucket. 4948func (c *BucketsSetIamPolicyCall) ProvisionalUserProject(provisionalUserProject string) *BucketsSetIamPolicyCall { 4949 c.urlParams_.Set("provisionalUserProject", provisionalUserProject) 4950 return c 4951} 4952 4953// UserProject sets the optional parameter "userProject": The project to 4954// be billed for this request. Required for Requester Pays buckets. 4955func (c *BucketsSetIamPolicyCall) UserProject(userProject string) *BucketsSetIamPolicyCall { 4956 c.urlParams_.Set("userProject", userProject) 4957 return c 4958} 4959 4960// Fields allows partial responses to be retrieved. See 4961// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 4962// for more information. 4963func (c *BucketsSetIamPolicyCall) Fields(s ...googleapi.Field) *BucketsSetIamPolicyCall { 4964 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 4965 return c 4966} 4967 4968// Context sets the context to be used in this call's Do method. Any 4969// pending HTTP request will be aborted if the provided context is 4970// canceled. 4971func (c *BucketsSetIamPolicyCall) Context(ctx context.Context) *BucketsSetIamPolicyCall { 4972 c.ctx_ = ctx 4973 return c 4974} 4975 4976// Header returns an http.Header that can be modified by the caller to 4977// add HTTP headers to the request. 4978func (c *BucketsSetIamPolicyCall) Header() http.Header { 4979 if c.header_ == nil { 4980 c.header_ = make(http.Header) 4981 } 4982 return c.header_ 4983} 4984 4985func (c *BucketsSetIamPolicyCall) doRequest(alt string) (*http.Response, error) { 4986 reqHeaders := make(http.Header) 4987 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") 4988 for k, v := range c.header_ { 4989 reqHeaders[k] = v 4990 } 4991 reqHeaders.Set("User-Agent", c.s.userAgent()) 4992 var body io.Reader = nil 4993 body, err := googleapi.WithoutDataWrapper.JSONReader(c.policy) 4994 if err != nil { 4995 return nil, err 4996 } 4997 reqHeaders.Set("Content-Type", "application/json") 4998 c.urlParams_.Set("alt", alt) 4999 c.urlParams_.Set("prettyPrint", "false") 5000 urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/iam") 5001 urls += "?" + c.urlParams_.Encode() 5002 req, err := http.NewRequest("PUT", urls, body) 5003 if err != nil { 5004 return nil, err 5005 } 5006 req.Header = reqHeaders 5007 googleapi.Expand(req.URL, map[string]string{ 5008 "bucket": c.bucket, 5009 }) 5010 return gensupport.SendRequest(c.ctx_, c.s.client, req) 5011} 5012 5013// Do executes the "storage.buckets.setIamPolicy" call. 5014// Exactly one of *Policy or error will be non-nil. Any non-2xx status 5015// code is an error. Response headers are in either 5016// *Policy.ServerResponse.Header or (if a response was returned at all) 5017// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 5018// check whether the returned error was because http.StatusNotModified 5019// was returned. 5020func (c *BucketsSetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Policy, error) { 5021 gensupport.SetOptions(c.urlParams_, opts...) 5022 res, err := c.doRequest("json") 5023 if res != nil && res.StatusCode == http.StatusNotModified { 5024 if res.Body != nil { 5025 res.Body.Close() 5026 } 5027 return nil, &googleapi.Error{ 5028 Code: res.StatusCode, 5029 Header: res.Header, 5030 } 5031 } 5032 if err != nil { 5033 return nil, err 5034 } 5035 defer googleapi.CloseBody(res) 5036 if err := googleapi.CheckResponse(res); err != nil { 5037 return nil, err 5038 } 5039 ret := &Policy{ 5040 ServerResponse: googleapi.ServerResponse{ 5041 Header: res.Header, 5042 HTTPStatusCode: res.StatusCode, 5043 }, 5044 } 5045 target := &ret 5046 if err := gensupport.DecodeResponse(target, res); err != nil { 5047 return nil, err 5048 } 5049 return ret, nil 5050 // { 5051 // "description": "Updates an IAM policy for the specified bucket.", 5052 // "httpMethod": "PUT", 5053 // "id": "storage.buckets.setIamPolicy", 5054 // "parameterOrder": [ 5055 // "bucket" 5056 // ], 5057 // "parameters": { 5058 // "bucket": { 5059 // "description": "Name of a bucket.", 5060 // "location": "path", 5061 // "required": true, 5062 // "type": "string" 5063 // }, 5064 // "provisionalUserProject": { 5065 // "description": "The project to be billed for this request if the target bucket is requester-pays bucket.", 5066 // "location": "query", 5067 // "type": "string" 5068 // }, 5069 // "userProject": { 5070 // "description": "The project to be billed for this request. Required for Requester Pays buckets.", 5071 // "location": "query", 5072 // "type": "string" 5073 // } 5074 // }, 5075 // "path": "b/{bucket}/iam", 5076 // "request": { 5077 // "$ref": "Policy" 5078 // }, 5079 // "response": { 5080 // "$ref": "Policy" 5081 // }, 5082 // "scopes": [ 5083 // "https://www.googleapis.com/auth/cloud-platform", 5084 // "https://www.googleapis.com/auth/devstorage.full_control" 5085 // ] 5086 // } 5087 5088} 5089 5090// method id "storage.buckets.testIamPermissions": 5091 5092type BucketsTestIamPermissionsCall struct { 5093 s *Service 5094 bucket string 5095 urlParams_ gensupport.URLParams 5096 ifNoneMatch_ string 5097 ctx_ context.Context 5098 header_ http.Header 5099} 5100 5101// TestIamPermissions: Tests a set of permissions on the given bucket to 5102// see which, if any, are held by the caller. 5103func (r *BucketsService) TestIamPermissions(bucket string, permissions []string) *BucketsTestIamPermissionsCall { 5104 c := &BucketsTestIamPermissionsCall{s: r.s, urlParams_: make(gensupport.URLParams)} 5105 c.bucket = bucket 5106 c.urlParams_.SetMulti("permissions", append([]string{}, permissions...)) 5107 return c 5108} 5109 5110// ProvisionalUserProject sets the optional parameter 5111// "provisionalUserProject": The project to be billed for this request 5112// if the target bucket is requester-pays bucket. 5113func (c *BucketsTestIamPermissionsCall) ProvisionalUserProject(provisionalUserProject string) *BucketsTestIamPermissionsCall { 5114 c.urlParams_.Set("provisionalUserProject", provisionalUserProject) 5115 return c 5116} 5117 5118// UserProject sets the optional parameter "userProject": The project to 5119// be billed for this request. Required for Requester Pays buckets. 5120func (c *BucketsTestIamPermissionsCall) UserProject(userProject string) *BucketsTestIamPermissionsCall { 5121 c.urlParams_.Set("userProject", userProject) 5122 return c 5123} 5124 5125// Fields allows partial responses to be retrieved. See 5126// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 5127// for more information. 5128func (c *BucketsTestIamPermissionsCall) Fields(s ...googleapi.Field) *BucketsTestIamPermissionsCall { 5129 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 5130 return c 5131} 5132 5133// IfNoneMatch sets the optional parameter which makes the operation 5134// fail if the object's ETag matches the given value. This is useful for 5135// getting updates only after the object has changed since the last 5136// request. Use googleapi.IsNotModified to check whether the response 5137// error from Do is the result of In-None-Match. 5138func (c *BucketsTestIamPermissionsCall) IfNoneMatch(entityTag string) *BucketsTestIamPermissionsCall { 5139 c.ifNoneMatch_ = entityTag 5140 return c 5141} 5142 5143// Context sets the context to be used in this call's Do method. Any 5144// pending HTTP request will be aborted if the provided context is 5145// canceled. 5146func (c *BucketsTestIamPermissionsCall) Context(ctx context.Context) *BucketsTestIamPermissionsCall { 5147 c.ctx_ = ctx 5148 return c 5149} 5150 5151// Header returns an http.Header that can be modified by the caller to 5152// add HTTP headers to the request. 5153func (c *BucketsTestIamPermissionsCall) Header() http.Header { 5154 if c.header_ == nil { 5155 c.header_ = make(http.Header) 5156 } 5157 return c.header_ 5158} 5159 5160func (c *BucketsTestIamPermissionsCall) doRequest(alt string) (*http.Response, error) { 5161 reqHeaders := make(http.Header) 5162 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") 5163 for k, v := range c.header_ { 5164 reqHeaders[k] = v 5165 } 5166 reqHeaders.Set("User-Agent", c.s.userAgent()) 5167 if c.ifNoneMatch_ != "" { 5168 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 5169 } 5170 var body io.Reader = nil 5171 c.urlParams_.Set("alt", alt) 5172 c.urlParams_.Set("prettyPrint", "false") 5173 urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/iam/testPermissions") 5174 urls += "?" + c.urlParams_.Encode() 5175 req, err := http.NewRequest("GET", urls, body) 5176 if err != nil { 5177 return nil, err 5178 } 5179 req.Header = reqHeaders 5180 googleapi.Expand(req.URL, map[string]string{ 5181 "bucket": c.bucket, 5182 }) 5183 return gensupport.SendRequest(c.ctx_, c.s.client, req) 5184} 5185 5186// Do executes the "storage.buckets.testIamPermissions" call. 5187// Exactly one of *TestIamPermissionsResponse or error will be non-nil. 5188// Any non-2xx status code is an error. Response headers are in either 5189// *TestIamPermissionsResponse.ServerResponse.Header or (if a response 5190// was returned at all) in error.(*googleapi.Error).Header. Use 5191// googleapi.IsNotModified to check whether the returned error was 5192// because http.StatusNotModified was returned. 5193func (c *BucketsTestIamPermissionsCall) Do(opts ...googleapi.CallOption) (*TestIamPermissionsResponse, error) { 5194 gensupport.SetOptions(c.urlParams_, opts...) 5195 res, err := c.doRequest("json") 5196 if res != nil && res.StatusCode == http.StatusNotModified { 5197 if res.Body != nil { 5198 res.Body.Close() 5199 } 5200 return nil, &googleapi.Error{ 5201 Code: res.StatusCode, 5202 Header: res.Header, 5203 } 5204 } 5205 if err != nil { 5206 return nil, err 5207 } 5208 defer googleapi.CloseBody(res) 5209 if err := googleapi.CheckResponse(res); err != nil { 5210 return nil, err 5211 } 5212 ret := &TestIamPermissionsResponse{ 5213 ServerResponse: googleapi.ServerResponse{ 5214 Header: res.Header, 5215 HTTPStatusCode: res.StatusCode, 5216 }, 5217 } 5218 target := &ret 5219 if err := gensupport.DecodeResponse(target, res); err != nil { 5220 return nil, err 5221 } 5222 return ret, nil 5223 // { 5224 // "description": "Tests a set of permissions on the given bucket to see which, if any, are held by the caller.", 5225 // "httpMethod": "GET", 5226 // "id": "storage.buckets.testIamPermissions", 5227 // "parameterOrder": [ 5228 // "bucket", 5229 // "permissions" 5230 // ], 5231 // "parameters": { 5232 // "bucket": { 5233 // "description": "Name of a bucket.", 5234 // "location": "path", 5235 // "required": true, 5236 // "type": "string" 5237 // }, 5238 // "permissions": { 5239 // "description": "Permissions to test.", 5240 // "location": "query", 5241 // "repeated": true, 5242 // "required": true, 5243 // "type": "string" 5244 // }, 5245 // "provisionalUserProject": { 5246 // "description": "The project to be billed for this request if the target bucket is requester-pays bucket.", 5247 // "location": "query", 5248 // "type": "string" 5249 // }, 5250 // "userProject": { 5251 // "description": "The project to be billed for this request. Required for Requester Pays buckets.", 5252 // "location": "query", 5253 // "type": "string" 5254 // } 5255 // }, 5256 // "path": "b/{bucket}/iam/testPermissions", 5257 // "response": { 5258 // "$ref": "TestIamPermissionsResponse" 5259 // }, 5260 // "scopes": [ 5261 // "https://www.googleapis.com/auth/cloud-platform", 5262 // "https://www.googleapis.com/auth/cloud-platform.read-only", 5263 // "https://www.googleapis.com/auth/devstorage.full_control", 5264 // "https://www.googleapis.com/auth/devstorage.read_only", 5265 // "https://www.googleapis.com/auth/devstorage.read_write" 5266 // ] 5267 // } 5268 5269} 5270 5271// method id "storage.buckets.update": 5272 5273type BucketsUpdateCall struct { 5274 s *Service 5275 bucket string 5276 bucket2 *Bucket 5277 urlParams_ gensupport.URLParams 5278 ctx_ context.Context 5279 header_ http.Header 5280} 5281 5282// Update: Updates a bucket. Changes to the bucket will be readable 5283// immediately after writing, but configuration changes may take time to 5284// propagate. 5285func (r *BucketsService) Update(bucket string, bucket2 *Bucket) *BucketsUpdateCall { 5286 c := &BucketsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 5287 c.bucket = bucket 5288 c.bucket2 = bucket2 5289 return c 5290} 5291 5292// IfMetagenerationMatch sets the optional parameter 5293// "ifMetagenerationMatch": Makes the return of the bucket metadata 5294// conditional on whether the bucket's current metageneration matches 5295// the given value. 5296func (c *BucketsUpdateCall) IfMetagenerationMatch(ifMetagenerationMatch int64) *BucketsUpdateCall { 5297 c.urlParams_.Set("ifMetagenerationMatch", fmt.Sprint(ifMetagenerationMatch)) 5298 return c 5299} 5300 5301// IfMetagenerationNotMatch sets the optional parameter 5302// "ifMetagenerationNotMatch": Makes the return of the bucket metadata 5303// conditional on whether the bucket's current metageneration does not 5304// match the given value. 5305func (c *BucketsUpdateCall) IfMetagenerationNotMatch(ifMetagenerationNotMatch int64) *BucketsUpdateCall { 5306 c.urlParams_.Set("ifMetagenerationNotMatch", fmt.Sprint(ifMetagenerationNotMatch)) 5307 return c 5308} 5309 5310// PredefinedAcl sets the optional parameter "predefinedAcl": Apply a 5311// predefined set of access controls to this bucket. 5312// 5313// Possible values: 5314// "authenticatedRead" - Project team owners get OWNER access, and 5315// allAuthenticatedUsers get READER access. 5316// "private" - Project team owners get OWNER access. 5317// "projectPrivate" - Project team members get access according to 5318// their roles. 5319// "publicRead" - Project team owners get OWNER access, and allUsers 5320// get READER access. 5321// "publicReadWrite" - Project team owners get OWNER access, and 5322// allUsers get WRITER access. 5323func (c *BucketsUpdateCall) PredefinedAcl(predefinedAcl string) *BucketsUpdateCall { 5324 c.urlParams_.Set("predefinedAcl", predefinedAcl) 5325 return c 5326} 5327 5328// PredefinedDefaultObjectAcl sets the optional parameter 5329// "predefinedDefaultObjectAcl": Apply a predefined set of default 5330// object access controls to this bucket. 5331// 5332// Possible values: 5333// "authenticatedRead" - Object owner gets OWNER access, and 5334// allAuthenticatedUsers get READER access. 5335// "bucketOwnerFullControl" - Object owner gets OWNER access, and 5336// project team owners get OWNER access. 5337// "bucketOwnerRead" - Object owner gets OWNER access, and project 5338// team owners get READER access. 5339// "private" - Object owner gets OWNER access. 5340// "projectPrivate" - Object owner gets OWNER access, and project team 5341// members get access according to their roles. 5342// "publicRead" - Object owner gets OWNER access, and allUsers get 5343// READER access. 5344func (c *BucketsUpdateCall) PredefinedDefaultObjectAcl(predefinedDefaultObjectAcl string) *BucketsUpdateCall { 5345 c.urlParams_.Set("predefinedDefaultObjectAcl", predefinedDefaultObjectAcl) 5346 return c 5347} 5348 5349// Projection sets the optional parameter "projection": Set of 5350// properties to return. Defaults to full. 5351// 5352// Possible values: 5353// "full" - Include all properties. 5354// "noAcl" - Omit owner, acl and defaultObjectAcl properties. 5355func (c *BucketsUpdateCall) Projection(projection string) *BucketsUpdateCall { 5356 c.urlParams_.Set("projection", projection) 5357 return c 5358} 5359 5360// ProvisionalUserProject sets the optional parameter 5361// "provisionalUserProject": The project to be billed for this request 5362// if the target bucket is requester-pays bucket. 5363func (c *BucketsUpdateCall) ProvisionalUserProject(provisionalUserProject string) *BucketsUpdateCall { 5364 c.urlParams_.Set("provisionalUserProject", provisionalUserProject) 5365 return c 5366} 5367 5368// UserProject sets the optional parameter "userProject": The project to 5369// be billed for this request. Required for Requester Pays buckets. 5370func (c *BucketsUpdateCall) UserProject(userProject string) *BucketsUpdateCall { 5371 c.urlParams_.Set("userProject", userProject) 5372 return c 5373} 5374 5375// Fields allows partial responses to be retrieved. See 5376// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 5377// for more information. 5378func (c *BucketsUpdateCall) Fields(s ...googleapi.Field) *BucketsUpdateCall { 5379 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 5380 return c 5381} 5382 5383// Context sets the context to be used in this call's Do method. Any 5384// pending HTTP request will be aborted if the provided context is 5385// canceled. 5386func (c *BucketsUpdateCall) Context(ctx context.Context) *BucketsUpdateCall { 5387 c.ctx_ = ctx 5388 return c 5389} 5390 5391// Header returns an http.Header that can be modified by the caller to 5392// add HTTP headers to the request. 5393func (c *BucketsUpdateCall) Header() http.Header { 5394 if c.header_ == nil { 5395 c.header_ = make(http.Header) 5396 } 5397 return c.header_ 5398} 5399 5400func (c *BucketsUpdateCall) doRequest(alt string) (*http.Response, error) { 5401 reqHeaders := make(http.Header) 5402 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") 5403 for k, v := range c.header_ { 5404 reqHeaders[k] = v 5405 } 5406 reqHeaders.Set("User-Agent", c.s.userAgent()) 5407 var body io.Reader = nil 5408 body, err := googleapi.WithoutDataWrapper.JSONReader(c.bucket2) 5409 if err != nil { 5410 return nil, err 5411 } 5412 reqHeaders.Set("Content-Type", "application/json") 5413 c.urlParams_.Set("alt", alt) 5414 c.urlParams_.Set("prettyPrint", "false") 5415 urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}") 5416 urls += "?" + c.urlParams_.Encode() 5417 req, err := http.NewRequest("PUT", urls, body) 5418 if err != nil { 5419 return nil, err 5420 } 5421 req.Header = reqHeaders 5422 googleapi.Expand(req.URL, map[string]string{ 5423 "bucket": c.bucket, 5424 }) 5425 return gensupport.SendRequest(c.ctx_, c.s.client, req) 5426} 5427 5428// Do executes the "storage.buckets.update" call. 5429// Exactly one of *Bucket or error will be non-nil. Any non-2xx status 5430// code is an error. Response headers are in either 5431// *Bucket.ServerResponse.Header or (if a response was returned at all) 5432// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 5433// check whether the returned error was because http.StatusNotModified 5434// was returned. 5435func (c *BucketsUpdateCall) Do(opts ...googleapi.CallOption) (*Bucket, error) { 5436 gensupport.SetOptions(c.urlParams_, opts...) 5437 res, err := c.doRequest("json") 5438 if res != nil && res.StatusCode == http.StatusNotModified { 5439 if res.Body != nil { 5440 res.Body.Close() 5441 } 5442 return nil, &googleapi.Error{ 5443 Code: res.StatusCode, 5444 Header: res.Header, 5445 } 5446 } 5447 if err != nil { 5448 return nil, err 5449 } 5450 defer googleapi.CloseBody(res) 5451 if err := googleapi.CheckResponse(res); err != nil { 5452 return nil, err 5453 } 5454 ret := &Bucket{ 5455 ServerResponse: googleapi.ServerResponse{ 5456 Header: res.Header, 5457 HTTPStatusCode: res.StatusCode, 5458 }, 5459 } 5460 target := &ret 5461 if err := gensupport.DecodeResponse(target, res); err != nil { 5462 return nil, err 5463 } 5464 return ret, nil 5465 // { 5466 // "description": "Updates a bucket. Changes to the bucket will be readable immediately after writing, but configuration changes may take time to propagate.", 5467 // "httpMethod": "PUT", 5468 // "id": "storage.buckets.update", 5469 // "parameterOrder": [ 5470 // "bucket" 5471 // ], 5472 // "parameters": { 5473 // "bucket": { 5474 // "description": "Name of a bucket.", 5475 // "location": "path", 5476 // "required": true, 5477 // "type": "string" 5478 // }, 5479 // "ifMetagenerationMatch": { 5480 // "description": "Makes the return of the bucket metadata conditional on whether the bucket's current metageneration matches the given value.", 5481 // "format": "int64", 5482 // "location": "query", 5483 // "type": "string" 5484 // }, 5485 // "ifMetagenerationNotMatch": { 5486 // "description": "Makes the return of the bucket metadata conditional on whether the bucket's current metageneration does not match the given value.", 5487 // "format": "int64", 5488 // "location": "query", 5489 // "type": "string" 5490 // }, 5491 // "predefinedAcl": { 5492 // "description": "Apply a predefined set of access controls to this bucket.", 5493 // "enum": [ 5494 // "authenticatedRead", 5495 // "private", 5496 // "projectPrivate", 5497 // "publicRead", 5498 // "publicReadWrite" 5499 // ], 5500 // "enumDescriptions": [ 5501 // "Project team owners get OWNER access, and allAuthenticatedUsers get READER access.", 5502 // "Project team owners get OWNER access.", 5503 // "Project team members get access according to their roles.", 5504 // "Project team owners get OWNER access, and allUsers get READER access.", 5505 // "Project team owners get OWNER access, and allUsers get WRITER access." 5506 // ], 5507 // "location": "query", 5508 // "type": "string" 5509 // }, 5510 // "predefinedDefaultObjectAcl": { 5511 // "description": "Apply a predefined set of default object access controls to this bucket.", 5512 // "enum": [ 5513 // "authenticatedRead", 5514 // "bucketOwnerFullControl", 5515 // "bucketOwnerRead", 5516 // "private", 5517 // "projectPrivate", 5518 // "publicRead" 5519 // ], 5520 // "enumDescriptions": [ 5521 // "Object owner gets OWNER access, and allAuthenticatedUsers get READER access.", 5522 // "Object owner gets OWNER access, and project team owners get OWNER access.", 5523 // "Object owner gets OWNER access, and project team owners get READER access.", 5524 // "Object owner gets OWNER access.", 5525 // "Object owner gets OWNER access, and project team members get access according to their roles.", 5526 // "Object owner gets OWNER access, and allUsers get READER access." 5527 // ], 5528 // "location": "query", 5529 // "type": "string" 5530 // }, 5531 // "projection": { 5532 // "description": "Set of properties to return. Defaults to full.", 5533 // "enum": [ 5534 // "full", 5535 // "noAcl" 5536 // ], 5537 // "enumDescriptions": [ 5538 // "Include all properties.", 5539 // "Omit owner, acl and defaultObjectAcl properties." 5540 // ], 5541 // "location": "query", 5542 // "type": "string" 5543 // }, 5544 // "provisionalUserProject": { 5545 // "description": "The project to be billed for this request if the target bucket is requester-pays bucket.", 5546 // "location": "query", 5547 // "type": "string" 5548 // }, 5549 // "userProject": { 5550 // "description": "The project to be billed for this request. Required for Requester Pays buckets.", 5551 // "location": "query", 5552 // "type": "string" 5553 // } 5554 // }, 5555 // "path": "b/{bucket}", 5556 // "request": { 5557 // "$ref": "Bucket" 5558 // }, 5559 // "response": { 5560 // "$ref": "Bucket" 5561 // }, 5562 // "scopes": [ 5563 // "https://www.googleapis.com/auth/cloud-platform", 5564 // "https://www.googleapis.com/auth/devstorage.full_control" 5565 // ] 5566 // } 5567 5568} 5569 5570// method id "storage.channels.stop": 5571 5572type ChannelsStopCall struct { 5573 s *Service 5574 channel *Channel 5575 urlParams_ gensupport.URLParams 5576 ctx_ context.Context 5577 header_ http.Header 5578} 5579 5580// Stop: Stop watching resources through this channel 5581func (r *ChannelsService) Stop(channel *Channel) *ChannelsStopCall { 5582 c := &ChannelsStopCall{s: r.s, urlParams_: make(gensupport.URLParams)} 5583 c.channel = channel 5584 return c 5585} 5586 5587// Fields allows partial responses to be retrieved. See 5588// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 5589// for more information. 5590func (c *ChannelsStopCall) Fields(s ...googleapi.Field) *ChannelsStopCall { 5591 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 5592 return c 5593} 5594 5595// Context sets the context to be used in this call's Do method. Any 5596// pending HTTP request will be aborted if the provided context is 5597// canceled. 5598func (c *ChannelsStopCall) Context(ctx context.Context) *ChannelsStopCall { 5599 c.ctx_ = ctx 5600 return c 5601} 5602 5603// Header returns an http.Header that can be modified by the caller to 5604// add HTTP headers to the request. 5605func (c *ChannelsStopCall) Header() http.Header { 5606 if c.header_ == nil { 5607 c.header_ = make(http.Header) 5608 } 5609 return c.header_ 5610} 5611 5612func (c *ChannelsStopCall) doRequest(alt string) (*http.Response, error) { 5613 reqHeaders := make(http.Header) 5614 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") 5615 for k, v := range c.header_ { 5616 reqHeaders[k] = v 5617 } 5618 reqHeaders.Set("User-Agent", c.s.userAgent()) 5619 var body io.Reader = nil 5620 body, err := googleapi.WithoutDataWrapper.JSONReader(c.channel) 5621 if err != nil { 5622 return nil, err 5623 } 5624 reqHeaders.Set("Content-Type", "application/json") 5625 c.urlParams_.Set("alt", alt) 5626 c.urlParams_.Set("prettyPrint", "false") 5627 urls := googleapi.ResolveRelative(c.s.BasePath, "channels/stop") 5628 urls += "?" + c.urlParams_.Encode() 5629 req, err := http.NewRequest("POST", urls, body) 5630 if err != nil { 5631 return nil, err 5632 } 5633 req.Header = reqHeaders 5634 return gensupport.SendRequest(c.ctx_, c.s.client, req) 5635} 5636 5637// Do executes the "storage.channels.stop" call. 5638func (c *ChannelsStopCall) Do(opts ...googleapi.CallOption) error { 5639 gensupport.SetOptions(c.urlParams_, opts...) 5640 res, err := c.doRequest("json") 5641 if err != nil { 5642 return err 5643 } 5644 defer googleapi.CloseBody(res) 5645 if err := googleapi.CheckResponse(res); err != nil { 5646 return err 5647 } 5648 return nil 5649 // { 5650 // "description": "Stop watching resources through this channel", 5651 // "httpMethod": "POST", 5652 // "id": "storage.channels.stop", 5653 // "path": "channels/stop", 5654 // "request": { 5655 // "$ref": "Channel", 5656 // "parameterName": "resource" 5657 // }, 5658 // "scopes": [ 5659 // "https://www.googleapis.com/auth/cloud-platform", 5660 // "https://www.googleapis.com/auth/cloud-platform.read-only", 5661 // "https://www.googleapis.com/auth/devstorage.full_control", 5662 // "https://www.googleapis.com/auth/devstorage.read_only", 5663 // "https://www.googleapis.com/auth/devstorage.read_write" 5664 // ] 5665 // } 5666 5667} 5668 5669// method id "storage.defaultObjectAccessControls.delete": 5670 5671type DefaultObjectAccessControlsDeleteCall struct { 5672 s *Service 5673 bucket string 5674 entity string 5675 urlParams_ gensupport.URLParams 5676 ctx_ context.Context 5677 header_ http.Header 5678} 5679 5680// Delete: Permanently deletes the default object ACL entry for the 5681// specified entity on the specified bucket. 5682func (r *DefaultObjectAccessControlsService) Delete(bucket string, entity string) *DefaultObjectAccessControlsDeleteCall { 5683 c := &DefaultObjectAccessControlsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 5684 c.bucket = bucket 5685 c.entity = entity 5686 return c 5687} 5688 5689// ProvisionalUserProject sets the optional parameter 5690// "provisionalUserProject": The project to be billed for this request 5691// if the target bucket is requester-pays bucket. 5692func (c *DefaultObjectAccessControlsDeleteCall) ProvisionalUserProject(provisionalUserProject string) *DefaultObjectAccessControlsDeleteCall { 5693 c.urlParams_.Set("provisionalUserProject", provisionalUserProject) 5694 return c 5695} 5696 5697// UserProject sets the optional parameter "userProject": The project to 5698// be billed for this request. Required for Requester Pays buckets. 5699func (c *DefaultObjectAccessControlsDeleteCall) UserProject(userProject string) *DefaultObjectAccessControlsDeleteCall { 5700 c.urlParams_.Set("userProject", userProject) 5701 return c 5702} 5703 5704// Fields allows partial responses to be retrieved. See 5705// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 5706// for more information. 5707func (c *DefaultObjectAccessControlsDeleteCall) Fields(s ...googleapi.Field) *DefaultObjectAccessControlsDeleteCall { 5708 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 5709 return c 5710} 5711 5712// Context sets the context to be used in this call's Do method. Any 5713// pending HTTP request will be aborted if the provided context is 5714// canceled. 5715func (c *DefaultObjectAccessControlsDeleteCall) Context(ctx context.Context) *DefaultObjectAccessControlsDeleteCall { 5716 c.ctx_ = ctx 5717 return c 5718} 5719 5720// Header returns an http.Header that can be modified by the caller to 5721// add HTTP headers to the request. 5722func (c *DefaultObjectAccessControlsDeleteCall) Header() http.Header { 5723 if c.header_ == nil { 5724 c.header_ = make(http.Header) 5725 } 5726 return c.header_ 5727} 5728 5729func (c *DefaultObjectAccessControlsDeleteCall) doRequest(alt string) (*http.Response, error) { 5730 reqHeaders := make(http.Header) 5731 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") 5732 for k, v := range c.header_ { 5733 reqHeaders[k] = v 5734 } 5735 reqHeaders.Set("User-Agent", c.s.userAgent()) 5736 var body io.Reader = nil 5737 c.urlParams_.Set("alt", alt) 5738 c.urlParams_.Set("prettyPrint", "false") 5739 urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/defaultObjectAcl/{entity}") 5740 urls += "?" + c.urlParams_.Encode() 5741 req, err := http.NewRequest("DELETE", urls, body) 5742 if err != nil { 5743 return nil, err 5744 } 5745 req.Header = reqHeaders 5746 googleapi.Expand(req.URL, map[string]string{ 5747 "bucket": c.bucket, 5748 "entity": c.entity, 5749 }) 5750 return gensupport.SendRequest(c.ctx_, c.s.client, req) 5751} 5752 5753// Do executes the "storage.defaultObjectAccessControls.delete" call. 5754func (c *DefaultObjectAccessControlsDeleteCall) Do(opts ...googleapi.CallOption) error { 5755 gensupport.SetOptions(c.urlParams_, opts...) 5756 res, err := c.doRequest("json") 5757 if err != nil { 5758 return err 5759 } 5760 defer googleapi.CloseBody(res) 5761 if err := googleapi.CheckResponse(res); err != nil { 5762 return err 5763 } 5764 return nil 5765 // { 5766 // "description": "Permanently deletes the default object ACL entry for the specified entity on the specified bucket.", 5767 // "httpMethod": "DELETE", 5768 // "id": "storage.defaultObjectAccessControls.delete", 5769 // "parameterOrder": [ 5770 // "bucket", 5771 // "entity" 5772 // ], 5773 // "parameters": { 5774 // "bucket": { 5775 // "description": "Name of a bucket.", 5776 // "location": "path", 5777 // "required": true, 5778 // "type": "string" 5779 // }, 5780 // "entity": { 5781 // "description": "The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.", 5782 // "location": "path", 5783 // "required": true, 5784 // "type": "string" 5785 // }, 5786 // "provisionalUserProject": { 5787 // "description": "The project to be billed for this request if the target bucket is requester-pays bucket.", 5788 // "location": "query", 5789 // "type": "string" 5790 // }, 5791 // "userProject": { 5792 // "description": "The project to be billed for this request. Required for Requester Pays buckets.", 5793 // "location": "query", 5794 // "type": "string" 5795 // } 5796 // }, 5797 // "path": "b/{bucket}/defaultObjectAcl/{entity}", 5798 // "scopes": [ 5799 // "https://www.googleapis.com/auth/cloud-platform", 5800 // "https://www.googleapis.com/auth/devstorage.full_control" 5801 // ] 5802 // } 5803 5804} 5805 5806// method id "storage.defaultObjectAccessControls.get": 5807 5808type DefaultObjectAccessControlsGetCall struct { 5809 s *Service 5810 bucket string 5811 entity string 5812 urlParams_ gensupport.URLParams 5813 ifNoneMatch_ string 5814 ctx_ context.Context 5815 header_ http.Header 5816} 5817 5818// Get: Returns the default object ACL entry for the specified entity on 5819// the specified bucket. 5820func (r *DefaultObjectAccessControlsService) Get(bucket string, entity string) *DefaultObjectAccessControlsGetCall { 5821 c := &DefaultObjectAccessControlsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 5822 c.bucket = bucket 5823 c.entity = entity 5824 return c 5825} 5826 5827// ProvisionalUserProject sets the optional parameter 5828// "provisionalUserProject": The project to be billed for this request 5829// if the target bucket is requester-pays bucket. 5830func (c *DefaultObjectAccessControlsGetCall) ProvisionalUserProject(provisionalUserProject string) *DefaultObjectAccessControlsGetCall { 5831 c.urlParams_.Set("provisionalUserProject", provisionalUserProject) 5832 return c 5833} 5834 5835// UserProject sets the optional parameter "userProject": The project to 5836// be billed for this request. Required for Requester Pays buckets. 5837func (c *DefaultObjectAccessControlsGetCall) UserProject(userProject string) *DefaultObjectAccessControlsGetCall { 5838 c.urlParams_.Set("userProject", userProject) 5839 return c 5840} 5841 5842// Fields allows partial responses to be retrieved. See 5843// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 5844// for more information. 5845func (c *DefaultObjectAccessControlsGetCall) Fields(s ...googleapi.Field) *DefaultObjectAccessControlsGetCall { 5846 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 5847 return c 5848} 5849 5850// IfNoneMatch sets the optional parameter which makes the operation 5851// fail if the object's ETag matches the given value. This is useful for 5852// getting updates only after the object has changed since the last 5853// request. Use googleapi.IsNotModified to check whether the response 5854// error from Do is the result of In-None-Match. 5855func (c *DefaultObjectAccessControlsGetCall) IfNoneMatch(entityTag string) *DefaultObjectAccessControlsGetCall { 5856 c.ifNoneMatch_ = entityTag 5857 return c 5858} 5859 5860// Context sets the context to be used in this call's Do method. Any 5861// pending HTTP request will be aborted if the provided context is 5862// canceled. 5863func (c *DefaultObjectAccessControlsGetCall) Context(ctx context.Context) *DefaultObjectAccessControlsGetCall { 5864 c.ctx_ = ctx 5865 return c 5866} 5867 5868// Header returns an http.Header that can be modified by the caller to 5869// add HTTP headers to the request. 5870func (c *DefaultObjectAccessControlsGetCall) Header() http.Header { 5871 if c.header_ == nil { 5872 c.header_ = make(http.Header) 5873 } 5874 return c.header_ 5875} 5876 5877func (c *DefaultObjectAccessControlsGetCall) doRequest(alt string) (*http.Response, error) { 5878 reqHeaders := make(http.Header) 5879 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") 5880 for k, v := range c.header_ { 5881 reqHeaders[k] = v 5882 } 5883 reqHeaders.Set("User-Agent", c.s.userAgent()) 5884 if c.ifNoneMatch_ != "" { 5885 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 5886 } 5887 var body io.Reader = nil 5888 c.urlParams_.Set("alt", alt) 5889 c.urlParams_.Set("prettyPrint", "false") 5890 urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/defaultObjectAcl/{entity}") 5891 urls += "?" + c.urlParams_.Encode() 5892 req, err := http.NewRequest("GET", urls, body) 5893 if err != nil { 5894 return nil, err 5895 } 5896 req.Header = reqHeaders 5897 googleapi.Expand(req.URL, map[string]string{ 5898 "bucket": c.bucket, 5899 "entity": c.entity, 5900 }) 5901 return gensupport.SendRequest(c.ctx_, c.s.client, req) 5902} 5903 5904// Do executes the "storage.defaultObjectAccessControls.get" call. 5905// Exactly one of *ObjectAccessControl or error will be non-nil. Any 5906// non-2xx status code is an error. Response headers are in either 5907// *ObjectAccessControl.ServerResponse.Header or (if a response was 5908// returned at all) in error.(*googleapi.Error).Header. Use 5909// googleapi.IsNotModified to check whether the returned error was 5910// because http.StatusNotModified was returned. 5911func (c *DefaultObjectAccessControlsGetCall) Do(opts ...googleapi.CallOption) (*ObjectAccessControl, error) { 5912 gensupport.SetOptions(c.urlParams_, opts...) 5913 res, err := c.doRequest("json") 5914 if res != nil && res.StatusCode == http.StatusNotModified { 5915 if res.Body != nil { 5916 res.Body.Close() 5917 } 5918 return nil, &googleapi.Error{ 5919 Code: res.StatusCode, 5920 Header: res.Header, 5921 } 5922 } 5923 if err != nil { 5924 return nil, err 5925 } 5926 defer googleapi.CloseBody(res) 5927 if err := googleapi.CheckResponse(res); err != nil { 5928 return nil, err 5929 } 5930 ret := &ObjectAccessControl{ 5931 ServerResponse: googleapi.ServerResponse{ 5932 Header: res.Header, 5933 HTTPStatusCode: res.StatusCode, 5934 }, 5935 } 5936 target := &ret 5937 if err := gensupport.DecodeResponse(target, res); err != nil { 5938 return nil, err 5939 } 5940 return ret, nil 5941 // { 5942 // "description": "Returns the default object ACL entry for the specified entity on the specified bucket.", 5943 // "httpMethod": "GET", 5944 // "id": "storage.defaultObjectAccessControls.get", 5945 // "parameterOrder": [ 5946 // "bucket", 5947 // "entity" 5948 // ], 5949 // "parameters": { 5950 // "bucket": { 5951 // "description": "Name of a bucket.", 5952 // "location": "path", 5953 // "required": true, 5954 // "type": "string" 5955 // }, 5956 // "entity": { 5957 // "description": "The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.", 5958 // "location": "path", 5959 // "required": true, 5960 // "type": "string" 5961 // }, 5962 // "provisionalUserProject": { 5963 // "description": "The project to be billed for this request if the target bucket is requester-pays bucket.", 5964 // "location": "query", 5965 // "type": "string" 5966 // }, 5967 // "userProject": { 5968 // "description": "The project to be billed for this request. Required for Requester Pays buckets.", 5969 // "location": "query", 5970 // "type": "string" 5971 // } 5972 // }, 5973 // "path": "b/{bucket}/defaultObjectAcl/{entity}", 5974 // "response": { 5975 // "$ref": "ObjectAccessControl" 5976 // }, 5977 // "scopes": [ 5978 // "https://www.googleapis.com/auth/cloud-platform", 5979 // "https://www.googleapis.com/auth/devstorage.full_control" 5980 // ] 5981 // } 5982 5983} 5984 5985// method id "storage.defaultObjectAccessControls.insert": 5986 5987type DefaultObjectAccessControlsInsertCall struct { 5988 s *Service 5989 bucket string 5990 objectaccesscontrol *ObjectAccessControl 5991 urlParams_ gensupport.URLParams 5992 ctx_ context.Context 5993 header_ http.Header 5994} 5995 5996// Insert: Creates a new default object ACL entry on the specified 5997// bucket. 5998func (r *DefaultObjectAccessControlsService) Insert(bucket string, objectaccesscontrol *ObjectAccessControl) *DefaultObjectAccessControlsInsertCall { 5999 c := &DefaultObjectAccessControlsInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)} 6000 c.bucket = bucket 6001 c.objectaccesscontrol = objectaccesscontrol 6002 return c 6003} 6004 6005// ProvisionalUserProject sets the optional parameter 6006// "provisionalUserProject": The project to be billed for this request 6007// if the target bucket is requester-pays bucket. 6008func (c *DefaultObjectAccessControlsInsertCall) ProvisionalUserProject(provisionalUserProject string) *DefaultObjectAccessControlsInsertCall { 6009 c.urlParams_.Set("provisionalUserProject", provisionalUserProject) 6010 return c 6011} 6012 6013// UserProject sets the optional parameter "userProject": The project to 6014// be billed for this request. Required for Requester Pays buckets. 6015func (c *DefaultObjectAccessControlsInsertCall) UserProject(userProject string) *DefaultObjectAccessControlsInsertCall { 6016 c.urlParams_.Set("userProject", userProject) 6017 return c 6018} 6019 6020// Fields allows partial responses to be retrieved. See 6021// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 6022// for more information. 6023func (c *DefaultObjectAccessControlsInsertCall) Fields(s ...googleapi.Field) *DefaultObjectAccessControlsInsertCall { 6024 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 6025 return c 6026} 6027 6028// Context sets the context to be used in this call's Do method. Any 6029// pending HTTP request will be aborted if the provided context is 6030// canceled. 6031func (c *DefaultObjectAccessControlsInsertCall) Context(ctx context.Context) *DefaultObjectAccessControlsInsertCall { 6032 c.ctx_ = ctx 6033 return c 6034} 6035 6036// Header returns an http.Header that can be modified by the caller to 6037// add HTTP headers to the request. 6038func (c *DefaultObjectAccessControlsInsertCall) Header() http.Header { 6039 if c.header_ == nil { 6040 c.header_ = make(http.Header) 6041 } 6042 return c.header_ 6043} 6044 6045func (c *DefaultObjectAccessControlsInsertCall) doRequest(alt string) (*http.Response, error) { 6046 reqHeaders := make(http.Header) 6047 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") 6048 for k, v := range c.header_ { 6049 reqHeaders[k] = v 6050 } 6051 reqHeaders.Set("User-Agent", c.s.userAgent()) 6052 var body io.Reader = nil 6053 body, err := googleapi.WithoutDataWrapper.JSONReader(c.objectaccesscontrol) 6054 if err != nil { 6055 return nil, err 6056 } 6057 reqHeaders.Set("Content-Type", "application/json") 6058 c.urlParams_.Set("alt", alt) 6059 c.urlParams_.Set("prettyPrint", "false") 6060 urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/defaultObjectAcl") 6061 urls += "?" + c.urlParams_.Encode() 6062 req, err := http.NewRequest("POST", urls, body) 6063 if err != nil { 6064 return nil, err 6065 } 6066 req.Header = reqHeaders 6067 googleapi.Expand(req.URL, map[string]string{ 6068 "bucket": c.bucket, 6069 }) 6070 return gensupport.SendRequest(c.ctx_, c.s.client, req) 6071} 6072 6073// Do executes the "storage.defaultObjectAccessControls.insert" call. 6074// Exactly one of *ObjectAccessControl or error will be non-nil. Any 6075// non-2xx status code is an error. Response headers are in either 6076// *ObjectAccessControl.ServerResponse.Header or (if a response was 6077// returned at all) in error.(*googleapi.Error).Header. Use 6078// googleapi.IsNotModified to check whether the returned error was 6079// because http.StatusNotModified was returned. 6080func (c *DefaultObjectAccessControlsInsertCall) Do(opts ...googleapi.CallOption) (*ObjectAccessControl, error) { 6081 gensupport.SetOptions(c.urlParams_, opts...) 6082 res, err := c.doRequest("json") 6083 if res != nil && res.StatusCode == http.StatusNotModified { 6084 if res.Body != nil { 6085 res.Body.Close() 6086 } 6087 return nil, &googleapi.Error{ 6088 Code: res.StatusCode, 6089 Header: res.Header, 6090 } 6091 } 6092 if err != nil { 6093 return nil, err 6094 } 6095 defer googleapi.CloseBody(res) 6096 if err := googleapi.CheckResponse(res); err != nil { 6097 return nil, err 6098 } 6099 ret := &ObjectAccessControl{ 6100 ServerResponse: googleapi.ServerResponse{ 6101 Header: res.Header, 6102 HTTPStatusCode: res.StatusCode, 6103 }, 6104 } 6105 target := &ret 6106 if err := gensupport.DecodeResponse(target, res); err != nil { 6107 return nil, err 6108 } 6109 return ret, nil 6110 // { 6111 // "description": "Creates a new default object ACL entry on the specified bucket.", 6112 // "httpMethod": "POST", 6113 // "id": "storage.defaultObjectAccessControls.insert", 6114 // "parameterOrder": [ 6115 // "bucket" 6116 // ], 6117 // "parameters": { 6118 // "bucket": { 6119 // "description": "Name of a bucket.", 6120 // "location": "path", 6121 // "required": true, 6122 // "type": "string" 6123 // }, 6124 // "provisionalUserProject": { 6125 // "description": "The project to be billed for this request if the target bucket is requester-pays bucket.", 6126 // "location": "query", 6127 // "type": "string" 6128 // }, 6129 // "userProject": { 6130 // "description": "The project to be billed for this request. Required for Requester Pays buckets.", 6131 // "location": "query", 6132 // "type": "string" 6133 // } 6134 // }, 6135 // "path": "b/{bucket}/defaultObjectAcl", 6136 // "request": { 6137 // "$ref": "ObjectAccessControl" 6138 // }, 6139 // "response": { 6140 // "$ref": "ObjectAccessControl" 6141 // }, 6142 // "scopes": [ 6143 // "https://www.googleapis.com/auth/cloud-platform", 6144 // "https://www.googleapis.com/auth/devstorage.full_control" 6145 // ] 6146 // } 6147 6148} 6149 6150// method id "storage.defaultObjectAccessControls.list": 6151 6152type DefaultObjectAccessControlsListCall struct { 6153 s *Service 6154 bucket string 6155 urlParams_ gensupport.URLParams 6156 ifNoneMatch_ string 6157 ctx_ context.Context 6158 header_ http.Header 6159} 6160 6161// List: Retrieves default object ACL entries on the specified bucket. 6162func (r *DefaultObjectAccessControlsService) List(bucket string) *DefaultObjectAccessControlsListCall { 6163 c := &DefaultObjectAccessControlsListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 6164 c.bucket = bucket 6165 return c 6166} 6167 6168// IfMetagenerationMatch sets the optional parameter 6169// "ifMetagenerationMatch": If present, only return default ACL listing 6170// if the bucket's current metageneration matches this value. 6171func (c *DefaultObjectAccessControlsListCall) IfMetagenerationMatch(ifMetagenerationMatch int64) *DefaultObjectAccessControlsListCall { 6172 c.urlParams_.Set("ifMetagenerationMatch", fmt.Sprint(ifMetagenerationMatch)) 6173 return c 6174} 6175 6176// IfMetagenerationNotMatch sets the optional parameter 6177// "ifMetagenerationNotMatch": If present, only return default ACL 6178// listing if the bucket's current metageneration does not match the 6179// given value. 6180func (c *DefaultObjectAccessControlsListCall) IfMetagenerationNotMatch(ifMetagenerationNotMatch int64) *DefaultObjectAccessControlsListCall { 6181 c.urlParams_.Set("ifMetagenerationNotMatch", fmt.Sprint(ifMetagenerationNotMatch)) 6182 return c 6183} 6184 6185// ProvisionalUserProject sets the optional parameter 6186// "provisionalUserProject": The project to be billed for this request 6187// if the target bucket is requester-pays bucket. 6188func (c *DefaultObjectAccessControlsListCall) ProvisionalUserProject(provisionalUserProject string) *DefaultObjectAccessControlsListCall { 6189 c.urlParams_.Set("provisionalUserProject", provisionalUserProject) 6190 return c 6191} 6192 6193// UserProject sets the optional parameter "userProject": The project to 6194// be billed for this request. Required for Requester Pays buckets. 6195func (c *DefaultObjectAccessControlsListCall) UserProject(userProject string) *DefaultObjectAccessControlsListCall { 6196 c.urlParams_.Set("userProject", userProject) 6197 return c 6198} 6199 6200// Fields allows partial responses to be retrieved. See 6201// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 6202// for more information. 6203func (c *DefaultObjectAccessControlsListCall) Fields(s ...googleapi.Field) *DefaultObjectAccessControlsListCall { 6204 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 6205 return c 6206} 6207 6208// IfNoneMatch sets the optional parameter which makes the operation 6209// fail if the object's ETag matches the given value. This is useful for 6210// getting updates only after the object has changed since the last 6211// request. Use googleapi.IsNotModified to check whether the response 6212// error from Do is the result of In-None-Match. 6213func (c *DefaultObjectAccessControlsListCall) IfNoneMatch(entityTag string) *DefaultObjectAccessControlsListCall { 6214 c.ifNoneMatch_ = entityTag 6215 return c 6216} 6217 6218// Context sets the context to be used in this call's Do method. Any 6219// pending HTTP request will be aborted if the provided context is 6220// canceled. 6221func (c *DefaultObjectAccessControlsListCall) Context(ctx context.Context) *DefaultObjectAccessControlsListCall { 6222 c.ctx_ = ctx 6223 return c 6224} 6225 6226// Header returns an http.Header that can be modified by the caller to 6227// add HTTP headers to the request. 6228func (c *DefaultObjectAccessControlsListCall) Header() http.Header { 6229 if c.header_ == nil { 6230 c.header_ = make(http.Header) 6231 } 6232 return c.header_ 6233} 6234 6235func (c *DefaultObjectAccessControlsListCall) doRequest(alt string) (*http.Response, error) { 6236 reqHeaders := make(http.Header) 6237 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") 6238 for k, v := range c.header_ { 6239 reqHeaders[k] = v 6240 } 6241 reqHeaders.Set("User-Agent", c.s.userAgent()) 6242 if c.ifNoneMatch_ != "" { 6243 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 6244 } 6245 var body io.Reader = nil 6246 c.urlParams_.Set("alt", alt) 6247 c.urlParams_.Set("prettyPrint", "false") 6248 urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/defaultObjectAcl") 6249 urls += "?" + c.urlParams_.Encode() 6250 req, err := http.NewRequest("GET", urls, body) 6251 if err != nil { 6252 return nil, err 6253 } 6254 req.Header = reqHeaders 6255 googleapi.Expand(req.URL, map[string]string{ 6256 "bucket": c.bucket, 6257 }) 6258 return gensupport.SendRequest(c.ctx_, c.s.client, req) 6259} 6260 6261// Do executes the "storage.defaultObjectAccessControls.list" call. 6262// Exactly one of *ObjectAccessControls or error will be non-nil. Any 6263// non-2xx status code is an error. Response headers are in either 6264// *ObjectAccessControls.ServerResponse.Header or (if a response was 6265// returned at all) in error.(*googleapi.Error).Header. Use 6266// googleapi.IsNotModified to check whether the returned error was 6267// because http.StatusNotModified was returned. 6268func (c *DefaultObjectAccessControlsListCall) Do(opts ...googleapi.CallOption) (*ObjectAccessControls, error) { 6269 gensupport.SetOptions(c.urlParams_, opts...) 6270 res, err := c.doRequest("json") 6271 if res != nil && res.StatusCode == http.StatusNotModified { 6272 if res.Body != nil { 6273 res.Body.Close() 6274 } 6275 return nil, &googleapi.Error{ 6276 Code: res.StatusCode, 6277 Header: res.Header, 6278 } 6279 } 6280 if err != nil { 6281 return nil, err 6282 } 6283 defer googleapi.CloseBody(res) 6284 if err := googleapi.CheckResponse(res); err != nil { 6285 return nil, err 6286 } 6287 ret := &ObjectAccessControls{ 6288 ServerResponse: googleapi.ServerResponse{ 6289 Header: res.Header, 6290 HTTPStatusCode: res.StatusCode, 6291 }, 6292 } 6293 target := &ret 6294 if err := gensupport.DecodeResponse(target, res); err != nil { 6295 return nil, err 6296 } 6297 return ret, nil 6298 // { 6299 // "description": "Retrieves default object ACL entries on the specified bucket.", 6300 // "httpMethod": "GET", 6301 // "id": "storage.defaultObjectAccessControls.list", 6302 // "parameterOrder": [ 6303 // "bucket" 6304 // ], 6305 // "parameters": { 6306 // "bucket": { 6307 // "description": "Name of a bucket.", 6308 // "location": "path", 6309 // "required": true, 6310 // "type": "string" 6311 // }, 6312 // "ifMetagenerationMatch": { 6313 // "description": "If present, only return default ACL listing if the bucket's current metageneration matches this value.", 6314 // "format": "int64", 6315 // "location": "query", 6316 // "type": "string" 6317 // }, 6318 // "ifMetagenerationNotMatch": { 6319 // "description": "If present, only return default ACL listing if the bucket's current metageneration does not match the given value.", 6320 // "format": "int64", 6321 // "location": "query", 6322 // "type": "string" 6323 // }, 6324 // "provisionalUserProject": { 6325 // "description": "The project to be billed for this request if the target bucket is requester-pays bucket.", 6326 // "location": "query", 6327 // "type": "string" 6328 // }, 6329 // "userProject": { 6330 // "description": "The project to be billed for this request. Required for Requester Pays buckets.", 6331 // "location": "query", 6332 // "type": "string" 6333 // } 6334 // }, 6335 // "path": "b/{bucket}/defaultObjectAcl", 6336 // "response": { 6337 // "$ref": "ObjectAccessControls" 6338 // }, 6339 // "scopes": [ 6340 // "https://www.googleapis.com/auth/cloud-platform", 6341 // "https://www.googleapis.com/auth/devstorage.full_control" 6342 // ] 6343 // } 6344 6345} 6346 6347// method id "storage.defaultObjectAccessControls.patch": 6348 6349type DefaultObjectAccessControlsPatchCall struct { 6350 s *Service 6351 bucket string 6352 entity string 6353 objectaccesscontrol *ObjectAccessControl 6354 urlParams_ gensupport.URLParams 6355 ctx_ context.Context 6356 header_ http.Header 6357} 6358 6359// Patch: Patches a default object ACL entry on the specified bucket. 6360func (r *DefaultObjectAccessControlsService) Patch(bucket string, entity string, objectaccesscontrol *ObjectAccessControl) *DefaultObjectAccessControlsPatchCall { 6361 c := &DefaultObjectAccessControlsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)} 6362 c.bucket = bucket 6363 c.entity = entity 6364 c.objectaccesscontrol = objectaccesscontrol 6365 return c 6366} 6367 6368// ProvisionalUserProject sets the optional parameter 6369// "provisionalUserProject": The project to be billed for this request 6370// if the target bucket is requester-pays bucket. 6371func (c *DefaultObjectAccessControlsPatchCall) ProvisionalUserProject(provisionalUserProject string) *DefaultObjectAccessControlsPatchCall { 6372 c.urlParams_.Set("provisionalUserProject", provisionalUserProject) 6373 return c 6374} 6375 6376// UserProject sets the optional parameter "userProject": The project to 6377// be billed for this request. Required for Requester Pays buckets. 6378func (c *DefaultObjectAccessControlsPatchCall) UserProject(userProject string) *DefaultObjectAccessControlsPatchCall { 6379 c.urlParams_.Set("userProject", userProject) 6380 return c 6381} 6382 6383// Fields allows partial responses to be retrieved. See 6384// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 6385// for more information. 6386func (c *DefaultObjectAccessControlsPatchCall) Fields(s ...googleapi.Field) *DefaultObjectAccessControlsPatchCall { 6387 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 6388 return c 6389} 6390 6391// Context sets the context to be used in this call's Do method. Any 6392// pending HTTP request will be aborted if the provided context is 6393// canceled. 6394func (c *DefaultObjectAccessControlsPatchCall) Context(ctx context.Context) *DefaultObjectAccessControlsPatchCall { 6395 c.ctx_ = ctx 6396 return c 6397} 6398 6399// Header returns an http.Header that can be modified by the caller to 6400// add HTTP headers to the request. 6401func (c *DefaultObjectAccessControlsPatchCall) Header() http.Header { 6402 if c.header_ == nil { 6403 c.header_ = make(http.Header) 6404 } 6405 return c.header_ 6406} 6407 6408func (c *DefaultObjectAccessControlsPatchCall) doRequest(alt string) (*http.Response, error) { 6409 reqHeaders := make(http.Header) 6410 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") 6411 for k, v := range c.header_ { 6412 reqHeaders[k] = v 6413 } 6414 reqHeaders.Set("User-Agent", c.s.userAgent()) 6415 var body io.Reader = nil 6416 body, err := googleapi.WithoutDataWrapper.JSONReader(c.objectaccesscontrol) 6417 if err != nil { 6418 return nil, err 6419 } 6420 reqHeaders.Set("Content-Type", "application/json") 6421 c.urlParams_.Set("alt", alt) 6422 c.urlParams_.Set("prettyPrint", "false") 6423 urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/defaultObjectAcl/{entity}") 6424 urls += "?" + c.urlParams_.Encode() 6425 req, err := http.NewRequest("PATCH", urls, body) 6426 if err != nil { 6427 return nil, err 6428 } 6429 req.Header = reqHeaders 6430 googleapi.Expand(req.URL, map[string]string{ 6431 "bucket": c.bucket, 6432 "entity": c.entity, 6433 }) 6434 return gensupport.SendRequest(c.ctx_, c.s.client, req) 6435} 6436 6437// Do executes the "storage.defaultObjectAccessControls.patch" call. 6438// Exactly one of *ObjectAccessControl or error will be non-nil. Any 6439// non-2xx status code is an error. Response headers are in either 6440// *ObjectAccessControl.ServerResponse.Header or (if a response was 6441// returned at all) in error.(*googleapi.Error).Header. Use 6442// googleapi.IsNotModified to check whether the returned error was 6443// because http.StatusNotModified was returned. 6444func (c *DefaultObjectAccessControlsPatchCall) Do(opts ...googleapi.CallOption) (*ObjectAccessControl, error) { 6445 gensupport.SetOptions(c.urlParams_, opts...) 6446 res, err := c.doRequest("json") 6447 if res != nil && res.StatusCode == http.StatusNotModified { 6448 if res.Body != nil { 6449 res.Body.Close() 6450 } 6451 return nil, &googleapi.Error{ 6452 Code: res.StatusCode, 6453 Header: res.Header, 6454 } 6455 } 6456 if err != nil { 6457 return nil, err 6458 } 6459 defer googleapi.CloseBody(res) 6460 if err := googleapi.CheckResponse(res); err != nil { 6461 return nil, err 6462 } 6463 ret := &ObjectAccessControl{ 6464 ServerResponse: googleapi.ServerResponse{ 6465 Header: res.Header, 6466 HTTPStatusCode: res.StatusCode, 6467 }, 6468 } 6469 target := &ret 6470 if err := gensupport.DecodeResponse(target, res); err != nil { 6471 return nil, err 6472 } 6473 return ret, nil 6474 // { 6475 // "description": "Patches a default object ACL entry on the specified bucket.", 6476 // "httpMethod": "PATCH", 6477 // "id": "storage.defaultObjectAccessControls.patch", 6478 // "parameterOrder": [ 6479 // "bucket", 6480 // "entity" 6481 // ], 6482 // "parameters": { 6483 // "bucket": { 6484 // "description": "Name of a bucket.", 6485 // "location": "path", 6486 // "required": true, 6487 // "type": "string" 6488 // }, 6489 // "entity": { 6490 // "description": "The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.", 6491 // "location": "path", 6492 // "required": true, 6493 // "type": "string" 6494 // }, 6495 // "provisionalUserProject": { 6496 // "description": "The project to be billed for this request if the target bucket is requester-pays bucket.", 6497 // "location": "query", 6498 // "type": "string" 6499 // }, 6500 // "userProject": { 6501 // "description": "The project to be billed for this request. Required for Requester Pays buckets.", 6502 // "location": "query", 6503 // "type": "string" 6504 // } 6505 // }, 6506 // "path": "b/{bucket}/defaultObjectAcl/{entity}", 6507 // "request": { 6508 // "$ref": "ObjectAccessControl" 6509 // }, 6510 // "response": { 6511 // "$ref": "ObjectAccessControl" 6512 // }, 6513 // "scopes": [ 6514 // "https://www.googleapis.com/auth/cloud-platform", 6515 // "https://www.googleapis.com/auth/devstorage.full_control" 6516 // ] 6517 // } 6518 6519} 6520 6521// method id "storage.defaultObjectAccessControls.update": 6522 6523type DefaultObjectAccessControlsUpdateCall struct { 6524 s *Service 6525 bucket string 6526 entity string 6527 objectaccesscontrol *ObjectAccessControl 6528 urlParams_ gensupport.URLParams 6529 ctx_ context.Context 6530 header_ http.Header 6531} 6532 6533// Update: Updates a default object ACL entry on the specified bucket. 6534func (r *DefaultObjectAccessControlsService) Update(bucket string, entity string, objectaccesscontrol *ObjectAccessControl) *DefaultObjectAccessControlsUpdateCall { 6535 c := &DefaultObjectAccessControlsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 6536 c.bucket = bucket 6537 c.entity = entity 6538 c.objectaccesscontrol = objectaccesscontrol 6539 return c 6540} 6541 6542// ProvisionalUserProject sets the optional parameter 6543// "provisionalUserProject": The project to be billed for this request 6544// if the target bucket is requester-pays bucket. 6545func (c *DefaultObjectAccessControlsUpdateCall) ProvisionalUserProject(provisionalUserProject string) *DefaultObjectAccessControlsUpdateCall { 6546 c.urlParams_.Set("provisionalUserProject", provisionalUserProject) 6547 return c 6548} 6549 6550// UserProject sets the optional parameter "userProject": The project to 6551// be billed for this request. Required for Requester Pays buckets. 6552func (c *DefaultObjectAccessControlsUpdateCall) UserProject(userProject string) *DefaultObjectAccessControlsUpdateCall { 6553 c.urlParams_.Set("userProject", userProject) 6554 return c 6555} 6556 6557// Fields allows partial responses to be retrieved. See 6558// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 6559// for more information. 6560func (c *DefaultObjectAccessControlsUpdateCall) Fields(s ...googleapi.Field) *DefaultObjectAccessControlsUpdateCall { 6561 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 6562 return c 6563} 6564 6565// Context sets the context to be used in this call's Do method. Any 6566// pending HTTP request will be aborted if the provided context is 6567// canceled. 6568func (c *DefaultObjectAccessControlsUpdateCall) Context(ctx context.Context) *DefaultObjectAccessControlsUpdateCall { 6569 c.ctx_ = ctx 6570 return c 6571} 6572 6573// Header returns an http.Header that can be modified by the caller to 6574// add HTTP headers to the request. 6575func (c *DefaultObjectAccessControlsUpdateCall) Header() http.Header { 6576 if c.header_ == nil { 6577 c.header_ = make(http.Header) 6578 } 6579 return c.header_ 6580} 6581 6582func (c *DefaultObjectAccessControlsUpdateCall) doRequest(alt string) (*http.Response, error) { 6583 reqHeaders := make(http.Header) 6584 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") 6585 for k, v := range c.header_ { 6586 reqHeaders[k] = v 6587 } 6588 reqHeaders.Set("User-Agent", c.s.userAgent()) 6589 var body io.Reader = nil 6590 body, err := googleapi.WithoutDataWrapper.JSONReader(c.objectaccesscontrol) 6591 if err != nil { 6592 return nil, err 6593 } 6594 reqHeaders.Set("Content-Type", "application/json") 6595 c.urlParams_.Set("alt", alt) 6596 c.urlParams_.Set("prettyPrint", "false") 6597 urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/defaultObjectAcl/{entity}") 6598 urls += "?" + c.urlParams_.Encode() 6599 req, err := http.NewRequest("PUT", urls, body) 6600 if err != nil { 6601 return nil, err 6602 } 6603 req.Header = reqHeaders 6604 googleapi.Expand(req.URL, map[string]string{ 6605 "bucket": c.bucket, 6606 "entity": c.entity, 6607 }) 6608 return gensupport.SendRequest(c.ctx_, c.s.client, req) 6609} 6610 6611// Do executes the "storage.defaultObjectAccessControls.update" call. 6612// Exactly one of *ObjectAccessControl or error will be non-nil. Any 6613// non-2xx status code is an error. Response headers are in either 6614// *ObjectAccessControl.ServerResponse.Header or (if a response was 6615// returned at all) in error.(*googleapi.Error).Header. Use 6616// googleapi.IsNotModified to check whether the returned error was 6617// because http.StatusNotModified was returned. 6618func (c *DefaultObjectAccessControlsUpdateCall) Do(opts ...googleapi.CallOption) (*ObjectAccessControl, error) { 6619 gensupport.SetOptions(c.urlParams_, opts...) 6620 res, err := c.doRequest("json") 6621 if res != nil && res.StatusCode == http.StatusNotModified { 6622 if res.Body != nil { 6623 res.Body.Close() 6624 } 6625 return nil, &googleapi.Error{ 6626 Code: res.StatusCode, 6627 Header: res.Header, 6628 } 6629 } 6630 if err != nil { 6631 return nil, err 6632 } 6633 defer googleapi.CloseBody(res) 6634 if err := googleapi.CheckResponse(res); err != nil { 6635 return nil, err 6636 } 6637 ret := &ObjectAccessControl{ 6638 ServerResponse: googleapi.ServerResponse{ 6639 Header: res.Header, 6640 HTTPStatusCode: res.StatusCode, 6641 }, 6642 } 6643 target := &ret 6644 if err := gensupport.DecodeResponse(target, res); err != nil { 6645 return nil, err 6646 } 6647 return ret, nil 6648 // { 6649 // "description": "Updates a default object ACL entry on the specified bucket.", 6650 // "httpMethod": "PUT", 6651 // "id": "storage.defaultObjectAccessControls.update", 6652 // "parameterOrder": [ 6653 // "bucket", 6654 // "entity" 6655 // ], 6656 // "parameters": { 6657 // "bucket": { 6658 // "description": "Name of a bucket.", 6659 // "location": "path", 6660 // "required": true, 6661 // "type": "string" 6662 // }, 6663 // "entity": { 6664 // "description": "The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.", 6665 // "location": "path", 6666 // "required": true, 6667 // "type": "string" 6668 // }, 6669 // "provisionalUserProject": { 6670 // "description": "The project to be billed for this request if the target bucket is requester-pays bucket.", 6671 // "location": "query", 6672 // "type": "string" 6673 // }, 6674 // "userProject": { 6675 // "description": "The project to be billed for this request. Required for Requester Pays buckets.", 6676 // "location": "query", 6677 // "type": "string" 6678 // } 6679 // }, 6680 // "path": "b/{bucket}/defaultObjectAcl/{entity}", 6681 // "request": { 6682 // "$ref": "ObjectAccessControl" 6683 // }, 6684 // "response": { 6685 // "$ref": "ObjectAccessControl" 6686 // }, 6687 // "scopes": [ 6688 // "https://www.googleapis.com/auth/cloud-platform", 6689 // "https://www.googleapis.com/auth/devstorage.full_control" 6690 // ] 6691 // } 6692 6693} 6694 6695// method id "storage.notifications.delete": 6696 6697type NotificationsDeleteCall struct { 6698 s *Service 6699 bucket string 6700 notification string 6701 urlParams_ gensupport.URLParams 6702 ctx_ context.Context 6703 header_ http.Header 6704} 6705 6706// Delete: Permanently deletes a notification subscription. 6707func (r *NotificationsService) Delete(bucket string, notification string) *NotificationsDeleteCall { 6708 c := &NotificationsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 6709 c.bucket = bucket 6710 c.notification = notification 6711 return c 6712} 6713 6714// ProvisionalUserProject sets the optional parameter 6715// "provisionalUserProject": The project to be billed for this request 6716// if the target bucket is requester-pays bucket. 6717func (c *NotificationsDeleteCall) ProvisionalUserProject(provisionalUserProject string) *NotificationsDeleteCall { 6718 c.urlParams_.Set("provisionalUserProject", provisionalUserProject) 6719 return c 6720} 6721 6722// UserProject sets the optional parameter "userProject": The project to 6723// be billed for this request. Required for Requester Pays buckets. 6724func (c *NotificationsDeleteCall) UserProject(userProject string) *NotificationsDeleteCall { 6725 c.urlParams_.Set("userProject", userProject) 6726 return c 6727} 6728 6729// Fields allows partial responses to be retrieved. See 6730// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 6731// for more information. 6732func (c *NotificationsDeleteCall) Fields(s ...googleapi.Field) *NotificationsDeleteCall { 6733 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 6734 return c 6735} 6736 6737// Context sets the context to be used in this call's Do method. Any 6738// pending HTTP request will be aborted if the provided context is 6739// canceled. 6740func (c *NotificationsDeleteCall) Context(ctx context.Context) *NotificationsDeleteCall { 6741 c.ctx_ = ctx 6742 return c 6743} 6744 6745// Header returns an http.Header that can be modified by the caller to 6746// add HTTP headers to the request. 6747func (c *NotificationsDeleteCall) Header() http.Header { 6748 if c.header_ == nil { 6749 c.header_ = make(http.Header) 6750 } 6751 return c.header_ 6752} 6753 6754func (c *NotificationsDeleteCall) doRequest(alt string) (*http.Response, error) { 6755 reqHeaders := make(http.Header) 6756 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") 6757 for k, v := range c.header_ { 6758 reqHeaders[k] = v 6759 } 6760 reqHeaders.Set("User-Agent", c.s.userAgent()) 6761 var body io.Reader = nil 6762 c.urlParams_.Set("alt", alt) 6763 c.urlParams_.Set("prettyPrint", "false") 6764 urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/notificationConfigs/{notification}") 6765 urls += "?" + c.urlParams_.Encode() 6766 req, err := http.NewRequest("DELETE", urls, body) 6767 if err != nil { 6768 return nil, err 6769 } 6770 req.Header = reqHeaders 6771 googleapi.Expand(req.URL, map[string]string{ 6772 "bucket": c.bucket, 6773 "notification": c.notification, 6774 }) 6775 return gensupport.SendRequest(c.ctx_, c.s.client, req) 6776} 6777 6778// Do executes the "storage.notifications.delete" call. 6779func (c *NotificationsDeleteCall) Do(opts ...googleapi.CallOption) error { 6780 gensupport.SetOptions(c.urlParams_, opts...) 6781 res, err := c.doRequest("json") 6782 if err != nil { 6783 return err 6784 } 6785 defer googleapi.CloseBody(res) 6786 if err := googleapi.CheckResponse(res); err != nil { 6787 return err 6788 } 6789 return nil 6790 // { 6791 // "description": "Permanently deletes a notification subscription.", 6792 // "httpMethod": "DELETE", 6793 // "id": "storage.notifications.delete", 6794 // "parameterOrder": [ 6795 // "bucket", 6796 // "notification" 6797 // ], 6798 // "parameters": { 6799 // "bucket": { 6800 // "description": "The parent bucket of the notification.", 6801 // "location": "path", 6802 // "required": true, 6803 // "type": "string" 6804 // }, 6805 // "notification": { 6806 // "description": "ID of the notification to delete.", 6807 // "location": "path", 6808 // "required": true, 6809 // "type": "string" 6810 // }, 6811 // "provisionalUserProject": { 6812 // "description": "The project to be billed for this request if the target bucket is requester-pays bucket.", 6813 // "location": "query", 6814 // "type": "string" 6815 // }, 6816 // "userProject": { 6817 // "description": "The project to be billed for this request. Required for Requester Pays buckets.", 6818 // "location": "query", 6819 // "type": "string" 6820 // } 6821 // }, 6822 // "path": "b/{bucket}/notificationConfigs/{notification}", 6823 // "scopes": [ 6824 // "https://www.googleapis.com/auth/cloud-platform", 6825 // "https://www.googleapis.com/auth/devstorage.full_control", 6826 // "https://www.googleapis.com/auth/devstorage.read_write" 6827 // ] 6828 // } 6829 6830} 6831 6832// method id "storage.notifications.get": 6833 6834type NotificationsGetCall struct { 6835 s *Service 6836 bucket string 6837 notification string 6838 urlParams_ gensupport.URLParams 6839 ifNoneMatch_ string 6840 ctx_ context.Context 6841 header_ http.Header 6842} 6843 6844// Get: View a notification configuration. 6845func (r *NotificationsService) Get(bucket string, notification string) *NotificationsGetCall { 6846 c := &NotificationsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 6847 c.bucket = bucket 6848 c.notification = notification 6849 return c 6850} 6851 6852// ProvisionalUserProject sets the optional parameter 6853// "provisionalUserProject": The project to be billed for this request 6854// if the target bucket is requester-pays bucket. 6855func (c *NotificationsGetCall) ProvisionalUserProject(provisionalUserProject string) *NotificationsGetCall { 6856 c.urlParams_.Set("provisionalUserProject", provisionalUserProject) 6857 return c 6858} 6859 6860// UserProject sets the optional parameter "userProject": The project to 6861// be billed for this request. Required for Requester Pays buckets. 6862func (c *NotificationsGetCall) UserProject(userProject string) *NotificationsGetCall { 6863 c.urlParams_.Set("userProject", userProject) 6864 return c 6865} 6866 6867// Fields allows partial responses to be retrieved. See 6868// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 6869// for more information. 6870func (c *NotificationsGetCall) Fields(s ...googleapi.Field) *NotificationsGetCall { 6871 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 6872 return c 6873} 6874 6875// IfNoneMatch sets the optional parameter which makes the operation 6876// fail if the object's ETag matches the given value. This is useful for 6877// getting updates only after the object has changed since the last 6878// request. Use googleapi.IsNotModified to check whether the response 6879// error from Do is the result of In-None-Match. 6880func (c *NotificationsGetCall) IfNoneMatch(entityTag string) *NotificationsGetCall { 6881 c.ifNoneMatch_ = entityTag 6882 return c 6883} 6884 6885// Context sets the context to be used in this call's Do method. Any 6886// pending HTTP request will be aborted if the provided context is 6887// canceled. 6888func (c *NotificationsGetCall) Context(ctx context.Context) *NotificationsGetCall { 6889 c.ctx_ = ctx 6890 return c 6891} 6892 6893// Header returns an http.Header that can be modified by the caller to 6894// add HTTP headers to the request. 6895func (c *NotificationsGetCall) Header() http.Header { 6896 if c.header_ == nil { 6897 c.header_ = make(http.Header) 6898 } 6899 return c.header_ 6900} 6901 6902func (c *NotificationsGetCall) doRequest(alt string) (*http.Response, error) { 6903 reqHeaders := make(http.Header) 6904 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") 6905 for k, v := range c.header_ { 6906 reqHeaders[k] = v 6907 } 6908 reqHeaders.Set("User-Agent", c.s.userAgent()) 6909 if c.ifNoneMatch_ != "" { 6910 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 6911 } 6912 var body io.Reader = nil 6913 c.urlParams_.Set("alt", alt) 6914 c.urlParams_.Set("prettyPrint", "false") 6915 urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/notificationConfigs/{notification}") 6916 urls += "?" + c.urlParams_.Encode() 6917 req, err := http.NewRequest("GET", urls, body) 6918 if err != nil { 6919 return nil, err 6920 } 6921 req.Header = reqHeaders 6922 googleapi.Expand(req.URL, map[string]string{ 6923 "bucket": c.bucket, 6924 "notification": c.notification, 6925 }) 6926 return gensupport.SendRequest(c.ctx_, c.s.client, req) 6927} 6928 6929// Do executes the "storage.notifications.get" call. 6930// Exactly one of *Notification or error will be non-nil. Any non-2xx 6931// status code is an error. Response headers are in either 6932// *Notification.ServerResponse.Header or (if a response was returned at 6933// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 6934// to check whether the returned error was because 6935// http.StatusNotModified was returned. 6936func (c *NotificationsGetCall) Do(opts ...googleapi.CallOption) (*Notification, error) { 6937 gensupport.SetOptions(c.urlParams_, opts...) 6938 res, err := c.doRequest("json") 6939 if res != nil && res.StatusCode == http.StatusNotModified { 6940 if res.Body != nil { 6941 res.Body.Close() 6942 } 6943 return nil, &googleapi.Error{ 6944 Code: res.StatusCode, 6945 Header: res.Header, 6946 } 6947 } 6948 if err != nil { 6949 return nil, err 6950 } 6951 defer googleapi.CloseBody(res) 6952 if err := googleapi.CheckResponse(res); err != nil { 6953 return nil, err 6954 } 6955 ret := &Notification{ 6956 ServerResponse: googleapi.ServerResponse{ 6957 Header: res.Header, 6958 HTTPStatusCode: res.StatusCode, 6959 }, 6960 } 6961 target := &ret 6962 if err := gensupport.DecodeResponse(target, res); err != nil { 6963 return nil, err 6964 } 6965 return ret, nil 6966 // { 6967 // "description": "View a notification configuration.", 6968 // "httpMethod": "GET", 6969 // "id": "storage.notifications.get", 6970 // "parameterOrder": [ 6971 // "bucket", 6972 // "notification" 6973 // ], 6974 // "parameters": { 6975 // "bucket": { 6976 // "description": "The parent bucket of the notification.", 6977 // "location": "path", 6978 // "required": true, 6979 // "type": "string" 6980 // }, 6981 // "notification": { 6982 // "description": "Notification ID", 6983 // "location": "path", 6984 // "required": true, 6985 // "type": "string" 6986 // }, 6987 // "provisionalUserProject": { 6988 // "description": "The project to be billed for this request if the target bucket is requester-pays bucket.", 6989 // "location": "query", 6990 // "type": "string" 6991 // }, 6992 // "userProject": { 6993 // "description": "The project to be billed for this request. Required for Requester Pays buckets.", 6994 // "location": "query", 6995 // "type": "string" 6996 // } 6997 // }, 6998 // "path": "b/{bucket}/notificationConfigs/{notification}", 6999 // "response": { 7000 // "$ref": "Notification" 7001 // }, 7002 // "scopes": [ 7003 // "https://www.googleapis.com/auth/cloud-platform", 7004 // "https://www.googleapis.com/auth/cloud-platform.read-only", 7005 // "https://www.googleapis.com/auth/devstorage.full_control", 7006 // "https://www.googleapis.com/auth/devstorage.read_only", 7007 // "https://www.googleapis.com/auth/devstorage.read_write" 7008 // ] 7009 // } 7010 7011} 7012 7013// method id "storage.notifications.insert": 7014 7015type NotificationsInsertCall struct { 7016 s *Service 7017 bucket string 7018 notification *Notification 7019 urlParams_ gensupport.URLParams 7020 ctx_ context.Context 7021 header_ http.Header 7022} 7023 7024// Insert: Creates a notification subscription for a given bucket. 7025func (r *NotificationsService) Insert(bucket string, notification *Notification) *NotificationsInsertCall { 7026 c := &NotificationsInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)} 7027 c.bucket = bucket 7028 c.notification = notification 7029 return c 7030} 7031 7032// ProvisionalUserProject sets the optional parameter 7033// "provisionalUserProject": The project to be billed for this request 7034// if the target bucket is requester-pays bucket. 7035func (c *NotificationsInsertCall) ProvisionalUserProject(provisionalUserProject string) *NotificationsInsertCall { 7036 c.urlParams_.Set("provisionalUserProject", provisionalUserProject) 7037 return c 7038} 7039 7040// UserProject sets the optional parameter "userProject": The project to 7041// be billed for this request. Required for Requester Pays buckets. 7042func (c *NotificationsInsertCall) UserProject(userProject string) *NotificationsInsertCall { 7043 c.urlParams_.Set("userProject", userProject) 7044 return c 7045} 7046 7047// Fields allows partial responses to be retrieved. See 7048// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 7049// for more information. 7050func (c *NotificationsInsertCall) Fields(s ...googleapi.Field) *NotificationsInsertCall { 7051 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 7052 return c 7053} 7054 7055// Context sets the context to be used in this call's Do method. Any 7056// pending HTTP request will be aborted if the provided context is 7057// canceled. 7058func (c *NotificationsInsertCall) Context(ctx context.Context) *NotificationsInsertCall { 7059 c.ctx_ = ctx 7060 return c 7061} 7062 7063// Header returns an http.Header that can be modified by the caller to 7064// add HTTP headers to the request. 7065func (c *NotificationsInsertCall) Header() http.Header { 7066 if c.header_ == nil { 7067 c.header_ = make(http.Header) 7068 } 7069 return c.header_ 7070} 7071 7072func (c *NotificationsInsertCall) doRequest(alt string) (*http.Response, error) { 7073 reqHeaders := make(http.Header) 7074 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") 7075 for k, v := range c.header_ { 7076 reqHeaders[k] = v 7077 } 7078 reqHeaders.Set("User-Agent", c.s.userAgent()) 7079 var body io.Reader = nil 7080 body, err := googleapi.WithoutDataWrapper.JSONReader(c.notification) 7081 if err != nil { 7082 return nil, err 7083 } 7084 reqHeaders.Set("Content-Type", "application/json") 7085 c.urlParams_.Set("alt", alt) 7086 c.urlParams_.Set("prettyPrint", "false") 7087 urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/notificationConfigs") 7088 urls += "?" + c.urlParams_.Encode() 7089 req, err := http.NewRequest("POST", urls, body) 7090 if err != nil { 7091 return nil, err 7092 } 7093 req.Header = reqHeaders 7094 googleapi.Expand(req.URL, map[string]string{ 7095 "bucket": c.bucket, 7096 }) 7097 return gensupport.SendRequest(c.ctx_, c.s.client, req) 7098} 7099 7100// Do executes the "storage.notifications.insert" call. 7101// Exactly one of *Notification or error will be non-nil. Any non-2xx 7102// status code is an error. Response headers are in either 7103// *Notification.ServerResponse.Header or (if a response was returned at 7104// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 7105// to check whether the returned error was because 7106// http.StatusNotModified was returned. 7107func (c *NotificationsInsertCall) Do(opts ...googleapi.CallOption) (*Notification, error) { 7108 gensupport.SetOptions(c.urlParams_, opts...) 7109 res, err := c.doRequest("json") 7110 if res != nil && res.StatusCode == http.StatusNotModified { 7111 if res.Body != nil { 7112 res.Body.Close() 7113 } 7114 return nil, &googleapi.Error{ 7115 Code: res.StatusCode, 7116 Header: res.Header, 7117 } 7118 } 7119 if err != nil { 7120 return nil, err 7121 } 7122 defer googleapi.CloseBody(res) 7123 if err := googleapi.CheckResponse(res); err != nil { 7124 return nil, err 7125 } 7126 ret := &Notification{ 7127 ServerResponse: googleapi.ServerResponse{ 7128 Header: res.Header, 7129 HTTPStatusCode: res.StatusCode, 7130 }, 7131 } 7132 target := &ret 7133 if err := gensupport.DecodeResponse(target, res); err != nil { 7134 return nil, err 7135 } 7136 return ret, nil 7137 // { 7138 // "description": "Creates a notification subscription for a given bucket.", 7139 // "httpMethod": "POST", 7140 // "id": "storage.notifications.insert", 7141 // "parameterOrder": [ 7142 // "bucket" 7143 // ], 7144 // "parameters": { 7145 // "bucket": { 7146 // "description": "The parent bucket of the notification.", 7147 // "location": "path", 7148 // "required": true, 7149 // "type": "string" 7150 // }, 7151 // "provisionalUserProject": { 7152 // "description": "The project to be billed for this request if the target bucket is requester-pays bucket.", 7153 // "location": "query", 7154 // "type": "string" 7155 // }, 7156 // "userProject": { 7157 // "description": "The project to be billed for this request. Required for Requester Pays buckets.", 7158 // "location": "query", 7159 // "type": "string" 7160 // } 7161 // }, 7162 // "path": "b/{bucket}/notificationConfigs", 7163 // "request": { 7164 // "$ref": "Notification" 7165 // }, 7166 // "response": { 7167 // "$ref": "Notification" 7168 // }, 7169 // "scopes": [ 7170 // "https://www.googleapis.com/auth/cloud-platform", 7171 // "https://www.googleapis.com/auth/devstorage.full_control", 7172 // "https://www.googleapis.com/auth/devstorage.read_write" 7173 // ] 7174 // } 7175 7176} 7177 7178// method id "storage.notifications.list": 7179 7180type NotificationsListCall struct { 7181 s *Service 7182 bucket string 7183 urlParams_ gensupport.URLParams 7184 ifNoneMatch_ string 7185 ctx_ context.Context 7186 header_ http.Header 7187} 7188 7189// List: Retrieves a list of notification subscriptions for a given 7190// bucket. 7191func (r *NotificationsService) List(bucket string) *NotificationsListCall { 7192 c := &NotificationsListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 7193 c.bucket = bucket 7194 return c 7195} 7196 7197// ProvisionalUserProject sets the optional parameter 7198// "provisionalUserProject": The project to be billed for this request 7199// if the target bucket is requester-pays bucket. 7200func (c *NotificationsListCall) ProvisionalUserProject(provisionalUserProject string) *NotificationsListCall { 7201 c.urlParams_.Set("provisionalUserProject", provisionalUserProject) 7202 return c 7203} 7204 7205// UserProject sets the optional parameter "userProject": The project to 7206// be billed for this request. Required for Requester Pays buckets. 7207func (c *NotificationsListCall) UserProject(userProject string) *NotificationsListCall { 7208 c.urlParams_.Set("userProject", userProject) 7209 return c 7210} 7211 7212// Fields allows partial responses to be retrieved. See 7213// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 7214// for more information. 7215func (c *NotificationsListCall) Fields(s ...googleapi.Field) *NotificationsListCall { 7216 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 7217 return c 7218} 7219 7220// IfNoneMatch sets the optional parameter which makes the operation 7221// fail if the object's ETag matches the given value. This is useful for 7222// getting updates only after the object has changed since the last 7223// request. Use googleapi.IsNotModified to check whether the response 7224// error from Do is the result of In-None-Match. 7225func (c *NotificationsListCall) IfNoneMatch(entityTag string) *NotificationsListCall { 7226 c.ifNoneMatch_ = entityTag 7227 return c 7228} 7229 7230// Context sets the context to be used in this call's Do method. Any 7231// pending HTTP request will be aborted if the provided context is 7232// canceled. 7233func (c *NotificationsListCall) Context(ctx context.Context) *NotificationsListCall { 7234 c.ctx_ = ctx 7235 return c 7236} 7237 7238// Header returns an http.Header that can be modified by the caller to 7239// add HTTP headers to the request. 7240func (c *NotificationsListCall) Header() http.Header { 7241 if c.header_ == nil { 7242 c.header_ = make(http.Header) 7243 } 7244 return c.header_ 7245} 7246 7247func (c *NotificationsListCall) doRequest(alt string) (*http.Response, error) { 7248 reqHeaders := make(http.Header) 7249 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") 7250 for k, v := range c.header_ { 7251 reqHeaders[k] = v 7252 } 7253 reqHeaders.Set("User-Agent", c.s.userAgent()) 7254 if c.ifNoneMatch_ != "" { 7255 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 7256 } 7257 var body io.Reader = nil 7258 c.urlParams_.Set("alt", alt) 7259 c.urlParams_.Set("prettyPrint", "false") 7260 urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/notificationConfigs") 7261 urls += "?" + c.urlParams_.Encode() 7262 req, err := http.NewRequest("GET", urls, body) 7263 if err != nil { 7264 return nil, err 7265 } 7266 req.Header = reqHeaders 7267 googleapi.Expand(req.URL, map[string]string{ 7268 "bucket": c.bucket, 7269 }) 7270 return gensupport.SendRequest(c.ctx_, c.s.client, req) 7271} 7272 7273// Do executes the "storage.notifications.list" call. 7274// Exactly one of *Notifications or error will be non-nil. Any non-2xx 7275// status code is an error. Response headers are in either 7276// *Notifications.ServerResponse.Header or (if a response was returned 7277// at all) in error.(*googleapi.Error).Header. Use 7278// googleapi.IsNotModified to check whether the returned error was 7279// because http.StatusNotModified was returned. 7280func (c *NotificationsListCall) Do(opts ...googleapi.CallOption) (*Notifications, error) { 7281 gensupport.SetOptions(c.urlParams_, opts...) 7282 res, err := c.doRequest("json") 7283 if res != nil && res.StatusCode == http.StatusNotModified { 7284 if res.Body != nil { 7285 res.Body.Close() 7286 } 7287 return nil, &googleapi.Error{ 7288 Code: res.StatusCode, 7289 Header: res.Header, 7290 } 7291 } 7292 if err != nil { 7293 return nil, err 7294 } 7295 defer googleapi.CloseBody(res) 7296 if err := googleapi.CheckResponse(res); err != nil { 7297 return nil, err 7298 } 7299 ret := &Notifications{ 7300 ServerResponse: googleapi.ServerResponse{ 7301 Header: res.Header, 7302 HTTPStatusCode: res.StatusCode, 7303 }, 7304 } 7305 target := &ret 7306 if err := gensupport.DecodeResponse(target, res); err != nil { 7307 return nil, err 7308 } 7309 return ret, nil 7310 // { 7311 // "description": "Retrieves a list of notification subscriptions for a given bucket.", 7312 // "httpMethod": "GET", 7313 // "id": "storage.notifications.list", 7314 // "parameterOrder": [ 7315 // "bucket" 7316 // ], 7317 // "parameters": { 7318 // "bucket": { 7319 // "description": "Name of a Google Cloud Storage bucket.", 7320 // "location": "path", 7321 // "required": true, 7322 // "type": "string" 7323 // }, 7324 // "provisionalUserProject": { 7325 // "description": "The project to be billed for this request if the target bucket is requester-pays bucket.", 7326 // "location": "query", 7327 // "type": "string" 7328 // }, 7329 // "userProject": { 7330 // "description": "The project to be billed for this request. Required for Requester Pays buckets.", 7331 // "location": "query", 7332 // "type": "string" 7333 // } 7334 // }, 7335 // "path": "b/{bucket}/notificationConfigs", 7336 // "response": { 7337 // "$ref": "Notifications" 7338 // }, 7339 // "scopes": [ 7340 // "https://www.googleapis.com/auth/cloud-platform", 7341 // "https://www.googleapis.com/auth/cloud-platform.read-only", 7342 // "https://www.googleapis.com/auth/devstorage.full_control", 7343 // "https://www.googleapis.com/auth/devstorage.read_only", 7344 // "https://www.googleapis.com/auth/devstorage.read_write" 7345 // ] 7346 // } 7347 7348} 7349 7350// method id "storage.objectAccessControls.delete": 7351 7352type ObjectAccessControlsDeleteCall struct { 7353 s *Service 7354 bucket string 7355 object string 7356 entity string 7357 urlParams_ gensupport.URLParams 7358 ctx_ context.Context 7359 header_ http.Header 7360} 7361 7362// Delete: Permanently deletes the ACL entry for the specified entity on 7363// the specified object. 7364func (r *ObjectAccessControlsService) Delete(bucket string, object string, entity string) *ObjectAccessControlsDeleteCall { 7365 c := &ObjectAccessControlsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 7366 c.bucket = bucket 7367 c.object = object 7368 c.entity = entity 7369 return c 7370} 7371 7372// Generation sets the optional parameter "generation": If present, 7373// selects a specific revision of this object (as opposed to the latest 7374// version, the default). 7375func (c *ObjectAccessControlsDeleteCall) Generation(generation int64) *ObjectAccessControlsDeleteCall { 7376 c.urlParams_.Set("generation", fmt.Sprint(generation)) 7377 return c 7378} 7379 7380// ProvisionalUserProject sets the optional parameter 7381// "provisionalUserProject": The project to be billed for this request 7382// if the target bucket is requester-pays bucket. 7383func (c *ObjectAccessControlsDeleteCall) ProvisionalUserProject(provisionalUserProject string) *ObjectAccessControlsDeleteCall { 7384 c.urlParams_.Set("provisionalUserProject", provisionalUserProject) 7385 return c 7386} 7387 7388// UserProject sets the optional parameter "userProject": The project to 7389// be billed for this request. Required for Requester Pays buckets. 7390func (c *ObjectAccessControlsDeleteCall) UserProject(userProject string) *ObjectAccessControlsDeleteCall { 7391 c.urlParams_.Set("userProject", userProject) 7392 return c 7393} 7394 7395// Fields allows partial responses to be retrieved. See 7396// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 7397// for more information. 7398func (c *ObjectAccessControlsDeleteCall) Fields(s ...googleapi.Field) *ObjectAccessControlsDeleteCall { 7399 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 7400 return c 7401} 7402 7403// Context sets the context to be used in this call's Do method. Any 7404// pending HTTP request will be aborted if the provided context is 7405// canceled. 7406func (c *ObjectAccessControlsDeleteCall) Context(ctx context.Context) *ObjectAccessControlsDeleteCall { 7407 c.ctx_ = ctx 7408 return c 7409} 7410 7411// Header returns an http.Header that can be modified by the caller to 7412// add HTTP headers to the request. 7413func (c *ObjectAccessControlsDeleteCall) Header() http.Header { 7414 if c.header_ == nil { 7415 c.header_ = make(http.Header) 7416 } 7417 return c.header_ 7418} 7419 7420func (c *ObjectAccessControlsDeleteCall) doRequest(alt string) (*http.Response, error) { 7421 reqHeaders := make(http.Header) 7422 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") 7423 for k, v := range c.header_ { 7424 reqHeaders[k] = v 7425 } 7426 reqHeaders.Set("User-Agent", c.s.userAgent()) 7427 var body io.Reader = nil 7428 c.urlParams_.Set("alt", alt) 7429 c.urlParams_.Set("prettyPrint", "false") 7430 urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o/{object}/acl/{entity}") 7431 urls += "?" + c.urlParams_.Encode() 7432 req, err := http.NewRequest("DELETE", urls, body) 7433 if err != nil { 7434 return nil, err 7435 } 7436 req.Header = reqHeaders 7437 googleapi.Expand(req.URL, map[string]string{ 7438 "bucket": c.bucket, 7439 "object": c.object, 7440 "entity": c.entity, 7441 }) 7442 return gensupport.SendRequest(c.ctx_, c.s.client, req) 7443} 7444 7445// Do executes the "storage.objectAccessControls.delete" call. 7446func (c *ObjectAccessControlsDeleteCall) Do(opts ...googleapi.CallOption) error { 7447 gensupport.SetOptions(c.urlParams_, opts...) 7448 res, err := c.doRequest("json") 7449 if err != nil { 7450 return err 7451 } 7452 defer googleapi.CloseBody(res) 7453 if err := googleapi.CheckResponse(res); err != nil { 7454 return err 7455 } 7456 return nil 7457 // { 7458 // "description": "Permanently deletes the ACL entry for the specified entity on the specified object.", 7459 // "httpMethod": "DELETE", 7460 // "id": "storage.objectAccessControls.delete", 7461 // "parameterOrder": [ 7462 // "bucket", 7463 // "object", 7464 // "entity" 7465 // ], 7466 // "parameters": { 7467 // "bucket": { 7468 // "description": "Name of a bucket.", 7469 // "location": "path", 7470 // "required": true, 7471 // "type": "string" 7472 // }, 7473 // "entity": { 7474 // "description": "The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.", 7475 // "location": "path", 7476 // "required": true, 7477 // "type": "string" 7478 // }, 7479 // "generation": { 7480 // "description": "If present, selects a specific revision of this object (as opposed to the latest version, the default).", 7481 // "format": "int64", 7482 // "location": "query", 7483 // "type": "string" 7484 // }, 7485 // "object": { 7486 // "description": "Name of the object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.", 7487 // "location": "path", 7488 // "required": true, 7489 // "type": "string" 7490 // }, 7491 // "provisionalUserProject": { 7492 // "description": "The project to be billed for this request if the target bucket is requester-pays bucket.", 7493 // "location": "query", 7494 // "type": "string" 7495 // }, 7496 // "userProject": { 7497 // "description": "The project to be billed for this request. Required for Requester Pays buckets.", 7498 // "location": "query", 7499 // "type": "string" 7500 // } 7501 // }, 7502 // "path": "b/{bucket}/o/{object}/acl/{entity}", 7503 // "scopes": [ 7504 // "https://www.googleapis.com/auth/cloud-platform", 7505 // "https://www.googleapis.com/auth/devstorage.full_control" 7506 // ] 7507 // } 7508 7509} 7510 7511// method id "storage.objectAccessControls.get": 7512 7513type ObjectAccessControlsGetCall struct { 7514 s *Service 7515 bucket string 7516 object string 7517 entity string 7518 urlParams_ gensupport.URLParams 7519 ifNoneMatch_ string 7520 ctx_ context.Context 7521 header_ http.Header 7522} 7523 7524// Get: Returns the ACL entry for the specified entity on the specified 7525// object. 7526func (r *ObjectAccessControlsService) Get(bucket string, object string, entity string) *ObjectAccessControlsGetCall { 7527 c := &ObjectAccessControlsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 7528 c.bucket = bucket 7529 c.object = object 7530 c.entity = entity 7531 return c 7532} 7533 7534// Generation sets the optional parameter "generation": If present, 7535// selects a specific revision of this object (as opposed to the latest 7536// version, the default). 7537func (c *ObjectAccessControlsGetCall) Generation(generation int64) *ObjectAccessControlsGetCall { 7538 c.urlParams_.Set("generation", fmt.Sprint(generation)) 7539 return c 7540} 7541 7542// ProvisionalUserProject sets the optional parameter 7543// "provisionalUserProject": The project to be billed for this request 7544// if the target bucket is requester-pays bucket. 7545func (c *ObjectAccessControlsGetCall) ProvisionalUserProject(provisionalUserProject string) *ObjectAccessControlsGetCall { 7546 c.urlParams_.Set("provisionalUserProject", provisionalUserProject) 7547 return c 7548} 7549 7550// UserProject sets the optional parameter "userProject": The project to 7551// be billed for this request. Required for Requester Pays buckets. 7552func (c *ObjectAccessControlsGetCall) UserProject(userProject string) *ObjectAccessControlsGetCall { 7553 c.urlParams_.Set("userProject", userProject) 7554 return c 7555} 7556 7557// Fields allows partial responses to be retrieved. See 7558// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 7559// for more information. 7560func (c *ObjectAccessControlsGetCall) Fields(s ...googleapi.Field) *ObjectAccessControlsGetCall { 7561 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 7562 return c 7563} 7564 7565// IfNoneMatch sets the optional parameter which makes the operation 7566// fail if the object's ETag matches the given value. This is useful for 7567// getting updates only after the object has changed since the last 7568// request. Use googleapi.IsNotModified to check whether the response 7569// error from Do is the result of In-None-Match. 7570func (c *ObjectAccessControlsGetCall) IfNoneMatch(entityTag string) *ObjectAccessControlsGetCall { 7571 c.ifNoneMatch_ = entityTag 7572 return c 7573} 7574 7575// Context sets the context to be used in this call's Do method. Any 7576// pending HTTP request will be aborted if the provided context is 7577// canceled. 7578func (c *ObjectAccessControlsGetCall) Context(ctx context.Context) *ObjectAccessControlsGetCall { 7579 c.ctx_ = ctx 7580 return c 7581} 7582 7583// Header returns an http.Header that can be modified by the caller to 7584// add HTTP headers to the request. 7585func (c *ObjectAccessControlsGetCall) Header() http.Header { 7586 if c.header_ == nil { 7587 c.header_ = make(http.Header) 7588 } 7589 return c.header_ 7590} 7591 7592func (c *ObjectAccessControlsGetCall) doRequest(alt string) (*http.Response, error) { 7593 reqHeaders := make(http.Header) 7594 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") 7595 for k, v := range c.header_ { 7596 reqHeaders[k] = v 7597 } 7598 reqHeaders.Set("User-Agent", c.s.userAgent()) 7599 if c.ifNoneMatch_ != "" { 7600 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 7601 } 7602 var body io.Reader = nil 7603 c.urlParams_.Set("alt", alt) 7604 c.urlParams_.Set("prettyPrint", "false") 7605 urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o/{object}/acl/{entity}") 7606 urls += "?" + c.urlParams_.Encode() 7607 req, err := http.NewRequest("GET", urls, body) 7608 if err != nil { 7609 return nil, err 7610 } 7611 req.Header = reqHeaders 7612 googleapi.Expand(req.URL, map[string]string{ 7613 "bucket": c.bucket, 7614 "object": c.object, 7615 "entity": c.entity, 7616 }) 7617 return gensupport.SendRequest(c.ctx_, c.s.client, req) 7618} 7619 7620// Do executes the "storage.objectAccessControls.get" call. 7621// Exactly one of *ObjectAccessControl or error will be non-nil. Any 7622// non-2xx status code is an error. Response headers are in either 7623// *ObjectAccessControl.ServerResponse.Header or (if a response was 7624// returned at all) in error.(*googleapi.Error).Header. Use 7625// googleapi.IsNotModified to check whether the returned error was 7626// because http.StatusNotModified was returned. 7627func (c *ObjectAccessControlsGetCall) Do(opts ...googleapi.CallOption) (*ObjectAccessControl, error) { 7628 gensupport.SetOptions(c.urlParams_, opts...) 7629 res, err := c.doRequest("json") 7630 if res != nil && res.StatusCode == http.StatusNotModified { 7631 if res.Body != nil { 7632 res.Body.Close() 7633 } 7634 return nil, &googleapi.Error{ 7635 Code: res.StatusCode, 7636 Header: res.Header, 7637 } 7638 } 7639 if err != nil { 7640 return nil, err 7641 } 7642 defer googleapi.CloseBody(res) 7643 if err := googleapi.CheckResponse(res); err != nil { 7644 return nil, err 7645 } 7646 ret := &ObjectAccessControl{ 7647 ServerResponse: googleapi.ServerResponse{ 7648 Header: res.Header, 7649 HTTPStatusCode: res.StatusCode, 7650 }, 7651 } 7652 target := &ret 7653 if err := gensupport.DecodeResponse(target, res); err != nil { 7654 return nil, err 7655 } 7656 return ret, nil 7657 // { 7658 // "description": "Returns the ACL entry for the specified entity on the specified object.", 7659 // "httpMethod": "GET", 7660 // "id": "storage.objectAccessControls.get", 7661 // "parameterOrder": [ 7662 // "bucket", 7663 // "object", 7664 // "entity" 7665 // ], 7666 // "parameters": { 7667 // "bucket": { 7668 // "description": "Name of a bucket.", 7669 // "location": "path", 7670 // "required": true, 7671 // "type": "string" 7672 // }, 7673 // "entity": { 7674 // "description": "The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.", 7675 // "location": "path", 7676 // "required": true, 7677 // "type": "string" 7678 // }, 7679 // "generation": { 7680 // "description": "If present, selects a specific revision of this object (as opposed to the latest version, the default).", 7681 // "format": "int64", 7682 // "location": "query", 7683 // "type": "string" 7684 // }, 7685 // "object": { 7686 // "description": "Name of the object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.", 7687 // "location": "path", 7688 // "required": true, 7689 // "type": "string" 7690 // }, 7691 // "provisionalUserProject": { 7692 // "description": "The project to be billed for this request if the target bucket is requester-pays bucket.", 7693 // "location": "query", 7694 // "type": "string" 7695 // }, 7696 // "userProject": { 7697 // "description": "The project to be billed for this request. Required for Requester Pays buckets.", 7698 // "location": "query", 7699 // "type": "string" 7700 // } 7701 // }, 7702 // "path": "b/{bucket}/o/{object}/acl/{entity}", 7703 // "response": { 7704 // "$ref": "ObjectAccessControl" 7705 // }, 7706 // "scopes": [ 7707 // "https://www.googleapis.com/auth/cloud-platform", 7708 // "https://www.googleapis.com/auth/devstorage.full_control" 7709 // ] 7710 // } 7711 7712} 7713 7714// method id "storage.objectAccessControls.insert": 7715 7716type ObjectAccessControlsInsertCall struct { 7717 s *Service 7718 bucket string 7719 object string 7720 objectaccesscontrol *ObjectAccessControl 7721 urlParams_ gensupport.URLParams 7722 ctx_ context.Context 7723 header_ http.Header 7724} 7725 7726// Insert: Creates a new ACL entry on the specified object. 7727func (r *ObjectAccessControlsService) Insert(bucket string, object string, objectaccesscontrol *ObjectAccessControl) *ObjectAccessControlsInsertCall { 7728 c := &ObjectAccessControlsInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)} 7729 c.bucket = bucket 7730 c.object = object 7731 c.objectaccesscontrol = objectaccesscontrol 7732 return c 7733} 7734 7735// Generation sets the optional parameter "generation": If present, 7736// selects a specific revision of this object (as opposed to the latest 7737// version, the default). 7738func (c *ObjectAccessControlsInsertCall) Generation(generation int64) *ObjectAccessControlsInsertCall { 7739 c.urlParams_.Set("generation", fmt.Sprint(generation)) 7740 return c 7741} 7742 7743// ProvisionalUserProject sets the optional parameter 7744// "provisionalUserProject": The project to be billed for this request 7745// if the target bucket is requester-pays bucket. 7746func (c *ObjectAccessControlsInsertCall) ProvisionalUserProject(provisionalUserProject string) *ObjectAccessControlsInsertCall { 7747 c.urlParams_.Set("provisionalUserProject", provisionalUserProject) 7748 return c 7749} 7750 7751// UserProject sets the optional parameter "userProject": The project to 7752// be billed for this request. Required for Requester Pays buckets. 7753func (c *ObjectAccessControlsInsertCall) UserProject(userProject string) *ObjectAccessControlsInsertCall { 7754 c.urlParams_.Set("userProject", userProject) 7755 return c 7756} 7757 7758// Fields allows partial responses to be retrieved. See 7759// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 7760// for more information. 7761func (c *ObjectAccessControlsInsertCall) Fields(s ...googleapi.Field) *ObjectAccessControlsInsertCall { 7762 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 7763 return c 7764} 7765 7766// Context sets the context to be used in this call's Do method. Any 7767// pending HTTP request will be aborted if the provided context is 7768// canceled. 7769func (c *ObjectAccessControlsInsertCall) Context(ctx context.Context) *ObjectAccessControlsInsertCall { 7770 c.ctx_ = ctx 7771 return c 7772} 7773 7774// Header returns an http.Header that can be modified by the caller to 7775// add HTTP headers to the request. 7776func (c *ObjectAccessControlsInsertCall) Header() http.Header { 7777 if c.header_ == nil { 7778 c.header_ = make(http.Header) 7779 } 7780 return c.header_ 7781} 7782 7783func (c *ObjectAccessControlsInsertCall) doRequest(alt string) (*http.Response, error) { 7784 reqHeaders := make(http.Header) 7785 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") 7786 for k, v := range c.header_ { 7787 reqHeaders[k] = v 7788 } 7789 reqHeaders.Set("User-Agent", c.s.userAgent()) 7790 var body io.Reader = nil 7791 body, err := googleapi.WithoutDataWrapper.JSONReader(c.objectaccesscontrol) 7792 if err != nil { 7793 return nil, err 7794 } 7795 reqHeaders.Set("Content-Type", "application/json") 7796 c.urlParams_.Set("alt", alt) 7797 c.urlParams_.Set("prettyPrint", "false") 7798 urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o/{object}/acl") 7799 urls += "?" + c.urlParams_.Encode() 7800 req, err := http.NewRequest("POST", urls, body) 7801 if err != nil { 7802 return nil, err 7803 } 7804 req.Header = reqHeaders 7805 googleapi.Expand(req.URL, map[string]string{ 7806 "bucket": c.bucket, 7807 "object": c.object, 7808 }) 7809 return gensupport.SendRequest(c.ctx_, c.s.client, req) 7810} 7811 7812// Do executes the "storage.objectAccessControls.insert" call. 7813// Exactly one of *ObjectAccessControl or error will be non-nil. Any 7814// non-2xx status code is an error. Response headers are in either 7815// *ObjectAccessControl.ServerResponse.Header or (if a response was 7816// returned at all) in error.(*googleapi.Error).Header. Use 7817// googleapi.IsNotModified to check whether the returned error was 7818// because http.StatusNotModified was returned. 7819func (c *ObjectAccessControlsInsertCall) Do(opts ...googleapi.CallOption) (*ObjectAccessControl, error) { 7820 gensupport.SetOptions(c.urlParams_, opts...) 7821 res, err := c.doRequest("json") 7822 if res != nil && res.StatusCode == http.StatusNotModified { 7823 if res.Body != nil { 7824 res.Body.Close() 7825 } 7826 return nil, &googleapi.Error{ 7827 Code: res.StatusCode, 7828 Header: res.Header, 7829 } 7830 } 7831 if err != nil { 7832 return nil, err 7833 } 7834 defer googleapi.CloseBody(res) 7835 if err := googleapi.CheckResponse(res); err != nil { 7836 return nil, err 7837 } 7838 ret := &ObjectAccessControl{ 7839 ServerResponse: googleapi.ServerResponse{ 7840 Header: res.Header, 7841 HTTPStatusCode: res.StatusCode, 7842 }, 7843 } 7844 target := &ret 7845 if err := gensupport.DecodeResponse(target, res); err != nil { 7846 return nil, err 7847 } 7848 return ret, nil 7849 // { 7850 // "description": "Creates a new ACL entry on the specified object.", 7851 // "httpMethod": "POST", 7852 // "id": "storage.objectAccessControls.insert", 7853 // "parameterOrder": [ 7854 // "bucket", 7855 // "object" 7856 // ], 7857 // "parameters": { 7858 // "bucket": { 7859 // "description": "Name of a bucket.", 7860 // "location": "path", 7861 // "required": true, 7862 // "type": "string" 7863 // }, 7864 // "generation": { 7865 // "description": "If present, selects a specific revision of this object (as opposed to the latest version, the default).", 7866 // "format": "int64", 7867 // "location": "query", 7868 // "type": "string" 7869 // }, 7870 // "object": { 7871 // "description": "Name of the object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.", 7872 // "location": "path", 7873 // "required": true, 7874 // "type": "string" 7875 // }, 7876 // "provisionalUserProject": { 7877 // "description": "The project to be billed for this request if the target bucket is requester-pays bucket.", 7878 // "location": "query", 7879 // "type": "string" 7880 // }, 7881 // "userProject": { 7882 // "description": "The project to be billed for this request. Required for Requester Pays buckets.", 7883 // "location": "query", 7884 // "type": "string" 7885 // } 7886 // }, 7887 // "path": "b/{bucket}/o/{object}/acl", 7888 // "request": { 7889 // "$ref": "ObjectAccessControl" 7890 // }, 7891 // "response": { 7892 // "$ref": "ObjectAccessControl" 7893 // }, 7894 // "scopes": [ 7895 // "https://www.googleapis.com/auth/cloud-platform", 7896 // "https://www.googleapis.com/auth/devstorage.full_control" 7897 // ] 7898 // } 7899 7900} 7901 7902// method id "storage.objectAccessControls.list": 7903 7904type ObjectAccessControlsListCall struct { 7905 s *Service 7906 bucket string 7907 object string 7908 urlParams_ gensupport.URLParams 7909 ifNoneMatch_ string 7910 ctx_ context.Context 7911 header_ http.Header 7912} 7913 7914// List: Retrieves ACL entries on the specified object. 7915func (r *ObjectAccessControlsService) List(bucket string, object string) *ObjectAccessControlsListCall { 7916 c := &ObjectAccessControlsListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 7917 c.bucket = bucket 7918 c.object = object 7919 return c 7920} 7921 7922// Generation sets the optional parameter "generation": If present, 7923// selects a specific revision of this object (as opposed to the latest 7924// version, the default). 7925func (c *ObjectAccessControlsListCall) Generation(generation int64) *ObjectAccessControlsListCall { 7926 c.urlParams_.Set("generation", fmt.Sprint(generation)) 7927 return c 7928} 7929 7930// ProvisionalUserProject sets the optional parameter 7931// "provisionalUserProject": The project to be billed for this request 7932// if the target bucket is requester-pays bucket. 7933func (c *ObjectAccessControlsListCall) ProvisionalUserProject(provisionalUserProject string) *ObjectAccessControlsListCall { 7934 c.urlParams_.Set("provisionalUserProject", provisionalUserProject) 7935 return c 7936} 7937 7938// UserProject sets the optional parameter "userProject": The project to 7939// be billed for this request. Required for Requester Pays buckets. 7940func (c *ObjectAccessControlsListCall) UserProject(userProject string) *ObjectAccessControlsListCall { 7941 c.urlParams_.Set("userProject", userProject) 7942 return c 7943} 7944 7945// Fields allows partial responses to be retrieved. See 7946// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 7947// for more information. 7948func (c *ObjectAccessControlsListCall) Fields(s ...googleapi.Field) *ObjectAccessControlsListCall { 7949 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 7950 return c 7951} 7952 7953// IfNoneMatch sets the optional parameter which makes the operation 7954// fail if the object's ETag matches the given value. This is useful for 7955// getting updates only after the object has changed since the last 7956// request. Use googleapi.IsNotModified to check whether the response 7957// error from Do is the result of In-None-Match. 7958func (c *ObjectAccessControlsListCall) IfNoneMatch(entityTag string) *ObjectAccessControlsListCall { 7959 c.ifNoneMatch_ = entityTag 7960 return c 7961} 7962 7963// Context sets the context to be used in this call's Do method. Any 7964// pending HTTP request will be aborted if the provided context is 7965// canceled. 7966func (c *ObjectAccessControlsListCall) Context(ctx context.Context) *ObjectAccessControlsListCall { 7967 c.ctx_ = ctx 7968 return c 7969} 7970 7971// Header returns an http.Header that can be modified by the caller to 7972// add HTTP headers to the request. 7973func (c *ObjectAccessControlsListCall) Header() http.Header { 7974 if c.header_ == nil { 7975 c.header_ = make(http.Header) 7976 } 7977 return c.header_ 7978} 7979 7980func (c *ObjectAccessControlsListCall) doRequest(alt string) (*http.Response, error) { 7981 reqHeaders := make(http.Header) 7982 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") 7983 for k, v := range c.header_ { 7984 reqHeaders[k] = v 7985 } 7986 reqHeaders.Set("User-Agent", c.s.userAgent()) 7987 if c.ifNoneMatch_ != "" { 7988 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 7989 } 7990 var body io.Reader = nil 7991 c.urlParams_.Set("alt", alt) 7992 c.urlParams_.Set("prettyPrint", "false") 7993 urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o/{object}/acl") 7994 urls += "?" + c.urlParams_.Encode() 7995 req, err := http.NewRequest("GET", urls, body) 7996 if err != nil { 7997 return nil, err 7998 } 7999 req.Header = reqHeaders 8000 googleapi.Expand(req.URL, map[string]string{ 8001 "bucket": c.bucket, 8002 "object": c.object, 8003 }) 8004 return gensupport.SendRequest(c.ctx_, c.s.client, req) 8005} 8006 8007// Do executes the "storage.objectAccessControls.list" call. 8008// Exactly one of *ObjectAccessControls or error will be non-nil. Any 8009// non-2xx status code is an error. Response headers are in either 8010// *ObjectAccessControls.ServerResponse.Header or (if a response was 8011// returned at all) in error.(*googleapi.Error).Header. Use 8012// googleapi.IsNotModified to check whether the returned error was 8013// because http.StatusNotModified was returned. 8014func (c *ObjectAccessControlsListCall) Do(opts ...googleapi.CallOption) (*ObjectAccessControls, error) { 8015 gensupport.SetOptions(c.urlParams_, opts...) 8016 res, err := c.doRequest("json") 8017 if res != nil && res.StatusCode == http.StatusNotModified { 8018 if res.Body != nil { 8019 res.Body.Close() 8020 } 8021 return nil, &googleapi.Error{ 8022 Code: res.StatusCode, 8023 Header: res.Header, 8024 } 8025 } 8026 if err != nil { 8027 return nil, err 8028 } 8029 defer googleapi.CloseBody(res) 8030 if err := googleapi.CheckResponse(res); err != nil { 8031 return nil, err 8032 } 8033 ret := &ObjectAccessControls{ 8034 ServerResponse: googleapi.ServerResponse{ 8035 Header: res.Header, 8036 HTTPStatusCode: res.StatusCode, 8037 }, 8038 } 8039 target := &ret 8040 if err := gensupport.DecodeResponse(target, res); err != nil { 8041 return nil, err 8042 } 8043 return ret, nil 8044 // { 8045 // "description": "Retrieves ACL entries on the specified object.", 8046 // "httpMethod": "GET", 8047 // "id": "storage.objectAccessControls.list", 8048 // "parameterOrder": [ 8049 // "bucket", 8050 // "object" 8051 // ], 8052 // "parameters": { 8053 // "bucket": { 8054 // "description": "Name of a bucket.", 8055 // "location": "path", 8056 // "required": true, 8057 // "type": "string" 8058 // }, 8059 // "generation": { 8060 // "description": "If present, selects a specific revision of this object (as opposed to the latest version, the default).", 8061 // "format": "int64", 8062 // "location": "query", 8063 // "type": "string" 8064 // }, 8065 // "object": { 8066 // "description": "Name of the object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.", 8067 // "location": "path", 8068 // "required": true, 8069 // "type": "string" 8070 // }, 8071 // "provisionalUserProject": { 8072 // "description": "The project to be billed for this request if the target bucket is requester-pays bucket.", 8073 // "location": "query", 8074 // "type": "string" 8075 // }, 8076 // "userProject": { 8077 // "description": "The project to be billed for this request. Required for Requester Pays buckets.", 8078 // "location": "query", 8079 // "type": "string" 8080 // } 8081 // }, 8082 // "path": "b/{bucket}/o/{object}/acl", 8083 // "response": { 8084 // "$ref": "ObjectAccessControls" 8085 // }, 8086 // "scopes": [ 8087 // "https://www.googleapis.com/auth/cloud-platform", 8088 // "https://www.googleapis.com/auth/devstorage.full_control" 8089 // ] 8090 // } 8091 8092} 8093 8094// method id "storage.objectAccessControls.patch": 8095 8096type ObjectAccessControlsPatchCall struct { 8097 s *Service 8098 bucket string 8099 object string 8100 entity string 8101 objectaccesscontrol *ObjectAccessControl 8102 urlParams_ gensupport.URLParams 8103 ctx_ context.Context 8104 header_ http.Header 8105} 8106 8107// Patch: Patches an ACL entry on the specified object. 8108func (r *ObjectAccessControlsService) Patch(bucket string, object string, entity string, objectaccesscontrol *ObjectAccessControl) *ObjectAccessControlsPatchCall { 8109 c := &ObjectAccessControlsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)} 8110 c.bucket = bucket 8111 c.object = object 8112 c.entity = entity 8113 c.objectaccesscontrol = objectaccesscontrol 8114 return c 8115} 8116 8117// Generation sets the optional parameter "generation": If present, 8118// selects a specific revision of this object (as opposed to the latest 8119// version, the default). 8120func (c *ObjectAccessControlsPatchCall) Generation(generation int64) *ObjectAccessControlsPatchCall { 8121 c.urlParams_.Set("generation", fmt.Sprint(generation)) 8122 return c 8123} 8124 8125// ProvisionalUserProject sets the optional parameter 8126// "provisionalUserProject": The project to be billed for this request 8127// if the target bucket is requester-pays bucket. 8128func (c *ObjectAccessControlsPatchCall) ProvisionalUserProject(provisionalUserProject string) *ObjectAccessControlsPatchCall { 8129 c.urlParams_.Set("provisionalUserProject", provisionalUserProject) 8130 return c 8131} 8132 8133// UserProject sets the optional parameter "userProject": The project to 8134// be billed for this request. Required for Requester Pays buckets. 8135func (c *ObjectAccessControlsPatchCall) UserProject(userProject string) *ObjectAccessControlsPatchCall { 8136 c.urlParams_.Set("userProject", userProject) 8137 return c 8138} 8139 8140// Fields allows partial responses to be retrieved. See 8141// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 8142// for more information. 8143func (c *ObjectAccessControlsPatchCall) Fields(s ...googleapi.Field) *ObjectAccessControlsPatchCall { 8144 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 8145 return c 8146} 8147 8148// Context sets the context to be used in this call's Do method. Any 8149// pending HTTP request will be aborted if the provided context is 8150// canceled. 8151func (c *ObjectAccessControlsPatchCall) Context(ctx context.Context) *ObjectAccessControlsPatchCall { 8152 c.ctx_ = ctx 8153 return c 8154} 8155 8156// Header returns an http.Header that can be modified by the caller to 8157// add HTTP headers to the request. 8158func (c *ObjectAccessControlsPatchCall) Header() http.Header { 8159 if c.header_ == nil { 8160 c.header_ = make(http.Header) 8161 } 8162 return c.header_ 8163} 8164 8165func (c *ObjectAccessControlsPatchCall) doRequest(alt string) (*http.Response, error) { 8166 reqHeaders := make(http.Header) 8167 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") 8168 for k, v := range c.header_ { 8169 reqHeaders[k] = v 8170 } 8171 reqHeaders.Set("User-Agent", c.s.userAgent()) 8172 var body io.Reader = nil 8173 body, err := googleapi.WithoutDataWrapper.JSONReader(c.objectaccesscontrol) 8174 if err != nil { 8175 return nil, err 8176 } 8177 reqHeaders.Set("Content-Type", "application/json") 8178 c.urlParams_.Set("alt", alt) 8179 c.urlParams_.Set("prettyPrint", "false") 8180 urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o/{object}/acl/{entity}") 8181 urls += "?" + c.urlParams_.Encode() 8182 req, err := http.NewRequest("PATCH", urls, body) 8183 if err != nil { 8184 return nil, err 8185 } 8186 req.Header = reqHeaders 8187 googleapi.Expand(req.URL, map[string]string{ 8188 "bucket": c.bucket, 8189 "object": c.object, 8190 "entity": c.entity, 8191 }) 8192 return gensupport.SendRequest(c.ctx_, c.s.client, req) 8193} 8194 8195// Do executes the "storage.objectAccessControls.patch" call. 8196// Exactly one of *ObjectAccessControl or error will be non-nil. Any 8197// non-2xx status code is an error. Response headers are in either 8198// *ObjectAccessControl.ServerResponse.Header or (if a response was 8199// returned at all) in error.(*googleapi.Error).Header. Use 8200// googleapi.IsNotModified to check whether the returned error was 8201// because http.StatusNotModified was returned. 8202func (c *ObjectAccessControlsPatchCall) Do(opts ...googleapi.CallOption) (*ObjectAccessControl, error) { 8203 gensupport.SetOptions(c.urlParams_, opts...) 8204 res, err := c.doRequest("json") 8205 if res != nil && res.StatusCode == http.StatusNotModified { 8206 if res.Body != nil { 8207 res.Body.Close() 8208 } 8209 return nil, &googleapi.Error{ 8210 Code: res.StatusCode, 8211 Header: res.Header, 8212 } 8213 } 8214 if err != nil { 8215 return nil, err 8216 } 8217 defer googleapi.CloseBody(res) 8218 if err := googleapi.CheckResponse(res); err != nil { 8219 return nil, err 8220 } 8221 ret := &ObjectAccessControl{ 8222 ServerResponse: googleapi.ServerResponse{ 8223 Header: res.Header, 8224 HTTPStatusCode: res.StatusCode, 8225 }, 8226 } 8227 target := &ret 8228 if err := gensupport.DecodeResponse(target, res); err != nil { 8229 return nil, err 8230 } 8231 return ret, nil 8232 // { 8233 // "description": "Patches an ACL entry on the specified object.", 8234 // "httpMethod": "PATCH", 8235 // "id": "storage.objectAccessControls.patch", 8236 // "parameterOrder": [ 8237 // "bucket", 8238 // "object", 8239 // "entity" 8240 // ], 8241 // "parameters": { 8242 // "bucket": { 8243 // "description": "Name of a bucket.", 8244 // "location": "path", 8245 // "required": true, 8246 // "type": "string" 8247 // }, 8248 // "entity": { 8249 // "description": "The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.", 8250 // "location": "path", 8251 // "required": true, 8252 // "type": "string" 8253 // }, 8254 // "generation": { 8255 // "description": "If present, selects a specific revision of this object (as opposed to the latest version, the default).", 8256 // "format": "int64", 8257 // "location": "query", 8258 // "type": "string" 8259 // }, 8260 // "object": { 8261 // "description": "Name of the object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.", 8262 // "location": "path", 8263 // "required": true, 8264 // "type": "string" 8265 // }, 8266 // "provisionalUserProject": { 8267 // "description": "The project to be billed for this request if the target bucket is requester-pays bucket.", 8268 // "location": "query", 8269 // "type": "string" 8270 // }, 8271 // "userProject": { 8272 // "description": "The project to be billed for this request. Required for Requester Pays buckets.", 8273 // "location": "query", 8274 // "type": "string" 8275 // } 8276 // }, 8277 // "path": "b/{bucket}/o/{object}/acl/{entity}", 8278 // "request": { 8279 // "$ref": "ObjectAccessControl" 8280 // }, 8281 // "response": { 8282 // "$ref": "ObjectAccessControl" 8283 // }, 8284 // "scopes": [ 8285 // "https://www.googleapis.com/auth/cloud-platform", 8286 // "https://www.googleapis.com/auth/devstorage.full_control" 8287 // ] 8288 // } 8289 8290} 8291 8292// method id "storage.objectAccessControls.update": 8293 8294type ObjectAccessControlsUpdateCall struct { 8295 s *Service 8296 bucket string 8297 object string 8298 entity string 8299 objectaccesscontrol *ObjectAccessControl 8300 urlParams_ gensupport.URLParams 8301 ctx_ context.Context 8302 header_ http.Header 8303} 8304 8305// Update: Updates an ACL entry on the specified object. 8306func (r *ObjectAccessControlsService) Update(bucket string, object string, entity string, objectaccesscontrol *ObjectAccessControl) *ObjectAccessControlsUpdateCall { 8307 c := &ObjectAccessControlsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 8308 c.bucket = bucket 8309 c.object = object 8310 c.entity = entity 8311 c.objectaccesscontrol = objectaccesscontrol 8312 return c 8313} 8314 8315// Generation sets the optional parameter "generation": If present, 8316// selects a specific revision of this object (as opposed to the latest 8317// version, the default). 8318func (c *ObjectAccessControlsUpdateCall) Generation(generation int64) *ObjectAccessControlsUpdateCall { 8319 c.urlParams_.Set("generation", fmt.Sprint(generation)) 8320 return c 8321} 8322 8323// ProvisionalUserProject sets the optional parameter 8324// "provisionalUserProject": The project to be billed for this request 8325// if the target bucket is requester-pays bucket. 8326func (c *ObjectAccessControlsUpdateCall) ProvisionalUserProject(provisionalUserProject string) *ObjectAccessControlsUpdateCall { 8327 c.urlParams_.Set("provisionalUserProject", provisionalUserProject) 8328 return c 8329} 8330 8331// UserProject sets the optional parameter "userProject": The project to 8332// be billed for this request. Required for Requester Pays buckets. 8333func (c *ObjectAccessControlsUpdateCall) UserProject(userProject string) *ObjectAccessControlsUpdateCall { 8334 c.urlParams_.Set("userProject", userProject) 8335 return c 8336} 8337 8338// Fields allows partial responses to be retrieved. See 8339// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 8340// for more information. 8341func (c *ObjectAccessControlsUpdateCall) Fields(s ...googleapi.Field) *ObjectAccessControlsUpdateCall { 8342 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 8343 return c 8344} 8345 8346// Context sets the context to be used in this call's Do method. Any 8347// pending HTTP request will be aborted if the provided context is 8348// canceled. 8349func (c *ObjectAccessControlsUpdateCall) Context(ctx context.Context) *ObjectAccessControlsUpdateCall { 8350 c.ctx_ = ctx 8351 return c 8352} 8353 8354// Header returns an http.Header that can be modified by the caller to 8355// add HTTP headers to the request. 8356func (c *ObjectAccessControlsUpdateCall) Header() http.Header { 8357 if c.header_ == nil { 8358 c.header_ = make(http.Header) 8359 } 8360 return c.header_ 8361} 8362 8363func (c *ObjectAccessControlsUpdateCall) doRequest(alt string) (*http.Response, error) { 8364 reqHeaders := make(http.Header) 8365 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") 8366 for k, v := range c.header_ { 8367 reqHeaders[k] = v 8368 } 8369 reqHeaders.Set("User-Agent", c.s.userAgent()) 8370 var body io.Reader = nil 8371 body, err := googleapi.WithoutDataWrapper.JSONReader(c.objectaccesscontrol) 8372 if err != nil { 8373 return nil, err 8374 } 8375 reqHeaders.Set("Content-Type", "application/json") 8376 c.urlParams_.Set("alt", alt) 8377 c.urlParams_.Set("prettyPrint", "false") 8378 urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o/{object}/acl/{entity}") 8379 urls += "?" + c.urlParams_.Encode() 8380 req, err := http.NewRequest("PUT", urls, body) 8381 if err != nil { 8382 return nil, err 8383 } 8384 req.Header = reqHeaders 8385 googleapi.Expand(req.URL, map[string]string{ 8386 "bucket": c.bucket, 8387 "object": c.object, 8388 "entity": c.entity, 8389 }) 8390 return gensupport.SendRequest(c.ctx_, c.s.client, req) 8391} 8392 8393// Do executes the "storage.objectAccessControls.update" call. 8394// Exactly one of *ObjectAccessControl or error will be non-nil. Any 8395// non-2xx status code is an error. Response headers are in either 8396// *ObjectAccessControl.ServerResponse.Header or (if a response was 8397// returned at all) in error.(*googleapi.Error).Header. Use 8398// googleapi.IsNotModified to check whether the returned error was 8399// because http.StatusNotModified was returned. 8400func (c *ObjectAccessControlsUpdateCall) Do(opts ...googleapi.CallOption) (*ObjectAccessControl, error) { 8401 gensupport.SetOptions(c.urlParams_, opts...) 8402 res, err := c.doRequest("json") 8403 if res != nil && res.StatusCode == http.StatusNotModified { 8404 if res.Body != nil { 8405 res.Body.Close() 8406 } 8407 return nil, &googleapi.Error{ 8408 Code: res.StatusCode, 8409 Header: res.Header, 8410 } 8411 } 8412 if err != nil { 8413 return nil, err 8414 } 8415 defer googleapi.CloseBody(res) 8416 if err := googleapi.CheckResponse(res); err != nil { 8417 return nil, err 8418 } 8419 ret := &ObjectAccessControl{ 8420 ServerResponse: googleapi.ServerResponse{ 8421 Header: res.Header, 8422 HTTPStatusCode: res.StatusCode, 8423 }, 8424 } 8425 target := &ret 8426 if err := gensupport.DecodeResponse(target, res); err != nil { 8427 return nil, err 8428 } 8429 return ret, nil 8430 // { 8431 // "description": "Updates an ACL entry on the specified object.", 8432 // "httpMethod": "PUT", 8433 // "id": "storage.objectAccessControls.update", 8434 // "parameterOrder": [ 8435 // "bucket", 8436 // "object", 8437 // "entity" 8438 // ], 8439 // "parameters": { 8440 // "bucket": { 8441 // "description": "Name of a bucket.", 8442 // "location": "path", 8443 // "required": true, 8444 // "type": "string" 8445 // }, 8446 // "entity": { 8447 // "description": "The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.", 8448 // "location": "path", 8449 // "required": true, 8450 // "type": "string" 8451 // }, 8452 // "generation": { 8453 // "description": "If present, selects a specific revision of this object (as opposed to the latest version, the default).", 8454 // "format": "int64", 8455 // "location": "query", 8456 // "type": "string" 8457 // }, 8458 // "object": { 8459 // "description": "Name of the object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.", 8460 // "location": "path", 8461 // "required": true, 8462 // "type": "string" 8463 // }, 8464 // "provisionalUserProject": { 8465 // "description": "The project to be billed for this request if the target bucket is requester-pays bucket.", 8466 // "location": "query", 8467 // "type": "string" 8468 // }, 8469 // "userProject": { 8470 // "description": "The project to be billed for this request. Required for Requester Pays buckets.", 8471 // "location": "query", 8472 // "type": "string" 8473 // } 8474 // }, 8475 // "path": "b/{bucket}/o/{object}/acl/{entity}", 8476 // "request": { 8477 // "$ref": "ObjectAccessControl" 8478 // }, 8479 // "response": { 8480 // "$ref": "ObjectAccessControl" 8481 // }, 8482 // "scopes": [ 8483 // "https://www.googleapis.com/auth/cloud-platform", 8484 // "https://www.googleapis.com/auth/devstorage.full_control" 8485 // ] 8486 // } 8487 8488} 8489 8490// method id "storage.objects.compose": 8491 8492type ObjectsComposeCall struct { 8493 s *Service 8494 destinationBucket string 8495 destinationObject string 8496 composerequest *ComposeRequest 8497 urlParams_ gensupport.URLParams 8498 ctx_ context.Context 8499 header_ http.Header 8500} 8501 8502// Compose: Concatenates a list of existing objects into a new object in 8503// the same bucket. 8504func (r *ObjectsService) Compose(destinationBucket string, destinationObject string, composerequest *ComposeRequest) *ObjectsComposeCall { 8505 c := &ObjectsComposeCall{s: r.s, urlParams_: make(gensupport.URLParams)} 8506 c.destinationBucket = destinationBucket 8507 c.destinationObject = destinationObject 8508 c.composerequest = composerequest 8509 return c 8510} 8511 8512// DestinationPredefinedAcl sets the optional parameter 8513// "destinationPredefinedAcl": Apply a predefined set of access controls 8514// to the destination object. 8515// 8516// Possible values: 8517// "authenticatedRead" - Object owner gets OWNER access, and 8518// allAuthenticatedUsers get READER access. 8519// "bucketOwnerFullControl" - Object owner gets OWNER access, and 8520// project team owners get OWNER access. 8521// "bucketOwnerRead" - Object owner gets OWNER access, and project 8522// team owners get READER access. 8523// "private" - Object owner gets OWNER access. 8524// "projectPrivate" - Object owner gets OWNER access, and project team 8525// members get access according to their roles. 8526// "publicRead" - Object owner gets OWNER access, and allUsers get 8527// READER access. 8528func (c *ObjectsComposeCall) DestinationPredefinedAcl(destinationPredefinedAcl string) *ObjectsComposeCall { 8529 c.urlParams_.Set("destinationPredefinedAcl", destinationPredefinedAcl) 8530 return c 8531} 8532 8533// IfGenerationMatch sets the optional parameter "ifGenerationMatch": 8534// Makes the operation conditional on whether the object's current 8535// generation matches the given value. Setting to 0 makes the operation 8536// succeed only if there are no live versions of the object. 8537func (c *ObjectsComposeCall) IfGenerationMatch(ifGenerationMatch int64) *ObjectsComposeCall { 8538 c.urlParams_.Set("ifGenerationMatch", fmt.Sprint(ifGenerationMatch)) 8539 return c 8540} 8541 8542// IfMetagenerationMatch sets the optional parameter 8543// "ifMetagenerationMatch": Makes the operation conditional on whether 8544// the object's current metageneration matches the given value. 8545func (c *ObjectsComposeCall) IfMetagenerationMatch(ifMetagenerationMatch int64) *ObjectsComposeCall { 8546 c.urlParams_.Set("ifMetagenerationMatch", fmt.Sprint(ifMetagenerationMatch)) 8547 return c 8548} 8549 8550// KmsKeyName sets the optional parameter "kmsKeyName": Not currently 8551// supported. Specifying the parameter causes the request to fail with 8552// status code 400 - Bad Request. 8553func (c *ObjectsComposeCall) KmsKeyName(kmsKeyName string) *ObjectsComposeCall { 8554 c.urlParams_.Set("kmsKeyName", kmsKeyName) 8555 return c 8556} 8557 8558// ProvisionalUserProject sets the optional parameter 8559// "provisionalUserProject": The project to be billed for this request 8560// if the target bucket is requester-pays bucket. 8561func (c *ObjectsComposeCall) ProvisionalUserProject(provisionalUserProject string) *ObjectsComposeCall { 8562 c.urlParams_.Set("provisionalUserProject", provisionalUserProject) 8563 return c 8564} 8565 8566// UserProject sets the optional parameter "userProject": The project to 8567// be billed for this request. Required for Requester Pays buckets. 8568func (c *ObjectsComposeCall) UserProject(userProject string) *ObjectsComposeCall { 8569 c.urlParams_.Set("userProject", userProject) 8570 return c 8571} 8572 8573// Fields allows partial responses to be retrieved. See 8574// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 8575// for more information. 8576func (c *ObjectsComposeCall) Fields(s ...googleapi.Field) *ObjectsComposeCall { 8577 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 8578 return c 8579} 8580 8581// Context sets the context to be used in this call's Do method. Any 8582// pending HTTP request will be aborted if the provided context is 8583// canceled. 8584func (c *ObjectsComposeCall) Context(ctx context.Context) *ObjectsComposeCall { 8585 c.ctx_ = ctx 8586 return c 8587} 8588 8589// Header returns an http.Header that can be modified by the caller to 8590// add HTTP headers to the request. 8591func (c *ObjectsComposeCall) Header() http.Header { 8592 if c.header_ == nil { 8593 c.header_ = make(http.Header) 8594 } 8595 return c.header_ 8596} 8597 8598func (c *ObjectsComposeCall) doRequest(alt string) (*http.Response, error) { 8599 reqHeaders := make(http.Header) 8600 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") 8601 for k, v := range c.header_ { 8602 reqHeaders[k] = v 8603 } 8604 reqHeaders.Set("User-Agent", c.s.userAgent()) 8605 var body io.Reader = nil 8606 body, err := googleapi.WithoutDataWrapper.JSONReader(c.composerequest) 8607 if err != nil { 8608 return nil, err 8609 } 8610 reqHeaders.Set("Content-Type", "application/json") 8611 c.urlParams_.Set("alt", alt) 8612 c.urlParams_.Set("prettyPrint", "false") 8613 urls := googleapi.ResolveRelative(c.s.BasePath, "b/{destinationBucket}/o/{destinationObject}/compose") 8614 urls += "?" + c.urlParams_.Encode() 8615 req, err := http.NewRequest("POST", urls, body) 8616 if err != nil { 8617 return nil, err 8618 } 8619 req.Header = reqHeaders 8620 googleapi.Expand(req.URL, map[string]string{ 8621 "destinationBucket": c.destinationBucket, 8622 "destinationObject": c.destinationObject, 8623 }) 8624 return gensupport.SendRequest(c.ctx_, c.s.client, req) 8625} 8626 8627// Do executes the "storage.objects.compose" call. 8628// Exactly one of *Object or error will be non-nil. Any non-2xx status 8629// code is an error. Response headers are in either 8630// *Object.ServerResponse.Header or (if a response was returned at all) 8631// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 8632// check whether the returned error was because http.StatusNotModified 8633// was returned. 8634func (c *ObjectsComposeCall) Do(opts ...googleapi.CallOption) (*Object, error) { 8635 gensupport.SetOptions(c.urlParams_, opts...) 8636 res, err := c.doRequest("json") 8637 if res != nil && res.StatusCode == http.StatusNotModified { 8638 if res.Body != nil { 8639 res.Body.Close() 8640 } 8641 return nil, &googleapi.Error{ 8642 Code: res.StatusCode, 8643 Header: res.Header, 8644 } 8645 } 8646 if err != nil { 8647 return nil, err 8648 } 8649 defer googleapi.CloseBody(res) 8650 if err := googleapi.CheckResponse(res); err != nil { 8651 return nil, err 8652 } 8653 ret := &Object{ 8654 ServerResponse: googleapi.ServerResponse{ 8655 Header: res.Header, 8656 HTTPStatusCode: res.StatusCode, 8657 }, 8658 } 8659 target := &ret 8660 if err := gensupport.DecodeResponse(target, res); err != nil { 8661 return nil, err 8662 } 8663 return ret, nil 8664 // { 8665 // "description": "Concatenates a list of existing objects into a new object in the same bucket.", 8666 // "httpMethod": "POST", 8667 // "id": "storage.objects.compose", 8668 // "parameterOrder": [ 8669 // "destinationBucket", 8670 // "destinationObject" 8671 // ], 8672 // "parameters": { 8673 // "destinationBucket": { 8674 // "description": "Name of the bucket containing the source objects. The destination object is stored in this bucket.", 8675 // "location": "path", 8676 // "required": true, 8677 // "type": "string" 8678 // }, 8679 // "destinationObject": { 8680 // "description": "Name of the new object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.", 8681 // "location": "path", 8682 // "required": true, 8683 // "type": "string" 8684 // }, 8685 // "destinationPredefinedAcl": { 8686 // "description": "Apply a predefined set of access controls to the destination object.", 8687 // "enum": [ 8688 // "authenticatedRead", 8689 // "bucketOwnerFullControl", 8690 // "bucketOwnerRead", 8691 // "private", 8692 // "projectPrivate", 8693 // "publicRead" 8694 // ], 8695 // "enumDescriptions": [ 8696 // "Object owner gets OWNER access, and allAuthenticatedUsers get READER access.", 8697 // "Object owner gets OWNER access, and project team owners get OWNER access.", 8698 // "Object owner gets OWNER access, and project team owners get READER access.", 8699 // "Object owner gets OWNER access.", 8700 // "Object owner gets OWNER access, and project team members get access according to their roles.", 8701 // "Object owner gets OWNER access, and allUsers get READER access." 8702 // ], 8703 // "location": "query", 8704 // "type": "string" 8705 // }, 8706 // "ifGenerationMatch": { 8707 // "description": "Makes the operation conditional on whether the object's current generation matches the given value. Setting to 0 makes the operation succeed only if there are no live versions of the object.", 8708 // "format": "int64", 8709 // "location": "query", 8710 // "type": "string" 8711 // }, 8712 // "ifMetagenerationMatch": { 8713 // "description": "Makes the operation conditional on whether the object's current metageneration matches the given value.", 8714 // "format": "int64", 8715 // "location": "query", 8716 // "type": "string" 8717 // }, 8718 // "kmsKeyName": { 8719 // "description": "Not currently supported. Specifying the parameter causes the request to fail with status code 400 - Bad Request.", 8720 // "location": "query", 8721 // "type": "string" 8722 // }, 8723 // "provisionalUserProject": { 8724 // "description": "The project to be billed for this request if the target bucket is requester-pays bucket.", 8725 // "location": "query", 8726 // "type": "string" 8727 // }, 8728 // "userProject": { 8729 // "description": "The project to be billed for this request. Required for Requester Pays buckets.", 8730 // "location": "query", 8731 // "type": "string" 8732 // } 8733 // }, 8734 // "path": "b/{destinationBucket}/o/{destinationObject}/compose", 8735 // "request": { 8736 // "$ref": "ComposeRequest" 8737 // }, 8738 // "response": { 8739 // "$ref": "Object" 8740 // }, 8741 // "scopes": [ 8742 // "https://www.googleapis.com/auth/cloud-platform", 8743 // "https://www.googleapis.com/auth/devstorage.full_control", 8744 // "https://www.googleapis.com/auth/devstorage.read_write" 8745 // ] 8746 // } 8747 8748} 8749 8750// method id "storage.objects.copy": 8751 8752type ObjectsCopyCall struct { 8753 s *Service 8754 sourceBucket string 8755 sourceObject string 8756 destinationBucket string 8757 destinationObject string 8758 object *Object 8759 urlParams_ gensupport.URLParams 8760 ctx_ context.Context 8761 header_ http.Header 8762} 8763 8764// Copy: Copies a source object to a destination object. Optionally 8765// overrides metadata. 8766func (r *ObjectsService) Copy(sourceBucket string, sourceObject string, destinationBucket string, destinationObject string, object *Object) *ObjectsCopyCall { 8767 c := &ObjectsCopyCall{s: r.s, urlParams_: make(gensupport.URLParams)} 8768 c.sourceBucket = sourceBucket 8769 c.sourceObject = sourceObject 8770 c.destinationBucket = destinationBucket 8771 c.destinationObject = destinationObject 8772 c.object = object 8773 return c 8774} 8775 8776// DestinationKmsKeyName sets the optional parameter 8777// "destinationKmsKeyName": Resource name of the Cloud KMS key, of the 8778// form 8779// projects/my-project/locations/global/keyRings/my-kr/cryptoKeys/my-key, 8780// that will be used to encrypt the object. Overrides the object 8781// metadata's kms_key_name value, if any. 8782func (c *ObjectsCopyCall) DestinationKmsKeyName(destinationKmsKeyName string) *ObjectsCopyCall { 8783 c.urlParams_.Set("destinationKmsKeyName", destinationKmsKeyName) 8784 return c 8785} 8786 8787// DestinationPredefinedAcl sets the optional parameter 8788// "destinationPredefinedAcl": Apply a predefined set of access controls 8789// to the destination object. 8790// 8791// Possible values: 8792// "authenticatedRead" - Object owner gets OWNER access, and 8793// allAuthenticatedUsers get READER access. 8794// "bucketOwnerFullControl" - Object owner gets OWNER access, and 8795// project team owners get OWNER access. 8796// "bucketOwnerRead" - Object owner gets OWNER access, and project 8797// team owners get READER access. 8798// "private" - Object owner gets OWNER access. 8799// "projectPrivate" - Object owner gets OWNER access, and project team 8800// members get access according to their roles. 8801// "publicRead" - Object owner gets OWNER access, and allUsers get 8802// READER access. 8803func (c *ObjectsCopyCall) DestinationPredefinedAcl(destinationPredefinedAcl string) *ObjectsCopyCall { 8804 c.urlParams_.Set("destinationPredefinedAcl", destinationPredefinedAcl) 8805 return c 8806} 8807 8808// IfGenerationMatch sets the optional parameter "ifGenerationMatch": 8809// Makes the operation conditional on whether the destination object's 8810// current generation matches the given value. Setting to 0 makes the 8811// operation succeed only if there are no live versions of the object. 8812func (c *ObjectsCopyCall) IfGenerationMatch(ifGenerationMatch int64) *ObjectsCopyCall { 8813 c.urlParams_.Set("ifGenerationMatch", fmt.Sprint(ifGenerationMatch)) 8814 return c 8815} 8816 8817// IfGenerationNotMatch sets the optional parameter 8818// "ifGenerationNotMatch": Makes the operation conditional on whether 8819// the destination object's current generation does not match the given 8820// value. If no live object exists, the precondition fails. Setting to 0 8821// makes the operation succeed only if there is a live version of the 8822// object. 8823func (c *ObjectsCopyCall) IfGenerationNotMatch(ifGenerationNotMatch int64) *ObjectsCopyCall { 8824 c.urlParams_.Set("ifGenerationNotMatch", fmt.Sprint(ifGenerationNotMatch)) 8825 return c 8826} 8827 8828// IfMetagenerationMatch sets the optional parameter 8829// "ifMetagenerationMatch": Makes the operation conditional on whether 8830// the destination object's current metageneration matches the given 8831// value. 8832func (c *ObjectsCopyCall) IfMetagenerationMatch(ifMetagenerationMatch int64) *ObjectsCopyCall { 8833 c.urlParams_.Set("ifMetagenerationMatch", fmt.Sprint(ifMetagenerationMatch)) 8834 return c 8835} 8836 8837// IfMetagenerationNotMatch sets the optional parameter 8838// "ifMetagenerationNotMatch": Makes the operation conditional on 8839// whether the destination object's current metageneration does not 8840// match the given value. 8841func (c *ObjectsCopyCall) IfMetagenerationNotMatch(ifMetagenerationNotMatch int64) *ObjectsCopyCall { 8842 c.urlParams_.Set("ifMetagenerationNotMatch", fmt.Sprint(ifMetagenerationNotMatch)) 8843 return c 8844} 8845 8846// IfSourceGenerationMatch sets the optional parameter 8847// "ifSourceGenerationMatch": Makes the operation conditional on whether 8848// the source object's current generation matches the given value. 8849func (c *ObjectsCopyCall) IfSourceGenerationMatch(ifSourceGenerationMatch int64) *ObjectsCopyCall { 8850 c.urlParams_.Set("ifSourceGenerationMatch", fmt.Sprint(ifSourceGenerationMatch)) 8851 return c 8852} 8853 8854// IfSourceGenerationNotMatch sets the optional parameter 8855// "ifSourceGenerationNotMatch": Makes the operation conditional on 8856// whether the source object's current generation does not match the 8857// given value. 8858func (c *ObjectsCopyCall) IfSourceGenerationNotMatch(ifSourceGenerationNotMatch int64) *ObjectsCopyCall { 8859 c.urlParams_.Set("ifSourceGenerationNotMatch", fmt.Sprint(ifSourceGenerationNotMatch)) 8860 return c 8861} 8862 8863// IfSourceMetagenerationMatch sets the optional parameter 8864// "ifSourceMetagenerationMatch": Makes the operation conditional on 8865// whether the source object's current metageneration matches the given 8866// value. 8867func (c *ObjectsCopyCall) IfSourceMetagenerationMatch(ifSourceMetagenerationMatch int64) *ObjectsCopyCall { 8868 c.urlParams_.Set("ifSourceMetagenerationMatch", fmt.Sprint(ifSourceMetagenerationMatch)) 8869 return c 8870} 8871 8872// IfSourceMetagenerationNotMatch sets the optional parameter 8873// "ifSourceMetagenerationNotMatch": Makes the operation conditional on 8874// whether the source object's current metageneration does not match the 8875// given value. 8876func (c *ObjectsCopyCall) IfSourceMetagenerationNotMatch(ifSourceMetagenerationNotMatch int64) *ObjectsCopyCall { 8877 c.urlParams_.Set("ifSourceMetagenerationNotMatch", fmt.Sprint(ifSourceMetagenerationNotMatch)) 8878 return c 8879} 8880 8881// Projection sets the optional parameter "projection": Set of 8882// properties to return. Defaults to noAcl, unless the object resource 8883// specifies the acl property, when it defaults to full. 8884// 8885// Possible values: 8886// "full" - Include all properties. 8887// "noAcl" - Omit the owner, acl property. 8888func (c *ObjectsCopyCall) Projection(projection string) *ObjectsCopyCall { 8889 c.urlParams_.Set("projection", projection) 8890 return c 8891} 8892 8893// ProvisionalUserProject sets the optional parameter 8894// "provisionalUserProject": The project to be billed for this request 8895// if the target bucket is requester-pays bucket. 8896func (c *ObjectsCopyCall) ProvisionalUserProject(provisionalUserProject string) *ObjectsCopyCall { 8897 c.urlParams_.Set("provisionalUserProject", provisionalUserProject) 8898 return c 8899} 8900 8901// SourceGeneration sets the optional parameter "sourceGeneration": If 8902// present, selects a specific revision of the source object (as opposed 8903// to the latest version, the default). 8904func (c *ObjectsCopyCall) SourceGeneration(sourceGeneration int64) *ObjectsCopyCall { 8905 c.urlParams_.Set("sourceGeneration", fmt.Sprint(sourceGeneration)) 8906 return c 8907} 8908 8909// UserProject sets the optional parameter "userProject": The project to 8910// be billed for this request. Required for Requester Pays buckets. 8911func (c *ObjectsCopyCall) UserProject(userProject string) *ObjectsCopyCall { 8912 c.urlParams_.Set("userProject", userProject) 8913 return c 8914} 8915 8916// Fields allows partial responses to be retrieved. See 8917// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 8918// for more information. 8919func (c *ObjectsCopyCall) Fields(s ...googleapi.Field) *ObjectsCopyCall { 8920 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 8921 return c 8922} 8923 8924// Context sets the context to be used in this call's Do method. Any 8925// pending HTTP request will be aborted if the provided context is 8926// canceled. 8927func (c *ObjectsCopyCall) Context(ctx context.Context) *ObjectsCopyCall { 8928 c.ctx_ = ctx 8929 return c 8930} 8931 8932// Header returns an http.Header that can be modified by the caller to 8933// add HTTP headers to the request. 8934func (c *ObjectsCopyCall) Header() http.Header { 8935 if c.header_ == nil { 8936 c.header_ = make(http.Header) 8937 } 8938 return c.header_ 8939} 8940 8941func (c *ObjectsCopyCall) doRequest(alt string) (*http.Response, error) { 8942 reqHeaders := make(http.Header) 8943 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") 8944 for k, v := range c.header_ { 8945 reqHeaders[k] = v 8946 } 8947 reqHeaders.Set("User-Agent", c.s.userAgent()) 8948 var body io.Reader = nil 8949 body, err := googleapi.WithoutDataWrapper.JSONReader(c.object) 8950 if err != nil { 8951 return nil, err 8952 } 8953 reqHeaders.Set("Content-Type", "application/json") 8954 c.urlParams_.Set("alt", alt) 8955 c.urlParams_.Set("prettyPrint", "false") 8956 urls := googleapi.ResolveRelative(c.s.BasePath, "b/{sourceBucket}/o/{sourceObject}/copyTo/b/{destinationBucket}/o/{destinationObject}") 8957 urls += "?" + c.urlParams_.Encode() 8958 req, err := http.NewRequest("POST", urls, body) 8959 if err != nil { 8960 return nil, err 8961 } 8962 req.Header = reqHeaders 8963 googleapi.Expand(req.URL, map[string]string{ 8964 "sourceBucket": c.sourceBucket, 8965 "sourceObject": c.sourceObject, 8966 "destinationBucket": c.destinationBucket, 8967 "destinationObject": c.destinationObject, 8968 }) 8969 return gensupport.SendRequest(c.ctx_, c.s.client, req) 8970} 8971 8972// Do executes the "storage.objects.copy" call. 8973// Exactly one of *Object or error will be non-nil. Any non-2xx status 8974// code is an error. Response headers are in either 8975// *Object.ServerResponse.Header or (if a response was returned at all) 8976// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 8977// check whether the returned error was because http.StatusNotModified 8978// was returned. 8979func (c *ObjectsCopyCall) Do(opts ...googleapi.CallOption) (*Object, error) { 8980 gensupport.SetOptions(c.urlParams_, opts...) 8981 res, err := c.doRequest("json") 8982 if res != nil && res.StatusCode == http.StatusNotModified { 8983 if res.Body != nil { 8984 res.Body.Close() 8985 } 8986 return nil, &googleapi.Error{ 8987 Code: res.StatusCode, 8988 Header: res.Header, 8989 } 8990 } 8991 if err != nil { 8992 return nil, err 8993 } 8994 defer googleapi.CloseBody(res) 8995 if err := googleapi.CheckResponse(res); err != nil { 8996 return nil, err 8997 } 8998 ret := &Object{ 8999 ServerResponse: googleapi.ServerResponse{ 9000 Header: res.Header, 9001 HTTPStatusCode: res.StatusCode, 9002 }, 9003 } 9004 target := &ret 9005 if err := gensupport.DecodeResponse(target, res); err != nil { 9006 return nil, err 9007 } 9008 return ret, nil 9009 // { 9010 // "description": "Copies a source object to a destination object. Optionally overrides metadata.", 9011 // "httpMethod": "POST", 9012 // "id": "storage.objects.copy", 9013 // "parameterOrder": [ 9014 // "sourceBucket", 9015 // "sourceObject", 9016 // "destinationBucket", 9017 // "destinationObject" 9018 // ], 9019 // "parameters": { 9020 // "destinationBucket": { 9021 // "description": "Name of the bucket in which to store the new object. Overrides the provided object metadata's bucket value, if any.For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.", 9022 // "location": "path", 9023 // "required": true, 9024 // "type": "string" 9025 // }, 9026 // "destinationKmsKeyName": { 9027 // "description": "Resource name of the Cloud KMS key, of the form projects/my-project/locations/global/keyRings/my-kr/cryptoKeys/my-key, that will be used to encrypt the object. Overrides the object metadata's kms_key_name value, if any.", 9028 // "location": "query", 9029 // "type": "string" 9030 // }, 9031 // "destinationObject": { 9032 // "description": "Name of the new object. Required when the object metadata is not otherwise provided. Overrides the object metadata's name value, if any.", 9033 // "location": "path", 9034 // "required": true, 9035 // "type": "string" 9036 // }, 9037 // "destinationPredefinedAcl": { 9038 // "description": "Apply a predefined set of access controls to the destination object.", 9039 // "enum": [ 9040 // "authenticatedRead", 9041 // "bucketOwnerFullControl", 9042 // "bucketOwnerRead", 9043 // "private", 9044 // "projectPrivate", 9045 // "publicRead" 9046 // ], 9047 // "enumDescriptions": [ 9048 // "Object owner gets OWNER access, and allAuthenticatedUsers get READER access.", 9049 // "Object owner gets OWNER access, and project team owners get OWNER access.", 9050 // "Object owner gets OWNER access, and project team owners get READER access.", 9051 // "Object owner gets OWNER access.", 9052 // "Object owner gets OWNER access, and project team members get access according to their roles.", 9053 // "Object owner gets OWNER access, and allUsers get READER access." 9054 // ], 9055 // "location": "query", 9056 // "type": "string" 9057 // }, 9058 // "ifGenerationMatch": { 9059 // "description": "Makes the operation conditional on whether the destination object's current generation matches the given value. Setting to 0 makes the operation succeed only if there are no live versions of the object.", 9060 // "format": "int64", 9061 // "location": "query", 9062 // "type": "string" 9063 // }, 9064 // "ifGenerationNotMatch": { 9065 // "description": "Makes the operation conditional on whether the destination object's current generation does not match the given value. If no live object exists, the precondition fails. Setting to 0 makes the operation succeed only if there is a live version of the object.", 9066 // "format": "int64", 9067 // "location": "query", 9068 // "type": "string" 9069 // }, 9070 // "ifMetagenerationMatch": { 9071 // "description": "Makes the operation conditional on whether the destination object's current metageneration matches the given value.", 9072 // "format": "int64", 9073 // "location": "query", 9074 // "type": "string" 9075 // }, 9076 // "ifMetagenerationNotMatch": { 9077 // "description": "Makes the operation conditional on whether the destination object's current metageneration does not match the given value.", 9078 // "format": "int64", 9079 // "location": "query", 9080 // "type": "string" 9081 // }, 9082 // "ifSourceGenerationMatch": { 9083 // "description": "Makes the operation conditional on whether the source object's current generation matches the given value.", 9084 // "format": "int64", 9085 // "location": "query", 9086 // "type": "string" 9087 // }, 9088 // "ifSourceGenerationNotMatch": { 9089 // "description": "Makes the operation conditional on whether the source object's current generation does not match the given value.", 9090 // "format": "int64", 9091 // "location": "query", 9092 // "type": "string" 9093 // }, 9094 // "ifSourceMetagenerationMatch": { 9095 // "description": "Makes the operation conditional on whether the source object's current metageneration matches the given value.", 9096 // "format": "int64", 9097 // "location": "query", 9098 // "type": "string" 9099 // }, 9100 // "ifSourceMetagenerationNotMatch": { 9101 // "description": "Makes the operation conditional on whether the source object's current metageneration does not match the given value.", 9102 // "format": "int64", 9103 // "location": "query", 9104 // "type": "string" 9105 // }, 9106 // "projection": { 9107 // "description": "Set of properties to return. Defaults to noAcl, unless the object resource specifies the acl property, when it defaults to full.", 9108 // "enum": [ 9109 // "full", 9110 // "noAcl" 9111 // ], 9112 // "enumDescriptions": [ 9113 // "Include all properties.", 9114 // "Omit the owner, acl property." 9115 // ], 9116 // "location": "query", 9117 // "type": "string" 9118 // }, 9119 // "provisionalUserProject": { 9120 // "description": "The project to be billed for this request if the target bucket is requester-pays bucket.", 9121 // "location": "query", 9122 // "type": "string" 9123 // }, 9124 // "sourceBucket": { 9125 // "description": "Name of the bucket in which to find the source object.", 9126 // "location": "path", 9127 // "required": true, 9128 // "type": "string" 9129 // }, 9130 // "sourceGeneration": { 9131 // "description": "If present, selects a specific revision of the source object (as opposed to the latest version, the default).", 9132 // "format": "int64", 9133 // "location": "query", 9134 // "type": "string" 9135 // }, 9136 // "sourceObject": { 9137 // "description": "Name of the source object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.", 9138 // "location": "path", 9139 // "required": true, 9140 // "type": "string" 9141 // }, 9142 // "userProject": { 9143 // "description": "The project to be billed for this request. Required for Requester Pays buckets.", 9144 // "location": "query", 9145 // "type": "string" 9146 // } 9147 // }, 9148 // "path": "b/{sourceBucket}/o/{sourceObject}/copyTo/b/{destinationBucket}/o/{destinationObject}", 9149 // "request": { 9150 // "$ref": "Object" 9151 // }, 9152 // "response": { 9153 // "$ref": "Object" 9154 // }, 9155 // "scopes": [ 9156 // "https://www.googleapis.com/auth/cloud-platform", 9157 // "https://www.googleapis.com/auth/devstorage.full_control", 9158 // "https://www.googleapis.com/auth/devstorage.read_write" 9159 // ] 9160 // } 9161 9162} 9163 9164// method id "storage.objects.delete": 9165 9166type ObjectsDeleteCall struct { 9167 s *Service 9168 bucket string 9169 object string 9170 urlParams_ gensupport.URLParams 9171 ctx_ context.Context 9172 header_ http.Header 9173} 9174 9175// Delete: Deletes an object and its metadata. Deletions are permanent 9176// if versioning is not enabled for the bucket, or if the generation 9177// parameter is used. 9178func (r *ObjectsService) Delete(bucket string, object string) *ObjectsDeleteCall { 9179 c := &ObjectsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 9180 c.bucket = bucket 9181 c.object = object 9182 return c 9183} 9184 9185// Generation sets the optional parameter "generation": If present, 9186// permanently deletes a specific revision of this object (as opposed to 9187// the latest version, the default). 9188func (c *ObjectsDeleteCall) Generation(generation int64) *ObjectsDeleteCall { 9189 c.urlParams_.Set("generation", fmt.Sprint(generation)) 9190 return c 9191} 9192 9193// IfGenerationMatch sets the optional parameter "ifGenerationMatch": 9194// Makes the operation conditional on whether the object's current 9195// generation matches the given value. Setting to 0 makes the operation 9196// succeed only if there are no live versions of the object. 9197func (c *ObjectsDeleteCall) IfGenerationMatch(ifGenerationMatch int64) *ObjectsDeleteCall { 9198 c.urlParams_.Set("ifGenerationMatch", fmt.Sprint(ifGenerationMatch)) 9199 return c 9200} 9201 9202// IfGenerationNotMatch sets the optional parameter 9203// "ifGenerationNotMatch": Makes the operation conditional on whether 9204// the object's current generation does not match the given value. If no 9205// live object exists, the precondition fails. Setting to 0 makes the 9206// operation succeed only if there is a live version of the object. 9207func (c *ObjectsDeleteCall) IfGenerationNotMatch(ifGenerationNotMatch int64) *ObjectsDeleteCall { 9208 c.urlParams_.Set("ifGenerationNotMatch", fmt.Sprint(ifGenerationNotMatch)) 9209 return c 9210} 9211 9212// IfMetagenerationMatch sets the optional parameter 9213// "ifMetagenerationMatch": Makes the operation conditional on whether 9214// the object's current metageneration matches the given value. 9215func (c *ObjectsDeleteCall) IfMetagenerationMatch(ifMetagenerationMatch int64) *ObjectsDeleteCall { 9216 c.urlParams_.Set("ifMetagenerationMatch", fmt.Sprint(ifMetagenerationMatch)) 9217 return c 9218} 9219 9220// IfMetagenerationNotMatch sets the optional parameter 9221// "ifMetagenerationNotMatch": Makes the operation conditional on 9222// whether the object's current metageneration does not match the given 9223// value. 9224func (c *ObjectsDeleteCall) IfMetagenerationNotMatch(ifMetagenerationNotMatch int64) *ObjectsDeleteCall { 9225 c.urlParams_.Set("ifMetagenerationNotMatch", fmt.Sprint(ifMetagenerationNotMatch)) 9226 return c 9227} 9228 9229// ProvisionalUserProject sets the optional parameter 9230// "provisionalUserProject": The project to be billed for this request 9231// if the target bucket is requester-pays bucket. 9232func (c *ObjectsDeleteCall) ProvisionalUserProject(provisionalUserProject string) *ObjectsDeleteCall { 9233 c.urlParams_.Set("provisionalUserProject", provisionalUserProject) 9234 return c 9235} 9236 9237// UserProject sets the optional parameter "userProject": The project to 9238// be billed for this request. Required for Requester Pays buckets. 9239func (c *ObjectsDeleteCall) UserProject(userProject string) *ObjectsDeleteCall { 9240 c.urlParams_.Set("userProject", userProject) 9241 return c 9242} 9243 9244// Fields allows partial responses to be retrieved. See 9245// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 9246// for more information. 9247func (c *ObjectsDeleteCall) Fields(s ...googleapi.Field) *ObjectsDeleteCall { 9248 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 9249 return c 9250} 9251 9252// Context sets the context to be used in this call's Do method. Any 9253// pending HTTP request will be aborted if the provided context is 9254// canceled. 9255func (c *ObjectsDeleteCall) Context(ctx context.Context) *ObjectsDeleteCall { 9256 c.ctx_ = ctx 9257 return c 9258} 9259 9260// Header returns an http.Header that can be modified by the caller to 9261// add HTTP headers to the request. 9262func (c *ObjectsDeleteCall) Header() http.Header { 9263 if c.header_ == nil { 9264 c.header_ = make(http.Header) 9265 } 9266 return c.header_ 9267} 9268 9269func (c *ObjectsDeleteCall) doRequest(alt string) (*http.Response, error) { 9270 reqHeaders := make(http.Header) 9271 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") 9272 for k, v := range c.header_ { 9273 reqHeaders[k] = v 9274 } 9275 reqHeaders.Set("User-Agent", c.s.userAgent()) 9276 var body io.Reader = nil 9277 c.urlParams_.Set("alt", alt) 9278 c.urlParams_.Set("prettyPrint", "false") 9279 urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o/{object}") 9280 urls += "?" + c.urlParams_.Encode() 9281 req, err := http.NewRequest("DELETE", urls, body) 9282 if err != nil { 9283 return nil, err 9284 } 9285 req.Header = reqHeaders 9286 googleapi.Expand(req.URL, map[string]string{ 9287 "bucket": c.bucket, 9288 "object": c.object, 9289 }) 9290 return gensupport.SendRequest(c.ctx_, c.s.client, req) 9291} 9292 9293// Do executes the "storage.objects.delete" call. 9294func (c *ObjectsDeleteCall) Do(opts ...googleapi.CallOption) error { 9295 gensupport.SetOptions(c.urlParams_, opts...) 9296 res, err := c.doRequest("json") 9297 if err != nil { 9298 return err 9299 } 9300 defer googleapi.CloseBody(res) 9301 if err := googleapi.CheckResponse(res); err != nil { 9302 return err 9303 } 9304 return nil 9305 // { 9306 // "description": "Deletes an object and its metadata. Deletions are permanent if versioning is not enabled for the bucket, or if the generation parameter is used.", 9307 // "httpMethod": "DELETE", 9308 // "id": "storage.objects.delete", 9309 // "parameterOrder": [ 9310 // "bucket", 9311 // "object" 9312 // ], 9313 // "parameters": { 9314 // "bucket": { 9315 // "description": "Name of the bucket in which the object resides.", 9316 // "location": "path", 9317 // "required": true, 9318 // "type": "string" 9319 // }, 9320 // "generation": { 9321 // "description": "If present, permanently deletes a specific revision of this object (as opposed to the latest version, the default).", 9322 // "format": "int64", 9323 // "location": "query", 9324 // "type": "string" 9325 // }, 9326 // "ifGenerationMatch": { 9327 // "description": "Makes the operation conditional on whether the object's current generation matches the given value. Setting to 0 makes the operation succeed only if there are no live versions of the object.", 9328 // "format": "int64", 9329 // "location": "query", 9330 // "type": "string" 9331 // }, 9332 // "ifGenerationNotMatch": { 9333 // "description": "Makes the operation conditional on whether the object's current generation does not match the given value. If no live object exists, the precondition fails. Setting to 0 makes the operation succeed only if there is a live version of the object.", 9334 // "format": "int64", 9335 // "location": "query", 9336 // "type": "string" 9337 // }, 9338 // "ifMetagenerationMatch": { 9339 // "description": "Makes the operation conditional on whether the object's current metageneration matches the given value.", 9340 // "format": "int64", 9341 // "location": "query", 9342 // "type": "string" 9343 // }, 9344 // "ifMetagenerationNotMatch": { 9345 // "description": "Makes the operation conditional on whether the object's current metageneration does not match the given value.", 9346 // "format": "int64", 9347 // "location": "query", 9348 // "type": "string" 9349 // }, 9350 // "object": { 9351 // "description": "Name of the object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.", 9352 // "location": "path", 9353 // "required": true, 9354 // "type": "string" 9355 // }, 9356 // "provisionalUserProject": { 9357 // "description": "The project to be billed for this request if the target bucket is requester-pays bucket.", 9358 // "location": "query", 9359 // "type": "string" 9360 // }, 9361 // "userProject": { 9362 // "description": "The project to be billed for this request. Required for Requester Pays buckets.", 9363 // "location": "query", 9364 // "type": "string" 9365 // } 9366 // }, 9367 // "path": "b/{bucket}/o/{object}", 9368 // "scopes": [ 9369 // "https://www.googleapis.com/auth/cloud-platform", 9370 // "https://www.googleapis.com/auth/devstorage.full_control", 9371 // "https://www.googleapis.com/auth/devstorage.read_write" 9372 // ] 9373 // } 9374 9375} 9376 9377// method id "storage.objects.get": 9378 9379type ObjectsGetCall struct { 9380 s *Service 9381 bucket string 9382 object string 9383 urlParams_ gensupport.URLParams 9384 ifNoneMatch_ string 9385 ctx_ context.Context 9386 header_ http.Header 9387} 9388 9389// Get: Retrieves an object or its metadata. 9390func (r *ObjectsService) Get(bucket string, object string) *ObjectsGetCall { 9391 c := &ObjectsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 9392 c.bucket = bucket 9393 c.object = object 9394 return c 9395} 9396 9397// Generation sets the optional parameter "generation": If present, 9398// selects a specific revision of this object (as opposed to the latest 9399// version, the default). 9400func (c *ObjectsGetCall) Generation(generation int64) *ObjectsGetCall { 9401 c.urlParams_.Set("generation", fmt.Sprint(generation)) 9402 return c 9403} 9404 9405// IfGenerationMatch sets the optional parameter "ifGenerationMatch": 9406// Makes the operation conditional on whether the object's current 9407// generation matches the given value. Setting to 0 makes the operation 9408// succeed only if there are no live versions of the object. 9409func (c *ObjectsGetCall) IfGenerationMatch(ifGenerationMatch int64) *ObjectsGetCall { 9410 c.urlParams_.Set("ifGenerationMatch", fmt.Sprint(ifGenerationMatch)) 9411 return c 9412} 9413 9414// IfGenerationNotMatch sets the optional parameter 9415// "ifGenerationNotMatch": Makes the operation conditional on whether 9416// the object's current generation does not match the given value. If no 9417// live object exists, the precondition fails. Setting to 0 makes the 9418// operation succeed only if there is a live version of the object. 9419func (c *ObjectsGetCall) IfGenerationNotMatch(ifGenerationNotMatch int64) *ObjectsGetCall { 9420 c.urlParams_.Set("ifGenerationNotMatch", fmt.Sprint(ifGenerationNotMatch)) 9421 return c 9422} 9423 9424// IfMetagenerationMatch sets the optional parameter 9425// "ifMetagenerationMatch": Makes the operation conditional on whether 9426// the object's current metageneration matches the given value. 9427func (c *ObjectsGetCall) IfMetagenerationMatch(ifMetagenerationMatch int64) *ObjectsGetCall { 9428 c.urlParams_.Set("ifMetagenerationMatch", fmt.Sprint(ifMetagenerationMatch)) 9429 return c 9430} 9431 9432// IfMetagenerationNotMatch sets the optional parameter 9433// "ifMetagenerationNotMatch": Makes the operation conditional on 9434// whether the object's current metageneration does not match the given 9435// value. 9436func (c *ObjectsGetCall) IfMetagenerationNotMatch(ifMetagenerationNotMatch int64) *ObjectsGetCall { 9437 c.urlParams_.Set("ifMetagenerationNotMatch", fmt.Sprint(ifMetagenerationNotMatch)) 9438 return c 9439} 9440 9441// Projection sets the optional parameter "projection": Set of 9442// properties to return. Defaults to noAcl. 9443// 9444// Possible values: 9445// "full" - Include all properties. 9446// "noAcl" - Omit the owner, acl property. 9447func (c *ObjectsGetCall) Projection(projection string) *ObjectsGetCall { 9448 c.urlParams_.Set("projection", projection) 9449 return c 9450} 9451 9452// ProvisionalUserProject sets the optional parameter 9453// "provisionalUserProject": The project to be billed for this request 9454// if the target bucket is requester-pays bucket. 9455func (c *ObjectsGetCall) ProvisionalUserProject(provisionalUserProject string) *ObjectsGetCall { 9456 c.urlParams_.Set("provisionalUserProject", provisionalUserProject) 9457 return c 9458} 9459 9460// UserProject sets the optional parameter "userProject": The project to 9461// be billed for this request. Required for Requester Pays buckets. 9462func (c *ObjectsGetCall) UserProject(userProject string) *ObjectsGetCall { 9463 c.urlParams_.Set("userProject", userProject) 9464 return c 9465} 9466 9467// Fields allows partial responses to be retrieved. See 9468// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 9469// for more information. 9470func (c *ObjectsGetCall) Fields(s ...googleapi.Field) *ObjectsGetCall { 9471 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 9472 return c 9473} 9474 9475// IfNoneMatch sets the optional parameter which makes the operation 9476// fail if the object's ETag matches the given value. This is useful for 9477// getting updates only after the object has changed since the last 9478// request. Use googleapi.IsNotModified to check whether the response 9479// error from Do is the result of In-None-Match. 9480func (c *ObjectsGetCall) IfNoneMatch(entityTag string) *ObjectsGetCall { 9481 c.ifNoneMatch_ = entityTag 9482 return c 9483} 9484 9485// Context sets the context to be used in this call's Do and Download 9486// methods. Any pending HTTP request will be aborted if the provided 9487// context is canceled. 9488func (c *ObjectsGetCall) Context(ctx context.Context) *ObjectsGetCall { 9489 c.ctx_ = ctx 9490 return c 9491} 9492 9493// Header returns an http.Header that can be modified by the caller to 9494// add HTTP headers to the request. 9495func (c *ObjectsGetCall) Header() http.Header { 9496 if c.header_ == nil { 9497 c.header_ = make(http.Header) 9498 } 9499 return c.header_ 9500} 9501 9502func (c *ObjectsGetCall) doRequest(alt string) (*http.Response, error) { 9503 reqHeaders := make(http.Header) 9504 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") 9505 for k, v := range c.header_ { 9506 reqHeaders[k] = v 9507 } 9508 reqHeaders.Set("User-Agent", c.s.userAgent()) 9509 if c.ifNoneMatch_ != "" { 9510 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 9511 } 9512 var body io.Reader = nil 9513 c.urlParams_.Set("alt", alt) 9514 c.urlParams_.Set("prettyPrint", "false") 9515 urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o/{object}") 9516 urls += "?" + c.urlParams_.Encode() 9517 req, err := http.NewRequest("GET", urls, body) 9518 if err != nil { 9519 return nil, err 9520 } 9521 req.Header = reqHeaders 9522 googleapi.Expand(req.URL, map[string]string{ 9523 "bucket": c.bucket, 9524 "object": c.object, 9525 }) 9526 return gensupport.SendRequest(c.ctx_, c.s.client, req) 9527} 9528 9529// Download fetches the API endpoint's "media" value, instead of the normal 9530// API response value. If the returned error is nil, the Response is guaranteed to 9531// have a 2xx status code. Callers must close the Response.Body as usual. 9532func (c *ObjectsGetCall) Download(opts ...googleapi.CallOption) (*http.Response, error) { 9533 gensupport.SetOptions(c.urlParams_, opts...) 9534 res, err := c.doRequest("media") 9535 if err != nil { 9536 return nil, err 9537 } 9538 if err := googleapi.CheckMediaResponse(res); err != nil { 9539 res.Body.Close() 9540 return nil, err 9541 } 9542 return res, nil 9543} 9544 9545// Do executes the "storage.objects.get" call. 9546// Exactly one of *Object or error will be non-nil. Any non-2xx status 9547// code is an error. Response headers are in either 9548// *Object.ServerResponse.Header or (if a response was returned at all) 9549// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 9550// check whether the returned error was because http.StatusNotModified 9551// was returned. 9552func (c *ObjectsGetCall) Do(opts ...googleapi.CallOption) (*Object, error) { 9553 gensupport.SetOptions(c.urlParams_, opts...) 9554 res, err := c.doRequest("json") 9555 if res != nil && res.StatusCode == http.StatusNotModified { 9556 if res.Body != nil { 9557 res.Body.Close() 9558 } 9559 return nil, &googleapi.Error{ 9560 Code: res.StatusCode, 9561 Header: res.Header, 9562 } 9563 } 9564 if err != nil { 9565 return nil, err 9566 } 9567 defer googleapi.CloseBody(res) 9568 if err := googleapi.CheckResponse(res); err != nil { 9569 return nil, err 9570 } 9571 ret := &Object{ 9572 ServerResponse: googleapi.ServerResponse{ 9573 Header: res.Header, 9574 HTTPStatusCode: res.StatusCode, 9575 }, 9576 } 9577 target := &ret 9578 if err := gensupport.DecodeResponse(target, res); err != nil { 9579 return nil, err 9580 } 9581 return ret, nil 9582 // { 9583 // "description": "Retrieves an object or its metadata.", 9584 // "httpMethod": "GET", 9585 // "id": "storage.objects.get", 9586 // "parameterOrder": [ 9587 // "bucket", 9588 // "object" 9589 // ], 9590 // "parameters": { 9591 // "bucket": { 9592 // "description": "Name of the bucket in which the object resides.", 9593 // "location": "path", 9594 // "required": true, 9595 // "type": "string" 9596 // }, 9597 // "generation": { 9598 // "description": "If present, selects a specific revision of this object (as opposed to the latest version, the default).", 9599 // "format": "int64", 9600 // "location": "query", 9601 // "type": "string" 9602 // }, 9603 // "ifGenerationMatch": { 9604 // "description": "Makes the operation conditional on whether the object's current generation matches the given value. Setting to 0 makes the operation succeed only if there are no live versions of the object.", 9605 // "format": "int64", 9606 // "location": "query", 9607 // "type": "string" 9608 // }, 9609 // "ifGenerationNotMatch": { 9610 // "description": "Makes the operation conditional on whether the object's current generation does not match the given value. If no live object exists, the precondition fails. Setting to 0 makes the operation succeed only if there is a live version of the object.", 9611 // "format": "int64", 9612 // "location": "query", 9613 // "type": "string" 9614 // }, 9615 // "ifMetagenerationMatch": { 9616 // "description": "Makes the operation conditional on whether the object's current metageneration matches the given value.", 9617 // "format": "int64", 9618 // "location": "query", 9619 // "type": "string" 9620 // }, 9621 // "ifMetagenerationNotMatch": { 9622 // "description": "Makes the operation conditional on whether the object's current metageneration does not match the given value.", 9623 // "format": "int64", 9624 // "location": "query", 9625 // "type": "string" 9626 // }, 9627 // "object": { 9628 // "description": "Name of the object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.", 9629 // "location": "path", 9630 // "required": true, 9631 // "type": "string" 9632 // }, 9633 // "projection": { 9634 // "description": "Set of properties to return. Defaults to noAcl.", 9635 // "enum": [ 9636 // "full", 9637 // "noAcl" 9638 // ], 9639 // "enumDescriptions": [ 9640 // "Include all properties.", 9641 // "Omit the owner, acl property." 9642 // ], 9643 // "location": "query", 9644 // "type": "string" 9645 // }, 9646 // "provisionalUserProject": { 9647 // "description": "The project to be billed for this request if the target bucket is requester-pays bucket.", 9648 // "location": "query", 9649 // "type": "string" 9650 // }, 9651 // "userProject": { 9652 // "description": "The project to be billed for this request. Required for Requester Pays buckets.", 9653 // "location": "query", 9654 // "type": "string" 9655 // } 9656 // }, 9657 // "path": "b/{bucket}/o/{object}", 9658 // "response": { 9659 // "$ref": "Object" 9660 // }, 9661 // "scopes": [ 9662 // "https://www.googleapis.com/auth/cloud-platform", 9663 // "https://www.googleapis.com/auth/cloud-platform.read-only", 9664 // "https://www.googleapis.com/auth/devstorage.full_control", 9665 // "https://www.googleapis.com/auth/devstorage.read_only", 9666 // "https://www.googleapis.com/auth/devstorage.read_write" 9667 // ], 9668 // "supportsMediaDownload": true, 9669 // "useMediaDownloadService": true 9670 // } 9671 9672} 9673 9674// method id "storage.objects.getIamPolicy": 9675 9676type ObjectsGetIamPolicyCall struct { 9677 s *Service 9678 bucket string 9679 object string 9680 urlParams_ gensupport.URLParams 9681 ifNoneMatch_ string 9682 ctx_ context.Context 9683 header_ http.Header 9684} 9685 9686// GetIamPolicy: Returns an IAM policy for the specified object. 9687func (r *ObjectsService) GetIamPolicy(bucket string, object string) *ObjectsGetIamPolicyCall { 9688 c := &ObjectsGetIamPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)} 9689 c.bucket = bucket 9690 c.object = object 9691 return c 9692} 9693 9694// Generation sets the optional parameter "generation": If present, 9695// selects a specific revision of this object (as opposed to the latest 9696// version, the default). 9697func (c *ObjectsGetIamPolicyCall) Generation(generation int64) *ObjectsGetIamPolicyCall { 9698 c.urlParams_.Set("generation", fmt.Sprint(generation)) 9699 return c 9700} 9701 9702// ProvisionalUserProject sets the optional parameter 9703// "provisionalUserProject": The project to be billed for this request 9704// if the target bucket is requester-pays bucket. 9705func (c *ObjectsGetIamPolicyCall) ProvisionalUserProject(provisionalUserProject string) *ObjectsGetIamPolicyCall { 9706 c.urlParams_.Set("provisionalUserProject", provisionalUserProject) 9707 return c 9708} 9709 9710// UserProject sets the optional parameter "userProject": The project to 9711// be billed for this request. Required for Requester Pays buckets. 9712func (c *ObjectsGetIamPolicyCall) UserProject(userProject string) *ObjectsGetIamPolicyCall { 9713 c.urlParams_.Set("userProject", userProject) 9714 return c 9715} 9716 9717// Fields allows partial responses to be retrieved. See 9718// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 9719// for more information. 9720func (c *ObjectsGetIamPolicyCall) Fields(s ...googleapi.Field) *ObjectsGetIamPolicyCall { 9721 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 9722 return c 9723} 9724 9725// IfNoneMatch sets the optional parameter which makes the operation 9726// fail if the object's ETag matches the given value. This is useful for 9727// getting updates only after the object has changed since the last 9728// request. Use googleapi.IsNotModified to check whether the response 9729// error from Do is the result of In-None-Match. 9730func (c *ObjectsGetIamPolicyCall) IfNoneMatch(entityTag string) *ObjectsGetIamPolicyCall { 9731 c.ifNoneMatch_ = entityTag 9732 return c 9733} 9734 9735// Context sets the context to be used in this call's Do method. Any 9736// pending HTTP request will be aborted if the provided context is 9737// canceled. 9738func (c *ObjectsGetIamPolicyCall) Context(ctx context.Context) *ObjectsGetIamPolicyCall { 9739 c.ctx_ = ctx 9740 return c 9741} 9742 9743// Header returns an http.Header that can be modified by the caller to 9744// add HTTP headers to the request. 9745func (c *ObjectsGetIamPolicyCall) Header() http.Header { 9746 if c.header_ == nil { 9747 c.header_ = make(http.Header) 9748 } 9749 return c.header_ 9750} 9751 9752func (c *ObjectsGetIamPolicyCall) doRequest(alt string) (*http.Response, error) { 9753 reqHeaders := make(http.Header) 9754 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") 9755 for k, v := range c.header_ { 9756 reqHeaders[k] = v 9757 } 9758 reqHeaders.Set("User-Agent", c.s.userAgent()) 9759 if c.ifNoneMatch_ != "" { 9760 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 9761 } 9762 var body io.Reader = nil 9763 c.urlParams_.Set("alt", alt) 9764 c.urlParams_.Set("prettyPrint", "false") 9765 urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o/{object}/iam") 9766 urls += "?" + c.urlParams_.Encode() 9767 req, err := http.NewRequest("GET", urls, body) 9768 if err != nil { 9769 return nil, err 9770 } 9771 req.Header = reqHeaders 9772 googleapi.Expand(req.URL, map[string]string{ 9773 "bucket": c.bucket, 9774 "object": c.object, 9775 }) 9776 return gensupport.SendRequest(c.ctx_, c.s.client, req) 9777} 9778 9779// Do executes the "storage.objects.getIamPolicy" call. 9780// Exactly one of *Policy or error will be non-nil. Any non-2xx status 9781// code is an error. Response headers are in either 9782// *Policy.ServerResponse.Header or (if a response was returned at all) 9783// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 9784// check whether the returned error was because http.StatusNotModified 9785// was returned. 9786func (c *ObjectsGetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Policy, error) { 9787 gensupport.SetOptions(c.urlParams_, opts...) 9788 res, err := c.doRequest("json") 9789 if res != nil && res.StatusCode == http.StatusNotModified { 9790 if res.Body != nil { 9791 res.Body.Close() 9792 } 9793 return nil, &googleapi.Error{ 9794 Code: res.StatusCode, 9795 Header: res.Header, 9796 } 9797 } 9798 if err != nil { 9799 return nil, err 9800 } 9801 defer googleapi.CloseBody(res) 9802 if err := googleapi.CheckResponse(res); err != nil { 9803 return nil, err 9804 } 9805 ret := &Policy{ 9806 ServerResponse: googleapi.ServerResponse{ 9807 Header: res.Header, 9808 HTTPStatusCode: res.StatusCode, 9809 }, 9810 } 9811 target := &ret 9812 if err := gensupport.DecodeResponse(target, res); err != nil { 9813 return nil, err 9814 } 9815 return ret, nil 9816 // { 9817 // "description": "Returns an IAM policy for the specified object.", 9818 // "httpMethod": "GET", 9819 // "id": "storage.objects.getIamPolicy", 9820 // "parameterOrder": [ 9821 // "bucket", 9822 // "object" 9823 // ], 9824 // "parameters": { 9825 // "bucket": { 9826 // "description": "Name of the bucket in which the object resides.", 9827 // "location": "path", 9828 // "required": true, 9829 // "type": "string" 9830 // }, 9831 // "generation": { 9832 // "description": "If present, selects a specific revision of this object (as opposed to the latest version, the default).", 9833 // "format": "int64", 9834 // "location": "query", 9835 // "type": "string" 9836 // }, 9837 // "object": { 9838 // "description": "Name of the object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.", 9839 // "location": "path", 9840 // "required": true, 9841 // "type": "string" 9842 // }, 9843 // "provisionalUserProject": { 9844 // "description": "The project to be billed for this request if the target bucket is requester-pays bucket.", 9845 // "location": "query", 9846 // "type": "string" 9847 // }, 9848 // "userProject": { 9849 // "description": "The project to be billed for this request. Required for Requester Pays buckets.", 9850 // "location": "query", 9851 // "type": "string" 9852 // } 9853 // }, 9854 // "path": "b/{bucket}/o/{object}/iam", 9855 // "response": { 9856 // "$ref": "Policy" 9857 // }, 9858 // "scopes": [ 9859 // "https://www.googleapis.com/auth/cloud-platform", 9860 // "https://www.googleapis.com/auth/cloud-platform.read-only", 9861 // "https://www.googleapis.com/auth/devstorage.full_control", 9862 // "https://www.googleapis.com/auth/devstorage.read_only", 9863 // "https://www.googleapis.com/auth/devstorage.read_write" 9864 // ] 9865 // } 9866 9867} 9868 9869// method id "storage.objects.insert": 9870 9871type ObjectsInsertCall struct { 9872 s *Service 9873 bucket string 9874 object *Object 9875 urlParams_ gensupport.URLParams 9876 mediaInfo_ *gensupport.MediaInfo 9877 ctx_ context.Context 9878 header_ http.Header 9879} 9880 9881// Insert: Stores a new object and metadata. 9882func (r *ObjectsService) Insert(bucket string, object *Object) *ObjectsInsertCall { 9883 c := &ObjectsInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)} 9884 c.bucket = bucket 9885 c.object = object 9886 return c 9887} 9888 9889// ContentEncoding sets the optional parameter "contentEncoding": If 9890// set, sets the contentEncoding property of the final object to this 9891// value. Setting this parameter is equivalent to setting the 9892// contentEncoding metadata property. This can be useful when uploading 9893// an object with uploadType=media to indicate the encoding of the 9894// content being uploaded. 9895func (c *ObjectsInsertCall) ContentEncoding(contentEncoding string) *ObjectsInsertCall { 9896 c.urlParams_.Set("contentEncoding", contentEncoding) 9897 return c 9898} 9899 9900// IfGenerationMatch sets the optional parameter "ifGenerationMatch": 9901// Makes the operation conditional on whether the object's current 9902// generation matches the given value. Setting to 0 makes the operation 9903// succeed only if there are no live versions of the object. 9904func (c *ObjectsInsertCall) IfGenerationMatch(ifGenerationMatch int64) *ObjectsInsertCall { 9905 c.urlParams_.Set("ifGenerationMatch", fmt.Sprint(ifGenerationMatch)) 9906 return c 9907} 9908 9909// IfGenerationNotMatch sets the optional parameter 9910// "ifGenerationNotMatch": Makes the operation conditional on whether 9911// the object's current generation does not match the given value. If no 9912// live object exists, the precondition fails. Setting to 0 makes the 9913// operation succeed only if there is a live version of the object. 9914func (c *ObjectsInsertCall) IfGenerationNotMatch(ifGenerationNotMatch int64) *ObjectsInsertCall { 9915 c.urlParams_.Set("ifGenerationNotMatch", fmt.Sprint(ifGenerationNotMatch)) 9916 return c 9917} 9918 9919// IfMetagenerationMatch sets the optional parameter 9920// "ifMetagenerationMatch": Makes the operation conditional on whether 9921// the object's current metageneration matches the given value. 9922func (c *ObjectsInsertCall) IfMetagenerationMatch(ifMetagenerationMatch int64) *ObjectsInsertCall { 9923 c.urlParams_.Set("ifMetagenerationMatch", fmt.Sprint(ifMetagenerationMatch)) 9924 return c 9925} 9926 9927// IfMetagenerationNotMatch sets the optional parameter 9928// "ifMetagenerationNotMatch": Makes the operation conditional on 9929// whether the object's current metageneration does not match the given 9930// value. 9931func (c *ObjectsInsertCall) IfMetagenerationNotMatch(ifMetagenerationNotMatch int64) *ObjectsInsertCall { 9932 c.urlParams_.Set("ifMetagenerationNotMatch", fmt.Sprint(ifMetagenerationNotMatch)) 9933 return c 9934} 9935 9936// KmsKeyName sets the optional parameter "kmsKeyName": Resource name of 9937// the Cloud KMS key, of the form 9938// projects/my-project/locations/global/keyRings/my-kr/cryptoKeys/my-key, 9939// that will be used to encrypt the object. Overrides the object 9940// metadata's kms_key_name value, if any. 9941func (c *ObjectsInsertCall) KmsKeyName(kmsKeyName string) *ObjectsInsertCall { 9942 c.urlParams_.Set("kmsKeyName", kmsKeyName) 9943 return c 9944} 9945 9946// Name sets the optional parameter "name": Name of the object. Required 9947// when the object metadata is not otherwise provided. Overrides the 9948// object metadata's name value, if any. For information about how to 9949// URL encode object names to be path safe, see Encoding URI Path Parts. 9950func (c *ObjectsInsertCall) Name(name string) *ObjectsInsertCall { 9951 c.urlParams_.Set("name", name) 9952 return c 9953} 9954 9955// PredefinedAcl sets the optional parameter "predefinedAcl": Apply a 9956// predefined set of access controls to this object. 9957// 9958// Possible values: 9959// "authenticatedRead" - Object owner gets OWNER access, and 9960// allAuthenticatedUsers get READER access. 9961// "bucketOwnerFullControl" - Object owner gets OWNER access, and 9962// project team owners get OWNER access. 9963// "bucketOwnerRead" - Object owner gets OWNER access, and project 9964// team owners get READER access. 9965// "private" - Object owner gets OWNER access. 9966// "projectPrivate" - Object owner gets OWNER access, and project team 9967// members get access according to their roles. 9968// "publicRead" - Object owner gets OWNER access, and allUsers get 9969// READER access. 9970func (c *ObjectsInsertCall) PredefinedAcl(predefinedAcl string) *ObjectsInsertCall { 9971 c.urlParams_.Set("predefinedAcl", predefinedAcl) 9972 return c 9973} 9974 9975// Projection sets the optional parameter "projection": Set of 9976// properties to return. Defaults to noAcl, unless the object resource 9977// specifies the acl property, when it defaults to full. 9978// 9979// Possible values: 9980// "full" - Include all properties. 9981// "noAcl" - Omit the owner, acl property. 9982func (c *ObjectsInsertCall) Projection(projection string) *ObjectsInsertCall { 9983 c.urlParams_.Set("projection", projection) 9984 return c 9985} 9986 9987// ProvisionalUserProject sets the optional parameter 9988// "provisionalUserProject": The project to be billed for this request 9989// if the target bucket is requester-pays bucket. 9990func (c *ObjectsInsertCall) ProvisionalUserProject(provisionalUserProject string) *ObjectsInsertCall { 9991 c.urlParams_.Set("provisionalUserProject", provisionalUserProject) 9992 return c 9993} 9994 9995// UserProject sets the optional parameter "userProject": The project to 9996// be billed for this request. Required for Requester Pays buckets. 9997func (c *ObjectsInsertCall) UserProject(userProject string) *ObjectsInsertCall { 9998 c.urlParams_.Set("userProject", userProject) 9999 return c 10000} 10001 10002// Media specifies the media to upload in one or more chunks. The chunk 10003// size may be controlled by supplying a MediaOption generated by 10004// googleapi.ChunkSize. The chunk size defaults to 10005// googleapi.DefaultUploadChunkSize.The Content-Type header used in the 10006// upload request will be determined by sniffing the contents of r, 10007// unless a MediaOption generated by googleapi.ContentType is 10008// supplied. 10009// At most one of Media and ResumableMedia may be set. 10010func (c *ObjectsInsertCall) Media(r io.Reader, options ...googleapi.MediaOption) *ObjectsInsertCall { 10011 if ct := c.object.ContentType; ct != "" { 10012 options = append([]googleapi.MediaOption{googleapi.ContentType(ct)}, options...) 10013 } 10014 c.mediaInfo_ = gensupport.NewInfoFromMedia(r, options) 10015 return c 10016} 10017 10018// ResumableMedia specifies the media to upload in chunks and can be 10019// canceled with ctx. 10020// 10021// Deprecated: use Media instead. 10022// 10023// At most one of Media and ResumableMedia may be set. mediaType 10024// identifies the MIME media type of the upload, such as "image/png". If 10025// mediaType is "", it will be auto-detected. The provided ctx will 10026// supersede any context previously provided to the Context method. 10027func (c *ObjectsInsertCall) ResumableMedia(ctx context.Context, r io.ReaderAt, size int64, mediaType string) *ObjectsInsertCall { 10028 c.ctx_ = ctx 10029 c.mediaInfo_ = gensupport.NewInfoFromResumableMedia(r, size, mediaType) 10030 return c 10031} 10032 10033// ProgressUpdater provides a callback function that will be called 10034// after every chunk. It should be a low-latency function in order to 10035// not slow down the upload operation. This should only be called when 10036// using ResumableMedia (as opposed to Media). 10037func (c *ObjectsInsertCall) ProgressUpdater(pu googleapi.ProgressUpdater) *ObjectsInsertCall { 10038 c.mediaInfo_.SetProgressUpdater(pu) 10039 return c 10040} 10041 10042// Fields allows partial responses to be retrieved. See 10043// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 10044// for more information. 10045func (c *ObjectsInsertCall) Fields(s ...googleapi.Field) *ObjectsInsertCall { 10046 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 10047 return c 10048} 10049 10050// Context sets the context to be used in this call's Do method. Any 10051// pending HTTP request will be aborted if the provided context is 10052// canceled. 10053// This context will supersede any context previously provided to the 10054// ResumableMedia method. 10055func (c *ObjectsInsertCall) Context(ctx context.Context) *ObjectsInsertCall { 10056 c.ctx_ = ctx 10057 return c 10058} 10059 10060// Header returns an http.Header that can be modified by the caller to 10061// add HTTP headers to the request. 10062func (c *ObjectsInsertCall) Header() http.Header { 10063 if c.header_ == nil { 10064 c.header_ = make(http.Header) 10065 } 10066 return c.header_ 10067} 10068 10069func (c *ObjectsInsertCall) doRequest(alt string) (*http.Response, error) { 10070 reqHeaders := make(http.Header) 10071 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") 10072 for k, v := range c.header_ { 10073 reqHeaders[k] = v 10074 } 10075 reqHeaders.Set("User-Agent", c.s.userAgent()) 10076 var body io.Reader = nil 10077 body, err := googleapi.WithoutDataWrapper.JSONReader(c.object) 10078 if err != nil { 10079 return nil, err 10080 } 10081 reqHeaders.Set("Content-Type", "application/json") 10082 c.urlParams_.Set("alt", alt) 10083 c.urlParams_.Set("prettyPrint", "false") 10084 urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o") 10085 if c.mediaInfo_ != nil { 10086 urls = googleapi.ResolveRelative(c.s.BasePath, "/upload/storage/v1/b/{bucket}/o") 10087 c.urlParams_.Set("uploadType", c.mediaInfo_.UploadType()) 10088 } 10089 if body == nil { 10090 body = new(bytes.Buffer) 10091 reqHeaders.Set("Content-Type", "application/json") 10092 } 10093 body, getBody, cleanup := c.mediaInfo_.UploadRequest(reqHeaders, body) 10094 defer cleanup() 10095 urls += "?" + c.urlParams_.Encode() 10096 req, err := http.NewRequest("POST", urls, body) 10097 if err != nil { 10098 return nil, err 10099 } 10100 req.Header = reqHeaders 10101 req.GetBody = getBody 10102 googleapi.Expand(req.URL, map[string]string{ 10103 "bucket": c.bucket, 10104 }) 10105 return gensupport.SendRequestWithRetry(c.ctx_, c.s.client, req) 10106} 10107 10108// Do executes the "storage.objects.insert" call. 10109// Exactly one of *Object or error will be non-nil. Any non-2xx status 10110// code is an error. Response headers are in either 10111// *Object.ServerResponse.Header or (if a response was returned at all) 10112// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 10113// check whether the returned error was because http.StatusNotModified 10114// was returned. 10115func (c *ObjectsInsertCall) Do(opts ...googleapi.CallOption) (*Object, error) { 10116 gensupport.SetOptions(c.urlParams_, opts...) 10117 res, err := c.doRequest("json") 10118 if res != nil && res.StatusCode == http.StatusNotModified { 10119 if res.Body != nil { 10120 res.Body.Close() 10121 } 10122 return nil, &googleapi.Error{ 10123 Code: res.StatusCode, 10124 Header: res.Header, 10125 } 10126 } 10127 if err != nil { 10128 return nil, err 10129 } 10130 defer googleapi.CloseBody(res) 10131 if err := googleapi.CheckResponse(res); err != nil { 10132 return nil, err 10133 } 10134 rx := c.mediaInfo_.ResumableUpload(res.Header.Get("Location")) 10135 if rx != nil { 10136 rx.Client = c.s.client 10137 rx.UserAgent = c.s.userAgent() 10138 ctx := c.ctx_ 10139 if ctx == nil { 10140 ctx = context.TODO() 10141 } 10142 res, err = rx.Upload(ctx) 10143 if err != nil { 10144 return nil, err 10145 } 10146 defer res.Body.Close() 10147 if err := googleapi.CheckResponse(res); err != nil { 10148 return nil, err 10149 } 10150 } 10151 ret := &Object{ 10152 ServerResponse: googleapi.ServerResponse{ 10153 Header: res.Header, 10154 HTTPStatusCode: res.StatusCode, 10155 }, 10156 } 10157 target := &ret 10158 if err := gensupport.DecodeResponse(target, res); err != nil { 10159 return nil, err 10160 } 10161 return ret, nil 10162 // { 10163 // "description": "Stores a new object and metadata.", 10164 // "httpMethod": "POST", 10165 // "id": "storage.objects.insert", 10166 // "mediaUpload": { 10167 // "accept": [ 10168 // "*/*" 10169 // ], 10170 // "protocols": { 10171 // "resumable": { 10172 // "multipart": true, 10173 // "path": "/resumable/upload/storage/v1/b/{bucket}/o" 10174 // }, 10175 // "simple": { 10176 // "multipart": true, 10177 // "path": "/upload/storage/v1/b/{bucket}/o" 10178 // } 10179 // } 10180 // }, 10181 // "parameterOrder": [ 10182 // "bucket" 10183 // ], 10184 // "parameters": { 10185 // "bucket": { 10186 // "description": "Name of the bucket in which to store the new object. Overrides the provided object metadata's bucket value, if any.", 10187 // "location": "path", 10188 // "required": true, 10189 // "type": "string" 10190 // }, 10191 // "contentEncoding": { 10192 // "description": "If set, sets the contentEncoding property of the final object to this value. Setting this parameter is equivalent to setting the contentEncoding metadata property. This can be useful when uploading an object with uploadType=media to indicate the encoding of the content being uploaded.", 10193 // "location": "query", 10194 // "type": "string" 10195 // }, 10196 // "ifGenerationMatch": { 10197 // "description": "Makes the operation conditional on whether the object's current generation matches the given value. Setting to 0 makes the operation succeed only if there are no live versions of the object.", 10198 // "format": "int64", 10199 // "location": "query", 10200 // "type": "string" 10201 // }, 10202 // "ifGenerationNotMatch": { 10203 // "description": "Makes the operation conditional on whether the object's current generation does not match the given value. If no live object exists, the precondition fails. Setting to 0 makes the operation succeed only if there is a live version of the object.", 10204 // "format": "int64", 10205 // "location": "query", 10206 // "type": "string" 10207 // }, 10208 // "ifMetagenerationMatch": { 10209 // "description": "Makes the operation conditional on whether the object's current metageneration matches the given value.", 10210 // "format": "int64", 10211 // "location": "query", 10212 // "type": "string" 10213 // }, 10214 // "ifMetagenerationNotMatch": { 10215 // "description": "Makes the operation conditional on whether the object's current metageneration does not match the given value.", 10216 // "format": "int64", 10217 // "location": "query", 10218 // "type": "string" 10219 // }, 10220 // "kmsKeyName": { 10221 // "description": "Resource name of the Cloud KMS key, of the form projects/my-project/locations/global/keyRings/my-kr/cryptoKeys/my-key, that will be used to encrypt the object. Overrides the object metadata's kms_key_name value, if any.", 10222 // "location": "query", 10223 // "type": "string" 10224 // }, 10225 // "name": { 10226 // "description": "Name of the object. Required when the object metadata is not otherwise provided. Overrides the object metadata's name value, if any. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.", 10227 // "location": "query", 10228 // "type": "string" 10229 // }, 10230 // "predefinedAcl": { 10231 // "description": "Apply a predefined set of access controls to this object.", 10232 // "enum": [ 10233 // "authenticatedRead", 10234 // "bucketOwnerFullControl", 10235 // "bucketOwnerRead", 10236 // "private", 10237 // "projectPrivate", 10238 // "publicRead" 10239 // ], 10240 // "enumDescriptions": [ 10241 // "Object owner gets OWNER access, and allAuthenticatedUsers get READER access.", 10242 // "Object owner gets OWNER access, and project team owners get OWNER access.", 10243 // "Object owner gets OWNER access, and project team owners get READER access.", 10244 // "Object owner gets OWNER access.", 10245 // "Object owner gets OWNER access, and project team members get access according to their roles.", 10246 // "Object owner gets OWNER access, and allUsers get READER access." 10247 // ], 10248 // "location": "query", 10249 // "type": "string" 10250 // }, 10251 // "projection": { 10252 // "description": "Set of properties to return. Defaults to noAcl, unless the object resource specifies the acl property, when it defaults to full.", 10253 // "enum": [ 10254 // "full", 10255 // "noAcl" 10256 // ], 10257 // "enumDescriptions": [ 10258 // "Include all properties.", 10259 // "Omit the owner, acl property." 10260 // ], 10261 // "location": "query", 10262 // "type": "string" 10263 // }, 10264 // "provisionalUserProject": { 10265 // "description": "The project to be billed for this request if the target bucket is requester-pays bucket.", 10266 // "location": "query", 10267 // "type": "string" 10268 // }, 10269 // "userProject": { 10270 // "description": "The project to be billed for this request. Required for Requester Pays buckets.", 10271 // "location": "query", 10272 // "type": "string" 10273 // } 10274 // }, 10275 // "path": "b/{bucket}/o", 10276 // "request": { 10277 // "$ref": "Object" 10278 // }, 10279 // "response": { 10280 // "$ref": "Object" 10281 // }, 10282 // "scopes": [ 10283 // "https://www.googleapis.com/auth/cloud-platform", 10284 // "https://www.googleapis.com/auth/devstorage.full_control", 10285 // "https://www.googleapis.com/auth/devstorage.read_write" 10286 // ], 10287 // "supportsMediaUpload": true 10288 // } 10289 10290} 10291 10292// method id "storage.objects.list": 10293 10294type ObjectsListCall struct { 10295 s *Service 10296 bucket string 10297 urlParams_ gensupport.URLParams 10298 ifNoneMatch_ string 10299 ctx_ context.Context 10300 header_ http.Header 10301} 10302 10303// List: Retrieves a list of objects matching the criteria. 10304func (r *ObjectsService) List(bucket string) *ObjectsListCall { 10305 c := &ObjectsListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 10306 c.bucket = bucket 10307 return c 10308} 10309 10310// Delimiter sets the optional parameter "delimiter": Returns results in 10311// a directory-like mode. items will contain only objects whose names, 10312// aside from the prefix, do not contain delimiter. Objects whose names, 10313// aside from the prefix, contain delimiter will have their name, 10314// truncated after the delimiter, returned in prefixes. Duplicate 10315// prefixes are omitted. 10316func (c *ObjectsListCall) Delimiter(delimiter string) *ObjectsListCall { 10317 c.urlParams_.Set("delimiter", delimiter) 10318 return c 10319} 10320 10321// EndOffset sets the optional parameter "endOffset": Filter results to 10322// objects whose names are lexicographically before endOffset. If 10323// startOffset is also set, the objects listed will have names between 10324// startOffset (inclusive) and endOffset (exclusive). 10325func (c *ObjectsListCall) EndOffset(endOffset string) *ObjectsListCall { 10326 c.urlParams_.Set("endOffset", endOffset) 10327 return c 10328} 10329 10330// IncludeTrailingDelimiter sets the optional parameter 10331// "includeTrailingDelimiter": If true, objects that end in exactly one 10332// instance of delimiter will have their metadata included in items in 10333// addition to prefixes. 10334func (c *ObjectsListCall) IncludeTrailingDelimiter(includeTrailingDelimiter bool) *ObjectsListCall { 10335 c.urlParams_.Set("includeTrailingDelimiter", fmt.Sprint(includeTrailingDelimiter)) 10336 return c 10337} 10338 10339// MaxResults sets the optional parameter "maxResults": Maximum number 10340// of items plus prefixes to return in a single page of responses. As 10341// duplicate prefixes are omitted, fewer total results may be returned 10342// than requested. The service will use this parameter or 1,000 items, 10343// whichever is smaller. 10344func (c *ObjectsListCall) MaxResults(maxResults int64) *ObjectsListCall { 10345 c.urlParams_.Set("maxResults", fmt.Sprint(maxResults)) 10346 return c 10347} 10348 10349// PageToken sets the optional parameter "pageToken": A 10350// previously-returned page token representing part of the larger set of 10351// results to view. 10352func (c *ObjectsListCall) PageToken(pageToken string) *ObjectsListCall { 10353 c.urlParams_.Set("pageToken", pageToken) 10354 return c 10355} 10356 10357// Prefix sets the optional parameter "prefix": Filter results to 10358// objects whose names begin with this prefix. 10359func (c *ObjectsListCall) Prefix(prefix string) *ObjectsListCall { 10360 c.urlParams_.Set("prefix", prefix) 10361 return c 10362} 10363 10364// Projection sets the optional parameter "projection": Set of 10365// properties to return. Defaults to noAcl. 10366// 10367// Possible values: 10368// "full" - Include all properties. 10369// "noAcl" - Omit the owner, acl property. 10370func (c *ObjectsListCall) Projection(projection string) *ObjectsListCall { 10371 c.urlParams_.Set("projection", projection) 10372 return c 10373} 10374 10375// ProvisionalUserProject sets the optional parameter 10376// "provisionalUserProject": The project to be billed for this request 10377// if the target bucket is requester-pays bucket. 10378func (c *ObjectsListCall) ProvisionalUserProject(provisionalUserProject string) *ObjectsListCall { 10379 c.urlParams_.Set("provisionalUserProject", provisionalUserProject) 10380 return c 10381} 10382 10383// StartOffset sets the optional parameter "startOffset": Filter results 10384// to objects whose names are lexicographically equal to or after 10385// startOffset. If endOffset is also set, the objects listed will have 10386// names between startOffset (inclusive) and endOffset (exclusive). 10387func (c *ObjectsListCall) StartOffset(startOffset string) *ObjectsListCall { 10388 c.urlParams_.Set("startOffset", startOffset) 10389 return c 10390} 10391 10392// UserProject sets the optional parameter "userProject": The project to 10393// be billed for this request. Required for Requester Pays buckets. 10394func (c *ObjectsListCall) UserProject(userProject string) *ObjectsListCall { 10395 c.urlParams_.Set("userProject", userProject) 10396 return c 10397} 10398 10399// Versions sets the optional parameter "versions": If true, lists all 10400// versions of an object as distinct results. The default is false. For 10401// more information, see Object Versioning. 10402func (c *ObjectsListCall) Versions(versions bool) *ObjectsListCall { 10403 c.urlParams_.Set("versions", fmt.Sprint(versions)) 10404 return c 10405} 10406 10407// Fields allows partial responses to be retrieved. See 10408// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 10409// for more information. 10410func (c *ObjectsListCall) Fields(s ...googleapi.Field) *ObjectsListCall { 10411 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 10412 return c 10413} 10414 10415// IfNoneMatch sets the optional parameter which makes the operation 10416// fail if the object's ETag matches the given value. This is useful for 10417// getting updates only after the object has changed since the last 10418// request. Use googleapi.IsNotModified to check whether the response 10419// error from Do is the result of In-None-Match. 10420func (c *ObjectsListCall) IfNoneMatch(entityTag string) *ObjectsListCall { 10421 c.ifNoneMatch_ = entityTag 10422 return c 10423} 10424 10425// Context sets the context to be used in this call's Do method. Any 10426// pending HTTP request will be aborted if the provided context is 10427// canceled. 10428func (c *ObjectsListCall) Context(ctx context.Context) *ObjectsListCall { 10429 c.ctx_ = ctx 10430 return c 10431} 10432 10433// Header returns an http.Header that can be modified by the caller to 10434// add HTTP headers to the request. 10435func (c *ObjectsListCall) Header() http.Header { 10436 if c.header_ == nil { 10437 c.header_ = make(http.Header) 10438 } 10439 return c.header_ 10440} 10441 10442func (c *ObjectsListCall) doRequest(alt string) (*http.Response, error) { 10443 reqHeaders := make(http.Header) 10444 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") 10445 for k, v := range c.header_ { 10446 reqHeaders[k] = v 10447 } 10448 reqHeaders.Set("User-Agent", c.s.userAgent()) 10449 if c.ifNoneMatch_ != "" { 10450 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 10451 } 10452 var body io.Reader = nil 10453 c.urlParams_.Set("alt", alt) 10454 c.urlParams_.Set("prettyPrint", "false") 10455 urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o") 10456 urls += "?" + c.urlParams_.Encode() 10457 req, err := http.NewRequest("GET", urls, body) 10458 if err != nil { 10459 return nil, err 10460 } 10461 req.Header = reqHeaders 10462 googleapi.Expand(req.URL, map[string]string{ 10463 "bucket": c.bucket, 10464 }) 10465 return gensupport.SendRequest(c.ctx_, c.s.client, req) 10466} 10467 10468// Do executes the "storage.objects.list" call. 10469// Exactly one of *Objects or error will be non-nil. Any non-2xx status 10470// code is an error. Response headers are in either 10471// *Objects.ServerResponse.Header or (if a response was returned at all) 10472// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 10473// check whether the returned error was because http.StatusNotModified 10474// was returned. 10475func (c *ObjectsListCall) Do(opts ...googleapi.CallOption) (*Objects, error) { 10476 gensupport.SetOptions(c.urlParams_, opts...) 10477 res, err := c.doRequest("json") 10478 if res != nil && res.StatusCode == http.StatusNotModified { 10479 if res.Body != nil { 10480 res.Body.Close() 10481 } 10482 return nil, &googleapi.Error{ 10483 Code: res.StatusCode, 10484 Header: res.Header, 10485 } 10486 } 10487 if err != nil { 10488 return nil, err 10489 } 10490 defer googleapi.CloseBody(res) 10491 if err := googleapi.CheckResponse(res); err != nil { 10492 return nil, err 10493 } 10494 ret := &Objects{ 10495 ServerResponse: googleapi.ServerResponse{ 10496 Header: res.Header, 10497 HTTPStatusCode: res.StatusCode, 10498 }, 10499 } 10500 target := &ret 10501 if err := gensupport.DecodeResponse(target, res); err != nil { 10502 return nil, err 10503 } 10504 return ret, nil 10505 // { 10506 // "description": "Retrieves a list of objects matching the criteria.", 10507 // "httpMethod": "GET", 10508 // "id": "storage.objects.list", 10509 // "parameterOrder": [ 10510 // "bucket" 10511 // ], 10512 // "parameters": { 10513 // "bucket": { 10514 // "description": "Name of the bucket in which to look for objects.", 10515 // "location": "path", 10516 // "required": true, 10517 // "type": "string" 10518 // }, 10519 // "delimiter": { 10520 // "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.", 10521 // "location": "query", 10522 // "type": "string" 10523 // }, 10524 // "endOffset": { 10525 // "description": "Filter results to objects whose names are lexicographically before endOffset. If startOffset is also set, the objects listed will have names between startOffset (inclusive) and endOffset (exclusive).", 10526 // "location": "query", 10527 // "type": "string" 10528 // }, 10529 // "includeTrailingDelimiter": { 10530 // "description": "If true, objects that end in exactly one instance of delimiter will have their metadata included in items in addition to prefixes.", 10531 // "location": "query", 10532 // "type": "boolean" 10533 // }, 10534 // "maxResults": { 10535 // "default": "1000", 10536 // "description": "Maximum number of items plus prefixes to return in a single page of responses. As duplicate prefixes are omitted, fewer total results may be returned than requested. The service will use this parameter or 1,000 items, whichever is smaller.", 10537 // "format": "uint32", 10538 // "location": "query", 10539 // "minimum": "0", 10540 // "type": "integer" 10541 // }, 10542 // "pageToken": { 10543 // "description": "A previously-returned page token representing part of the larger set of results to view.", 10544 // "location": "query", 10545 // "type": "string" 10546 // }, 10547 // "prefix": { 10548 // "description": "Filter results to objects whose names begin with this prefix.", 10549 // "location": "query", 10550 // "type": "string" 10551 // }, 10552 // "projection": { 10553 // "description": "Set of properties to return. Defaults to noAcl.", 10554 // "enum": [ 10555 // "full", 10556 // "noAcl" 10557 // ], 10558 // "enumDescriptions": [ 10559 // "Include all properties.", 10560 // "Omit the owner, acl property." 10561 // ], 10562 // "location": "query", 10563 // "type": "string" 10564 // }, 10565 // "provisionalUserProject": { 10566 // "description": "The project to be billed for this request if the target bucket is requester-pays bucket.", 10567 // "location": "query", 10568 // "type": "string" 10569 // }, 10570 // "startOffset": { 10571 // "description": "Filter results to objects whose names are lexicographically equal to or after startOffset. If endOffset is also set, the objects listed will have names between startOffset (inclusive) and endOffset (exclusive).", 10572 // "location": "query", 10573 // "type": "string" 10574 // }, 10575 // "userProject": { 10576 // "description": "The project to be billed for this request. Required for Requester Pays buckets.", 10577 // "location": "query", 10578 // "type": "string" 10579 // }, 10580 // "versions": { 10581 // "description": "If true, lists all versions of an object as distinct results. The default is false. For more information, see Object Versioning.", 10582 // "location": "query", 10583 // "type": "boolean" 10584 // } 10585 // }, 10586 // "path": "b/{bucket}/o", 10587 // "response": { 10588 // "$ref": "Objects" 10589 // }, 10590 // "scopes": [ 10591 // "https://www.googleapis.com/auth/cloud-platform", 10592 // "https://www.googleapis.com/auth/cloud-platform.read-only", 10593 // "https://www.googleapis.com/auth/devstorage.full_control", 10594 // "https://www.googleapis.com/auth/devstorage.read_only", 10595 // "https://www.googleapis.com/auth/devstorage.read_write" 10596 // ], 10597 // "supportsSubscription": true 10598 // } 10599 10600} 10601 10602// Pages invokes f for each page of results. 10603// A non-nil error returned from f will halt the iteration. 10604// The provided context supersedes any context provided to the Context method. 10605func (c *ObjectsListCall) Pages(ctx context.Context, f func(*Objects) error) error { 10606 c.ctx_ = ctx 10607 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 10608 for { 10609 x, err := c.Do() 10610 if err != nil { 10611 return err 10612 } 10613 if err := f(x); err != nil { 10614 return err 10615 } 10616 if x.NextPageToken == "" { 10617 return nil 10618 } 10619 c.PageToken(x.NextPageToken) 10620 } 10621} 10622 10623// method id "storage.objects.patch": 10624 10625type ObjectsPatchCall struct { 10626 s *Service 10627 bucket string 10628 object string 10629 object2 *Object 10630 urlParams_ gensupport.URLParams 10631 ctx_ context.Context 10632 header_ http.Header 10633} 10634 10635// Patch: Patches an object's metadata. 10636func (r *ObjectsService) Patch(bucket string, object string, object2 *Object) *ObjectsPatchCall { 10637 c := &ObjectsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)} 10638 c.bucket = bucket 10639 c.object = object 10640 c.object2 = object2 10641 return c 10642} 10643 10644// Generation sets the optional parameter "generation": If present, 10645// selects a specific revision of this object (as opposed to the latest 10646// version, the default). 10647func (c *ObjectsPatchCall) Generation(generation int64) *ObjectsPatchCall { 10648 c.urlParams_.Set("generation", fmt.Sprint(generation)) 10649 return c 10650} 10651 10652// IfGenerationMatch sets the optional parameter "ifGenerationMatch": 10653// Makes the operation conditional on whether the object's current 10654// generation matches the given value. Setting to 0 makes the operation 10655// succeed only if there are no live versions of the object. 10656func (c *ObjectsPatchCall) IfGenerationMatch(ifGenerationMatch int64) *ObjectsPatchCall { 10657 c.urlParams_.Set("ifGenerationMatch", fmt.Sprint(ifGenerationMatch)) 10658 return c 10659} 10660 10661// IfGenerationNotMatch sets the optional parameter 10662// "ifGenerationNotMatch": Makes the operation conditional on whether 10663// the object's current generation does not match the given value. If no 10664// live object exists, the precondition fails. Setting to 0 makes the 10665// operation succeed only if there is a live version of the object. 10666func (c *ObjectsPatchCall) IfGenerationNotMatch(ifGenerationNotMatch int64) *ObjectsPatchCall { 10667 c.urlParams_.Set("ifGenerationNotMatch", fmt.Sprint(ifGenerationNotMatch)) 10668 return c 10669} 10670 10671// IfMetagenerationMatch sets the optional parameter 10672// "ifMetagenerationMatch": Makes the operation conditional on whether 10673// the object's current metageneration matches the given value. 10674func (c *ObjectsPatchCall) IfMetagenerationMatch(ifMetagenerationMatch int64) *ObjectsPatchCall { 10675 c.urlParams_.Set("ifMetagenerationMatch", fmt.Sprint(ifMetagenerationMatch)) 10676 return c 10677} 10678 10679// IfMetagenerationNotMatch sets the optional parameter 10680// "ifMetagenerationNotMatch": Makes the operation conditional on 10681// whether the object's current metageneration does not match the given 10682// value. 10683func (c *ObjectsPatchCall) IfMetagenerationNotMatch(ifMetagenerationNotMatch int64) *ObjectsPatchCall { 10684 c.urlParams_.Set("ifMetagenerationNotMatch", fmt.Sprint(ifMetagenerationNotMatch)) 10685 return c 10686} 10687 10688// PredefinedAcl sets the optional parameter "predefinedAcl": Apply a 10689// predefined set of access controls to this object. 10690// 10691// Possible values: 10692// "authenticatedRead" - Object owner gets OWNER access, and 10693// allAuthenticatedUsers get READER access. 10694// "bucketOwnerFullControl" - Object owner gets OWNER access, and 10695// project team owners get OWNER access. 10696// "bucketOwnerRead" - Object owner gets OWNER access, and project 10697// team owners get READER access. 10698// "private" - Object owner gets OWNER access. 10699// "projectPrivate" - Object owner gets OWNER access, and project team 10700// members get access according to their roles. 10701// "publicRead" - Object owner gets OWNER access, and allUsers get 10702// READER access. 10703func (c *ObjectsPatchCall) PredefinedAcl(predefinedAcl string) *ObjectsPatchCall { 10704 c.urlParams_.Set("predefinedAcl", predefinedAcl) 10705 return c 10706} 10707 10708// Projection sets the optional parameter "projection": Set of 10709// properties to return. Defaults to full. 10710// 10711// Possible values: 10712// "full" - Include all properties. 10713// "noAcl" - Omit the owner, acl property. 10714func (c *ObjectsPatchCall) Projection(projection string) *ObjectsPatchCall { 10715 c.urlParams_.Set("projection", projection) 10716 return c 10717} 10718 10719// ProvisionalUserProject sets the optional parameter 10720// "provisionalUserProject": The project to be billed for this request 10721// if the target bucket is requester-pays bucket. 10722func (c *ObjectsPatchCall) ProvisionalUserProject(provisionalUserProject string) *ObjectsPatchCall { 10723 c.urlParams_.Set("provisionalUserProject", provisionalUserProject) 10724 return c 10725} 10726 10727// UserProject sets the optional parameter "userProject": The project to 10728// be billed for this request, for Requester Pays buckets. 10729func (c *ObjectsPatchCall) UserProject(userProject string) *ObjectsPatchCall { 10730 c.urlParams_.Set("userProject", userProject) 10731 return c 10732} 10733 10734// Fields allows partial responses to be retrieved. See 10735// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 10736// for more information. 10737func (c *ObjectsPatchCall) Fields(s ...googleapi.Field) *ObjectsPatchCall { 10738 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 10739 return c 10740} 10741 10742// Context sets the context to be used in this call's Do method. Any 10743// pending HTTP request will be aborted if the provided context is 10744// canceled. 10745func (c *ObjectsPatchCall) Context(ctx context.Context) *ObjectsPatchCall { 10746 c.ctx_ = ctx 10747 return c 10748} 10749 10750// Header returns an http.Header that can be modified by the caller to 10751// add HTTP headers to the request. 10752func (c *ObjectsPatchCall) Header() http.Header { 10753 if c.header_ == nil { 10754 c.header_ = make(http.Header) 10755 } 10756 return c.header_ 10757} 10758 10759func (c *ObjectsPatchCall) doRequest(alt string) (*http.Response, error) { 10760 reqHeaders := make(http.Header) 10761 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") 10762 for k, v := range c.header_ { 10763 reqHeaders[k] = v 10764 } 10765 reqHeaders.Set("User-Agent", c.s.userAgent()) 10766 var body io.Reader = nil 10767 body, err := googleapi.WithoutDataWrapper.JSONReader(c.object2) 10768 if err != nil { 10769 return nil, err 10770 } 10771 reqHeaders.Set("Content-Type", "application/json") 10772 c.urlParams_.Set("alt", alt) 10773 c.urlParams_.Set("prettyPrint", "false") 10774 urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o/{object}") 10775 urls += "?" + c.urlParams_.Encode() 10776 req, err := http.NewRequest("PATCH", urls, body) 10777 if err != nil { 10778 return nil, err 10779 } 10780 req.Header = reqHeaders 10781 googleapi.Expand(req.URL, map[string]string{ 10782 "bucket": c.bucket, 10783 "object": c.object, 10784 }) 10785 return gensupport.SendRequest(c.ctx_, c.s.client, req) 10786} 10787 10788// Do executes the "storage.objects.patch" call. 10789// Exactly one of *Object or error will be non-nil. Any non-2xx status 10790// code is an error. Response headers are in either 10791// *Object.ServerResponse.Header or (if a response was returned at all) 10792// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 10793// check whether the returned error was because http.StatusNotModified 10794// was returned. 10795func (c *ObjectsPatchCall) Do(opts ...googleapi.CallOption) (*Object, error) { 10796 gensupport.SetOptions(c.urlParams_, opts...) 10797 res, err := c.doRequest("json") 10798 if res != nil && res.StatusCode == http.StatusNotModified { 10799 if res.Body != nil { 10800 res.Body.Close() 10801 } 10802 return nil, &googleapi.Error{ 10803 Code: res.StatusCode, 10804 Header: res.Header, 10805 } 10806 } 10807 if err != nil { 10808 return nil, err 10809 } 10810 defer googleapi.CloseBody(res) 10811 if err := googleapi.CheckResponse(res); err != nil { 10812 return nil, err 10813 } 10814 ret := &Object{ 10815 ServerResponse: googleapi.ServerResponse{ 10816 Header: res.Header, 10817 HTTPStatusCode: res.StatusCode, 10818 }, 10819 } 10820 target := &ret 10821 if err := gensupport.DecodeResponse(target, res); err != nil { 10822 return nil, err 10823 } 10824 return ret, nil 10825 // { 10826 // "description": "Patches an object's metadata.", 10827 // "httpMethod": "PATCH", 10828 // "id": "storage.objects.patch", 10829 // "parameterOrder": [ 10830 // "bucket", 10831 // "object" 10832 // ], 10833 // "parameters": { 10834 // "bucket": { 10835 // "description": "Name of the bucket in which the object resides.", 10836 // "location": "path", 10837 // "required": true, 10838 // "type": "string" 10839 // }, 10840 // "generation": { 10841 // "description": "If present, selects a specific revision of this object (as opposed to the latest version, the default).", 10842 // "format": "int64", 10843 // "location": "query", 10844 // "type": "string" 10845 // }, 10846 // "ifGenerationMatch": { 10847 // "description": "Makes the operation conditional on whether the object's current generation matches the given value. Setting to 0 makes the operation succeed only if there are no live versions of the object.", 10848 // "format": "int64", 10849 // "location": "query", 10850 // "type": "string" 10851 // }, 10852 // "ifGenerationNotMatch": { 10853 // "description": "Makes the operation conditional on whether the object's current generation does not match the given value. If no live object exists, the precondition fails. Setting to 0 makes the operation succeed only if there is a live version of the object.", 10854 // "format": "int64", 10855 // "location": "query", 10856 // "type": "string" 10857 // }, 10858 // "ifMetagenerationMatch": { 10859 // "description": "Makes the operation conditional on whether the object's current metageneration matches the given value.", 10860 // "format": "int64", 10861 // "location": "query", 10862 // "type": "string" 10863 // }, 10864 // "ifMetagenerationNotMatch": { 10865 // "description": "Makes the operation conditional on whether the object's current metageneration does not match the given value.", 10866 // "format": "int64", 10867 // "location": "query", 10868 // "type": "string" 10869 // }, 10870 // "object": { 10871 // "description": "Name of the object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.", 10872 // "location": "path", 10873 // "required": true, 10874 // "type": "string" 10875 // }, 10876 // "predefinedAcl": { 10877 // "description": "Apply a predefined set of access controls to this object.", 10878 // "enum": [ 10879 // "authenticatedRead", 10880 // "bucketOwnerFullControl", 10881 // "bucketOwnerRead", 10882 // "private", 10883 // "projectPrivate", 10884 // "publicRead" 10885 // ], 10886 // "enumDescriptions": [ 10887 // "Object owner gets OWNER access, and allAuthenticatedUsers get READER access.", 10888 // "Object owner gets OWNER access, and project team owners get OWNER access.", 10889 // "Object owner gets OWNER access, and project team owners get READER access.", 10890 // "Object owner gets OWNER access.", 10891 // "Object owner gets OWNER access, and project team members get access according to their roles.", 10892 // "Object owner gets OWNER access, and allUsers get READER access." 10893 // ], 10894 // "location": "query", 10895 // "type": "string" 10896 // }, 10897 // "projection": { 10898 // "description": "Set of properties to return. Defaults to full.", 10899 // "enum": [ 10900 // "full", 10901 // "noAcl" 10902 // ], 10903 // "enumDescriptions": [ 10904 // "Include all properties.", 10905 // "Omit the owner, acl property." 10906 // ], 10907 // "location": "query", 10908 // "type": "string" 10909 // }, 10910 // "provisionalUserProject": { 10911 // "description": "The project to be billed for this request if the target bucket is requester-pays bucket.", 10912 // "location": "query", 10913 // "type": "string" 10914 // }, 10915 // "userProject": { 10916 // "description": "The project to be billed for this request, for Requester Pays buckets.", 10917 // "location": "query", 10918 // "type": "string" 10919 // } 10920 // }, 10921 // "path": "b/{bucket}/o/{object}", 10922 // "request": { 10923 // "$ref": "Object" 10924 // }, 10925 // "response": { 10926 // "$ref": "Object" 10927 // }, 10928 // "scopes": [ 10929 // "https://www.googleapis.com/auth/cloud-platform", 10930 // "https://www.googleapis.com/auth/devstorage.full_control" 10931 // ] 10932 // } 10933 10934} 10935 10936// method id "storage.objects.rewrite": 10937 10938type ObjectsRewriteCall struct { 10939 s *Service 10940 sourceBucket string 10941 sourceObject string 10942 destinationBucket string 10943 destinationObject string 10944 object *Object 10945 urlParams_ gensupport.URLParams 10946 ctx_ context.Context 10947 header_ http.Header 10948} 10949 10950// Rewrite: Rewrites a source object to a destination object. Optionally 10951// overrides metadata. 10952func (r *ObjectsService) Rewrite(sourceBucket string, sourceObject string, destinationBucket string, destinationObject string, object *Object) *ObjectsRewriteCall { 10953 c := &ObjectsRewriteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 10954 c.sourceBucket = sourceBucket 10955 c.sourceObject = sourceObject 10956 c.destinationBucket = destinationBucket 10957 c.destinationObject = destinationObject 10958 c.object = object 10959 return c 10960} 10961 10962// DestinationKmsKeyName sets the optional parameter 10963// "destinationKmsKeyName": Resource name of the Cloud KMS key, of the 10964// form 10965// projects/my-project/locations/global/keyRings/my-kr/cryptoKeys/my-key, 10966// that will be used to encrypt the object. Overrides the object 10967// metadata's kms_key_name value, if any. 10968func (c *ObjectsRewriteCall) DestinationKmsKeyName(destinationKmsKeyName string) *ObjectsRewriteCall { 10969 c.urlParams_.Set("destinationKmsKeyName", destinationKmsKeyName) 10970 return c 10971} 10972 10973// DestinationPredefinedAcl sets the optional parameter 10974// "destinationPredefinedAcl": Apply a predefined set of access controls 10975// to the destination object. 10976// 10977// Possible values: 10978// "authenticatedRead" - Object owner gets OWNER access, and 10979// allAuthenticatedUsers get READER access. 10980// "bucketOwnerFullControl" - Object owner gets OWNER access, and 10981// project team owners get OWNER access. 10982// "bucketOwnerRead" - Object owner gets OWNER access, and project 10983// team owners get READER access. 10984// "private" - Object owner gets OWNER access. 10985// "projectPrivate" - Object owner gets OWNER access, and project team 10986// members get access according to their roles. 10987// "publicRead" - Object owner gets OWNER access, and allUsers get 10988// READER access. 10989func (c *ObjectsRewriteCall) DestinationPredefinedAcl(destinationPredefinedAcl string) *ObjectsRewriteCall { 10990 c.urlParams_.Set("destinationPredefinedAcl", destinationPredefinedAcl) 10991 return c 10992} 10993 10994// IfGenerationMatch sets the optional parameter "ifGenerationMatch": 10995// Makes the operation conditional on whether the object's current 10996// generation matches the given value. Setting to 0 makes the operation 10997// succeed only if there are no live versions of the object. 10998func (c *ObjectsRewriteCall) IfGenerationMatch(ifGenerationMatch int64) *ObjectsRewriteCall { 10999 c.urlParams_.Set("ifGenerationMatch", fmt.Sprint(ifGenerationMatch)) 11000 return c 11001} 11002 11003// IfGenerationNotMatch sets the optional parameter 11004// "ifGenerationNotMatch": Makes the operation conditional on whether 11005// the object's current generation does not match the given value. If no 11006// live object exists, the precondition fails. Setting to 0 makes the 11007// operation succeed only if there is a live version of the object. 11008func (c *ObjectsRewriteCall) IfGenerationNotMatch(ifGenerationNotMatch int64) *ObjectsRewriteCall { 11009 c.urlParams_.Set("ifGenerationNotMatch", fmt.Sprint(ifGenerationNotMatch)) 11010 return c 11011} 11012 11013// IfMetagenerationMatch sets the optional parameter 11014// "ifMetagenerationMatch": Makes the operation conditional on whether 11015// the destination object's current metageneration matches the given 11016// value. 11017func (c *ObjectsRewriteCall) IfMetagenerationMatch(ifMetagenerationMatch int64) *ObjectsRewriteCall { 11018 c.urlParams_.Set("ifMetagenerationMatch", fmt.Sprint(ifMetagenerationMatch)) 11019 return c 11020} 11021 11022// IfMetagenerationNotMatch sets the optional parameter 11023// "ifMetagenerationNotMatch": Makes the operation conditional on 11024// whether the destination object's current metageneration does not 11025// match the given value. 11026func (c *ObjectsRewriteCall) IfMetagenerationNotMatch(ifMetagenerationNotMatch int64) *ObjectsRewriteCall { 11027 c.urlParams_.Set("ifMetagenerationNotMatch", fmt.Sprint(ifMetagenerationNotMatch)) 11028 return c 11029} 11030 11031// IfSourceGenerationMatch sets the optional parameter 11032// "ifSourceGenerationMatch": Makes the operation conditional on whether 11033// the source object's current generation matches the given value. 11034func (c *ObjectsRewriteCall) IfSourceGenerationMatch(ifSourceGenerationMatch int64) *ObjectsRewriteCall { 11035 c.urlParams_.Set("ifSourceGenerationMatch", fmt.Sprint(ifSourceGenerationMatch)) 11036 return c 11037} 11038 11039// IfSourceGenerationNotMatch sets the optional parameter 11040// "ifSourceGenerationNotMatch": Makes the operation conditional on 11041// whether the source object's current generation does not match the 11042// given value. 11043func (c *ObjectsRewriteCall) IfSourceGenerationNotMatch(ifSourceGenerationNotMatch int64) *ObjectsRewriteCall { 11044 c.urlParams_.Set("ifSourceGenerationNotMatch", fmt.Sprint(ifSourceGenerationNotMatch)) 11045 return c 11046} 11047 11048// IfSourceMetagenerationMatch sets the optional parameter 11049// "ifSourceMetagenerationMatch": Makes the operation conditional on 11050// whether the source object's current metageneration matches the given 11051// value. 11052func (c *ObjectsRewriteCall) IfSourceMetagenerationMatch(ifSourceMetagenerationMatch int64) *ObjectsRewriteCall { 11053 c.urlParams_.Set("ifSourceMetagenerationMatch", fmt.Sprint(ifSourceMetagenerationMatch)) 11054 return c 11055} 11056 11057// IfSourceMetagenerationNotMatch sets the optional parameter 11058// "ifSourceMetagenerationNotMatch": Makes the operation conditional on 11059// whether the source object's current metageneration does not match the 11060// given value. 11061func (c *ObjectsRewriteCall) IfSourceMetagenerationNotMatch(ifSourceMetagenerationNotMatch int64) *ObjectsRewriteCall { 11062 c.urlParams_.Set("ifSourceMetagenerationNotMatch", fmt.Sprint(ifSourceMetagenerationNotMatch)) 11063 return c 11064} 11065 11066// MaxBytesRewrittenPerCall sets the optional parameter 11067// "maxBytesRewrittenPerCall": The maximum number of bytes that will be 11068// rewritten per rewrite request. Most callers shouldn't need to specify 11069// this parameter - it is primarily in place to support testing. If 11070// specified the value must be an integral multiple of 1 MiB (1048576). 11071// Also, this only applies to requests where the source and destination 11072// span locations and/or storage classes. Finally, this value must not 11073// change across rewrite calls else you'll get an error that the 11074// rewriteToken is invalid. 11075func (c *ObjectsRewriteCall) MaxBytesRewrittenPerCall(maxBytesRewrittenPerCall int64) *ObjectsRewriteCall { 11076 c.urlParams_.Set("maxBytesRewrittenPerCall", fmt.Sprint(maxBytesRewrittenPerCall)) 11077 return c 11078} 11079 11080// Projection sets the optional parameter "projection": Set of 11081// properties to return. Defaults to noAcl, unless the object resource 11082// specifies the acl property, when it defaults to full. 11083// 11084// Possible values: 11085// "full" - Include all properties. 11086// "noAcl" - Omit the owner, acl property. 11087func (c *ObjectsRewriteCall) Projection(projection string) *ObjectsRewriteCall { 11088 c.urlParams_.Set("projection", projection) 11089 return c 11090} 11091 11092// ProvisionalUserProject sets the optional parameter 11093// "provisionalUserProject": The project to be billed for this request 11094// if the target bucket is requester-pays bucket. 11095func (c *ObjectsRewriteCall) ProvisionalUserProject(provisionalUserProject string) *ObjectsRewriteCall { 11096 c.urlParams_.Set("provisionalUserProject", provisionalUserProject) 11097 return c 11098} 11099 11100// RewriteToken sets the optional parameter "rewriteToken": Include this 11101// field (from the previous rewrite response) on each rewrite request 11102// after the first one, until the rewrite response 'done' flag is true. 11103// Calls that provide a rewriteToken can omit all other request fields, 11104// but if included those fields must match the values provided in the 11105// first rewrite request. 11106func (c *ObjectsRewriteCall) RewriteToken(rewriteToken string) *ObjectsRewriteCall { 11107 c.urlParams_.Set("rewriteToken", rewriteToken) 11108 return c 11109} 11110 11111// SourceGeneration sets the optional parameter "sourceGeneration": If 11112// present, selects a specific revision of the source object (as opposed 11113// to the latest version, the default). 11114func (c *ObjectsRewriteCall) SourceGeneration(sourceGeneration int64) *ObjectsRewriteCall { 11115 c.urlParams_.Set("sourceGeneration", fmt.Sprint(sourceGeneration)) 11116 return c 11117} 11118 11119// UserProject sets the optional parameter "userProject": The project to 11120// be billed for this request. Required for Requester Pays buckets. 11121func (c *ObjectsRewriteCall) UserProject(userProject string) *ObjectsRewriteCall { 11122 c.urlParams_.Set("userProject", userProject) 11123 return c 11124} 11125 11126// Fields allows partial responses to be retrieved. See 11127// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 11128// for more information. 11129func (c *ObjectsRewriteCall) Fields(s ...googleapi.Field) *ObjectsRewriteCall { 11130 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 11131 return c 11132} 11133 11134// Context sets the context to be used in this call's Do method. Any 11135// pending HTTP request will be aborted if the provided context is 11136// canceled. 11137func (c *ObjectsRewriteCall) Context(ctx context.Context) *ObjectsRewriteCall { 11138 c.ctx_ = ctx 11139 return c 11140} 11141 11142// Header returns an http.Header that can be modified by the caller to 11143// add HTTP headers to the request. 11144func (c *ObjectsRewriteCall) Header() http.Header { 11145 if c.header_ == nil { 11146 c.header_ = make(http.Header) 11147 } 11148 return c.header_ 11149} 11150 11151func (c *ObjectsRewriteCall) doRequest(alt string) (*http.Response, error) { 11152 reqHeaders := make(http.Header) 11153 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") 11154 for k, v := range c.header_ { 11155 reqHeaders[k] = v 11156 } 11157 reqHeaders.Set("User-Agent", c.s.userAgent()) 11158 var body io.Reader = nil 11159 body, err := googleapi.WithoutDataWrapper.JSONReader(c.object) 11160 if err != nil { 11161 return nil, err 11162 } 11163 reqHeaders.Set("Content-Type", "application/json") 11164 c.urlParams_.Set("alt", alt) 11165 c.urlParams_.Set("prettyPrint", "false") 11166 urls := googleapi.ResolveRelative(c.s.BasePath, "b/{sourceBucket}/o/{sourceObject}/rewriteTo/b/{destinationBucket}/o/{destinationObject}") 11167 urls += "?" + c.urlParams_.Encode() 11168 req, err := http.NewRequest("POST", urls, body) 11169 if err != nil { 11170 return nil, err 11171 } 11172 req.Header = reqHeaders 11173 googleapi.Expand(req.URL, map[string]string{ 11174 "sourceBucket": c.sourceBucket, 11175 "sourceObject": c.sourceObject, 11176 "destinationBucket": c.destinationBucket, 11177 "destinationObject": c.destinationObject, 11178 }) 11179 return gensupport.SendRequest(c.ctx_, c.s.client, req) 11180} 11181 11182// Do executes the "storage.objects.rewrite" call. 11183// Exactly one of *RewriteResponse or error will be non-nil. Any non-2xx 11184// status code is an error. Response headers are in either 11185// *RewriteResponse.ServerResponse.Header or (if a response was returned 11186// at all) in error.(*googleapi.Error).Header. Use 11187// googleapi.IsNotModified to check whether the returned error was 11188// because http.StatusNotModified was returned. 11189func (c *ObjectsRewriteCall) Do(opts ...googleapi.CallOption) (*RewriteResponse, error) { 11190 gensupport.SetOptions(c.urlParams_, opts...) 11191 res, err := c.doRequest("json") 11192 if res != nil && res.StatusCode == http.StatusNotModified { 11193 if res.Body != nil { 11194 res.Body.Close() 11195 } 11196 return nil, &googleapi.Error{ 11197 Code: res.StatusCode, 11198 Header: res.Header, 11199 } 11200 } 11201 if err != nil { 11202 return nil, err 11203 } 11204 defer googleapi.CloseBody(res) 11205 if err := googleapi.CheckResponse(res); err != nil { 11206 return nil, err 11207 } 11208 ret := &RewriteResponse{ 11209 ServerResponse: googleapi.ServerResponse{ 11210 Header: res.Header, 11211 HTTPStatusCode: res.StatusCode, 11212 }, 11213 } 11214 target := &ret 11215 if err := gensupport.DecodeResponse(target, res); err != nil { 11216 return nil, err 11217 } 11218 return ret, nil 11219 // { 11220 // "description": "Rewrites a source object to a destination object. Optionally overrides metadata.", 11221 // "httpMethod": "POST", 11222 // "id": "storage.objects.rewrite", 11223 // "parameterOrder": [ 11224 // "sourceBucket", 11225 // "sourceObject", 11226 // "destinationBucket", 11227 // "destinationObject" 11228 // ], 11229 // "parameters": { 11230 // "destinationBucket": { 11231 // "description": "Name of the bucket in which to store the new object. Overrides the provided object metadata's bucket value, if any.", 11232 // "location": "path", 11233 // "required": true, 11234 // "type": "string" 11235 // }, 11236 // "destinationKmsKeyName": { 11237 // "description": "Resource name of the Cloud KMS key, of the form projects/my-project/locations/global/keyRings/my-kr/cryptoKeys/my-key, that will be used to encrypt the object. Overrides the object metadata's kms_key_name value, if any.", 11238 // "location": "query", 11239 // "type": "string" 11240 // }, 11241 // "destinationObject": { 11242 // "description": "Name of the new object. Required when the object metadata is not otherwise provided. Overrides the object metadata's name value, if any. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.", 11243 // "location": "path", 11244 // "required": true, 11245 // "type": "string" 11246 // }, 11247 // "destinationPredefinedAcl": { 11248 // "description": "Apply a predefined set of access controls to the destination object.", 11249 // "enum": [ 11250 // "authenticatedRead", 11251 // "bucketOwnerFullControl", 11252 // "bucketOwnerRead", 11253 // "private", 11254 // "projectPrivate", 11255 // "publicRead" 11256 // ], 11257 // "enumDescriptions": [ 11258 // "Object owner gets OWNER access, and allAuthenticatedUsers get READER access.", 11259 // "Object owner gets OWNER access, and project team owners get OWNER access.", 11260 // "Object owner gets OWNER access, and project team owners get READER access.", 11261 // "Object owner gets OWNER access.", 11262 // "Object owner gets OWNER access, and project team members get access according to their roles.", 11263 // "Object owner gets OWNER access, and allUsers get READER access." 11264 // ], 11265 // "location": "query", 11266 // "type": "string" 11267 // }, 11268 // "ifGenerationMatch": { 11269 // "description": "Makes the operation conditional on whether the object's current generation matches the given value. Setting to 0 makes the operation succeed only if there are no live versions of the object.", 11270 // "format": "int64", 11271 // "location": "query", 11272 // "type": "string" 11273 // }, 11274 // "ifGenerationNotMatch": { 11275 // "description": "Makes the operation conditional on whether the object's current generation does not match the given value. If no live object exists, the precondition fails. Setting to 0 makes the operation succeed only if there is a live version of the object.", 11276 // "format": "int64", 11277 // "location": "query", 11278 // "type": "string" 11279 // }, 11280 // "ifMetagenerationMatch": { 11281 // "description": "Makes the operation conditional on whether the destination object's current metageneration matches the given value.", 11282 // "format": "int64", 11283 // "location": "query", 11284 // "type": "string" 11285 // }, 11286 // "ifMetagenerationNotMatch": { 11287 // "description": "Makes the operation conditional on whether the destination object's current metageneration does not match the given value.", 11288 // "format": "int64", 11289 // "location": "query", 11290 // "type": "string" 11291 // }, 11292 // "ifSourceGenerationMatch": { 11293 // "description": "Makes the operation conditional on whether the source object's current generation matches the given value.", 11294 // "format": "int64", 11295 // "location": "query", 11296 // "type": "string" 11297 // }, 11298 // "ifSourceGenerationNotMatch": { 11299 // "description": "Makes the operation conditional on whether the source object's current generation does not match the given value.", 11300 // "format": "int64", 11301 // "location": "query", 11302 // "type": "string" 11303 // }, 11304 // "ifSourceMetagenerationMatch": { 11305 // "description": "Makes the operation conditional on whether the source object's current metageneration matches the given value.", 11306 // "format": "int64", 11307 // "location": "query", 11308 // "type": "string" 11309 // }, 11310 // "ifSourceMetagenerationNotMatch": { 11311 // "description": "Makes the operation conditional on whether the source object's current metageneration does not match the given value.", 11312 // "format": "int64", 11313 // "location": "query", 11314 // "type": "string" 11315 // }, 11316 // "maxBytesRewrittenPerCall": { 11317 // "description": "The maximum number of bytes that will be rewritten per rewrite request. Most callers shouldn't need to specify this parameter - it is primarily in place to support testing. If specified the value must be an integral multiple of 1 MiB (1048576). Also, this only applies to requests where the source and destination span locations and/or storage classes. Finally, this value must not change across rewrite calls else you'll get an error that the rewriteToken is invalid.", 11318 // "format": "int64", 11319 // "location": "query", 11320 // "type": "string" 11321 // }, 11322 // "projection": { 11323 // "description": "Set of properties to return. Defaults to noAcl, unless the object resource specifies the acl property, when it defaults to full.", 11324 // "enum": [ 11325 // "full", 11326 // "noAcl" 11327 // ], 11328 // "enumDescriptions": [ 11329 // "Include all properties.", 11330 // "Omit the owner, acl property." 11331 // ], 11332 // "location": "query", 11333 // "type": "string" 11334 // }, 11335 // "provisionalUserProject": { 11336 // "description": "The project to be billed for this request if the target bucket is requester-pays bucket.", 11337 // "location": "query", 11338 // "type": "string" 11339 // }, 11340 // "rewriteToken": { 11341 // "description": "Include this field (from the previous rewrite response) on each rewrite request after the first one, until the rewrite response 'done' flag is true. Calls that provide a rewriteToken can omit all other request fields, but if included those fields must match the values provided in the first rewrite request.", 11342 // "location": "query", 11343 // "type": "string" 11344 // }, 11345 // "sourceBucket": { 11346 // "description": "Name of the bucket in which to find the source object.", 11347 // "location": "path", 11348 // "required": true, 11349 // "type": "string" 11350 // }, 11351 // "sourceGeneration": { 11352 // "description": "If present, selects a specific revision of the source object (as opposed to the latest version, the default).", 11353 // "format": "int64", 11354 // "location": "query", 11355 // "type": "string" 11356 // }, 11357 // "sourceObject": { 11358 // "description": "Name of the source object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.", 11359 // "location": "path", 11360 // "required": true, 11361 // "type": "string" 11362 // }, 11363 // "userProject": { 11364 // "description": "The project to be billed for this request. Required for Requester Pays buckets.", 11365 // "location": "query", 11366 // "type": "string" 11367 // } 11368 // }, 11369 // "path": "b/{sourceBucket}/o/{sourceObject}/rewriteTo/b/{destinationBucket}/o/{destinationObject}", 11370 // "request": { 11371 // "$ref": "Object" 11372 // }, 11373 // "response": { 11374 // "$ref": "RewriteResponse" 11375 // }, 11376 // "scopes": [ 11377 // "https://www.googleapis.com/auth/cloud-platform", 11378 // "https://www.googleapis.com/auth/devstorage.full_control", 11379 // "https://www.googleapis.com/auth/devstorage.read_write" 11380 // ] 11381 // } 11382 11383} 11384 11385// method id "storage.objects.setIamPolicy": 11386 11387type ObjectsSetIamPolicyCall struct { 11388 s *Service 11389 bucket string 11390 object string 11391 policy *Policy 11392 urlParams_ gensupport.URLParams 11393 ctx_ context.Context 11394 header_ http.Header 11395} 11396 11397// SetIamPolicy: Updates an IAM policy for the specified object. 11398func (r *ObjectsService) SetIamPolicy(bucket string, object string, policy *Policy) *ObjectsSetIamPolicyCall { 11399 c := &ObjectsSetIamPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)} 11400 c.bucket = bucket 11401 c.object = object 11402 c.policy = policy 11403 return c 11404} 11405 11406// Generation sets the optional parameter "generation": If present, 11407// selects a specific revision of this object (as opposed to the latest 11408// version, the default). 11409func (c *ObjectsSetIamPolicyCall) Generation(generation int64) *ObjectsSetIamPolicyCall { 11410 c.urlParams_.Set("generation", fmt.Sprint(generation)) 11411 return c 11412} 11413 11414// ProvisionalUserProject sets the optional parameter 11415// "provisionalUserProject": The project to be billed for this request 11416// if the target bucket is requester-pays bucket. 11417func (c *ObjectsSetIamPolicyCall) ProvisionalUserProject(provisionalUserProject string) *ObjectsSetIamPolicyCall { 11418 c.urlParams_.Set("provisionalUserProject", provisionalUserProject) 11419 return c 11420} 11421 11422// UserProject sets the optional parameter "userProject": The project to 11423// be billed for this request. Required for Requester Pays buckets. 11424func (c *ObjectsSetIamPolicyCall) UserProject(userProject string) *ObjectsSetIamPolicyCall { 11425 c.urlParams_.Set("userProject", userProject) 11426 return c 11427} 11428 11429// Fields allows partial responses to be retrieved. See 11430// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 11431// for more information. 11432func (c *ObjectsSetIamPolicyCall) Fields(s ...googleapi.Field) *ObjectsSetIamPolicyCall { 11433 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 11434 return c 11435} 11436 11437// Context sets the context to be used in this call's Do method. Any 11438// pending HTTP request will be aborted if the provided context is 11439// canceled. 11440func (c *ObjectsSetIamPolicyCall) Context(ctx context.Context) *ObjectsSetIamPolicyCall { 11441 c.ctx_ = ctx 11442 return c 11443} 11444 11445// Header returns an http.Header that can be modified by the caller to 11446// add HTTP headers to the request. 11447func (c *ObjectsSetIamPolicyCall) Header() http.Header { 11448 if c.header_ == nil { 11449 c.header_ = make(http.Header) 11450 } 11451 return c.header_ 11452} 11453 11454func (c *ObjectsSetIamPolicyCall) doRequest(alt string) (*http.Response, error) { 11455 reqHeaders := make(http.Header) 11456 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") 11457 for k, v := range c.header_ { 11458 reqHeaders[k] = v 11459 } 11460 reqHeaders.Set("User-Agent", c.s.userAgent()) 11461 var body io.Reader = nil 11462 body, err := googleapi.WithoutDataWrapper.JSONReader(c.policy) 11463 if err != nil { 11464 return nil, err 11465 } 11466 reqHeaders.Set("Content-Type", "application/json") 11467 c.urlParams_.Set("alt", alt) 11468 c.urlParams_.Set("prettyPrint", "false") 11469 urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o/{object}/iam") 11470 urls += "?" + c.urlParams_.Encode() 11471 req, err := http.NewRequest("PUT", urls, body) 11472 if err != nil { 11473 return nil, err 11474 } 11475 req.Header = reqHeaders 11476 googleapi.Expand(req.URL, map[string]string{ 11477 "bucket": c.bucket, 11478 "object": c.object, 11479 }) 11480 return gensupport.SendRequest(c.ctx_, c.s.client, req) 11481} 11482 11483// Do executes the "storage.objects.setIamPolicy" call. 11484// Exactly one of *Policy or error will be non-nil. Any non-2xx status 11485// code is an error. Response headers are in either 11486// *Policy.ServerResponse.Header or (if a response was returned at all) 11487// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 11488// check whether the returned error was because http.StatusNotModified 11489// was returned. 11490func (c *ObjectsSetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Policy, error) { 11491 gensupport.SetOptions(c.urlParams_, opts...) 11492 res, err := c.doRequest("json") 11493 if res != nil && res.StatusCode == http.StatusNotModified { 11494 if res.Body != nil { 11495 res.Body.Close() 11496 } 11497 return nil, &googleapi.Error{ 11498 Code: res.StatusCode, 11499 Header: res.Header, 11500 } 11501 } 11502 if err != nil { 11503 return nil, err 11504 } 11505 defer googleapi.CloseBody(res) 11506 if err := googleapi.CheckResponse(res); err != nil { 11507 return nil, err 11508 } 11509 ret := &Policy{ 11510 ServerResponse: googleapi.ServerResponse{ 11511 Header: res.Header, 11512 HTTPStatusCode: res.StatusCode, 11513 }, 11514 } 11515 target := &ret 11516 if err := gensupport.DecodeResponse(target, res); err != nil { 11517 return nil, err 11518 } 11519 return ret, nil 11520 // { 11521 // "description": "Updates an IAM policy for the specified object.", 11522 // "httpMethod": "PUT", 11523 // "id": "storage.objects.setIamPolicy", 11524 // "parameterOrder": [ 11525 // "bucket", 11526 // "object" 11527 // ], 11528 // "parameters": { 11529 // "bucket": { 11530 // "description": "Name of the bucket in which the object resides.", 11531 // "location": "path", 11532 // "required": true, 11533 // "type": "string" 11534 // }, 11535 // "generation": { 11536 // "description": "If present, selects a specific revision of this object (as opposed to the latest version, the default).", 11537 // "format": "int64", 11538 // "location": "query", 11539 // "type": "string" 11540 // }, 11541 // "object": { 11542 // "description": "Name of the object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.", 11543 // "location": "path", 11544 // "required": true, 11545 // "type": "string" 11546 // }, 11547 // "provisionalUserProject": { 11548 // "description": "The project to be billed for this request if the target bucket is requester-pays bucket.", 11549 // "location": "query", 11550 // "type": "string" 11551 // }, 11552 // "userProject": { 11553 // "description": "The project to be billed for this request. Required for Requester Pays buckets.", 11554 // "location": "query", 11555 // "type": "string" 11556 // } 11557 // }, 11558 // "path": "b/{bucket}/o/{object}/iam", 11559 // "request": { 11560 // "$ref": "Policy" 11561 // }, 11562 // "response": { 11563 // "$ref": "Policy" 11564 // }, 11565 // "scopes": [ 11566 // "https://www.googleapis.com/auth/cloud-platform", 11567 // "https://www.googleapis.com/auth/devstorage.full_control", 11568 // "https://www.googleapis.com/auth/devstorage.read_write" 11569 // ] 11570 // } 11571 11572} 11573 11574// method id "storage.objects.testIamPermissions": 11575 11576type ObjectsTestIamPermissionsCall struct { 11577 s *Service 11578 bucket string 11579 object string 11580 urlParams_ gensupport.URLParams 11581 ifNoneMatch_ string 11582 ctx_ context.Context 11583 header_ http.Header 11584} 11585 11586// TestIamPermissions: Tests a set of permissions on the given object to 11587// see which, if any, are held by the caller. 11588func (r *ObjectsService) TestIamPermissions(bucket string, object string, permissions []string) *ObjectsTestIamPermissionsCall { 11589 c := &ObjectsTestIamPermissionsCall{s: r.s, urlParams_: make(gensupport.URLParams)} 11590 c.bucket = bucket 11591 c.object = object 11592 c.urlParams_.SetMulti("permissions", append([]string{}, permissions...)) 11593 return c 11594} 11595 11596// Generation sets the optional parameter "generation": If present, 11597// selects a specific revision of this object (as opposed to the latest 11598// version, the default). 11599func (c *ObjectsTestIamPermissionsCall) Generation(generation int64) *ObjectsTestIamPermissionsCall { 11600 c.urlParams_.Set("generation", fmt.Sprint(generation)) 11601 return c 11602} 11603 11604// ProvisionalUserProject sets the optional parameter 11605// "provisionalUserProject": The project to be billed for this request 11606// if the target bucket is requester-pays bucket. 11607func (c *ObjectsTestIamPermissionsCall) ProvisionalUserProject(provisionalUserProject string) *ObjectsTestIamPermissionsCall { 11608 c.urlParams_.Set("provisionalUserProject", provisionalUserProject) 11609 return c 11610} 11611 11612// UserProject sets the optional parameter "userProject": The project to 11613// be billed for this request. Required for Requester Pays buckets. 11614func (c *ObjectsTestIamPermissionsCall) UserProject(userProject string) *ObjectsTestIamPermissionsCall { 11615 c.urlParams_.Set("userProject", userProject) 11616 return c 11617} 11618 11619// Fields allows partial responses to be retrieved. See 11620// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 11621// for more information. 11622func (c *ObjectsTestIamPermissionsCall) Fields(s ...googleapi.Field) *ObjectsTestIamPermissionsCall { 11623 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 11624 return c 11625} 11626 11627// IfNoneMatch sets the optional parameter which makes the operation 11628// fail if the object's ETag matches the given value. This is useful for 11629// getting updates only after the object has changed since the last 11630// request. Use googleapi.IsNotModified to check whether the response 11631// error from Do is the result of In-None-Match. 11632func (c *ObjectsTestIamPermissionsCall) IfNoneMatch(entityTag string) *ObjectsTestIamPermissionsCall { 11633 c.ifNoneMatch_ = entityTag 11634 return c 11635} 11636 11637// Context sets the context to be used in this call's Do method. Any 11638// pending HTTP request will be aborted if the provided context is 11639// canceled. 11640func (c *ObjectsTestIamPermissionsCall) Context(ctx context.Context) *ObjectsTestIamPermissionsCall { 11641 c.ctx_ = ctx 11642 return c 11643} 11644 11645// Header returns an http.Header that can be modified by the caller to 11646// add HTTP headers to the request. 11647func (c *ObjectsTestIamPermissionsCall) Header() http.Header { 11648 if c.header_ == nil { 11649 c.header_ = make(http.Header) 11650 } 11651 return c.header_ 11652} 11653 11654func (c *ObjectsTestIamPermissionsCall) doRequest(alt string) (*http.Response, error) { 11655 reqHeaders := make(http.Header) 11656 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") 11657 for k, v := range c.header_ { 11658 reqHeaders[k] = v 11659 } 11660 reqHeaders.Set("User-Agent", c.s.userAgent()) 11661 if c.ifNoneMatch_ != "" { 11662 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 11663 } 11664 var body io.Reader = nil 11665 c.urlParams_.Set("alt", alt) 11666 c.urlParams_.Set("prettyPrint", "false") 11667 urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o/{object}/iam/testPermissions") 11668 urls += "?" + c.urlParams_.Encode() 11669 req, err := http.NewRequest("GET", urls, body) 11670 if err != nil { 11671 return nil, err 11672 } 11673 req.Header = reqHeaders 11674 googleapi.Expand(req.URL, map[string]string{ 11675 "bucket": c.bucket, 11676 "object": c.object, 11677 }) 11678 return gensupport.SendRequest(c.ctx_, c.s.client, req) 11679} 11680 11681// Do executes the "storage.objects.testIamPermissions" call. 11682// Exactly one of *TestIamPermissionsResponse or error will be non-nil. 11683// Any non-2xx status code is an error. Response headers are in either 11684// *TestIamPermissionsResponse.ServerResponse.Header or (if a response 11685// was returned at all) in error.(*googleapi.Error).Header. Use 11686// googleapi.IsNotModified to check whether the returned error was 11687// because http.StatusNotModified was returned. 11688func (c *ObjectsTestIamPermissionsCall) Do(opts ...googleapi.CallOption) (*TestIamPermissionsResponse, error) { 11689 gensupport.SetOptions(c.urlParams_, opts...) 11690 res, err := c.doRequest("json") 11691 if res != nil && res.StatusCode == http.StatusNotModified { 11692 if res.Body != nil { 11693 res.Body.Close() 11694 } 11695 return nil, &googleapi.Error{ 11696 Code: res.StatusCode, 11697 Header: res.Header, 11698 } 11699 } 11700 if err != nil { 11701 return nil, err 11702 } 11703 defer googleapi.CloseBody(res) 11704 if err := googleapi.CheckResponse(res); err != nil { 11705 return nil, err 11706 } 11707 ret := &TestIamPermissionsResponse{ 11708 ServerResponse: googleapi.ServerResponse{ 11709 Header: res.Header, 11710 HTTPStatusCode: res.StatusCode, 11711 }, 11712 } 11713 target := &ret 11714 if err := gensupport.DecodeResponse(target, res); err != nil { 11715 return nil, err 11716 } 11717 return ret, nil 11718 // { 11719 // "description": "Tests a set of permissions on the given object to see which, if any, are held by the caller.", 11720 // "httpMethod": "GET", 11721 // "id": "storage.objects.testIamPermissions", 11722 // "parameterOrder": [ 11723 // "bucket", 11724 // "object", 11725 // "permissions" 11726 // ], 11727 // "parameters": { 11728 // "bucket": { 11729 // "description": "Name of the bucket in which the object resides.", 11730 // "location": "path", 11731 // "required": true, 11732 // "type": "string" 11733 // }, 11734 // "generation": { 11735 // "description": "If present, selects a specific revision of this object (as opposed to the latest version, the default).", 11736 // "format": "int64", 11737 // "location": "query", 11738 // "type": "string" 11739 // }, 11740 // "object": { 11741 // "description": "Name of the object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.", 11742 // "location": "path", 11743 // "required": true, 11744 // "type": "string" 11745 // }, 11746 // "permissions": { 11747 // "description": "Permissions to test.", 11748 // "location": "query", 11749 // "repeated": true, 11750 // "required": true, 11751 // "type": "string" 11752 // }, 11753 // "provisionalUserProject": { 11754 // "description": "The project to be billed for this request if the target bucket is requester-pays bucket.", 11755 // "location": "query", 11756 // "type": "string" 11757 // }, 11758 // "userProject": { 11759 // "description": "The project to be billed for this request. Required for Requester Pays buckets.", 11760 // "location": "query", 11761 // "type": "string" 11762 // } 11763 // }, 11764 // "path": "b/{bucket}/o/{object}/iam/testPermissions", 11765 // "response": { 11766 // "$ref": "TestIamPermissionsResponse" 11767 // }, 11768 // "scopes": [ 11769 // "https://www.googleapis.com/auth/cloud-platform", 11770 // "https://www.googleapis.com/auth/cloud-platform.read-only", 11771 // "https://www.googleapis.com/auth/devstorage.full_control", 11772 // "https://www.googleapis.com/auth/devstorage.read_only", 11773 // "https://www.googleapis.com/auth/devstorage.read_write" 11774 // ] 11775 // } 11776 11777} 11778 11779// method id "storage.objects.update": 11780 11781type ObjectsUpdateCall struct { 11782 s *Service 11783 bucket string 11784 object string 11785 object2 *Object 11786 urlParams_ gensupport.URLParams 11787 ctx_ context.Context 11788 header_ http.Header 11789} 11790 11791// Update: Updates an object's metadata. 11792func (r *ObjectsService) Update(bucket string, object string, object2 *Object) *ObjectsUpdateCall { 11793 c := &ObjectsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 11794 c.bucket = bucket 11795 c.object = object 11796 c.object2 = object2 11797 return c 11798} 11799 11800// Generation sets the optional parameter "generation": If present, 11801// selects a specific revision of this object (as opposed to the latest 11802// version, the default). 11803func (c *ObjectsUpdateCall) Generation(generation int64) *ObjectsUpdateCall { 11804 c.urlParams_.Set("generation", fmt.Sprint(generation)) 11805 return c 11806} 11807 11808// IfGenerationMatch sets the optional parameter "ifGenerationMatch": 11809// Makes the operation conditional on whether the object's current 11810// generation matches the given value. Setting to 0 makes the operation 11811// succeed only if there are no live versions of the object. 11812func (c *ObjectsUpdateCall) IfGenerationMatch(ifGenerationMatch int64) *ObjectsUpdateCall { 11813 c.urlParams_.Set("ifGenerationMatch", fmt.Sprint(ifGenerationMatch)) 11814 return c 11815} 11816 11817// IfGenerationNotMatch sets the optional parameter 11818// "ifGenerationNotMatch": Makes the operation conditional on whether 11819// the object's current generation does not match the given value. If no 11820// live object exists, the precondition fails. Setting to 0 makes the 11821// operation succeed only if there is a live version of the object. 11822func (c *ObjectsUpdateCall) IfGenerationNotMatch(ifGenerationNotMatch int64) *ObjectsUpdateCall { 11823 c.urlParams_.Set("ifGenerationNotMatch", fmt.Sprint(ifGenerationNotMatch)) 11824 return c 11825} 11826 11827// IfMetagenerationMatch sets the optional parameter 11828// "ifMetagenerationMatch": Makes the operation conditional on whether 11829// the object's current metageneration matches the given value. 11830func (c *ObjectsUpdateCall) IfMetagenerationMatch(ifMetagenerationMatch int64) *ObjectsUpdateCall { 11831 c.urlParams_.Set("ifMetagenerationMatch", fmt.Sprint(ifMetagenerationMatch)) 11832 return c 11833} 11834 11835// IfMetagenerationNotMatch sets the optional parameter 11836// "ifMetagenerationNotMatch": Makes the operation conditional on 11837// whether the object's current metageneration does not match the given 11838// value. 11839func (c *ObjectsUpdateCall) IfMetagenerationNotMatch(ifMetagenerationNotMatch int64) *ObjectsUpdateCall { 11840 c.urlParams_.Set("ifMetagenerationNotMatch", fmt.Sprint(ifMetagenerationNotMatch)) 11841 return c 11842} 11843 11844// PredefinedAcl sets the optional parameter "predefinedAcl": Apply a 11845// predefined set of access controls to this object. 11846// 11847// Possible values: 11848// "authenticatedRead" - Object owner gets OWNER access, and 11849// allAuthenticatedUsers get READER access. 11850// "bucketOwnerFullControl" - Object owner gets OWNER access, and 11851// project team owners get OWNER access. 11852// "bucketOwnerRead" - Object owner gets OWNER access, and project 11853// team owners get READER access. 11854// "private" - Object owner gets OWNER access. 11855// "projectPrivate" - Object owner gets OWNER access, and project team 11856// members get access according to their roles. 11857// "publicRead" - Object owner gets OWNER access, and allUsers get 11858// READER access. 11859func (c *ObjectsUpdateCall) PredefinedAcl(predefinedAcl string) *ObjectsUpdateCall { 11860 c.urlParams_.Set("predefinedAcl", predefinedAcl) 11861 return c 11862} 11863 11864// Projection sets the optional parameter "projection": Set of 11865// properties to return. Defaults to full. 11866// 11867// Possible values: 11868// "full" - Include all properties. 11869// "noAcl" - Omit the owner, acl property. 11870func (c *ObjectsUpdateCall) Projection(projection string) *ObjectsUpdateCall { 11871 c.urlParams_.Set("projection", projection) 11872 return c 11873} 11874 11875// ProvisionalUserProject sets the optional parameter 11876// "provisionalUserProject": The project to be billed for this request 11877// if the target bucket is requester-pays bucket. 11878func (c *ObjectsUpdateCall) ProvisionalUserProject(provisionalUserProject string) *ObjectsUpdateCall { 11879 c.urlParams_.Set("provisionalUserProject", provisionalUserProject) 11880 return c 11881} 11882 11883// UserProject sets the optional parameter "userProject": The project to 11884// be billed for this request. Required for Requester Pays buckets. 11885func (c *ObjectsUpdateCall) UserProject(userProject string) *ObjectsUpdateCall { 11886 c.urlParams_.Set("userProject", userProject) 11887 return c 11888} 11889 11890// Fields allows partial responses to be retrieved. See 11891// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 11892// for more information. 11893func (c *ObjectsUpdateCall) Fields(s ...googleapi.Field) *ObjectsUpdateCall { 11894 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 11895 return c 11896} 11897 11898// Context sets the context to be used in this call's Do method. Any 11899// pending HTTP request will be aborted if the provided context is 11900// canceled. 11901func (c *ObjectsUpdateCall) Context(ctx context.Context) *ObjectsUpdateCall { 11902 c.ctx_ = ctx 11903 return c 11904} 11905 11906// Header returns an http.Header that can be modified by the caller to 11907// add HTTP headers to the request. 11908func (c *ObjectsUpdateCall) Header() http.Header { 11909 if c.header_ == nil { 11910 c.header_ = make(http.Header) 11911 } 11912 return c.header_ 11913} 11914 11915func (c *ObjectsUpdateCall) doRequest(alt string) (*http.Response, error) { 11916 reqHeaders := make(http.Header) 11917 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") 11918 for k, v := range c.header_ { 11919 reqHeaders[k] = v 11920 } 11921 reqHeaders.Set("User-Agent", c.s.userAgent()) 11922 var body io.Reader = nil 11923 body, err := googleapi.WithoutDataWrapper.JSONReader(c.object2) 11924 if err != nil { 11925 return nil, err 11926 } 11927 reqHeaders.Set("Content-Type", "application/json") 11928 c.urlParams_.Set("alt", alt) 11929 c.urlParams_.Set("prettyPrint", "false") 11930 urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o/{object}") 11931 urls += "?" + c.urlParams_.Encode() 11932 req, err := http.NewRequest("PUT", urls, body) 11933 if err != nil { 11934 return nil, err 11935 } 11936 req.Header = reqHeaders 11937 googleapi.Expand(req.URL, map[string]string{ 11938 "bucket": c.bucket, 11939 "object": c.object, 11940 }) 11941 return gensupport.SendRequest(c.ctx_, c.s.client, req) 11942} 11943 11944// Do executes the "storage.objects.update" call. 11945// Exactly one of *Object or error will be non-nil. Any non-2xx status 11946// code is an error. Response headers are in either 11947// *Object.ServerResponse.Header or (if a response was returned at all) 11948// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 11949// check whether the returned error was because http.StatusNotModified 11950// was returned. 11951func (c *ObjectsUpdateCall) Do(opts ...googleapi.CallOption) (*Object, error) { 11952 gensupport.SetOptions(c.urlParams_, opts...) 11953 res, err := c.doRequest("json") 11954 if res != nil && res.StatusCode == http.StatusNotModified { 11955 if res.Body != nil { 11956 res.Body.Close() 11957 } 11958 return nil, &googleapi.Error{ 11959 Code: res.StatusCode, 11960 Header: res.Header, 11961 } 11962 } 11963 if err != nil { 11964 return nil, err 11965 } 11966 defer googleapi.CloseBody(res) 11967 if err := googleapi.CheckResponse(res); err != nil { 11968 return nil, err 11969 } 11970 ret := &Object{ 11971 ServerResponse: googleapi.ServerResponse{ 11972 Header: res.Header, 11973 HTTPStatusCode: res.StatusCode, 11974 }, 11975 } 11976 target := &ret 11977 if err := gensupport.DecodeResponse(target, res); err != nil { 11978 return nil, err 11979 } 11980 return ret, nil 11981 // { 11982 // "description": "Updates an object's metadata.", 11983 // "httpMethod": "PUT", 11984 // "id": "storage.objects.update", 11985 // "parameterOrder": [ 11986 // "bucket", 11987 // "object" 11988 // ], 11989 // "parameters": { 11990 // "bucket": { 11991 // "description": "Name of the bucket in which the object resides.", 11992 // "location": "path", 11993 // "required": true, 11994 // "type": "string" 11995 // }, 11996 // "generation": { 11997 // "description": "If present, selects a specific revision of this object (as opposed to the latest version, the default).", 11998 // "format": "int64", 11999 // "location": "query", 12000 // "type": "string" 12001 // }, 12002 // "ifGenerationMatch": { 12003 // "description": "Makes the operation conditional on whether the object's current generation matches the given value. Setting to 0 makes the operation succeed only if there are no live versions of the object.", 12004 // "format": "int64", 12005 // "location": "query", 12006 // "type": "string" 12007 // }, 12008 // "ifGenerationNotMatch": { 12009 // "description": "Makes the operation conditional on whether the object's current generation does not match the given value. If no live object exists, the precondition fails. Setting to 0 makes the operation succeed only if there is a live version of the object.", 12010 // "format": "int64", 12011 // "location": "query", 12012 // "type": "string" 12013 // }, 12014 // "ifMetagenerationMatch": { 12015 // "description": "Makes the operation conditional on whether the object's current metageneration matches the given value.", 12016 // "format": "int64", 12017 // "location": "query", 12018 // "type": "string" 12019 // }, 12020 // "ifMetagenerationNotMatch": { 12021 // "description": "Makes the operation conditional on whether the object's current metageneration does not match the given value.", 12022 // "format": "int64", 12023 // "location": "query", 12024 // "type": "string" 12025 // }, 12026 // "object": { 12027 // "description": "Name of the object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.", 12028 // "location": "path", 12029 // "required": true, 12030 // "type": "string" 12031 // }, 12032 // "predefinedAcl": { 12033 // "description": "Apply a predefined set of access controls to this object.", 12034 // "enum": [ 12035 // "authenticatedRead", 12036 // "bucketOwnerFullControl", 12037 // "bucketOwnerRead", 12038 // "private", 12039 // "projectPrivate", 12040 // "publicRead" 12041 // ], 12042 // "enumDescriptions": [ 12043 // "Object owner gets OWNER access, and allAuthenticatedUsers get READER access.", 12044 // "Object owner gets OWNER access, and project team owners get OWNER access.", 12045 // "Object owner gets OWNER access, and project team owners get READER access.", 12046 // "Object owner gets OWNER access.", 12047 // "Object owner gets OWNER access, and project team members get access according to their roles.", 12048 // "Object owner gets OWNER access, and allUsers get READER access." 12049 // ], 12050 // "location": "query", 12051 // "type": "string" 12052 // }, 12053 // "projection": { 12054 // "description": "Set of properties to return. Defaults to full.", 12055 // "enum": [ 12056 // "full", 12057 // "noAcl" 12058 // ], 12059 // "enumDescriptions": [ 12060 // "Include all properties.", 12061 // "Omit the owner, acl property." 12062 // ], 12063 // "location": "query", 12064 // "type": "string" 12065 // }, 12066 // "provisionalUserProject": { 12067 // "description": "The project to be billed for this request if the target bucket is requester-pays bucket.", 12068 // "location": "query", 12069 // "type": "string" 12070 // }, 12071 // "userProject": { 12072 // "description": "The project to be billed for this request. Required for Requester Pays buckets.", 12073 // "location": "query", 12074 // "type": "string" 12075 // } 12076 // }, 12077 // "path": "b/{bucket}/o/{object}", 12078 // "request": { 12079 // "$ref": "Object" 12080 // }, 12081 // "response": { 12082 // "$ref": "Object" 12083 // }, 12084 // "scopes": [ 12085 // "https://www.googleapis.com/auth/cloud-platform", 12086 // "https://www.googleapis.com/auth/devstorage.full_control" 12087 // ] 12088 // } 12089 12090} 12091 12092// method id "storage.objects.watchAll": 12093 12094type ObjectsWatchAllCall struct { 12095 s *Service 12096 bucket string 12097 channel *Channel 12098 urlParams_ gensupport.URLParams 12099 ctx_ context.Context 12100 header_ http.Header 12101} 12102 12103// WatchAll: Watch for changes on all objects in a bucket. 12104func (r *ObjectsService) WatchAll(bucket string, channel *Channel) *ObjectsWatchAllCall { 12105 c := &ObjectsWatchAllCall{s: r.s, urlParams_: make(gensupport.URLParams)} 12106 c.bucket = bucket 12107 c.channel = channel 12108 return c 12109} 12110 12111// Delimiter sets the optional parameter "delimiter": Returns results in 12112// a directory-like mode. items will contain only objects whose names, 12113// aside from the prefix, do not contain delimiter. Objects whose names, 12114// aside from the prefix, contain delimiter will have their name, 12115// truncated after the delimiter, returned in prefixes. Duplicate 12116// prefixes are omitted. 12117func (c *ObjectsWatchAllCall) Delimiter(delimiter string) *ObjectsWatchAllCall { 12118 c.urlParams_.Set("delimiter", delimiter) 12119 return c 12120} 12121 12122// EndOffset sets the optional parameter "endOffset": Filter results to 12123// objects whose names are lexicographically before endOffset. If 12124// startOffset is also set, the objects listed will have names between 12125// startOffset (inclusive) and endOffset (exclusive). 12126func (c *ObjectsWatchAllCall) EndOffset(endOffset string) *ObjectsWatchAllCall { 12127 c.urlParams_.Set("endOffset", endOffset) 12128 return c 12129} 12130 12131// IncludeTrailingDelimiter sets the optional parameter 12132// "includeTrailingDelimiter": If true, objects that end in exactly one 12133// instance of delimiter will have their metadata included in items in 12134// addition to prefixes. 12135func (c *ObjectsWatchAllCall) IncludeTrailingDelimiter(includeTrailingDelimiter bool) *ObjectsWatchAllCall { 12136 c.urlParams_.Set("includeTrailingDelimiter", fmt.Sprint(includeTrailingDelimiter)) 12137 return c 12138} 12139 12140// MaxResults sets the optional parameter "maxResults": Maximum number 12141// of items plus prefixes to return in a single page of responses. As 12142// duplicate prefixes are omitted, fewer total results may be returned 12143// than requested. The service will use this parameter or 1,000 items, 12144// whichever is smaller. 12145func (c *ObjectsWatchAllCall) MaxResults(maxResults int64) *ObjectsWatchAllCall { 12146 c.urlParams_.Set("maxResults", fmt.Sprint(maxResults)) 12147 return c 12148} 12149 12150// PageToken sets the optional parameter "pageToken": A 12151// previously-returned page token representing part of the larger set of 12152// results to view. 12153func (c *ObjectsWatchAllCall) PageToken(pageToken string) *ObjectsWatchAllCall { 12154 c.urlParams_.Set("pageToken", pageToken) 12155 return c 12156} 12157 12158// Prefix sets the optional parameter "prefix": Filter results to 12159// objects whose names begin with this prefix. 12160func (c *ObjectsWatchAllCall) Prefix(prefix string) *ObjectsWatchAllCall { 12161 c.urlParams_.Set("prefix", prefix) 12162 return c 12163} 12164 12165// Projection sets the optional parameter "projection": Set of 12166// properties to return. Defaults to noAcl. 12167// 12168// Possible values: 12169// "full" - Include all properties. 12170// "noAcl" - Omit the owner, acl property. 12171func (c *ObjectsWatchAllCall) Projection(projection string) *ObjectsWatchAllCall { 12172 c.urlParams_.Set("projection", projection) 12173 return c 12174} 12175 12176// ProvisionalUserProject sets the optional parameter 12177// "provisionalUserProject": The project to be billed for this request 12178// if the target bucket is requester-pays bucket. 12179func (c *ObjectsWatchAllCall) ProvisionalUserProject(provisionalUserProject string) *ObjectsWatchAllCall { 12180 c.urlParams_.Set("provisionalUserProject", provisionalUserProject) 12181 return c 12182} 12183 12184// StartOffset sets the optional parameter "startOffset": Filter results 12185// to objects whose names are lexicographically equal to or after 12186// startOffset. If endOffset is also set, the objects listed will have 12187// names between startOffset (inclusive) and endOffset (exclusive). 12188func (c *ObjectsWatchAllCall) StartOffset(startOffset string) *ObjectsWatchAllCall { 12189 c.urlParams_.Set("startOffset", startOffset) 12190 return c 12191} 12192 12193// UserProject sets the optional parameter "userProject": The project to 12194// be billed for this request. Required for Requester Pays buckets. 12195func (c *ObjectsWatchAllCall) UserProject(userProject string) *ObjectsWatchAllCall { 12196 c.urlParams_.Set("userProject", userProject) 12197 return c 12198} 12199 12200// Versions sets the optional parameter "versions": If true, lists all 12201// versions of an object as distinct results. The default is false. For 12202// more information, see Object Versioning. 12203func (c *ObjectsWatchAllCall) Versions(versions bool) *ObjectsWatchAllCall { 12204 c.urlParams_.Set("versions", fmt.Sprint(versions)) 12205 return c 12206} 12207 12208// Fields allows partial responses to be retrieved. See 12209// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 12210// for more information. 12211func (c *ObjectsWatchAllCall) Fields(s ...googleapi.Field) *ObjectsWatchAllCall { 12212 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 12213 return c 12214} 12215 12216// Context sets the context to be used in this call's Do method. Any 12217// pending HTTP request will be aborted if the provided context is 12218// canceled. 12219func (c *ObjectsWatchAllCall) Context(ctx context.Context) *ObjectsWatchAllCall { 12220 c.ctx_ = ctx 12221 return c 12222} 12223 12224// Header returns an http.Header that can be modified by the caller to 12225// add HTTP headers to the request. 12226func (c *ObjectsWatchAllCall) Header() http.Header { 12227 if c.header_ == nil { 12228 c.header_ = make(http.Header) 12229 } 12230 return c.header_ 12231} 12232 12233func (c *ObjectsWatchAllCall) doRequest(alt string) (*http.Response, error) { 12234 reqHeaders := make(http.Header) 12235 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") 12236 for k, v := range c.header_ { 12237 reqHeaders[k] = v 12238 } 12239 reqHeaders.Set("User-Agent", c.s.userAgent()) 12240 var body io.Reader = nil 12241 body, err := googleapi.WithoutDataWrapper.JSONReader(c.channel) 12242 if err != nil { 12243 return nil, err 12244 } 12245 reqHeaders.Set("Content-Type", "application/json") 12246 c.urlParams_.Set("alt", alt) 12247 c.urlParams_.Set("prettyPrint", "false") 12248 urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o/watch") 12249 urls += "?" + c.urlParams_.Encode() 12250 req, err := http.NewRequest("POST", urls, body) 12251 if err != nil { 12252 return nil, err 12253 } 12254 req.Header = reqHeaders 12255 googleapi.Expand(req.URL, map[string]string{ 12256 "bucket": c.bucket, 12257 }) 12258 return gensupport.SendRequest(c.ctx_, c.s.client, req) 12259} 12260 12261// Do executes the "storage.objects.watchAll" call. 12262// Exactly one of *Channel or error will be non-nil. Any non-2xx status 12263// code is an error. Response headers are in either 12264// *Channel.ServerResponse.Header or (if a response was returned at all) 12265// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 12266// check whether the returned error was because http.StatusNotModified 12267// was returned. 12268func (c *ObjectsWatchAllCall) Do(opts ...googleapi.CallOption) (*Channel, error) { 12269 gensupport.SetOptions(c.urlParams_, opts...) 12270 res, err := c.doRequest("json") 12271 if res != nil && res.StatusCode == http.StatusNotModified { 12272 if res.Body != nil { 12273 res.Body.Close() 12274 } 12275 return nil, &googleapi.Error{ 12276 Code: res.StatusCode, 12277 Header: res.Header, 12278 } 12279 } 12280 if err != nil { 12281 return nil, err 12282 } 12283 defer googleapi.CloseBody(res) 12284 if err := googleapi.CheckResponse(res); err != nil { 12285 return nil, err 12286 } 12287 ret := &Channel{ 12288 ServerResponse: googleapi.ServerResponse{ 12289 Header: res.Header, 12290 HTTPStatusCode: res.StatusCode, 12291 }, 12292 } 12293 target := &ret 12294 if err := gensupport.DecodeResponse(target, res); err != nil { 12295 return nil, err 12296 } 12297 return ret, nil 12298 // { 12299 // "description": "Watch for changes on all objects in a bucket.", 12300 // "httpMethod": "POST", 12301 // "id": "storage.objects.watchAll", 12302 // "parameterOrder": [ 12303 // "bucket" 12304 // ], 12305 // "parameters": { 12306 // "bucket": { 12307 // "description": "Name of the bucket in which to look for objects.", 12308 // "location": "path", 12309 // "required": true, 12310 // "type": "string" 12311 // }, 12312 // "delimiter": { 12313 // "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.", 12314 // "location": "query", 12315 // "type": "string" 12316 // }, 12317 // "endOffset": { 12318 // "description": "Filter results to objects whose names are lexicographically before endOffset. If startOffset is also set, the objects listed will have names between startOffset (inclusive) and endOffset (exclusive).", 12319 // "location": "query", 12320 // "type": "string" 12321 // }, 12322 // "includeTrailingDelimiter": { 12323 // "description": "If true, objects that end in exactly one instance of delimiter will have their metadata included in items in addition to prefixes.", 12324 // "location": "query", 12325 // "type": "boolean" 12326 // }, 12327 // "maxResults": { 12328 // "default": "1000", 12329 // "description": "Maximum number of items plus prefixes to return in a single page of responses. As duplicate prefixes are omitted, fewer total results may be returned than requested. The service will use this parameter or 1,000 items, whichever is smaller.", 12330 // "format": "uint32", 12331 // "location": "query", 12332 // "minimum": "0", 12333 // "type": "integer" 12334 // }, 12335 // "pageToken": { 12336 // "description": "A previously-returned page token representing part of the larger set of results to view.", 12337 // "location": "query", 12338 // "type": "string" 12339 // }, 12340 // "prefix": { 12341 // "description": "Filter results to objects whose names begin with this prefix.", 12342 // "location": "query", 12343 // "type": "string" 12344 // }, 12345 // "projection": { 12346 // "description": "Set of properties to return. Defaults to noAcl.", 12347 // "enum": [ 12348 // "full", 12349 // "noAcl" 12350 // ], 12351 // "enumDescriptions": [ 12352 // "Include all properties.", 12353 // "Omit the owner, acl property." 12354 // ], 12355 // "location": "query", 12356 // "type": "string" 12357 // }, 12358 // "provisionalUserProject": { 12359 // "description": "The project to be billed for this request if the target bucket is requester-pays bucket.", 12360 // "location": "query", 12361 // "type": "string" 12362 // }, 12363 // "startOffset": { 12364 // "description": "Filter results to objects whose names are lexicographically equal to or after startOffset. If endOffset is also set, the objects listed will have names between startOffset (inclusive) and endOffset (exclusive).", 12365 // "location": "query", 12366 // "type": "string" 12367 // }, 12368 // "userProject": { 12369 // "description": "The project to be billed for this request. Required for Requester Pays buckets.", 12370 // "location": "query", 12371 // "type": "string" 12372 // }, 12373 // "versions": { 12374 // "description": "If true, lists all versions of an object as distinct results. The default is false. For more information, see Object Versioning.", 12375 // "location": "query", 12376 // "type": "boolean" 12377 // } 12378 // }, 12379 // "path": "b/{bucket}/o/watch", 12380 // "request": { 12381 // "$ref": "Channel", 12382 // "parameterName": "resource" 12383 // }, 12384 // "response": { 12385 // "$ref": "Channel" 12386 // }, 12387 // "scopes": [ 12388 // "https://www.googleapis.com/auth/cloud-platform", 12389 // "https://www.googleapis.com/auth/cloud-platform.read-only", 12390 // "https://www.googleapis.com/auth/devstorage.full_control", 12391 // "https://www.googleapis.com/auth/devstorage.read_only", 12392 // "https://www.googleapis.com/auth/devstorage.read_write" 12393 // ], 12394 // "supportsSubscription": true 12395 // } 12396 12397} 12398 12399// method id "storage.projects.hmacKeys.create": 12400 12401type ProjectsHmacKeysCreateCall struct { 12402 s *Service 12403 projectId string 12404 urlParams_ gensupport.URLParams 12405 ctx_ context.Context 12406 header_ http.Header 12407} 12408 12409// Create: Creates a new HMAC key for the specified service account. 12410func (r *ProjectsHmacKeysService) Create(projectId string, serviceAccountEmail string) *ProjectsHmacKeysCreateCall { 12411 c := &ProjectsHmacKeysCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 12412 c.projectId = projectId 12413 c.urlParams_.Set("serviceAccountEmail", serviceAccountEmail) 12414 return c 12415} 12416 12417// UserProject sets the optional parameter "userProject": The project to 12418// be billed for this request. 12419func (c *ProjectsHmacKeysCreateCall) UserProject(userProject string) *ProjectsHmacKeysCreateCall { 12420 c.urlParams_.Set("userProject", userProject) 12421 return c 12422} 12423 12424// Fields allows partial responses to be retrieved. See 12425// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 12426// for more information. 12427func (c *ProjectsHmacKeysCreateCall) Fields(s ...googleapi.Field) *ProjectsHmacKeysCreateCall { 12428 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 12429 return c 12430} 12431 12432// Context sets the context to be used in this call's Do method. Any 12433// pending HTTP request will be aborted if the provided context is 12434// canceled. 12435func (c *ProjectsHmacKeysCreateCall) Context(ctx context.Context) *ProjectsHmacKeysCreateCall { 12436 c.ctx_ = ctx 12437 return c 12438} 12439 12440// Header returns an http.Header that can be modified by the caller to 12441// add HTTP headers to the request. 12442func (c *ProjectsHmacKeysCreateCall) Header() http.Header { 12443 if c.header_ == nil { 12444 c.header_ = make(http.Header) 12445 } 12446 return c.header_ 12447} 12448 12449func (c *ProjectsHmacKeysCreateCall) doRequest(alt string) (*http.Response, error) { 12450 reqHeaders := make(http.Header) 12451 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") 12452 for k, v := range c.header_ { 12453 reqHeaders[k] = v 12454 } 12455 reqHeaders.Set("User-Agent", c.s.userAgent()) 12456 var body io.Reader = nil 12457 c.urlParams_.Set("alt", alt) 12458 c.urlParams_.Set("prettyPrint", "false") 12459 urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{projectId}/hmacKeys") 12460 urls += "?" + c.urlParams_.Encode() 12461 req, err := http.NewRequest("POST", urls, body) 12462 if err != nil { 12463 return nil, err 12464 } 12465 req.Header = reqHeaders 12466 googleapi.Expand(req.URL, map[string]string{ 12467 "projectId": c.projectId, 12468 }) 12469 return gensupport.SendRequest(c.ctx_, c.s.client, req) 12470} 12471 12472// Do executes the "storage.projects.hmacKeys.create" call. 12473// Exactly one of *HmacKey or error will be non-nil. Any non-2xx status 12474// code is an error. Response headers are in either 12475// *HmacKey.ServerResponse.Header or (if a response was returned at all) 12476// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 12477// check whether the returned error was because http.StatusNotModified 12478// was returned. 12479func (c *ProjectsHmacKeysCreateCall) Do(opts ...googleapi.CallOption) (*HmacKey, error) { 12480 gensupport.SetOptions(c.urlParams_, opts...) 12481 res, err := c.doRequest("json") 12482 if res != nil && res.StatusCode == http.StatusNotModified { 12483 if res.Body != nil { 12484 res.Body.Close() 12485 } 12486 return nil, &googleapi.Error{ 12487 Code: res.StatusCode, 12488 Header: res.Header, 12489 } 12490 } 12491 if err != nil { 12492 return nil, err 12493 } 12494 defer googleapi.CloseBody(res) 12495 if err := googleapi.CheckResponse(res); err != nil { 12496 return nil, err 12497 } 12498 ret := &HmacKey{ 12499 ServerResponse: googleapi.ServerResponse{ 12500 Header: res.Header, 12501 HTTPStatusCode: res.StatusCode, 12502 }, 12503 } 12504 target := &ret 12505 if err := gensupport.DecodeResponse(target, res); err != nil { 12506 return nil, err 12507 } 12508 return ret, nil 12509 // { 12510 // "description": "Creates a new HMAC key for the specified service account.", 12511 // "httpMethod": "POST", 12512 // "id": "storage.projects.hmacKeys.create", 12513 // "parameterOrder": [ 12514 // "projectId", 12515 // "serviceAccountEmail" 12516 // ], 12517 // "parameters": { 12518 // "projectId": { 12519 // "description": "Project ID owning the service account.", 12520 // "location": "path", 12521 // "required": true, 12522 // "type": "string" 12523 // }, 12524 // "serviceAccountEmail": { 12525 // "description": "Email address of the service account.", 12526 // "location": "query", 12527 // "required": true, 12528 // "type": "string" 12529 // }, 12530 // "userProject": { 12531 // "description": "The project to be billed for this request.", 12532 // "location": "query", 12533 // "type": "string" 12534 // } 12535 // }, 12536 // "path": "projects/{projectId}/hmacKeys", 12537 // "response": { 12538 // "$ref": "HmacKey" 12539 // }, 12540 // "scopes": [ 12541 // "https://www.googleapis.com/auth/cloud-platform", 12542 // "https://www.googleapis.com/auth/devstorage.full_control" 12543 // ] 12544 // } 12545 12546} 12547 12548// method id "storage.projects.hmacKeys.delete": 12549 12550type ProjectsHmacKeysDeleteCall struct { 12551 s *Service 12552 projectId string 12553 accessId string 12554 urlParams_ gensupport.URLParams 12555 ctx_ context.Context 12556 header_ http.Header 12557} 12558 12559// Delete: Deletes an HMAC key. 12560func (r *ProjectsHmacKeysService) Delete(projectId string, accessId string) *ProjectsHmacKeysDeleteCall { 12561 c := &ProjectsHmacKeysDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 12562 c.projectId = projectId 12563 c.accessId = accessId 12564 return c 12565} 12566 12567// UserProject sets the optional parameter "userProject": The project to 12568// be billed for this request. 12569func (c *ProjectsHmacKeysDeleteCall) UserProject(userProject string) *ProjectsHmacKeysDeleteCall { 12570 c.urlParams_.Set("userProject", userProject) 12571 return c 12572} 12573 12574// Fields allows partial responses to be retrieved. See 12575// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 12576// for more information. 12577func (c *ProjectsHmacKeysDeleteCall) Fields(s ...googleapi.Field) *ProjectsHmacKeysDeleteCall { 12578 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 12579 return c 12580} 12581 12582// Context sets the context to be used in this call's Do method. Any 12583// pending HTTP request will be aborted if the provided context is 12584// canceled. 12585func (c *ProjectsHmacKeysDeleteCall) Context(ctx context.Context) *ProjectsHmacKeysDeleteCall { 12586 c.ctx_ = ctx 12587 return c 12588} 12589 12590// Header returns an http.Header that can be modified by the caller to 12591// add HTTP headers to the request. 12592func (c *ProjectsHmacKeysDeleteCall) Header() http.Header { 12593 if c.header_ == nil { 12594 c.header_ = make(http.Header) 12595 } 12596 return c.header_ 12597} 12598 12599func (c *ProjectsHmacKeysDeleteCall) doRequest(alt string) (*http.Response, error) { 12600 reqHeaders := make(http.Header) 12601 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") 12602 for k, v := range c.header_ { 12603 reqHeaders[k] = v 12604 } 12605 reqHeaders.Set("User-Agent", c.s.userAgent()) 12606 var body io.Reader = nil 12607 c.urlParams_.Set("alt", alt) 12608 c.urlParams_.Set("prettyPrint", "false") 12609 urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{projectId}/hmacKeys/{accessId}") 12610 urls += "?" + c.urlParams_.Encode() 12611 req, err := http.NewRequest("DELETE", urls, body) 12612 if err != nil { 12613 return nil, err 12614 } 12615 req.Header = reqHeaders 12616 googleapi.Expand(req.URL, map[string]string{ 12617 "projectId": c.projectId, 12618 "accessId": c.accessId, 12619 }) 12620 return gensupport.SendRequest(c.ctx_, c.s.client, req) 12621} 12622 12623// Do executes the "storage.projects.hmacKeys.delete" call. 12624func (c *ProjectsHmacKeysDeleteCall) Do(opts ...googleapi.CallOption) error { 12625 gensupport.SetOptions(c.urlParams_, opts...) 12626 res, err := c.doRequest("json") 12627 if err != nil { 12628 return err 12629 } 12630 defer googleapi.CloseBody(res) 12631 if err := googleapi.CheckResponse(res); err != nil { 12632 return err 12633 } 12634 return nil 12635 // { 12636 // "description": "Deletes an HMAC key.", 12637 // "httpMethod": "DELETE", 12638 // "id": "storage.projects.hmacKeys.delete", 12639 // "parameterOrder": [ 12640 // "projectId", 12641 // "accessId" 12642 // ], 12643 // "parameters": { 12644 // "accessId": { 12645 // "description": "Name of the HMAC key to be deleted.", 12646 // "location": "path", 12647 // "required": true, 12648 // "type": "string" 12649 // }, 12650 // "projectId": { 12651 // "description": "Project ID owning the requested key", 12652 // "location": "path", 12653 // "required": true, 12654 // "type": "string" 12655 // }, 12656 // "userProject": { 12657 // "description": "The project to be billed for this request.", 12658 // "location": "query", 12659 // "type": "string" 12660 // } 12661 // }, 12662 // "path": "projects/{projectId}/hmacKeys/{accessId}", 12663 // "scopes": [ 12664 // "https://www.googleapis.com/auth/cloud-platform", 12665 // "https://www.googleapis.com/auth/devstorage.full_control", 12666 // "https://www.googleapis.com/auth/devstorage.read_write" 12667 // ] 12668 // } 12669 12670} 12671 12672// method id "storage.projects.hmacKeys.get": 12673 12674type ProjectsHmacKeysGetCall struct { 12675 s *Service 12676 projectId string 12677 accessId string 12678 urlParams_ gensupport.URLParams 12679 ifNoneMatch_ string 12680 ctx_ context.Context 12681 header_ http.Header 12682} 12683 12684// Get: Retrieves an HMAC key's metadata 12685func (r *ProjectsHmacKeysService) Get(projectId string, accessId string) *ProjectsHmacKeysGetCall { 12686 c := &ProjectsHmacKeysGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 12687 c.projectId = projectId 12688 c.accessId = accessId 12689 return c 12690} 12691 12692// UserProject sets the optional parameter "userProject": The project to 12693// be billed for this request. 12694func (c *ProjectsHmacKeysGetCall) UserProject(userProject string) *ProjectsHmacKeysGetCall { 12695 c.urlParams_.Set("userProject", userProject) 12696 return c 12697} 12698 12699// Fields allows partial responses to be retrieved. See 12700// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 12701// for more information. 12702func (c *ProjectsHmacKeysGetCall) Fields(s ...googleapi.Field) *ProjectsHmacKeysGetCall { 12703 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 12704 return c 12705} 12706 12707// IfNoneMatch sets the optional parameter which makes the operation 12708// fail if the object's ETag matches the given value. This is useful for 12709// getting updates only after the object has changed since the last 12710// request. Use googleapi.IsNotModified to check whether the response 12711// error from Do is the result of In-None-Match. 12712func (c *ProjectsHmacKeysGetCall) IfNoneMatch(entityTag string) *ProjectsHmacKeysGetCall { 12713 c.ifNoneMatch_ = entityTag 12714 return c 12715} 12716 12717// Context sets the context to be used in this call's Do method. Any 12718// pending HTTP request will be aborted if the provided context is 12719// canceled. 12720func (c *ProjectsHmacKeysGetCall) Context(ctx context.Context) *ProjectsHmacKeysGetCall { 12721 c.ctx_ = ctx 12722 return c 12723} 12724 12725// Header returns an http.Header that can be modified by the caller to 12726// add HTTP headers to the request. 12727func (c *ProjectsHmacKeysGetCall) Header() http.Header { 12728 if c.header_ == nil { 12729 c.header_ = make(http.Header) 12730 } 12731 return c.header_ 12732} 12733 12734func (c *ProjectsHmacKeysGetCall) doRequest(alt string) (*http.Response, error) { 12735 reqHeaders := make(http.Header) 12736 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") 12737 for k, v := range c.header_ { 12738 reqHeaders[k] = v 12739 } 12740 reqHeaders.Set("User-Agent", c.s.userAgent()) 12741 if c.ifNoneMatch_ != "" { 12742 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 12743 } 12744 var body io.Reader = nil 12745 c.urlParams_.Set("alt", alt) 12746 c.urlParams_.Set("prettyPrint", "false") 12747 urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{projectId}/hmacKeys/{accessId}") 12748 urls += "?" + c.urlParams_.Encode() 12749 req, err := http.NewRequest("GET", urls, body) 12750 if err != nil { 12751 return nil, err 12752 } 12753 req.Header = reqHeaders 12754 googleapi.Expand(req.URL, map[string]string{ 12755 "projectId": c.projectId, 12756 "accessId": c.accessId, 12757 }) 12758 return gensupport.SendRequest(c.ctx_, c.s.client, req) 12759} 12760 12761// Do executes the "storage.projects.hmacKeys.get" call. 12762// Exactly one of *HmacKeyMetadata or error will be non-nil. Any non-2xx 12763// status code is an error. Response headers are in either 12764// *HmacKeyMetadata.ServerResponse.Header or (if a response was returned 12765// at all) in error.(*googleapi.Error).Header. Use 12766// googleapi.IsNotModified to check whether the returned error was 12767// because http.StatusNotModified was returned. 12768func (c *ProjectsHmacKeysGetCall) Do(opts ...googleapi.CallOption) (*HmacKeyMetadata, error) { 12769 gensupport.SetOptions(c.urlParams_, opts...) 12770 res, err := c.doRequest("json") 12771 if res != nil && res.StatusCode == http.StatusNotModified { 12772 if res.Body != nil { 12773 res.Body.Close() 12774 } 12775 return nil, &googleapi.Error{ 12776 Code: res.StatusCode, 12777 Header: res.Header, 12778 } 12779 } 12780 if err != nil { 12781 return nil, err 12782 } 12783 defer googleapi.CloseBody(res) 12784 if err := googleapi.CheckResponse(res); err != nil { 12785 return nil, err 12786 } 12787 ret := &HmacKeyMetadata{ 12788 ServerResponse: googleapi.ServerResponse{ 12789 Header: res.Header, 12790 HTTPStatusCode: res.StatusCode, 12791 }, 12792 } 12793 target := &ret 12794 if err := gensupport.DecodeResponse(target, res); err != nil { 12795 return nil, err 12796 } 12797 return ret, nil 12798 // { 12799 // "description": "Retrieves an HMAC key's metadata", 12800 // "httpMethod": "GET", 12801 // "id": "storage.projects.hmacKeys.get", 12802 // "parameterOrder": [ 12803 // "projectId", 12804 // "accessId" 12805 // ], 12806 // "parameters": { 12807 // "accessId": { 12808 // "description": "Name of the HMAC key.", 12809 // "location": "path", 12810 // "required": true, 12811 // "type": "string" 12812 // }, 12813 // "projectId": { 12814 // "description": "Project ID owning the service account of the requested key.", 12815 // "location": "path", 12816 // "required": true, 12817 // "type": "string" 12818 // }, 12819 // "userProject": { 12820 // "description": "The project to be billed for this request.", 12821 // "location": "query", 12822 // "type": "string" 12823 // } 12824 // }, 12825 // "path": "projects/{projectId}/hmacKeys/{accessId}", 12826 // "response": { 12827 // "$ref": "HmacKeyMetadata" 12828 // }, 12829 // "scopes": [ 12830 // "https://www.googleapis.com/auth/cloud-platform", 12831 // "https://www.googleapis.com/auth/cloud-platform.read-only", 12832 // "https://www.googleapis.com/auth/devstorage.full_control", 12833 // "https://www.googleapis.com/auth/devstorage.read_only" 12834 // ] 12835 // } 12836 12837} 12838 12839// method id "storage.projects.hmacKeys.list": 12840 12841type ProjectsHmacKeysListCall struct { 12842 s *Service 12843 projectId string 12844 urlParams_ gensupport.URLParams 12845 ifNoneMatch_ string 12846 ctx_ context.Context 12847 header_ http.Header 12848} 12849 12850// List: Retrieves a list of HMAC keys matching the criteria. 12851func (r *ProjectsHmacKeysService) List(projectId string) *ProjectsHmacKeysListCall { 12852 c := &ProjectsHmacKeysListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 12853 c.projectId = projectId 12854 return c 12855} 12856 12857// MaxResults sets the optional parameter "maxResults": Maximum number 12858// of items to return in a single page of responses. The service uses 12859// this parameter or 250 items, whichever is smaller. The max number of 12860// items per page will also be limited by the number of distinct service 12861// accounts in the response. If the number of service accounts in a 12862// single response is too high, the page will truncated and a next page 12863// token will be returned. 12864func (c *ProjectsHmacKeysListCall) MaxResults(maxResults int64) *ProjectsHmacKeysListCall { 12865 c.urlParams_.Set("maxResults", fmt.Sprint(maxResults)) 12866 return c 12867} 12868 12869// PageToken sets the optional parameter "pageToken": A 12870// previously-returned page token representing part of the larger set of 12871// results to view. 12872func (c *ProjectsHmacKeysListCall) PageToken(pageToken string) *ProjectsHmacKeysListCall { 12873 c.urlParams_.Set("pageToken", pageToken) 12874 return c 12875} 12876 12877// ServiceAccountEmail sets the optional parameter 12878// "serviceAccountEmail": If present, only keys for the given service 12879// account are returned. 12880func (c *ProjectsHmacKeysListCall) ServiceAccountEmail(serviceAccountEmail string) *ProjectsHmacKeysListCall { 12881 c.urlParams_.Set("serviceAccountEmail", serviceAccountEmail) 12882 return c 12883} 12884 12885// ShowDeletedKeys sets the optional parameter "showDeletedKeys": 12886// Whether or not to show keys in the DELETED state. 12887func (c *ProjectsHmacKeysListCall) ShowDeletedKeys(showDeletedKeys bool) *ProjectsHmacKeysListCall { 12888 c.urlParams_.Set("showDeletedKeys", fmt.Sprint(showDeletedKeys)) 12889 return c 12890} 12891 12892// UserProject sets the optional parameter "userProject": The project to 12893// be billed for this request. 12894func (c *ProjectsHmacKeysListCall) UserProject(userProject string) *ProjectsHmacKeysListCall { 12895 c.urlParams_.Set("userProject", userProject) 12896 return c 12897} 12898 12899// Fields allows partial responses to be retrieved. See 12900// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 12901// for more information. 12902func (c *ProjectsHmacKeysListCall) Fields(s ...googleapi.Field) *ProjectsHmacKeysListCall { 12903 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 12904 return c 12905} 12906 12907// IfNoneMatch sets the optional parameter which makes the operation 12908// fail if the object's ETag matches the given value. This is useful for 12909// getting updates only after the object has changed since the last 12910// request. Use googleapi.IsNotModified to check whether the response 12911// error from Do is the result of In-None-Match. 12912func (c *ProjectsHmacKeysListCall) IfNoneMatch(entityTag string) *ProjectsHmacKeysListCall { 12913 c.ifNoneMatch_ = entityTag 12914 return c 12915} 12916 12917// Context sets the context to be used in this call's Do method. Any 12918// pending HTTP request will be aborted if the provided context is 12919// canceled. 12920func (c *ProjectsHmacKeysListCall) Context(ctx context.Context) *ProjectsHmacKeysListCall { 12921 c.ctx_ = ctx 12922 return c 12923} 12924 12925// Header returns an http.Header that can be modified by the caller to 12926// add HTTP headers to the request. 12927func (c *ProjectsHmacKeysListCall) Header() http.Header { 12928 if c.header_ == nil { 12929 c.header_ = make(http.Header) 12930 } 12931 return c.header_ 12932} 12933 12934func (c *ProjectsHmacKeysListCall) doRequest(alt string) (*http.Response, error) { 12935 reqHeaders := make(http.Header) 12936 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") 12937 for k, v := range c.header_ { 12938 reqHeaders[k] = v 12939 } 12940 reqHeaders.Set("User-Agent", c.s.userAgent()) 12941 if c.ifNoneMatch_ != "" { 12942 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 12943 } 12944 var body io.Reader = nil 12945 c.urlParams_.Set("alt", alt) 12946 c.urlParams_.Set("prettyPrint", "false") 12947 urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{projectId}/hmacKeys") 12948 urls += "?" + c.urlParams_.Encode() 12949 req, err := http.NewRequest("GET", urls, body) 12950 if err != nil { 12951 return nil, err 12952 } 12953 req.Header = reqHeaders 12954 googleapi.Expand(req.URL, map[string]string{ 12955 "projectId": c.projectId, 12956 }) 12957 return gensupport.SendRequest(c.ctx_, c.s.client, req) 12958} 12959 12960// Do executes the "storage.projects.hmacKeys.list" call. 12961// Exactly one of *HmacKeysMetadata or error will be non-nil. Any 12962// non-2xx status code is an error. Response headers are in either 12963// *HmacKeysMetadata.ServerResponse.Header or (if a response was 12964// returned at all) in error.(*googleapi.Error).Header. Use 12965// googleapi.IsNotModified to check whether the returned error was 12966// because http.StatusNotModified was returned. 12967func (c *ProjectsHmacKeysListCall) Do(opts ...googleapi.CallOption) (*HmacKeysMetadata, error) { 12968 gensupport.SetOptions(c.urlParams_, opts...) 12969 res, err := c.doRequest("json") 12970 if res != nil && res.StatusCode == http.StatusNotModified { 12971 if res.Body != nil { 12972 res.Body.Close() 12973 } 12974 return nil, &googleapi.Error{ 12975 Code: res.StatusCode, 12976 Header: res.Header, 12977 } 12978 } 12979 if err != nil { 12980 return nil, err 12981 } 12982 defer googleapi.CloseBody(res) 12983 if err := googleapi.CheckResponse(res); err != nil { 12984 return nil, err 12985 } 12986 ret := &HmacKeysMetadata{ 12987 ServerResponse: googleapi.ServerResponse{ 12988 Header: res.Header, 12989 HTTPStatusCode: res.StatusCode, 12990 }, 12991 } 12992 target := &ret 12993 if err := gensupport.DecodeResponse(target, res); err != nil { 12994 return nil, err 12995 } 12996 return ret, nil 12997 // { 12998 // "description": "Retrieves a list of HMAC keys matching the criteria.", 12999 // "httpMethod": "GET", 13000 // "id": "storage.projects.hmacKeys.list", 13001 // "parameterOrder": [ 13002 // "projectId" 13003 // ], 13004 // "parameters": { 13005 // "maxResults": { 13006 // "default": "250", 13007 // "description": "Maximum number of items to return in a single page of responses. The service uses this parameter or 250 items, whichever is smaller. The max number of items per page will also be limited by the number of distinct service accounts in the response. If the number of service accounts in a single response is too high, the page will truncated and a next page token will be returned.", 13008 // "format": "uint32", 13009 // "location": "query", 13010 // "minimum": "0", 13011 // "type": "integer" 13012 // }, 13013 // "pageToken": { 13014 // "description": "A previously-returned page token representing part of the larger set of results to view.", 13015 // "location": "query", 13016 // "type": "string" 13017 // }, 13018 // "projectId": { 13019 // "description": "Name of the project in which to look for HMAC keys.", 13020 // "location": "path", 13021 // "required": true, 13022 // "type": "string" 13023 // }, 13024 // "serviceAccountEmail": { 13025 // "description": "If present, only keys for the given service account are returned.", 13026 // "location": "query", 13027 // "type": "string" 13028 // }, 13029 // "showDeletedKeys": { 13030 // "description": "Whether or not to show keys in the DELETED state.", 13031 // "location": "query", 13032 // "type": "boolean" 13033 // }, 13034 // "userProject": { 13035 // "description": "The project to be billed for this request.", 13036 // "location": "query", 13037 // "type": "string" 13038 // } 13039 // }, 13040 // "path": "projects/{projectId}/hmacKeys", 13041 // "response": { 13042 // "$ref": "HmacKeysMetadata" 13043 // }, 13044 // "scopes": [ 13045 // "https://www.googleapis.com/auth/cloud-platform", 13046 // "https://www.googleapis.com/auth/cloud-platform.read-only", 13047 // "https://www.googleapis.com/auth/devstorage.full_control", 13048 // "https://www.googleapis.com/auth/devstorage.read_only" 13049 // ] 13050 // } 13051 13052} 13053 13054// Pages invokes f for each page of results. 13055// A non-nil error returned from f will halt the iteration. 13056// The provided context supersedes any context provided to the Context method. 13057func (c *ProjectsHmacKeysListCall) Pages(ctx context.Context, f func(*HmacKeysMetadata) error) error { 13058 c.ctx_ = ctx 13059 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 13060 for { 13061 x, err := c.Do() 13062 if err != nil { 13063 return err 13064 } 13065 if err := f(x); err != nil { 13066 return err 13067 } 13068 if x.NextPageToken == "" { 13069 return nil 13070 } 13071 c.PageToken(x.NextPageToken) 13072 } 13073} 13074 13075// method id "storage.projects.hmacKeys.update": 13076 13077type ProjectsHmacKeysUpdateCall struct { 13078 s *Service 13079 projectId string 13080 accessId string 13081 hmackeymetadata *HmacKeyMetadata 13082 urlParams_ gensupport.URLParams 13083 ctx_ context.Context 13084 header_ http.Header 13085} 13086 13087// Update: Updates the state of an HMAC key. See the HMAC Key resource 13088// descriptor for valid states. 13089func (r *ProjectsHmacKeysService) Update(projectId string, accessId string, hmackeymetadata *HmacKeyMetadata) *ProjectsHmacKeysUpdateCall { 13090 c := &ProjectsHmacKeysUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 13091 c.projectId = projectId 13092 c.accessId = accessId 13093 c.hmackeymetadata = hmackeymetadata 13094 return c 13095} 13096 13097// UserProject sets the optional parameter "userProject": The project to 13098// be billed for this request. 13099func (c *ProjectsHmacKeysUpdateCall) UserProject(userProject string) *ProjectsHmacKeysUpdateCall { 13100 c.urlParams_.Set("userProject", userProject) 13101 return c 13102} 13103 13104// Fields allows partial responses to be retrieved. See 13105// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 13106// for more information. 13107func (c *ProjectsHmacKeysUpdateCall) Fields(s ...googleapi.Field) *ProjectsHmacKeysUpdateCall { 13108 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 13109 return c 13110} 13111 13112// Context sets the context to be used in this call's Do method. Any 13113// pending HTTP request will be aborted if the provided context is 13114// canceled. 13115func (c *ProjectsHmacKeysUpdateCall) Context(ctx context.Context) *ProjectsHmacKeysUpdateCall { 13116 c.ctx_ = ctx 13117 return c 13118} 13119 13120// Header returns an http.Header that can be modified by the caller to 13121// add HTTP headers to the request. 13122func (c *ProjectsHmacKeysUpdateCall) Header() http.Header { 13123 if c.header_ == nil { 13124 c.header_ = make(http.Header) 13125 } 13126 return c.header_ 13127} 13128 13129func (c *ProjectsHmacKeysUpdateCall) doRequest(alt string) (*http.Response, error) { 13130 reqHeaders := make(http.Header) 13131 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") 13132 for k, v := range c.header_ { 13133 reqHeaders[k] = v 13134 } 13135 reqHeaders.Set("User-Agent", c.s.userAgent()) 13136 var body io.Reader = nil 13137 body, err := googleapi.WithoutDataWrapper.JSONReader(c.hmackeymetadata) 13138 if err != nil { 13139 return nil, err 13140 } 13141 reqHeaders.Set("Content-Type", "application/json") 13142 c.urlParams_.Set("alt", alt) 13143 c.urlParams_.Set("prettyPrint", "false") 13144 urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{projectId}/hmacKeys/{accessId}") 13145 urls += "?" + c.urlParams_.Encode() 13146 req, err := http.NewRequest("PUT", urls, body) 13147 if err != nil { 13148 return nil, err 13149 } 13150 req.Header = reqHeaders 13151 googleapi.Expand(req.URL, map[string]string{ 13152 "projectId": c.projectId, 13153 "accessId": c.accessId, 13154 }) 13155 return gensupport.SendRequest(c.ctx_, c.s.client, req) 13156} 13157 13158// Do executes the "storage.projects.hmacKeys.update" call. 13159// Exactly one of *HmacKeyMetadata or error will be non-nil. Any non-2xx 13160// status code is an error. Response headers are in either 13161// *HmacKeyMetadata.ServerResponse.Header or (if a response was returned 13162// at all) in error.(*googleapi.Error).Header. Use 13163// googleapi.IsNotModified to check whether the returned error was 13164// because http.StatusNotModified was returned. 13165func (c *ProjectsHmacKeysUpdateCall) Do(opts ...googleapi.CallOption) (*HmacKeyMetadata, error) { 13166 gensupport.SetOptions(c.urlParams_, opts...) 13167 res, err := c.doRequest("json") 13168 if res != nil && res.StatusCode == http.StatusNotModified { 13169 if res.Body != nil { 13170 res.Body.Close() 13171 } 13172 return nil, &googleapi.Error{ 13173 Code: res.StatusCode, 13174 Header: res.Header, 13175 } 13176 } 13177 if err != nil { 13178 return nil, err 13179 } 13180 defer googleapi.CloseBody(res) 13181 if err := googleapi.CheckResponse(res); err != nil { 13182 return nil, err 13183 } 13184 ret := &HmacKeyMetadata{ 13185 ServerResponse: googleapi.ServerResponse{ 13186 Header: res.Header, 13187 HTTPStatusCode: res.StatusCode, 13188 }, 13189 } 13190 target := &ret 13191 if err := gensupport.DecodeResponse(target, res); err != nil { 13192 return nil, err 13193 } 13194 return ret, nil 13195 // { 13196 // "description": "Updates the state of an HMAC key. See the HMAC Key resource descriptor for valid states.", 13197 // "httpMethod": "PUT", 13198 // "id": "storage.projects.hmacKeys.update", 13199 // "parameterOrder": [ 13200 // "projectId", 13201 // "accessId" 13202 // ], 13203 // "parameters": { 13204 // "accessId": { 13205 // "description": "Name of the HMAC key being updated.", 13206 // "location": "path", 13207 // "required": true, 13208 // "type": "string" 13209 // }, 13210 // "projectId": { 13211 // "description": "Project ID owning the service account of the updated key.", 13212 // "location": "path", 13213 // "required": true, 13214 // "type": "string" 13215 // }, 13216 // "userProject": { 13217 // "description": "The project to be billed for this request.", 13218 // "location": "query", 13219 // "type": "string" 13220 // } 13221 // }, 13222 // "path": "projects/{projectId}/hmacKeys/{accessId}", 13223 // "request": { 13224 // "$ref": "HmacKeyMetadata" 13225 // }, 13226 // "response": { 13227 // "$ref": "HmacKeyMetadata" 13228 // }, 13229 // "scopes": [ 13230 // "https://www.googleapis.com/auth/cloud-platform", 13231 // "https://www.googleapis.com/auth/devstorage.full_control" 13232 // ] 13233 // } 13234 13235} 13236 13237// method id "storage.projects.serviceAccount.get": 13238 13239type ProjectsServiceAccountGetCall struct { 13240 s *Service 13241 projectId string 13242 urlParams_ gensupport.URLParams 13243 ifNoneMatch_ string 13244 ctx_ context.Context 13245 header_ http.Header 13246} 13247 13248// Get: Get the email address of this project's Google Cloud Storage 13249// service account. 13250func (r *ProjectsServiceAccountService) Get(projectId string) *ProjectsServiceAccountGetCall { 13251 c := &ProjectsServiceAccountGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 13252 c.projectId = projectId 13253 return c 13254} 13255 13256// ProvisionalUserProject sets the optional parameter 13257// "provisionalUserProject": The project to be billed for this request 13258// if the target bucket is requester-pays bucket. 13259func (c *ProjectsServiceAccountGetCall) ProvisionalUserProject(provisionalUserProject string) *ProjectsServiceAccountGetCall { 13260 c.urlParams_.Set("provisionalUserProject", provisionalUserProject) 13261 return c 13262} 13263 13264// UserProject sets the optional parameter "userProject": The project to 13265// be billed for this request. 13266func (c *ProjectsServiceAccountGetCall) UserProject(userProject string) *ProjectsServiceAccountGetCall { 13267 c.urlParams_.Set("userProject", userProject) 13268 return c 13269} 13270 13271// Fields allows partial responses to be retrieved. See 13272// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 13273// for more information. 13274func (c *ProjectsServiceAccountGetCall) Fields(s ...googleapi.Field) *ProjectsServiceAccountGetCall { 13275 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 13276 return c 13277} 13278 13279// IfNoneMatch sets the optional parameter which makes the operation 13280// fail if the object's ETag matches the given value. This is useful for 13281// getting updates only after the object has changed since the last 13282// request. Use googleapi.IsNotModified to check whether the response 13283// error from Do is the result of In-None-Match. 13284func (c *ProjectsServiceAccountGetCall) IfNoneMatch(entityTag string) *ProjectsServiceAccountGetCall { 13285 c.ifNoneMatch_ = entityTag 13286 return c 13287} 13288 13289// Context sets the context to be used in this call's Do method. Any 13290// pending HTTP request will be aborted if the provided context is 13291// canceled. 13292func (c *ProjectsServiceAccountGetCall) Context(ctx context.Context) *ProjectsServiceAccountGetCall { 13293 c.ctx_ = ctx 13294 return c 13295} 13296 13297// Header returns an http.Header that can be modified by the caller to 13298// add HTTP headers to the request. 13299func (c *ProjectsServiceAccountGetCall) Header() http.Header { 13300 if c.header_ == nil { 13301 c.header_ = make(http.Header) 13302 } 13303 return c.header_ 13304} 13305 13306func (c *ProjectsServiceAccountGetCall) doRequest(alt string) (*http.Response, error) { 13307 reqHeaders := make(http.Header) 13308 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") 13309 for k, v := range c.header_ { 13310 reqHeaders[k] = v 13311 } 13312 reqHeaders.Set("User-Agent", c.s.userAgent()) 13313 if c.ifNoneMatch_ != "" { 13314 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 13315 } 13316 var body io.Reader = nil 13317 c.urlParams_.Set("alt", alt) 13318 c.urlParams_.Set("prettyPrint", "false") 13319 urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{projectId}/serviceAccount") 13320 urls += "?" + c.urlParams_.Encode() 13321 req, err := http.NewRequest("GET", urls, body) 13322 if err != nil { 13323 return nil, err 13324 } 13325 req.Header = reqHeaders 13326 googleapi.Expand(req.URL, map[string]string{ 13327 "projectId": c.projectId, 13328 }) 13329 return gensupport.SendRequest(c.ctx_, c.s.client, req) 13330} 13331 13332// Do executes the "storage.projects.serviceAccount.get" call. 13333// Exactly one of *ServiceAccount or error will be non-nil. Any non-2xx 13334// status code is an error. Response headers are in either 13335// *ServiceAccount.ServerResponse.Header or (if a response was returned 13336// at all) in error.(*googleapi.Error).Header. Use 13337// googleapi.IsNotModified to check whether the returned error was 13338// because http.StatusNotModified was returned. 13339func (c *ProjectsServiceAccountGetCall) Do(opts ...googleapi.CallOption) (*ServiceAccount, error) { 13340 gensupport.SetOptions(c.urlParams_, opts...) 13341 res, err := c.doRequest("json") 13342 if res != nil && res.StatusCode == http.StatusNotModified { 13343 if res.Body != nil { 13344 res.Body.Close() 13345 } 13346 return nil, &googleapi.Error{ 13347 Code: res.StatusCode, 13348 Header: res.Header, 13349 } 13350 } 13351 if err != nil { 13352 return nil, err 13353 } 13354 defer googleapi.CloseBody(res) 13355 if err := googleapi.CheckResponse(res); err != nil { 13356 return nil, err 13357 } 13358 ret := &ServiceAccount{ 13359 ServerResponse: googleapi.ServerResponse{ 13360 Header: res.Header, 13361 HTTPStatusCode: res.StatusCode, 13362 }, 13363 } 13364 target := &ret 13365 if err := gensupport.DecodeResponse(target, res); err != nil { 13366 return nil, err 13367 } 13368 return ret, nil 13369 // { 13370 // "description": "Get the email address of this project's Google Cloud Storage service account.", 13371 // "httpMethod": "GET", 13372 // "id": "storage.projects.serviceAccount.get", 13373 // "parameterOrder": [ 13374 // "projectId" 13375 // ], 13376 // "parameters": { 13377 // "projectId": { 13378 // "description": "Project ID", 13379 // "location": "path", 13380 // "required": true, 13381 // "type": "string" 13382 // }, 13383 // "provisionalUserProject": { 13384 // "description": "The project to be billed for this request if the target bucket is requester-pays bucket.", 13385 // "location": "query", 13386 // "type": "string" 13387 // }, 13388 // "userProject": { 13389 // "description": "The project to be billed for this request.", 13390 // "location": "query", 13391 // "type": "string" 13392 // } 13393 // }, 13394 // "path": "projects/{projectId}/serviceAccount", 13395 // "response": { 13396 // "$ref": "ServiceAccount" 13397 // }, 13398 // "scopes": [ 13399 // "https://www.googleapis.com/auth/cloud-platform", 13400 // "https://www.googleapis.com/auth/cloud-platform.read-only", 13401 // "https://www.googleapis.com/auth/devstorage.full_control", 13402 // "https://www.googleapis.com/auth/devstorage.read_only", 13403 // "https://www.googleapis.com/auth/devstorage.read_write" 13404 // ] 13405 // } 13406 13407} 13408