You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

11589 lines
410 KiB

  1. // Copyright 2019 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. // Code generated file. DO NOT EDIT.
  5. // Package storage provides access to the Cloud Storage JSON API.
  6. //
  7. // This package is DEPRECATED. Use package cloud.google.com/go/storage instead.
  8. //
  9. // For product documentation, see: https://developers.google.com/storage/docs/json_api/
  10. //
  11. // Creating a client
  12. //
  13. // Usage example:
  14. //
  15. // import "google.golang.org/api/storage/v1"
  16. // ...
  17. // ctx := context.Background()
  18. // storageService, err := storage.NewService(ctx)
  19. //
  20. // In this example, Google Application Default Credentials are used for authentication.
  21. //
  22. // For information on how to create and obtain Application Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials.
  23. //
  24. // Other authentication options
  25. //
  26. // By default, all available scopes (see "Constants") are used to authenticate. To restrict scopes, use option.WithScopes:
  27. //
  28. // storageService, err := storage.NewService(ctx, option.WithScopes(storage.DevstorageReadWriteScope))
  29. //
  30. // To use an API key for authentication (note: some APIs do not support API keys), use option.WithAPIKey:
  31. //
  32. // storageService, err := storage.NewService(ctx, option.WithAPIKey("AIza..."))
  33. //
  34. // To use an OAuth token (e.g., a user token obtained via a three-legged OAuth flow), use option.WithTokenSource:
  35. //
  36. // config := &oauth2.Config{...}
  37. // // ...
  38. // token, err := config.Exchange(ctx, ...)
  39. // storageService, err := storage.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token)))
  40. //
  41. // See https://godoc.org/google.golang.org/api/option/ for details on options.
  42. package storage // import "google.golang.org/api/storage/v1"
  43. import (
  44. "bytes"
  45. "context"
  46. "encoding/json"
  47. "errors"
  48. "fmt"
  49. "io"
  50. "net/http"
  51. "net/url"
  52. "strconv"
  53. "strings"
  54. gensupport "google.golang.org/api/gensupport"
  55. googleapi "google.golang.org/api/googleapi"
  56. option "google.golang.org/api/option"
  57. htransport "google.golang.org/api/transport/http"
  58. )
  59. // Always reference these packages, just in case the auto-generated code
  60. // below doesn't.
  61. var _ = bytes.NewBuffer
  62. var _ = strconv.Itoa
  63. var _ = fmt.Sprintf
  64. var _ = json.NewDecoder
  65. var _ = io.Copy
  66. var _ = url.Parse
  67. var _ = gensupport.MarshalJSON
  68. var _ = googleapi.Version
  69. var _ = errors.New
  70. var _ = strings.Replace
  71. var _ = context.Canceled
  72. const apiId = "storage:v1"
  73. const apiName = "storage"
  74. const apiVersion = "v1"
  75. const basePath = "https://www.googleapis.com/storage/v1/"
  76. // OAuth2 scopes used by this API.
  77. const (
  78. // View and manage your data across Google Cloud Platform services
  79. CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platform"
  80. // View your data across Google Cloud Platform services
  81. CloudPlatformReadOnlyScope = "https://www.googleapis.com/auth/cloud-platform.read-only"
  82. // Manage your data and permissions in Google Cloud Storage
  83. DevstorageFullControlScope = "https://www.googleapis.com/auth/devstorage.full_control"
  84. // View your data in Google Cloud Storage
  85. DevstorageReadOnlyScope = "https://www.googleapis.com/auth/devstorage.read_only"
  86. // Manage your data in Google Cloud Storage
  87. DevstorageReadWriteScope = "https://www.googleapis.com/auth/devstorage.read_write"
  88. )
  89. // NewService creates a new Service.
  90. func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {
  91. scopesOption := option.WithScopes(
  92. "https://www.googleapis.com/auth/cloud-platform",
  93. "https://www.googleapis.com/auth/cloud-platform.read-only",
  94. "https://www.googleapis.com/auth/devstorage.full_control",
  95. "https://www.googleapis.com/auth/devstorage.read_only",
  96. "https://www.googleapis.com/auth/devstorage.read_write",
  97. )
  98. // NOTE: prepend, so we don't override user-specified scopes.
  99. opts = append([]option.ClientOption{scopesOption}, opts...)
  100. client, endpoint, err := htransport.NewClient(ctx, opts...)
  101. if err != nil {
  102. return nil, err
  103. }
  104. s, err := New(client)
  105. if err != nil {
  106. return nil, err
  107. }
  108. if endpoint != "" {
  109. s.BasePath = endpoint
  110. }
  111. return s, nil
  112. }
  113. // New creates a new Service. It uses the provided http.Client for requests.
  114. //
  115. // Deprecated: please use NewService instead.
  116. // To provide a custom HTTP client, use option.WithHTTPClient.
  117. // If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead.
  118. func New(client *http.Client) (*Service, error) {
  119. if client == nil {
  120. return nil, errors.New("client is nil")
  121. }
  122. s := &Service{client: client, BasePath: basePath}
  123. s.BucketAccessControls = NewBucketAccessControlsService(s)
  124. s.Buckets = NewBucketsService(s)
  125. s.Channels = NewChannelsService(s)
  126. s.DefaultObjectAccessControls = NewDefaultObjectAccessControlsService(s)
  127. s.Notifications = NewNotificationsService(s)
  128. s.ObjectAccessControls = NewObjectAccessControlsService(s)
  129. s.Objects = NewObjectsService(s)
  130. s.Projects = NewProjectsService(s)
  131. return s, nil
  132. }
  133. type Service struct {
  134. client *http.Client
  135. BasePath string // API endpoint base URL
  136. UserAgent string // optional additional User-Agent fragment
  137. BucketAccessControls *BucketAccessControlsService
  138. Buckets *BucketsService
  139. Channels *ChannelsService
  140. DefaultObjectAccessControls *DefaultObjectAccessControlsService
  141. Notifications *NotificationsService
  142. ObjectAccessControls *ObjectAccessControlsService
  143. Objects *ObjectsService
  144. Projects *ProjectsService
  145. }
  146. func (s *Service) userAgent() string {
  147. if s.UserAgent == "" {
  148. return googleapi.UserAgent
  149. }
  150. return googleapi.UserAgent + " " + s.UserAgent
  151. }
  152. func NewBucketAccessControlsService(s *Service) *BucketAccessControlsService {
  153. rs := &BucketAccessControlsService{s: s}
  154. return rs
  155. }
  156. type BucketAccessControlsService struct {
  157. s *Service
  158. }
  159. func NewBucketsService(s *Service) *BucketsService {
  160. rs := &BucketsService{s: s}
  161. return rs
  162. }
  163. type BucketsService struct {
  164. s *Service
  165. }
  166. func NewChannelsService(s *Service) *ChannelsService {
  167. rs := &ChannelsService{s: s}
  168. return rs
  169. }
  170. type ChannelsService struct {
  171. s *Service
  172. }
  173. func NewDefaultObjectAccessControlsService(s *Service) *DefaultObjectAccessControlsService {
  174. rs := &DefaultObjectAccessControlsService{s: s}
  175. return rs
  176. }
  177. type DefaultObjectAccessControlsService struct {
  178. s *Service
  179. }
  180. func NewNotificationsService(s *Service) *NotificationsService {
  181. rs := &NotificationsService{s: s}
  182. return rs
  183. }
  184. type NotificationsService struct {
  185. s *Service
  186. }
  187. func NewObjectAccessControlsService(s *Service) *ObjectAccessControlsService {
  188. rs := &ObjectAccessControlsService{s: s}
  189. return rs
  190. }
  191. type ObjectAccessControlsService struct {
  192. s *Service
  193. }
  194. func NewObjectsService(s *Service) *ObjectsService {
  195. rs := &ObjectsService{s: s}
  196. return rs
  197. }
  198. type ObjectsService struct {
  199. s *Service
  200. }
  201. func NewProjectsService(s *Service) *ProjectsService {
  202. rs := &ProjectsService{s: s}
  203. rs.ServiceAccount = NewProjectsServiceAccountService(s)
  204. return rs
  205. }
  206. type ProjectsService struct {
  207. s *Service
  208. ServiceAccount *ProjectsServiceAccountService
  209. }
  210. func NewProjectsServiceAccountService(s *Service) *ProjectsServiceAccountService {
  211. rs := &ProjectsServiceAccountService{s: s}
  212. return rs
  213. }
  214. type ProjectsServiceAccountService struct {
  215. s *Service
  216. }
  217. // Bucket: A bucket.
  218. type Bucket struct {
  219. // Acl: Access controls on the bucket.
  220. Acl []*BucketAccessControl `json:"acl,omitempty"`
  221. // Billing: The bucket's billing configuration.
  222. Billing *BucketBilling `json:"billing,omitempty"`
  223. // Cors: The bucket's Cross-Origin Resource Sharing (CORS)
  224. // configuration.
  225. Cors []*BucketCors `json:"cors,omitempty"`
  226. // DefaultEventBasedHold: The default value for event-based hold on
  227. // newly created objects in this bucket. Event-based hold is a way to
  228. // retain objects indefinitely until an event occurs, signified by the
  229. // hold's release. After being released, such objects will be subject to
  230. // bucket-level retention (if any). One sample use case of this flag is
  231. // for banks to hold loan documents for at least 3 years after loan is
  232. // paid in full. Here, bucket-level retention is 3 years and the event
  233. // is loan being paid in full. In this example, these objects will be
  234. // held intact for any number of years until the event has occurred
  235. // (event-based hold on the object is released) and then 3 more years
  236. // after that. That means retention duration of the objects begins from
  237. // the moment event-based hold transitioned from true to false. Objects
  238. // under event-based hold cannot be deleted, overwritten or archived
  239. // until the hold is removed.
  240. DefaultEventBasedHold bool `json:"defaultEventBasedHold,omitempty"`
  241. // DefaultObjectAcl: Default access controls to apply to new objects
  242. // when no ACL is provided.
  243. DefaultObjectAcl []*ObjectAccessControl `json:"defaultObjectAcl,omitempty"`
  244. // Encryption: Encryption configuration for a bucket.
  245. Encryption *BucketEncryption `json:"encryption,omitempty"`
  246. // Etag: HTTP 1.1 Entity tag for the bucket.
  247. Etag string `json:"etag,omitempty"`
  248. // IamConfiguration: The bucket's IAM configuration.
  249. IamConfiguration *BucketIamConfiguration `json:"iamConfiguration,omitempty"`
  250. // Id: The ID of the bucket. For buckets, the id and name properties are
  251. // the same.
  252. Id string `json:"id,omitempty"`
  253. // Kind: The kind of item this is. For buckets, this is always
  254. // storage#bucket.
  255. Kind string `json:"kind,omitempty"`
  256. // Labels: User-provided labels, in key/value pairs.
  257. Labels map[string]string `json:"labels,omitempty"`
  258. // Lifecycle: The bucket's lifecycle configuration. See lifecycle
  259. // management for more information.
  260. Lifecycle *BucketLifecycle `json:"lifecycle,omitempty"`
  261. // Location: The location of the bucket. Object data for objects in the
  262. // bucket resides in physical storage within this region. Defaults to
  263. // US. See the developer's guide for the authoritative list.
  264. Location string `json:"location,omitempty"`
  265. // Logging: The bucket's logging configuration, which defines the
  266. // destination bucket and optional name prefix for the current bucket's
  267. // logs.
  268. Logging *BucketLogging `json:"logging,omitempty"`
  269. // Metageneration: The metadata generation of this bucket.
  270. Metageneration int64 `json:"metageneration,omitempty,string"`
  271. // Name: The name of the bucket.
  272. Name string `json:"name,omitempty"`
  273. // Owner: The owner of the bucket. This is always the project team's
  274. // owner group.
  275. Owner *BucketOwner `json:"owner,omitempty"`
  276. // ProjectNumber: The project number of the project the bucket belongs
  277. // to.
  278. ProjectNumber uint64 `json:"projectNumber,omitempty,string"`
  279. // RetentionPolicy: The bucket's retention policy. The retention policy
  280. // enforces a minimum retention time for all objects contained in the
  281. // bucket, based on their creation time. Any attempt to overwrite or
  282. // delete objects younger than the retention period will result in a
  283. // PERMISSION_DENIED error. An unlocked retention policy can be modified
  284. // or removed from the bucket via a storage.buckets.update operation. A
  285. // locked retention policy cannot be removed or shortened in duration
  286. // for the lifetime of the bucket. Attempting to remove or decrease
  287. // period of a locked retention policy will result in a
  288. // PERMISSION_DENIED error.
  289. RetentionPolicy *BucketRetentionPolicy `json:"retentionPolicy,omitempty"`
  290. // SelfLink: The URI of this bucket.
  291. SelfLink string `json:"selfLink,omitempty"`
  292. // StorageClass: The bucket's default storage class, used whenever no
  293. // storageClass is specified for a newly-created object. This defines
  294. // how objects in the bucket are stored and determines the SLA and the
  295. // cost of storage. Values include MULTI_REGIONAL, REGIONAL, STANDARD,
  296. // NEARLINE, COLDLINE, and DURABLE_REDUCED_AVAILABILITY. If this value
  297. // is not specified when the bucket is created, it will default to
  298. // STANDARD. For more information, see storage classes.
  299. StorageClass string `json:"storageClass,omitempty"`
  300. // TimeCreated: The creation time of the bucket in RFC 3339 format.
  301. TimeCreated string `json:"timeCreated,omitempty"`
  302. // Updated: The modification time of the bucket in RFC 3339 format.
  303. Updated string `json:"updated,omitempty"`
  304. // Versioning: The bucket's versioning configuration.
  305. Versioning *BucketVersioning `json:"versioning,omitempty"`
  306. // Website: The bucket's website configuration, controlling how the
  307. // service behaves when accessing bucket contents as a web site. See the
  308. // Static Website Examples for more information.
  309. Website *BucketWebsite `json:"website,omitempty"`
  310. // ServerResponse contains the HTTP response code and headers from the
  311. // server.
  312. googleapi.ServerResponse `json:"-"`
  313. // ForceSendFields is a list of field names (e.g. "Acl") to
  314. // unconditionally include in API requests. By default, fields with
  315. // empty values are omitted from API requests. However, any non-pointer,
  316. // non-interface field appearing in ForceSendFields will be sent to the
  317. // server regardless of whether the field is empty or not. This may be
  318. // used to include empty fields in Patch requests.
  319. ForceSendFields []string `json:"-"`
  320. // NullFields is a list of field names (e.g. "Acl") to include in API
  321. // requests with the JSON null value. By default, fields with empty
  322. // values are omitted from API requests. However, any field with an
  323. // empty value appearing in NullFields will be sent to the server as
  324. // null. It is an error if a field in this list has a non-empty value.
  325. // This may be used to include null fields in Patch requests.
  326. NullFields []string `json:"-"`
  327. }
  328. func (s *Bucket) MarshalJSON() ([]byte, error) {
  329. type NoMethod Bucket
  330. raw := NoMethod(*s)
  331. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  332. }
  333. // BucketBilling: The bucket's billing configuration.
  334. type BucketBilling struct {
  335. // RequesterPays: When set to true, Requester Pays is enabled for this
  336. // bucket.
  337. RequesterPays bool `json:"requesterPays,omitempty"`
  338. // ForceSendFields is a list of field names (e.g. "RequesterPays") to
  339. // unconditionally include in API requests. By default, fields with
  340. // empty values are omitted from API requests. However, any non-pointer,
  341. // non-interface field appearing in ForceSendFields will be sent to the
  342. // server regardless of whether the field is empty or not. This may be
  343. // used to include empty fields in Patch requests.
  344. ForceSendFields []string `json:"-"`
  345. // NullFields is a list of field names (e.g. "RequesterPays") to include
  346. // in API requests with the JSON null value. By default, fields with
  347. // empty values are omitted from API requests. However, any field with
  348. // an empty value appearing in NullFields will be sent to the server as
  349. // null. It is an error if a field in this list has a non-empty value.
  350. // This may be used to include null fields in Patch requests.
  351. NullFields []string `json:"-"`
  352. }
  353. func (s *BucketBilling) MarshalJSON() ([]byte, error) {
  354. type NoMethod BucketBilling
  355. raw := NoMethod(*s)
  356. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  357. }
  358. type BucketCors struct {
  359. // MaxAgeSeconds: The value, in seconds, to return in the
  360. // Access-Control-Max-Age header used in preflight responses.
  361. MaxAgeSeconds int64 `json:"maxAgeSeconds,omitempty"`
  362. // Method: The list of HTTP methods on which to include CORS response
  363. // headers, (GET, OPTIONS, POST, etc) Note: "*" is permitted in the list
  364. // of methods, and means "any method".
  365. Method []string `json:"method,omitempty"`
  366. // Origin: The list of Origins eligible to receive CORS response
  367. // headers. Note: "*" is permitted in the list of origins, and means
  368. // "any Origin".
  369. Origin []string `json:"origin,omitempty"`
  370. // ResponseHeader: The list of HTTP headers other than the simple
  371. // response headers to give permission for the user-agent to share
  372. // across domains.
  373. ResponseHeader []string `json:"responseHeader,omitempty"`
  374. // ForceSendFields is a list of field names (e.g. "MaxAgeSeconds") to
  375. // unconditionally include in API requests. By default, fields with
  376. // empty values are omitted from API requests. However, any non-pointer,
  377. // non-interface field appearing in ForceSendFields will be sent to the
  378. // server regardless of whether the field is empty or not. This may be
  379. // used to include empty fields in Patch requests.
  380. ForceSendFields []string `json:"-"`
  381. // NullFields is a list of field names (e.g. "MaxAgeSeconds") to include
  382. // in API requests with the JSON null value. By default, fields with
  383. // empty values are omitted from API requests. However, any field with
  384. // an empty value appearing in NullFields will be sent to the server as
  385. // null. It is an error if a field in this list has a non-empty value.
  386. // This may be used to include null fields in Patch requests.
  387. NullFields []string `json:"-"`
  388. }
  389. func (s *BucketCors) MarshalJSON() ([]byte, error) {
  390. type NoMethod BucketCors
  391. raw := NoMethod(*s)
  392. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  393. }
  394. // BucketEncryption: Encryption configuration for a bucket.
  395. type BucketEncryption struct {
  396. // DefaultKmsKeyName: A Cloud KMS key that will be used to encrypt
  397. // objects inserted into this bucket, if no encryption method is
  398. // specified.
  399. DefaultKmsKeyName string `json:"defaultKmsKeyName,omitempty"`
  400. // ForceSendFields is a list of field names (e.g. "DefaultKmsKeyName")
  401. // to unconditionally include in API requests. By default, fields with
  402. // empty values are omitted from API requests. However, any non-pointer,
  403. // non-interface field appearing in ForceSendFields will be sent to the
  404. // server regardless of whether the field is empty or not. This may be
  405. // used to include empty fields in Patch requests.
  406. ForceSendFields []string `json:"-"`
  407. // NullFields is a list of field names (e.g. "DefaultKmsKeyName") to
  408. // include in API requests with the JSON null value. By default, fields
  409. // with empty values are omitted from API requests. However, any field
  410. // with an empty value appearing in NullFields will be sent to the
  411. // server as null. It is an error if a field in this list has a
  412. // non-empty value. This may be used to include null fields in Patch
  413. // requests.
  414. NullFields []string `json:"-"`
  415. }
  416. func (s *BucketEncryption) MarshalJSON() ([]byte, error) {
  417. type NoMethod BucketEncryption
  418. raw := NoMethod(*s)
  419. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  420. }
  421. // BucketIamConfiguration: The bucket's IAM configuration.
  422. type BucketIamConfiguration struct {
  423. // BucketPolicyOnly: The bucket's Bucket Policy Only configuration.
  424. BucketPolicyOnly *BucketIamConfigurationBucketPolicyOnly `json:"bucketPolicyOnly,omitempty"`
  425. // ForceSendFields is a list of field names (e.g. "BucketPolicyOnly") to
  426. // unconditionally include in API requests. By default, fields with
  427. // empty values are omitted from API requests. However, any non-pointer,
  428. // non-interface field appearing in ForceSendFields will be sent to the
  429. // server regardless of whether the field is empty or not. This may be
  430. // used to include empty fields in Patch requests.
  431. ForceSendFields []string `json:"-"`
  432. // NullFields is a list of field names (e.g. "BucketPolicyOnly") to
  433. // include in API requests with the JSON null value. By default, fields
  434. // with empty values are omitted from API requests. However, any field
  435. // with an empty value appearing in NullFields will be sent to the
  436. // server as null. It is an error if a field in this list has a
  437. // non-empty value. This may be used to include null fields in Patch
  438. // requests.
  439. NullFields []string `json:"-"`
  440. }
  441. func (s *BucketIamConfiguration) MarshalJSON() ([]byte, error) {
  442. type NoMethod BucketIamConfiguration
  443. raw := NoMethod(*s)
  444. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  445. }
  446. // BucketIamConfigurationBucketPolicyOnly: The bucket's Bucket Policy
  447. // Only configuration.
  448. type BucketIamConfigurationBucketPolicyOnly struct {
  449. // Enabled: If set, access checks only use bucket-level IAM policies or
  450. // above.
  451. Enabled bool `json:"enabled,omitempty"`
  452. // LockedTime: The deadline time for changing
  453. // iamConfiguration.bucketPolicyOnly.enabled from true to false in RFC
  454. // 3339 format. iamConfiguration.bucketPolicyOnly.enabled may be changed
  455. // from true to false until the locked time, after which the field is
  456. // immutable.
  457. LockedTime string `json:"lockedTime,omitempty"`
  458. // ForceSendFields is a list of field names (e.g. "Enabled") to
  459. // unconditionally include in API requests. By default, fields with
  460. // empty values are omitted from API requests. However, any non-pointer,
  461. // non-interface field appearing in ForceSendFields will be sent to the
  462. // server regardless of whether the field is empty or not. This may be
  463. // used to include empty fields in Patch requests.
  464. ForceSendFields []string `json:"-"`
  465. // NullFields is a list of field names (e.g. "Enabled") to include in
  466. // API requests with the JSON null value. By default, fields with empty
  467. // values are omitted from API requests. However, any field with an
  468. // empty value appearing in NullFields will be sent to the server as
  469. // null. It is an error if a field in this list has a non-empty value.
  470. // This may be used to include null fields in Patch requests.
  471. NullFields []string `json:"-"`
  472. }
  473. func (s *BucketIamConfigurationBucketPolicyOnly) MarshalJSON() ([]byte, error) {
  474. type NoMethod BucketIamConfigurationBucketPolicyOnly
  475. raw := NoMethod(*s)
  476. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  477. }
  478. // BucketLifecycle: The bucket's lifecycle configuration. See lifecycle
  479. // management for more information.
  480. type BucketLifecycle struct {
  481. // Rule: A lifecycle management rule, which is made of an action to take
  482. // and the condition(s) under which the action will be taken.
  483. Rule []*BucketLifecycleRule `json:"rule,omitempty"`
  484. // ForceSendFields is a list of field names (e.g. "Rule") to
  485. // unconditionally include in API requests. By default, fields with
  486. // empty values are omitted from API requests. However, any non-pointer,
  487. // non-interface field appearing in ForceSendFields will be sent to the
  488. // server regardless of whether the field is empty or not. This may be
  489. // used to include empty fields in Patch requests.
  490. ForceSendFields []string `json:"-"`
  491. // NullFields is a list of field names (e.g. "Rule") to include in API
  492. // requests with the JSON null value. By default, fields with empty
  493. // values are omitted from API requests. However, any field with an
  494. // 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. func (s *BucketLifecycle) MarshalJSON() ([]byte, error) {
  500. type NoMethod BucketLifecycle
  501. raw := NoMethod(*s)
  502. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  503. }
  504. type BucketLifecycleRule struct {
  505. // Action: The action to take.
  506. Action *BucketLifecycleRuleAction `json:"action,omitempty"`
  507. // Condition: The condition(s) under which the action will be taken.
  508. Condition *BucketLifecycleRuleCondition `json:"condition,omitempty"`
  509. // ForceSendFields is a list of field names (e.g. "Action") to
  510. // unconditionally include in API requests. By default, fields with
  511. // empty values are omitted from API requests. However, any non-pointer,
  512. // non-interface field appearing in ForceSendFields will be sent to the
  513. // server regardless of whether the field is empty or not. This may be
  514. // used to include empty fields in Patch requests.
  515. ForceSendFields []string `json:"-"`
  516. // NullFields is a list of field names (e.g. "Action") to include in API
  517. // requests with the JSON null value. By default, fields with empty
  518. // values are omitted from API requests. However, any field with an
  519. // empty value appearing in NullFields will be sent to the server as
  520. // null. It is an error if a field in this list has a non-empty value.
  521. // This may be used to include null fields in Patch requests.
  522. NullFields []string `json:"-"`
  523. }
  524. func (s *BucketLifecycleRule) MarshalJSON() ([]byte, error) {
  525. type NoMethod BucketLifecycleRule
  526. raw := NoMethod(*s)
  527. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  528. }
  529. // BucketLifecycleRuleAction: The action to take.
  530. type BucketLifecycleRuleAction struct {
  531. // StorageClass: Target storage class. Required iff the type of the
  532. // action is SetStorageClass.
  533. StorageClass string `json:"storageClass,omitempty"`
  534. // Type: Type of the action. Currently, only Delete and SetStorageClass
  535. // are supported.
  536. Type string `json:"type,omitempty"`
  537. // ForceSendFields is a list of field names (e.g. "StorageClass") to
  538. // unconditionally include in API requests. By default, fields with
  539. // empty values are omitted from API requests. However, any non-pointer,
  540. // non-interface field appearing in ForceSendFields will be sent to the
  541. // server regardless of whether the field is empty or not. This may be
  542. // used to include empty fields in Patch requests.
  543. ForceSendFields []string `json:"-"`
  544. // NullFields is a list of field names (e.g. "StorageClass") to include
  545. // in API requests with the JSON null value. By default, fields with
  546. // empty values are omitted from API requests. However, any field with
  547. // an empty value appearing in NullFields will be sent to the server as
  548. // null. It is an error if a field in this list has a non-empty value.
  549. // This may be used to include null fields in Patch requests.
  550. NullFields []string `json:"-"`
  551. }
  552. func (s *BucketLifecycleRuleAction) MarshalJSON() ([]byte, error) {
  553. type NoMethod BucketLifecycleRuleAction
  554. raw := NoMethod(*s)
  555. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  556. }
  557. // BucketLifecycleRuleCondition: The condition(s) under which the action
  558. // will be taken.
  559. type BucketLifecycleRuleCondition struct {
  560. // Age: Age of an object (in days). This condition is satisfied when an
  561. // object reaches the specified age.
  562. Age int64 `json:"age,omitempty"`
  563. // CreatedBefore: A date in RFC 3339 format with only the date part (for
  564. // instance, "2013-01-15"). This condition is satisfied when an object
  565. // is created before midnight of the specified date in UTC.
  566. CreatedBefore string `json:"createdBefore,omitempty"`
  567. // IsLive: Relevant only for versioned objects. If the value is true,
  568. // this condition matches live objects; if the value is false, it
  569. // matches archived objects.
  570. IsLive *bool `json:"isLive,omitempty"`
  571. // MatchesPattern: A regular expression that satisfies the RE2 syntax.
  572. // This condition is satisfied when the name of the object matches the
  573. // RE2 pattern. Note: This feature is currently in the "Early Access"
  574. // launch stage and is only available to a whitelisted set of users;
  575. // that means that this feature may be changed in backward-incompatible
  576. // ways and that it is not guaranteed to be released.
  577. MatchesPattern string `json:"matchesPattern,omitempty"`
  578. // MatchesStorageClass: Objects having any of the storage classes
  579. // specified by this condition will be matched. Values include
  580. // MULTI_REGIONAL, REGIONAL, NEARLINE, COLDLINE, STANDARD, and
  581. // DURABLE_REDUCED_AVAILABILITY.
  582. MatchesStorageClass []string `json:"matchesStorageClass,omitempty"`
  583. // NumNewerVersions: Relevant only for versioned objects. If the value
  584. // is N, this condition is satisfied when there are at least N versions
  585. // (including the live version) newer than this version of the object.
  586. NumNewerVersions int64 `json:"numNewerVersions,omitempty"`
  587. // ForceSendFields is a list of field names (e.g. "Age") to
  588. // unconditionally include in API requests. By default, fields with
  589. // empty values are omitted from API requests. However, any non-pointer,
  590. // non-interface field appearing in ForceSendFields will be sent to the
  591. // server regardless of whether the field is empty or not. This may be
  592. // used to include empty fields in Patch requests.
  593. ForceSendFields []string `json:"-"`
  594. // NullFields is a list of field names (e.g. "Age") to include in API
  595. // requests with the JSON null value. By default, fields with empty
  596. // values are omitted from API requests. However, any field with an
  597. // empty value appearing in NullFields will be sent to the server as
  598. // null. It is an error if a field in this list has a non-empty value.
  599. // This may be used to include null fields in Patch requests.
  600. NullFields []string `json:"-"`
  601. }
  602. func (s *BucketLifecycleRuleCondition) MarshalJSON() ([]byte, error) {
  603. type NoMethod BucketLifecycleRuleCondition
  604. raw := NoMethod(*s)
  605. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  606. }
  607. // BucketLogging: The bucket's logging configuration, which defines the
  608. // destination bucket and optional name prefix for the current bucket's
  609. // logs.
  610. type BucketLogging struct {
  611. // LogBucket: The destination bucket where the current bucket's logs
  612. // should be placed.
  613. LogBucket string `json:"logBucket,omitempty"`
  614. // LogObjectPrefix: A prefix for log object names.
  615. LogObjectPrefix string `json:"logObjectPrefix,omitempty"`
  616. // ForceSendFields is a list of field names (e.g. "LogBucket") to
  617. // unconditionally include in API requests. By default, fields with
  618. // empty values are omitted from API requests. However, any non-pointer,
  619. // non-interface field appearing in ForceSendFields will be sent to the
  620. // server regardless of whether the field is empty or not. This may be
  621. // used to include empty fields in Patch requests.
  622. ForceSendFields []string `json:"-"`
  623. // NullFields is a list of field names (e.g. "LogBucket") to include in
  624. // API requests with the JSON null value. By default, fields with empty
  625. // values are omitted from API requests. However, any field with an
  626. // empty value appearing in NullFields will be sent to the server as
  627. // null. It is an error if a field in this list has a non-empty value.
  628. // This may be used to include null fields in Patch requests.
  629. NullFields []string `json:"-"`
  630. }
  631. func (s *BucketLogging) MarshalJSON() ([]byte, error) {
  632. type NoMethod BucketLogging
  633. raw := NoMethod(*s)
  634. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  635. }
  636. // BucketOwner: The owner of the bucket. This is always the project
  637. // team's owner group.
  638. type BucketOwner struct {
  639. // Entity: The entity, in the form project-owner-projectId.
  640. Entity string `json:"entity,omitempty"`
  641. // EntityId: The ID for the entity.
  642. EntityId string `json:"entityId,omitempty"`
  643. // ForceSendFields is a list of field names (e.g. "Entity") to
  644. // unconditionally include in API requests. By default, fields with
  645. // empty values are omitted from API requests. However, any non-pointer,
  646. // non-interface field appearing in ForceSendFields will be sent to the
  647. // server regardless of whether the field is empty or not. This may be
  648. // used to include empty fields in Patch requests.
  649. ForceSendFields []string `json:"-"`
  650. // NullFields is a list of field names (e.g. "Entity") to include in API
  651. // requests with the JSON null value. By default, fields with empty
  652. // values are omitted from API requests. However, any field with an
  653. // empty value appearing in NullFields will be sent to the server as
  654. // null. It is an error if a field in this list has a non-empty value.
  655. // This may be used to include null fields in Patch requests.
  656. NullFields []string `json:"-"`
  657. }
  658. func (s *BucketOwner) MarshalJSON() ([]byte, error) {
  659. type NoMethod BucketOwner
  660. raw := NoMethod(*s)
  661. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  662. }
  663. // BucketRetentionPolicy: The bucket's retention policy. The retention
  664. // policy enforces a minimum retention time for all objects contained in
  665. // the bucket, based on their creation time. Any attempt to overwrite or
  666. // delete objects younger than the retention period will result in a
  667. // PERMISSION_DENIED error. An unlocked retention policy can be modified
  668. // or removed from the bucket via a storage.buckets.update operation. A
  669. // locked retention policy cannot be removed or shortened in duration
  670. // for the lifetime of the bucket. Attempting to remove or decrease
  671. // period of a locked retention policy will result in a
  672. // PERMISSION_DENIED error.
  673. type BucketRetentionPolicy struct {
  674. // EffectiveTime: Server-determined value that indicates the time from
  675. // which policy was enforced and effective. This value is in RFC 3339
  676. // format.
  677. EffectiveTime string `json:"effectiveTime,omitempty"`
  678. // IsLocked: Once locked, an object retention policy cannot be modified.
  679. IsLocked bool `json:"isLocked,omitempty"`
  680. // RetentionPeriod: The duration in seconds that objects need to be
  681. // retained. Retention duration must be greater than zero and less than
  682. // 100 years. Note that enforcement of retention periods less than a day
  683. // is not guaranteed. Such periods should only be used for testing
  684. // purposes.
  685. RetentionPeriod int64 `json:"retentionPeriod,omitempty,string"`
  686. // ForceSendFields is a list of field names (e.g. "EffectiveTime") to
  687. // unconditionally include in API requests. By default, fields with
  688. // empty values are omitted from API requests. However, any non-pointer,
  689. // non-interface field appearing in ForceSendFields will be sent to the
  690. // server regardless of whether the field is empty or not. This may be
  691. // used to include empty fields in Patch requests.
  692. ForceSendFields []string `json:"-"`
  693. // NullFields is a list of field names (e.g. "EffectiveTime") to include
  694. // in API requests with the JSON null value. By default, fields with
  695. // empty values are omitted from API requests. However, any field with
  696. // an empty value appearing in NullFields will be sent to the server as
  697. // null. It is an error if a field in this list has a non-empty value.
  698. // This may be used to include null fields in Patch requests.
  699. NullFields []string `json:"-"`
  700. }
  701. func (s *BucketRetentionPolicy) MarshalJSON() ([]byte, error) {
  702. type NoMethod BucketRetentionPolicy
  703. raw := NoMethod(*s)
  704. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  705. }
  706. // BucketVersioning: The bucket's versioning configuration.
  707. type BucketVersioning struct {
  708. // Enabled: While set to true, versioning is fully enabled for this
  709. // bucket.
  710. Enabled bool `json:"enabled,omitempty"`
  711. // ForceSendFields is a list of field names (e.g. "Enabled") to
  712. // unconditionally include in API requests. By default, fields with
  713. // empty values are omitted from API requests. However, any non-pointer,
  714. // non-interface field appearing in ForceSendFields will be sent to the
  715. // server regardless of whether the field is empty or not. This may be
  716. // used to include empty fields in Patch requests.
  717. ForceSendFields []string `json:"-"`
  718. // NullFields is a list of field names (e.g. "Enabled") to include in
  719. // API requests with the JSON null value. By default, fields with empty
  720. // values are omitted from API requests. However, any field with an
  721. // empty value appearing in NullFields will be sent to the server as
  722. // null. It is an error if a field in this list has a non-empty value.
  723. // This may be used to include null fields in Patch requests.
  724. NullFields []string `json:"-"`
  725. }
  726. func (s *BucketVersioning) MarshalJSON() ([]byte, error) {
  727. type NoMethod BucketVersioning
  728. raw := NoMethod(*s)
  729. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  730. }
  731. // BucketWebsite: The bucket's website configuration, controlling how
  732. // the service behaves when accessing bucket contents as a web site. See
  733. // the Static Website Examples for more information.
  734. type BucketWebsite struct {
  735. // MainPageSuffix: If the requested object path is missing, the service
  736. // will ensure the path has a trailing '/', append this suffix, and
  737. // attempt to retrieve the resulting object. This allows the creation of
  738. // index.html objects to represent directory pages.
  739. MainPageSuffix string `json:"mainPageSuffix,omitempty"`
  740. // NotFoundPage: If the requested object path is missing, and any
  741. // mainPageSuffix object is missing, if applicable, the service will
  742. // return the named object from this bucket as the content for a 404 Not
  743. // Found result.
  744. NotFoundPage string `json:"notFoundPage,omitempty"`
  745. // ForceSendFields is a list of field names (e.g. "MainPageSuffix") to
  746. // unconditionally include in API requests. By default, fields with
  747. // empty values are omitted from API requests. However, any non-pointer,
  748. // non-interface field appearing in ForceSendFields will be sent to the
  749. // server regardless of whether the field is empty or not. This may be
  750. // used to include empty fields in Patch requests.
  751. ForceSendFields []string `json:"-"`
  752. // NullFields is a list of field names (e.g. "MainPageSuffix") to
  753. // include in API requests with the JSON null value. By default, fields
  754. // with empty values are omitted from API requests. However, any field
  755. // with an empty value appearing in NullFields will be sent to the
  756. // server as null. It is an error if a field in this list has a
  757. // non-empty value. This may be used to include null fields in Patch
  758. // requests.
  759. NullFields []string `json:"-"`
  760. }
  761. func (s *BucketWebsite) MarshalJSON() ([]byte, error) {
  762. type NoMethod BucketWebsite
  763. raw := NoMethod(*s)
  764. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  765. }
  766. // BucketAccessControl: An access-control entry.
  767. type BucketAccessControl struct {
  768. // Bucket: The name of the bucket.
  769. Bucket string `json:"bucket,omitempty"`
  770. // Domain: The domain associated with the entity, if any.
  771. Domain string `json:"domain,omitempty"`
  772. // Email: The email address associated with the entity, if any.
  773. Email string `json:"email,omitempty"`
  774. // Entity: The entity holding the permission, in one of the following
  775. // forms:
  776. // - user-userId
  777. // - user-email
  778. // - group-groupId
  779. // - group-email
  780. // - domain-domain
  781. // - project-team-projectId
  782. // - allUsers
  783. // - allAuthenticatedUsers Examples:
  784. // - The user liz@example.com would be user-liz@example.com.
  785. // - The group example@googlegroups.com would be
  786. // group-example@googlegroups.com.
  787. // - To refer to all members of the Google Apps for Business domain
  788. // example.com, the entity would be domain-example.com.
  789. Entity string `json:"entity,omitempty"`
  790. // EntityId: The ID for the entity, if any.
  791. EntityId string `json:"entityId,omitempty"`
  792. // Etag: HTTP 1.1 Entity tag for the access-control entry.
  793. Etag string `json:"etag,omitempty"`
  794. // Id: The ID of the access-control entry.
  795. Id string `json:"id,omitempty"`
  796. // Kind: The kind of item this is. For bucket access control entries,
  797. // this is always storage#bucketAccessControl.
  798. Kind string `json:"kind,omitempty"`
  799. // ProjectTeam: The project team associated with the entity, if any.
  800. ProjectTeam *BucketAccessControlProjectTeam `json:"projectTeam,omitempty"`
  801. // Role: The access permission for the entity.
  802. Role string `json:"role,omitempty"`
  803. // SelfLink: The link to this access-control entry.
  804. SelfLink string `json:"selfLink,omitempty"`
  805. // ServerResponse contains the HTTP response code and headers from the
  806. // server.
  807. googleapi.ServerResponse `json:"-"`
  808. // ForceSendFields is a list of field names (e.g. "Bucket") to
  809. // unconditionally include in API requests. By default, fields with
  810. // empty values are omitted from API requests. However, any non-pointer,
  811. // non-interface field appearing in ForceSendFields will be sent to the
  812. // server regardless of whether the field is empty or not. This may be
  813. // used to include empty fields in Patch requests.
  814. ForceSendFields []string `json:"-"`
  815. // NullFields is a list of field names (e.g. "Bucket") to include in API
  816. // requests with the JSON null value. By default, fields with empty
  817. // values are omitted from API requests. However, any field with an
  818. // empty value appearing in NullFields will be sent to the server as
  819. // null. It is an error if a field in this list has a non-empty value.
  820. // This may be used to include null fields in Patch requests.
  821. NullFields []string `json:"-"`
  822. }
  823. func (s *BucketAccessControl) MarshalJSON() ([]byte, error) {
  824. type NoMethod BucketAccessControl
  825. raw := NoMethod(*s)
  826. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  827. }
  828. // BucketAccessControlProjectTeam: The project team associated with the
  829. // entity, if any.
  830. type BucketAccessControlProjectTeam struct {
  831. // ProjectNumber: The project number.
  832. ProjectNumber string `json:"projectNumber,omitempty"`
  833. // Team: The team.
  834. Team string `json:"team,omitempty"`
  835. // ForceSendFields is a list of field names (e.g. "ProjectNumber") to
  836. // unconditionally include in API requests. By default, fields with
  837. // empty values are omitted from API requests. However, any non-pointer,
  838. // non-interface field appearing in ForceSendFields will be sent to the
  839. // server regardless of whether the field is empty or not. This may be
  840. // used to include empty fields in Patch requests.
  841. ForceSendFields []string `json:"-"`
  842. // NullFields is a list of field names (e.g. "ProjectNumber") to include
  843. // in API requests with the JSON null value. By default, fields with
  844. // empty values are omitted from API requests. However, any field with
  845. // an empty value appearing in NullFields will be sent to the server as
  846. // null. It is an error if a field in this list has a non-empty value.
  847. // This may be used to include null fields in Patch requests.
  848. NullFields []string `json:"-"`
  849. }
  850. func (s *BucketAccessControlProjectTeam) MarshalJSON() ([]byte, error) {
  851. type NoMethod BucketAccessControlProjectTeam
  852. raw := NoMethod(*s)
  853. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  854. }
  855. // BucketAccessControls: An access-control list.
  856. type BucketAccessControls struct {
  857. // Items: The list of items.
  858. Items []*BucketAccessControl `json:"items,omitempty"`
  859. // Kind: The kind of item this is. For lists of bucket access control
  860. // entries, this is always storage#bucketAccessControls.
  861. Kind string `json:"kind,omitempty"`
  862. // ServerResponse contains the HTTP response code and headers from the
  863. // server.
  864. googleapi.ServerResponse `json:"-"`
  865. // ForceSendFields is a list of field names (e.g. "Items") to
  866. // unconditionally include in API requests. By default, fields with
  867. // empty values are omitted from API requests. However, any non-pointer,
  868. // non-interface field appearing in ForceSendFields will be sent to the
  869. // server regardless of whether the field is empty or not. This may be
  870. // used to include empty fields in Patch requests.
  871. ForceSendFields []string `json:"-"`
  872. // NullFields is a list of field names (e.g. "Items") to include in API
  873. // requests with the JSON null value. By default, fields with empty
  874. // values are omitted from API requests. However, any field with an
  875. // empty value appearing in NullFields will be sent to the server as
  876. // null. It is an error if a field in this list has a non-empty value.
  877. // This may be used to include null fields in Patch requests.
  878. NullFields []string `json:"-"`
  879. }
  880. func (s *BucketAccessControls) MarshalJSON() ([]byte, error) {
  881. type NoMethod BucketAccessControls
  882. raw := NoMethod(*s)
  883. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  884. }
  885. // Buckets: A list of buckets.
  886. type Buckets struct {
  887. // Items: The list of items.
  888. Items []*Bucket `json:"items,omitempty"`
  889. // Kind: The kind of item this is. For lists of buckets, this is always
  890. // storage#buckets.
  891. Kind string `json:"kind,omitempty"`
  892. // NextPageToken: The continuation token, used to page through large
  893. // result sets. Provide this value in a subsequent request to return the
  894. // next page of results.
  895. NextPageToken string `json:"nextPageToken,omitempty"`
  896. // ServerResponse contains the HTTP response code and headers from the
  897. // server.
  898. googleapi.ServerResponse `json:"-"`
  899. // ForceSendFields is a list of field names (e.g. "Items") to
  900. // unconditionally include in API requests. By default, fields with
  901. // empty values are omitted from API requests. However, any non-pointer,
  902. // non-interface field appearing in ForceSendFields will be sent to the
  903. // server regardless of whether the field is empty or not. This may be
  904. // used to include empty fields in Patch requests.
  905. ForceSendFields []string `json:"-"`
  906. // NullFields is a list of field names (e.g. "Items") to include in API
  907. // requests with the JSON null value. By default, fields with empty
  908. // values are omitted from API requests. However, any field with an
  909. // empty value appearing in NullFields will be sent to the server as
  910. // null. It is an error if a field in this list has a non-empty value.
  911. // This may be used to include null fields in Patch requests.
  912. NullFields []string `json:"-"`
  913. }
  914. func (s *Buckets) MarshalJSON() ([]byte, error) {
  915. type NoMethod Buckets
  916. raw := NoMethod(*s)
  917. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  918. }
  919. // Channel: An notification channel used to watch for resource changes.
  920. type Channel struct {
  921. // Address: The address where notifications are delivered for this
  922. // channel.
  923. Address string `json:"address,omitempty"`
  924. // Expiration: Date and time of notification channel expiration,
  925. // expressed as a Unix timestamp, in milliseconds. Optional.
  926. Expiration int64 `json:"expiration,omitempty,string"`
  927. // Id: A UUID or similar unique string that identifies this channel.
  928. Id string `json:"id,omitempty"`
  929. // Kind: Identifies this as a notification channel used to watch for
  930. // changes to a resource. Value: the fixed string "api#channel".
  931. Kind string `json:"kind,omitempty"`
  932. // Params: Additional parameters controlling delivery channel behavior.
  933. // Optional.
  934. Params map[string]string `json:"params,omitempty"`
  935. // Payload: A Boolean value to indicate whether payload is wanted.
  936. // Optional.
  937. Payload bool `json:"payload,omitempty"`
  938. // ResourceId: An opaque ID that identifies the resource being watched
  939. // on this channel. Stable across different API versions.
  940. ResourceId string `json:"resourceId,omitempty"`
  941. // ResourceUri: A version-specific identifier for the watched resource.
  942. ResourceUri string `json:"resourceUri,omitempty"`
  943. // Token: An arbitrary string delivered to the target address with each
  944. // notification delivered over this channel. Optional.
  945. Token string `json:"token,omitempty"`
  946. // Type: The type of delivery mechanism used for this channel.
  947. Type string `json:"type,omitempty"`
  948. // ServerResponse contains the HTTP response code and headers from the
  949. // server.
  950. googleapi.ServerResponse `json:"-"`
  951. // ForceSendFields is a list of field names (e.g. "Address") to
  952. // unconditionally include in API requests. By default, fields with
  953. // empty values are omitted from API requests. However, any non-pointer,
  954. // non-interface field appearing in ForceSendFields will be sent to the
  955. // server regardless of whether the field is empty or not. This may be
  956. // used to include empty fields in Patch requests.
  957. ForceSendFields []string `json:"-"`
  958. // NullFields is a list of field names (e.g. "Address") 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. func (s *Channel) MarshalJSON() ([]byte, error) {
  967. type NoMethod Channel
  968. raw := NoMethod(*s)
  969. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  970. }
  971. // ComposeRequest: A Compose request.
  972. type ComposeRequest struct {
  973. // Destination: Properties of the resulting object.
  974. Destination *Object `json:"destination,omitempty"`
  975. // Kind: The kind of item this is.
  976. Kind string `json:"kind,omitempty"`
  977. // SourceObjects: The list of source objects that will be concatenated
  978. // into a single object.
  979. SourceObjects []*ComposeRequestSourceObjects `json:"sourceObjects,omitempty"`
  980. // ForceSendFields is a list of field names (e.g. "Destination") to
  981. // unconditionally include in API requests. By default, fields with
  982. // empty values are omitted from API requests. However, any non-pointer,
  983. // non-interface field appearing in ForceSendFields will be sent to the
  984. // server regardless of whether the field is empty or not. This may be
  985. // used to include empty fields in Patch requests.
  986. ForceSendFields []string `json:"-"`
  987. // NullFields is a list of field names (e.g. "Destination") to include
  988. // in API requests with the JSON null value. By default, fields with
  989. // empty values are omitted from API requests. However, any field with
  990. // an empty value appearing in NullFields will be sent to the server as
  991. // null. It is an error if a field in this list has a non-empty value.
  992. // This may be used to include null fields in Patch requests.
  993. NullFields []string `json:"-"`
  994. }
  995. func (s *ComposeRequest) MarshalJSON() ([]byte, error) {
  996. type NoMethod ComposeRequest
  997. raw := NoMethod(*s)
  998. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  999. }
  1000. type ComposeRequestSourceObjects struct {
  1001. // Generation: The generation of this object to use as the source.
  1002. Generation int64 `json:"generation,omitempty,string"`
  1003. // Name: The source object's name. All source objects must reside in the
  1004. // same bucket.
  1005. Name string `json:"name,omitempty"`
  1006. // ObjectPreconditions: Conditions that must be met for this operation
  1007. // to execute.
  1008. ObjectPreconditions *ComposeRequestSourceObjectsObjectPreconditions `json:"objectPreconditions,omitempty"`
  1009. // ForceSendFields is a list of field names (e.g. "Generation") to
  1010. // unconditionally include in API requests. By default, fields with
  1011. // empty values are omitted from API requests. However, any non-pointer,
  1012. // non-interface field appearing in ForceSendFields will be sent to the
  1013. // server regardless of whether the field is empty or not. This may be
  1014. // used to include empty fields in Patch requests.
  1015. ForceSendFields []string `json:"-"`
  1016. // NullFields is a list of field names (e.g. "Generation") to include in
  1017. // API requests with the JSON null value. By default, fields with empty
  1018. // values are omitted from API requests. However, any field with an
  1019. // empty value appearing in NullFields will be sent to the server as
  1020. // null. It is an error if a field in this list has a non-empty value.
  1021. // This may be used to include null fields in Patch requests.
  1022. NullFields []string `json:"-"`
  1023. }
  1024. func (s *ComposeRequestSourceObjects) MarshalJSON() ([]byte, error) {
  1025. type NoMethod ComposeRequestSourceObjects
  1026. raw := NoMethod(*s)
  1027. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1028. }
  1029. // ComposeRequestSourceObjectsObjectPreconditions: Conditions that must
  1030. // be met for this operation to execute.
  1031. type ComposeRequestSourceObjectsObjectPreconditions struct {
  1032. // IfGenerationMatch: Only perform the composition if the generation of
  1033. // the source object that would be used matches this value. If this
  1034. // value and a generation are both specified, they must be the same
  1035. // value or the call will fail.
  1036. IfGenerationMatch int64 `json:"ifGenerationMatch,omitempty,string"`
  1037. // ForceSendFields is a list of field names (e.g. "IfGenerationMatch")
  1038. // to unconditionally include in API requests. By default, fields with
  1039. // empty values are omitted from API requests. However, any non-pointer,
  1040. // non-interface field appearing in ForceSendFields will be sent to the
  1041. // server regardless of whether the field is empty or not. This may be
  1042. // used to include empty fields in Patch requests.
  1043. ForceSendFields []string `json:"-"`
  1044. // NullFields is a list of field names (e.g. "IfGenerationMatch") to
  1045. // include in API requests with the JSON null value. By default, fields
  1046. // with empty values are omitted from API requests. However, any field
  1047. // with an empty value appearing in NullFields will be sent to the
  1048. // server as null. It is an error if a field in this list has a
  1049. // non-empty value. This may be used to include null fields in Patch
  1050. // requests.
  1051. NullFields []string `json:"-"`
  1052. }
  1053. func (s *ComposeRequestSourceObjectsObjectPreconditions) MarshalJSON() ([]byte, error) {
  1054. type NoMethod ComposeRequestSourceObjectsObjectPreconditions
  1055. raw := NoMethod(*s)
  1056. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1057. }
  1058. // Expr: Represents an expression text. Example: title: "User account
  1059. // presence" description: "Determines whether the request has a user
  1060. // account" expression: "size(request.user) > 0"
  1061. type Expr struct {
  1062. // Description: An optional description of the expression. This is a
  1063. // longer text which describes the expression, e.g. when hovered over it
  1064. // in a UI.
  1065. Description string `json:"description,omitempty"`
  1066. // Expression: Textual representation of an expression in Common
  1067. // Expression Language syntax. The application context of the containing
  1068. // message determines which well-known feature set of CEL is supported.
  1069. Expression string `json:"expression,omitempty"`
  1070. // Kind: The kind of item this is. For storage, this is always
  1071. // storage#expr. This field is ignored on input.
  1072. Kind string `json:"kind,omitempty"`
  1073. // Location: An optional string indicating the location of the
  1074. // expression for error reporting, e.g. a file name and a position in
  1075. // the file.
  1076. Location string `json:"location,omitempty"`
  1077. // Title: An optional title for the expression, i.e. a short string
  1078. // describing its purpose. This can be used e.g. in UIs which allow to
  1079. // enter the expression.
  1080. Title string `json:"title,omitempty"`
  1081. // ForceSendFields is a list of field names (e.g. "Description") to
  1082. // unconditionally include in API requests. By default, fields with
  1083. // empty values are omitted from API requests. However, any non-pointer,
  1084. // non-interface field appearing in ForceSendFields will be sent to the
  1085. // server regardless of whether the field is empty or not. This may be
  1086. // used to include empty fields in Patch requests.
  1087. ForceSendFields []string `json:"-"`
  1088. // NullFields is a list of field names (e.g. "Description") to include
  1089. // in API requests with the JSON null value. By default, fields with
  1090. // empty values are omitted from API requests. However, any field with
  1091. // an empty value appearing in NullFields will be sent to the server as
  1092. // null. It is an error if a field in this list has a non-empty value.
  1093. // This may be used to include null fields in Patch requests.
  1094. NullFields []string `json:"-"`
  1095. }
  1096. func (s *Expr) MarshalJSON() ([]byte, error) {
  1097. type NoMethod Expr
  1098. raw := NoMethod(*s)
  1099. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1100. }
  1101. // Notification: A subscription to receive Google PubSub notifications.
  1102. type Notification struct {
  1103. // CustomAttributes: An optional list of additional attributes to attach
  1104. // to each Cloud PubSub message published for this notification
  1105. // subscription.
  1106. CustomAttributes map[string]string `json:"custom_attributes,omitempty"`
  1107. // Etag: HTTP 1.1 Entity tag for this subscription notification.
  1108. Etag string `json:"etag,omitempty"`
  1109. // EventTypes: If present, only send notifications about listed event
  1110. // types. If empty, sent notifications for all event types.
  1111. EventTypes []string `json:"event_types,omitempty"`
  1112. // Id: The ID of the notification.
  1113. Id string `json:"id,omitempty"`
  1114. // Kind: The kind of item this is. For notifications, this is always
  1115. // storage#notification.
  1116. Kind string `json:"kind,omitempty"`
  1117. // ObjectNamePrefix: If present, only apply this notification
  1118. // configuration to object names that begin with this prefix.
  1119. ObjectNamePrefix string `json:"object_name_prefix,omitempty"`
  1120. // PayloadFormat: The desired content of the Payload.
  1121. PayloadFormat string `json:"payload_format,omitempty"`
  1122. // SelfLink: The canonical URL of this notification.
  1123. SelfLink string `json:"selfLink,omitempty"`
  1124. // Topic: The Cloud PubSub topic to which this subscription publishes.
  1125. // Formatted as:
  1126. // '//pubsub.googleapis.com/projects/{project-identifier}/topics/{my-topi
  1127. // c}'
  1128. Topic string `json:"topic,omitempty"`
  1129. // ServerResponse contains the HTTP response code and headers from the
  1130. // server.
  1131. googleapi.ServerResponse `json:"-"`
  1132. // ForceSendFields is a list of field names (e.g. "CustomAttributes") to
  1133. // unconditionally include in API requests. By default, fields with
  1134. // empty values are omitted from API requests. However, any non-pointer,
  1135. // non-interface field appearing in ForceSendFields will be sent to the
  1136. // server regardless of whether the field is empty or not. This may be
  1137. // used to include empty fields in Patch requests.
  1138. ForceSendFields []string `json:"-"`
  1139. // NullFields is a list of field names (e.g. "CustomAttributes") to
  1140. // include in API requests with the JSON null value. By default, fields
  1141. // with empty values are omitted from API requests. However, any field
  1142. // with an empty value appearing in NullFields will be sent to the
  1143. // server as null. It is an error if a field in this list has a
  1144. // non-empty value. This may be used to include null fields in Patch
  1145. // requests.
  1146. NullFields []string `json:"-"`
  1147. }
  1148. func (s *Notification) MarshalJSON() ([]byte, error) {
  1149. type NoMethod Notification
  1150. raw := NoMethod(*s)
  1151. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1152. }
  1153. // Notifications: A list of notification subscriptions.
  1154. type Notifications struct {
  1155. // Items: The list of items.
  1156. Items []*Notification `json:"items,omitempty"`
  1157. // Kind: The kind of item this is. For lists of notifications, this is
  1158. // always storage#notifications.
  1159. Kind string `json:"kind,omitempty"`
  1160. // ServerResponse contains the HTTP response code and headers from the
  1161. // server.
  1162. googleapi.ServerResponse `json:"-"`
  1163. // ForceSendFields is a list of field names (e.g. "Items") to
  1164. // unconditionally include in API requests. By default, fields with
  1165. // empty values are omitted from API requests. However, any non-pointer,
  1166. // non-interface field appearing in ForceSendFields will be sent to the
  1167. // server regardless of whether the field is empty or not. This may be
  1168. // used to include empty fields in Patch requests.
  1169. ForceSendFields []string `json:"-"`
  1170. // NullFields is a list of field names (e.g. "Items") to include in API
  1171. // requests with the JSON null value. By default, fields with empty
  1172. // values are omitted from API requests. However, any field with an
  1173. // empty value appearing in NullFields will be sent to the server as
  1174. // null. It is an error if a field in this list has a non-empty value.
  1175. // This may be used to include null fields in Patch requests.
  1176. NullFields []string `json:"-"`
  1177. }
  1178. func (s *Notifications) MarshalJSON() ([]byte, error) {
  1179. type NoMethod Notifications
  1180. raw := NoMethod(*s)
  1181. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1182. }
  1183. // Object: An object.
  1184. type Object struct {
  1185. // Acl: Access controls on the object.
  1186. Acl []*ObjectAccessControl `json:"acl,omitempty"`
  1187. // Bucket: The name of the bucket containing this object.
  1188. Bucket string `json:"bucket,omitempty"`
  1189. // CacheControl: Cache-Control directive for the object data. If
  1190. // omitted, and the object is accessible to all anonymous users, the
  1191. // default will be public, max-age=3600.
  1192. CacheControl string `json:"cacheControl,omitempty"`
  1193. // ComponentCount: Number of underlying components that make up this
  1194. // object. Components are accumulated by compose operations.
  1195. ComponentCount int64 `json:"componentCount,omitempty"`
  1196. // ContentDisposition: Content-Disposition of the object data.
  1197. ContentDisposition string `json:"contentDisposition,omitempty"`
  1198. // ContentEncoding: Content-Encoding of the object data.
  1199. ContentEncoding string `json:"contentEncoding,omitempty"`
  1200. // ContentLanguage: Content-Language of the object data.
  1201. ContentLanguage string `json:"contentLanguage,omitempty"`
  1202. // ContentType: Content-Type of the object data. If an object is stored
  1203. // without a Content-Type, it is served as application/octet-stream.
  1204. ContentType string `json:"contentType,omitempty"`
  1205. // Crc32c: CRC32c checksum, as described in RFC 4960, Appendix B;
  1206. // encoded using base64 in big-endian byte order. For more information
  1207. // about using the CRC32c checksum, see Hashes and ETags: Best
  1208. // Practices.
  1209. Crc32c string `json:"crc32c,omitempty"`
  1210. // CustomerEncryption: Metadata of customer-supplied encryption key, if
  1211. // the object is encrypted by such a key.
  1212. CustomerEncryption *ObjectCustomerEncryption `json:"customerEncryption,omitempty"`
  1213. // Etag: HTTP 1.1 Entity tag for the object.
  1214. Etag string `json:"etag,omitempty"`
  1215. // EventBasedHold: Whether an object is under event-based hold.
  1216. // Event-based hold is a way to retain objects until an event occurs,
  1217. // which is signified by the hold's release (i.e. this value is set to
  1218. // false). After being released (set to false), such objects will be
  1219. // subject to bucket-level retention (if any). One sample use case of
  1220. // this flag is for banks to hold loan documents for at least 3 years
  1221. // after loan is paid in full. Here, bucket-level retention is 3 years
  1222. // and the event is the loan being paid in full. In this example, these
  1223. // objects will be held intact for any number of years until the event
  1224. // has occurred (event-based hold on the object is released) and then 3
  1225. // more years after that. That means retention duration of the objects
  1226. // begins from the moment event-based hold transitioned from true to
  1227. // false.
  1228. EventBasedHold bool `json:"eventBasedHold,omitempty"`
  1229. // Generation: The content generation of this object. Used for object
  1230. // versioning.
  1231. Generation int64 `json:"generation,omitempty,string"`
  1232. // Id: The ID of the object, including the bucket name, object name, and
  1233. // generation number.
  1234. Id string `json:"id,omitempty"`
  1235. // Kind: The kind of item this is. For objects, this is always
  1236. // storage#object.
  1237. Kind string `json:"kind,omitempty"`
  1238. // KmsKeyName: Cloud KMS Key used to encrypt this object, if the object
  1239. // is encrypted by such a key.
  1240. KmsKeyName string `json:"kmsKeyName,omitempty"`
  1241. // Md5Hash: MD5 hash of the data; encoded using base64. For more
  1242. // information about using the MD5 hash, see Hashes and ETags: Best
  1243. // Practices.
  1244. Md5Hash string `json:"md5Hash,omitempty"`
  1245. // MediaLink: Media download link.
  1246. MediaLink string `json:"mediaLink,omitempty"`
  1247. // Metadata: User-provided metadata, in key/value pairs.
  1248. Metadata map[string]string `json:"metadata,omitempty"`
  1249. // Metageneration: The version of the metadata for this object at this
  1250. // generation. Used for preconditions and for detecting changes in
  1251. // metadata. A metageneration number is only meaningful in the context
  1252. // of a particular generation of a particular object.
  1253. Metageneration int64 `json:"metageneration,omitempty,string"`
  1254. // Name: The name of the object. Required if not specified by URL
  1255. // parameter.
  1256. Name string `json:"name,omitempty"`
  1257. // Owner: The owner of the object. This will always be the uploader of
  1258. // the object.
  1259. Owner *ObjectOwner `json:"owner,omitempty"`
  1260. // RetentionExpirationTime: A server-determined value that specifies the
  1261. // earliest time that the object's retention period expires. This value
  1262. // is in RFC 3339 format. Note 1: This field is not provided for objects
  1263. // with an active event-based hold, since retention expiration is
  1264. // unknown until the hold is removed. Note 2: This value can be provided
  1265. // even when temporary hold is set (so that the user can reason about
  1266. // policy without having to first unset the temporary hold).
  1267. RetentionExpirationTime string `json:"retentionExpirationTime,omitempty"`
  1268. // SelfLink: The link to this object.
  1269. SelfLink string `json:"selfLink,omitempty"`
  1270. // Size: Content-Length of the data in bytes.
  1271. Size uint64 `json:"size,omitempty,string"`
  1272. // StorageClass: Storage class of the object.
  1273. StorageClass string `json:"storageClass,omitempty"`
  1274. // TemporaryHold: Whether an object is under temporary hold. While this
  1275. // flag is set to true, the object is protected against deletion and
  1276. // overwrites. A common use case of this flag is regulatory
  1277. // investigations where objects need to be retained while the
  1278. // investigation is ongoing. Note that unlike event-based hold,
  1279. // temporary hold does not impact retention expiration time of an
  1280. // object.
  1281. TemporaryHold bool `json:"temporaryHold,omitempty"`
  1282. // TimeCreated: The creation time of the object in RFC 3339 format.
  1283. TimeCreated string `json:"timeCreated,omitempty"`
  1284. // TimeDeleted: The deletion time of the object in RFC 3339 format. Will
  1285. // be returned if and only if this version of the object has been
  1286. // deleted.
  1287. TimeDeleted string `json:"timeDeleted,omitempty"`
  1288. // TimeStorageClassUpdated: The time at which the object's storage class
  1289. // was last changed. When the object is initially created, it will be
  1290. // set to timeCreated.
  1291. TimeStorageClassUpdated string `json:"timeStorageClassUpdated,omitempty"`
  1292. // Updated: The modification time of the object metadata in RFC 3339
  1293. // format.
  1294. Updated string `json:"updated,omitempty"`
  1295. // ServerResponse contains the HTTP response code and headers from the
  1296. // server.
  1297. googleapi.ServerResponse `json:"-"`
  1298. // ForceSendFields is a list of field names (e.g. "Acl") to
  1299. // unconditionally include in API requests. By default, fields with
  1300. // empty values are omitted from API requests. However, any non-pointer,
  1301. // non-interface field appearing in ForceSendFields will be sent to the
  1302. // server regardless of whether the field is empty or not. This may be
  1303. // used to include empty fields in Patch requests.
  1304. ForceSendFields []string `json:"-"`
  1305. // NullFields is a list of field names (e.g. "Acl") to include in API
  1306. // requests with the JSON null value. By default, fields with empty
  1307. // values are omitted from API requests. However, any field with an
  1308. // empty value appearing in NullFields will be sent to the server as
  1309. // null. It is an error if a field in this list has a non-empty value.
  1310. // This may be used to include null fields in Patch requests.
  1311. NullFields []string `json:"-"`
  1312. }
  1313. func (s *Object) MarshalJSON() ([]byte, error) {
  1314. type NoMethod Object
  1315. raw := NoMethod(*s)
  1316. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1317. }
  1318. // ObjectCustomerEncryption: Metadata of customer-supplied encryption
  1319. // key, if the object is encrypted by such a key.
  1320. type ObjectCustomerEncryption struct {
  1321. // EncryptionAlgorithm: The encryption algorithm.
  1322. EncryptionAlgorithm string `json:"encryptionAlgorithm,omitempty"`
  1323. // KeySha256: SHA256 hash value of the encryption key.
  1324. KeySha256 string `json:"keySha256,omitempty"`
  1325. // ForceSendFields is a list of field names (e.g. "EncryptionAlgorithm")
  1326. // to unconditionally include in API requests. By default, fields with
  1327. // empty values are omitted from API requests. However, any non-pointer,
  1328. // non-interface field appearing in ForceSendFields will be sent to the
  1329. // server regardless of whether the field is empty or not. This may be
  1330. // used to include empty fields in Patch requests.
  1331. ForceSendFields []string `json:"-"`
  1332. // NullFields is a list of field names (e.g. "EncryptionAlgorithm") to
  1333. // include in API requests with the JSON null value. By default, fields
  1334. // with empty values are omitted from API requests. However, any field
  1335. // with an empty value appearing in NullFields will be sent to the
  1336. // server as null. It is an error if a field in this list has a
  1337. // non-empty value. This may be used to include null fields in Patch
  1338. // requests.
  1339. NullFields []string `json:"-"`
  1340. }
  1341. func (s *ObjectCustomerEncryption) MarshalJSON() ([]byte, error) {
  1342. type NoMethod ObjectCustomerEncryption
  1343. raw := NoMethod(*s)
  1344. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1345. }
  1346. // ObjectOwner: The owner of the object. This will always be the
  1347. // uploader of the object.
  1348. type ObjectOwner struct {
  1349. // Entity: The entity, in the form user-userId.
  1350. Entity string `json:"entity,omitempty"`
  1351. // EntityId: The ID for the entity.
  1352. EntityId string `json:"entityId,omitempty"`
  1353. // ForceSendFields is a list of field names (e.g. "Entity") to
  1354. // unconditionally include in API requests. By default, fields with
  1355. // empty values are omitted from API requests. However, any non-pointer,
  1356. // non-interface field appearing in ForceSendFields will be sent to the
  1357. // server regardless of whether the field is empty or not. This may be
  1358. // used to include empty fields in Patch requests.
  1359. ForceSendFields []string `json:"-"`
  1360. // NullFields is a list of field names (e.g. "Entity") to include in API
  1361. // requests with the JSON null value. By default, fields with empty
  1362. // values are omitted from API requests. However, any field with an
  1363. // empty value appearing in NullFields will be sent to the server as
  1364. // null. It is an error if a field in this list has a non-empty value.
  1365. // This may be used to include null fields in Patch requests.
  1366. NullFields []string `json:"-"`
  1367. }
  1368. func (s *ObjectOwner) MarshalJSON() ([]byte, error) {
  1369. type NoMethod ObjectOwner
  1370. raw := NoMethod(*s)
  1371. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1372. }
  1373. // ObjectAccessControl: An access-control entry.
  1374. type ObjectAccessControl struct {
  1375. // Bucket: The name of the bucket.
  1376. Bucket string `json:"bucket,omitempty"`
  1377. // Domain: The domain associated with the entity, if any.
  1378. Domain string `json:"domain,omitempty"`
  1379. // Email: The email address associated with the entity, if any.
  1380. Email string `json:"email,omitempty"`
  1381. // Entity: The entity holding the permission, in one of the following
  1382. // forms:
  1383. // - user-userId
  1384. // - user-email
  1385. // - group-groupId
  1386. // - group-email
  1387. // - domain-domain
  1388. // - project-team-projectId
  1389. // - allUsers
  1390. // - allAuthenticatedUsers Examples:
  1391. // - The user liz@example.com would be user-liz@example.com.
  1392. // - The group example@googlegroups.com would be
  1393. // group-example@googlegroups.com.
  1394. // - To refer to all members of the Google Apps for Business domain
  1395. // example.com, the entity would be domain-example.com.
  1396. Entity string `json:"entity,omitempty"`
  1397. // EntityId: The ID for the entity, if any.
  1398. EntityId string `json:"entityId,omitempty"`
  1399. // Etag: HTTP 1.1 Entity tag for the access-control entry.
  1400. Etag string `json:"etag,omitempty"`
  1401. // Generation: The content generation of the object, if applied to an
  1402. // object.
  1403. Generation int64 `json:"generation,omitempty,string"`
  1404. // Id: The ID of the access-control entry.
  1405. Id string `json:"id,omitempty"`
  1406. // Kind: The kind of item this is. For object access control entries,
  1407. // this is always storage#objectAccessControl.
  1408. Kind string `json:"kind,omitempty"`
  1409. // Object: The name of the object, if applied to an object.
  1410. Object string `json:"object,omitempty"`
  1411. // ProjectTeam: The project team associated with the entity, if any.
  1412. ProjectTeam *ObjectAccessControlProjectTeam `json:"projectTeam,omitempty"`
  1413. // Role: The access permission for the entity.
  1414. Role string `json:"role,omitempty"`
  1415. // SelfLink: The link to this access-control entry.
  1416. SelfLink string `json:"selfLink,omitempty"`
  1417. // ServerResponse contains the HTTP response code and headers from the
  1418. // server.
  1419. googleapi.ServerResponse `json:"-"`
  1420. // ForceSendFields is a list of field names (e.g. "Bucket") to
  1421. // unconditionally include in API requests. By default, fields with
  1422. // empty values are omitted from API requests. However, any non-pointer,
  1423. // non-interface field appearing in ForceSendFields will be sent to the
  1424. // server regardless of whether the field is empty or not. This may be
  1425. // used to include empty fields in Patch requests.
  1426. ForceSendFields []string `json:"-"`
  1427. // NullFields is a list of field names (e.g. "Bucket") to include in API
  1428. // requests with the JSON null value. By default, fields with empty
  1429. // values are omitted from API requests. However, any field with an
  1430. // empty value appearing in NullFields will be sent to the server as
  1431. // null. It is an error if a field in this list has a non-empty value.
  1432. // This may be used to include null fields in Patch requests.
  1433. NullFields []string `json:"-"`
  1434. }
  1435. func (s *ObjectAccessControl) MarshalJSON() ([]byte, error) {
  1436. type NoMethod ObjectAccessControl
  1437. raw := NoMethod(*s)
  1438. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1439. }
  1440. // ObjectAccessControlProjectTeam: The project team associated with the
  1441. // entity, if any.
  1442. type ObjectAccessControlProjectTeam struct {
  1443. // ProjectNumber: The project number.
  1444. ProjectNumber string `json:"projectNumber,omitempty"`
  1445. // Team: The team.
  1446. Team string `json:"team,omitempty"`
  1447. // ForceSendFields is a list of field names (e.g. "ProjectNumber") to
  1448. // unconditionally include in API requests. By default, fields with
  1449. // empty values are omitted from API requests. However, any non-pointer,
  1450. // non-interface field appearing in ForceSendFields will be sent to the
  1451. // server regardless of whether the field is empty or not. This may be
  1452. // used to include empty fields in Patch requests.
  1453. ForceSendFields []string `json:"-"`
  1454. // NullFields is a list of field names (e.g. "ProjectNumber") to include
  1455. // in API requests with the JSON null value. By default, fields with
  1456. // empty values are omitted from API requests. However, any field with
  1457. // an empty value appearing in NullFields will be sent to the server as
  1458. // null. It is an error if a field in this list has a non-empty value.
  1459. // This may be used to include null fields in Patch requests.
  1460. NullFields []string `json:"-"`
  1461. }
  1462. func (s *ObjectAccessControlProjectTeam) MarshalJSON() ([]byte, error) {
  1463. type NoMethod ObjectAccessControlProjectTeam
  1464. raw := NoMethod(*s)
  1465. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1466. }
  1467. // ObjectAccessControls: An access-control list.
  1468. type ObjectAccessControls struct {
  1469. // Items: The list of items.
  1470. Items []*ObjectAccessControl `json:"items,omitempty"`
  1471. // Kind: The kind of item this is. For lists of object access control
  1472. // entries, this is always storage#objectAccessControls.
  1473. Kind string `json:"kind,omitempty"`
  1474. // ServerResponse contains the HTTP response code and headers from the
  1475. // server.
  1476. googleapi.ServerResponse `json:"-"`
  1477. // ForceSendFields is a list of field names (e.g. "Items") to
  1478. // unconditionally include in API requests. By default, fields with
  1479. // empty values are omitted from API requests. However, any non-pointer,
  1480. // non-interface field appearing in ForceSendFields will be sent to the
  1481. // server regardless of whether the field is empty or not. This may be
  1482. // used to include empty fields in Patch requests.
  1483. ForceSendFields []string `json:"-"`
  1484. // NullFields is a list of field names (e.g. "Items") to include in API
  1485. // requests with the JSON null value. By default, fields with empty
  1486. // values are omitted from API requests. However, any field with an
  1487. // empty value appearing in NullFields will be sent to the server as
  1488. // null. It is an error if a field in this list has a non-empty value.
  1489. // This may be used to include null fields in Patch requests.
  1490. NullFields []string `json:"-"`
  1491. }
  1492. func (s *ObjectAccessControls) MarshalJSON() ([]byte, error) {
  1493. type NoMethod ObjectAccessControls
  1494. raw := NoMethod(*s)
  1495. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1496. }
  1497. // Objects: A list of objects.
  1498. type Objects struct {
  1499. // Items: The list of items.
  1500. Items []*Object `json:"items,omitempty"`
  1501. // Kind: The kind of item this is. For lists of objects, this is always
  1502. // storage#objects.
  1503. Kind string `json:"kind,omitempty"`
  1504. // NextPageToken: The continuation token, used to page through large
  1505. // result sets. Provide this value in a subsequent request to return the
  1506. // next page of results.
  1507. NextPageToken string `json:"nextPageToken,omitempty"`
  1508. // Prefixes: The list of prefixes of objects matching-but-not-listed up
  1509. // to and including the requested delimiter.
  1510. Prefixes []string `json:"prefixes,omitempty"`
  1511. // ServerResponse contains the HTTP response code and headers from the
  1512. // server.
  1513. googleapi.ServerResponse `json:"-"`
  1514. // ForceSendFields is a list of field names (e.g. "Items") to
  1515. // unconditionally include in API requests. By default, fields with
  1516. // empty values are omitted from API requests. However, any non-pointer,
  1517. // non-interface field appearing in ForceSendFields will be sent to the
  1518. // server regardless of whether the field is empty or not. This may be
  1519. // used to include empty fields in Patch requests.
  1520. ForceSendFields []string `json:"-"`
  1521. // NullFields is a list of field names (e.g. "Items") to include in API
  1522. // requests with the JSON null value. By default, fields with empty
  1523. // values are omitted from API requests. However, any field with an
  1524. // empty value appearing in NullFields will be sent to the server as
  1525. // null. It is an error if a field in this list has a non-empty value.
  1526. // This may be used to include null fields in Patch requests.
  1527. NullFields []string `json:"-"`
  1528. }
  1529. func (s *Objects) MarshalJSON() ([]byte, error) {
  1530. type NoMethod Objects
  1531. raw := NoMethod(*s)
  1532. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1533. }
  1534. // Policy: A bucket/object IAM policy.
  1535. type Policy struct {
  1536. // Bindings: An association between a role, which comes with a set of
  1537. // permissions, and members who may assume that role.
  1538. Bindings []*PolicyBindings `json:"bindings,omitempty"`
  1539. // Etag: HTTP 1.1 Entity tag for the policy.
  1540. Etag string `json:"etag,omitempty"`
  1541. // Kind: The kind of item this is. For policies, this is always
  1542. // storage#policy. This field is ignored on input.
  1543. Kind string `json:"kind,omitempty"`
  1544. // ResourceId: The ID of the resource to which this policy belongs. Will
  1545. // be of the form projects/_/buckets/bucket for buckets, and
  1546. // projects/_/buckets/bucket/objects/object for objects. A specific
  1547. // generation may be specified by appending #generationNumber to the end
  1548. // of the object name, e.g.
  1549. // projects/_/buckets/my-bucket/objects/data.txt#17. The current
  1550. // generation can be denoted with #0. This field is ignored on input.
  1551. ResourceId string `json:"resourceId,omitempty"`
  1552. // ServerResponse contains the HTTP response code and headers from the
  1553. // server.
  1554. googleapi.ServerResponse `json:"-"`
  1555. // ForceSendFields is a list of field names (e.g. "Bindings") to
  1556. // unconditionally include in API requests. By default, fields with
  1557. // empty values are omitted from API requests. However, any non-pointer,
  1558. // non-interface field appearing in ForceSendFields will be sent to the
  1559. // server regardless of whether the field is empty or not. This may be
  1560. // used to include empty fields in Patch requests.
  1561. ForceSendFields []string `json:"-"`
  1562. // NullFields is a list of field names (e.g. "Bindings") to include in
  1563. // API requests with the JSON null value. By default, fields with empty
  1564. // values are omitted from API requests. However, any field with an
  1565. // empty value appearing in NullFields will be sent to the server as
  1566. // null. It is an error if a field in this list has a non-empty value.
  1567. // This may be used to include null fields in Patch requests.
  1568. NullFields []string `json:"-"`
  1569. }
  1570. func (s *Policy) MarshalJSON() ([]byte, error) {
  1571. type NoMethod Policy
  1572. raw := NoMethod(*s)
  1573. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1574. }
  1575. type PolicyBindings struct {
  1576. // Condition: The condition that is associated with this binding. NOTE:
  1577. // an unsatisfied condition will not allow user access via current
  1578. // binding. Different bindings, including their conditions, are examined
  1579. // independently.
  1580. Condition *Expr `json:"condition,omitempty"`
  1581. // Members: A collection of identifiers for members who may assume the
  1582. // provided role. Recognized identifiers are as follows:
  1583. // - allUsers — A special identifier that represents anyone on the
  1584. // internet; with or without a Google account.
  1585. // - allAuthenticatedUsers — A special identifier that represents
  1586. // anyone who is authenticated with a Google account or a service
  1587. // account.
  1588. // - user:emailid — An email address that represents a specific
  1589. // account. For example, user:alice@gmail.com or user:joe@example.com.
  1590. //
  1591. // - serviceAccount:emailid — An email address that represents a
  1592. // service account. For example,
  1593. // serviceAccount:my-other-app@appspot.gserviceaccount.com .
  1594. // - group:emailid — An email address that represents a Google group.
  1595. // For example, group:admins@example.com.
  1596. // - domain:domain — A Google Apps domain name that represents all the
  1597. // users of that domain. For example, domain:google.com or
  1598. // domain:example.com.
  1599. // - projectOwner:projectid — Owners of the given project. For
  1600. // example, projectOwner:my-example-project
  1601. // - projectEditor:projectid — Editors of the given project. For
  1602. // example, projectEditor:my-example-project
  1603. // - projectViewer:projectid — Viewers of the given project. For
  1604. // example, projectViewer:my-example-project
  1605. Members []string `json:"members,omitempty"`
  1606. // Role: The role to which members belong. Two types of roles are
  1607. // supported: new IAM roles, which grant permissions that do not map
  1608. // directly to those provided by ACLs, and legacy IAM roles, which do
  1609. // map directly to ACL permissions. All roles are of the format
  1610. // roles/storage.specificRole.
  1611. // The new IAM roles are:
  1612. // - roles/storage.admin — Full control of Google Cloud Storage
  1613. // resources.
  1614. // - roles/storage.objectViewer — Read-Only access to Google Cloud
  1615. // Storage objects.
  1616. // - roles/storage.objectCreator — Access to create objects in Google
  1617. // Cloud Storage.
  1618. // - roles/storage.objectAdmin — Full control of Google Cloud Storage
  1619. // objects. The legacy IAM roles are:
  1620. // - roles/storage.legacyObjectReader — Read-only access to objects
  1621. // without listing. Equivalent to an ACL entry on an object with the
  1622. // READER role.
  1623. // - roles/storage.legacyObjectOwner — Read/write access to existing
  1624. // objects without listing. Equivalent to an ACL entry on an object with
  1625. // the OWNER role.
  1626. // - roles/storage.legacyBucketReader — Read access to buckets with
  1627. // object listing. Equivalent to an ACL entry on a bucket with the
  1628. // READER role.
  1629. // - roles/storage.legacyBucketWriter — Read access to buckets with
  1630. // object listing/creation/deletion. Equivalent to an ACL entry on a
  1631. // bucket with the WRITER role.
  1632. // - roles/storage.legacyBucketOwner — Read and write access to
  1633. // existing buckets with object listing/creation/deletion. Equivalent to
  1634. // an ACL entry on a bucket with the OWNER role.
  1635. Role string `json:"role,omitempty"`
  1636. // ForceSendFields is a list of field names (e.g. "Condition") to
  1637. // unconditionally include in API requests. By default, fields with
  1638. // empty values are omitted from API requests. However, any non-pointer,
  1639. // non-interface field appearing in ForceSendFields will be sent to the
  1640. // server regardless of whether the field is empty or not. This may be
  1641. // used to include empty fields in Patch requests.
  1642. ForceSendFields []string `json:"-"`
  1643. // NullFields is a list of field names (e.g. "Condition") to include in
  1644. // API requests with the JSON null value. By default, fields with empty
  1645. // values are omitted from API requests. However, any field with an
  1646. // empty value appearing in NullFields will be sent to the server as
  1647. // null. It is an error if a field in this list has a non-empty value.
  1648. // This may be used to include null fields in Patch requests.
  1649. NullFields []string `json:"-"`
  1650. }
  1651. func (s *PolicyBindings) MarshalJSON() ([]byte, error) {
  1652. type NoMethod PolicyBindings
  1653. raw := NoMethod(*s)
  1654. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1655. }
  1656. // RewriteResponse: A rewrite response.
  1657. type RewriteResponse struct {
  1658. // Done: true if the copy is finished; otherwise, false if the copy is
  1659. // in progress. This property is always present in the response.
  1660. Done bool `json:"done,omitempty"`
  1661. // Kind: The kind of item this is.
  1662. Kind string `json:"kind,omitempty"`
  1663. // ObjectSize: The total size of the object being copied in bytes. This
  1664. // property is always present in the response.
  1665. ObjectSize int64 `json:"objectSize,omitempty,string"`
  1666. // Resource: A resource containing the metadata for the copied-to
  1667. // object. This property is present in the response only when copying
  1668. // completes.
  1669. Resource *Object `json:"resource,omitempty"`
  1670. // RewriteToken: A token to use in subsequent requests to continue
  1671. // copying data. This token is present in the response only when there
  1672. // is more data to copy.
  1673. RewriteToken string `json:"rewriteToken,omitempty"`
  1674. // TotalBytesRewritten: The total bytes written so far, which can be
  1675. // used to provide a waiting user with a progress indicator. This
  1676. // property is always present in the response.
  1677. TotalBytesRewritten int64 `json:"totalBytesRewritten,omitempty,string"`
  1678. // ServerResponse contains the HTTP response code and headers from the
  1679. // server.
  1680. googleapi.ServerResponse `json:"-"`
  1681. // ForceSendFields is a list of field names (e.g. "Done") to
  1682. // unconditionally include in API requests. By default, fields with
  1683. // empty values are omitted from API requests. However, any non-pointer,
  1684. // non-interface field appearing in ForceSendFields will be sent to the
  1685. // server regardless of whether the field is empty or not. This may be
  1686. // used to include empty fields in Patch requests.
  1687. ForceSendFields []string `json:"-"`
  1688. // NullFields is a list of field names (e.g. "Done") to include in API
  1689. // requests with the JSON null value. By default, fields with empty
  1690. // values are omitted from API requests. However, any field with an
  1691. // empty value appearing in NullFields will be sent to the server as
  1692. // null. It is an error if a field in this list has a non-empty value.
  1693. // This may be used to include null fields in Patch requests.
  1694. NullFields []string `json:"-"`
  1695. }
  1696. func (s *RewriteResponse) MarshalJSON() ([]byte, error) {
  1697. type NoMethod RewriteResponse
  1698. raw := NoMethod(*s)
  1699. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1700. }
  1701. // ServiceAccount: A subscription to receive Google PubSub
  1702. // notifications.
  1703. type ServiceAccount struct {
  1704. // EmailAddress: The ID of the notification.
  1705. EmailAddress string `json:"email_address,omitempty"`
  1706. // Kind: The kind of item this is. For notifications, this is always
  1707. // storage#notification.
  1708. Kind string `json:"kind,omitempty"`
  1709. // ServerResponse contains the HTTP response code and headers from the
  1710. // server.
  1711. googleapi.ServerResponse `json:"-"`
  1712. // ForceSendFields is a list of field names (e.g. "EmailAddress") to
  1713. // unconditionally include in API requests. By default, fields with
  1714. // empty values are omitted from API requests. However, any non-pointer,
  1715. // non-interface field appearing in ForceSendFields will be sent to the
  1716. // server regardless of whether the field is empty or not. This may be
  1717. // used to include empty fields in Patch requests.
  1718. ForceSendFields []string `json:"-"`
  1719. // NullFields is a list of field names (e.g. "EmailAddress") to include
  1720. // in API requests with the JSON null value. By default, fields with
  1721. // empty values are omitted from API requests. However, any field with
  1722. // an empty value appearing in NullFields will be sent to the server as
  1723. // null. It is an error if a field in this list has a non-empty value.
  1724. // This may be used to include null fields in Patch requests.
  1725. NullFields []string `json:"-"`
  1726. }
  1727. func (s *ServiceAccount) MarshalJSON() ([]byte, error) {
  1728. type NoMethod ServiceAccount
  1729. raw := NoMethod(*s)
  1730. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1731. }
  1732. // TestIamPermissionsResponse: A
  1733. // storage.(buckets|objects).testIamPermissions response.
  1734. type TestIamPermissionsResponse struct {
  1735. // Kind: The kind of item this is.
  1736. Kind string `json:"kind,omitempty"`
  1737. // Permissions: The permissions held by the caller. Permissions are
  1738. // always of the format storage.resource.capability, where resource is
  1739. // one of buckets or objects. The supported permissions are as follows:
  1740. //
  1741. // - storage.buckets.delete — Delete bucket.
  1742. // - storage.buckets.get — Read bucket metadata.
  1743. // - storage.buckets.getIamPolicy — Read bucket IAM policy.
  1744. // - storage.buckets.create — Create bucket.
  1745. // - storage.buckets.list — List buckets.
  1746. // - storage.buckets.setIamPolicy — Update bucket IAM policy.
  1747. // - storage.buckets.update — Update bucket metadata.
  1748. // - storage.objects.delete — Delete object.
  1749. // - storage.objects.get — Read object data and metadata.
  1750. // - storage.objects.getIamPolicy — Read object IAM policy.
  1751. // - storage.objects.create — Create object.
  1752. // - storage.objects.list — List objects.
  1753. // - storage.objects.setIamPolicy — Update object IAM policy.
  1754. // - storage.objects.update — Update object metadata.
  1755. Permissions []string `json:"permissions,omitempty"`
  1756. // ServerResponse contains the HTTP response code and headers from the
  1757. // server.
  1758. googleapi.ServerResponse `json:"-"`
  1759. // ForceSendFields is a list of field names (e.g. "Kind") to
  1760. // unconditionally include in API requests. By default, fields with
  1761. // empty values are omitted from API requests. However, any non-pointer,
  1762. // non-interface field appearing in ForceSendFields will be sent to the
  1763. // server regardless of whether the field is empty or not. This may be
  1764. // used to include empty fields in Patch requests.
  1765. ForceSendFields []string `json:"-"`
  1766. // NullFields is a list of field names (e.g. "Kind") to include in API
  1767. // requests with the JSON null value. By default, fields with empty
  1768. // values are omitted from API requests. However, any field with an
  1769. // empty value appearing in NullFields will be sent to the server as
  1770. // null. It is an error if a field in this list has a non-empty value.
  1771. // This may be used to include null fields in Patch requests.
  1772. NullFields []string `json:"-"`
  1773. }
  1774. func (s *TestIamPermissionsResponse) MarshalJSON() ([]byte, error) {
  1775. type NoMethod TestIamPermissionsResponse
  1776. raw := NoMethod(*s)
  1777. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1778. }
  1779. // method id "storage.bucketAccessControls.delete":
  1780. type BucketAccessControlsDeleteCall struct {
  1781. s *Service
  1782. bucket string
  1783. entity string
  1784. urlParams_ gensupport.URLParams
  1785. ctx_ context.Context
  1786. header_ http.Header
  1787. }
  1788. // Delete: Permanently deletes the ACL entry for the specified entity on
  1789. // the specified bucket.
  1790. func (r *BucketAccessControlsService) Delete(bucket string, entity string) *BucketAccessControlsDeleteCall {
  1791. c := &BucketAccessControlsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1792. c.bucket = bucket
  1793. c.entity = entity
  1794. return c
  1795. }
  1796. // UserProject sets the optional parameter "userProject": The project to
  1797. // be billed for this request. Required for Requester Pays buckets.
  1798. func (c *BucketAccessControlsDeleteCall) UserProject(userProject string) *BucketAccessControlsDeleteCall {
  1799. c.urlParams_.Set("userProject", userProject)
  1800. return c
  1801. }
  1802. // Fields allows partial responses to be retrieved. See
  1803. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1804. // for more information.
  1805. func (c *BucketAccessControlsDeleteCall) Fields(s ...googleapi.Field) *BucketAccessControlsDeleteCall {
  1806. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1807. return c
  1808. }
  1809. // Context sets the context to be used in this call's Do method. Any
  1810. // pending HTTP request will be aborted if the provided context is
  1811. // canceled.
  1812. func (c *BucketAccessControlsDeleteCall) Context(ctx context.Context) *BucketAccessControlsDeleteCall {
  1813. c.ctx_ = ctx
  1814. return c
  1815. }
  1816. // Header returns an http.Header that can be modified by the caller to
  1817. // add HTTP headers to the request.
  1818. func (c *BucketAccessControlsDeleteCall) Header() http.Header {
  1819. if c.header_ == nil {
  1820. c.header_ = make(http.Header)
  1821. }
  1822. return c.header_
  1823. }
  1824. func (c *BucketAccessControlsDeleteCall) doRequest(alt string) (*http.Response, error) {
  1825. reqHeaders := make(http.Header)
  1826. for k, v := range c.header_ {
  1827. reqHeaders[k] = v
  1828. }
  1829. reqHeaders.Set("User-Agent", c.s.userAgent())
  1830. var body io.Reader = nil
  1831. c.urlParams_.Set("alt", alt)
  1832. c.urlParams_.Set("prettyPrint", "false")
  1833. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/acl/{entity}")
  1834. urls += "?" + c.urlParams_.Encode()
  1835. req, err := http.NewRequest("DELETE", urls, body)
  1836. if err != nil {
  1837. return nil, err
  1838. }
  1839. req.Header = reqHeaders
  1840. googleapi.Expand(req.URL, map[string]string{
  1841. "bucket": c.bucket,
  1842. "entity": c.entity,
  1843. })
  1844. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1845. }
  1846. // Do executes the "storage.bucketAccessControls.delete" call.
  1847. func (c *BucketAccessControlsDeleteCall) Do(opts ...googleapi.CallOption) error {
  1848. gensupport.SetOptions(c.urlParams_, opts...)
  1849. res, err := c.doRequest("json")
  1850. if err != nil {
  1851. return err
  1852. }
  1853. defer googleapi.CloseBody(res)
  1854. if err := googleapi.CheckResponse(res); err != nil {
  1855. return err
  1856. }
  1857. return nil
  1858. // {
  1859. // "description": "Permanently deletes the ACL entry for the specified entity on the specified bucket.",
  1860. // "httpMethod": "DELETE",
  1861. // "id": "storage.bucketAccessControls.delete",
  1862. // "parameterOrder": [
  1863. // "bucket",
  1864. // "entity"
  1865. // ],
  1866. // "parameters": {
  1867. // "bucket": {
  1868. // "description": "Name of a bucket.",
  1869. // "location": "path",
  1870. // "required": true,
  1871. // "type": "string"
  1872. // },
  1873. // "entity": {
  1874. // "description": "The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.",
  1875. // "location": "path",
  1876. // "required": true,
  1877. // "type": "string"
  1878. // },
  1879. // "userProject": {
  1880. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  1881. // "location": "query",
  1882. // "type": "string"
  1883. // }
  1884. // },
  1885. // "path": "b/{bucket}/acl/{entity}",
  1886. // "scopes": [
  1887. // "https://www.googleapis.com/auth/cloud-platform",
  1888. // "https://www.googleapis.com/auth/devstorage.full_control"
  1889. // ]
  1890. // }
  1891. }
  1892. // method id "storage.bucketAccessControls.get":
  1893. type BucketAccessControlsGetCall struct {
  1894. s *Service
  1895. bucket string
  1896. entity string
  1897. urlParams_ gensupport.URLParams
  1898. ifNoneMatch_ string
  1899. ctx_ context.Context
  1900. header_ http.Header
  1901. }
  1902. // Get: Returns the ACL entry for the specified entity on the specified
  1903. // bucket.
  1904. func (r *BucketAccessControlsService) Get(bucket string, entity string) *BucketAccessControlsGetCall {
  1905. c := &BucketAccessControlsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1906. c.bucket = bucket
  1907. c.entity = entity
  1908. return c
  1909. }
  1910. // UserProject sets the optional parameter "userProject": The project to
  1911. // be billed for this request. Required for Requester Pays buckets.
  1912. func (c *BucketAccessControlsGetCall) UserProject(userProject string) *BucketAccessControlsGetCall {
  1913. c.urlParams_.Set("userProject", userProject)
  1914. return c
  1915. }
  1916. // Fields allows partial responses to be retrieved. See
  1917. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1918. // for more information.
  1919. func (c *BucketAccessControlsGetCall) Fields(s ...googleapi.Field) *BucketAccessControlsGetCall {
  1920. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1921. return c
  1922. }
  1923. // IfNoneMatch sets the optional parameter which makes the operation
  1924. // fail if the object's ETag matches the given value. This is useful for
  1925. // getting updates only after the object has changed since the last
  1926. // request. Use googleapi.IsNotModified to check whether the response
  1927. // error from Do is the result of In-None-Match.
  1928. func (c *BucketAccessControlsGetCall) IfNoneMatch(entityTag string) *BucketAccessControlsGetCall {
  1929. c.ifNoneMatch_ = entityTag
  1930. return c
  1931. }
  1932. // Context sets the context to be used in this call's Do method. Any
  1933. // pending HTTP request will be aborted if the provided context is
  1934. // canceled.
  1935. func (c *BucketAccessControlsGetCall) Context(ctx context.Context) *BucketAccessControlsGetCall {
  1936. c.ctx_ = ctx
  1937. return c
  1938. }
  1939. // Header returns an http.Header that can be modified by the caller to
  1940. // add HTTP headers to the request.
  1941. func (c *BucketAccessControlsGetCall) Header() http.Header {
  1942. if c.header_ == nil {
  1943. c.header_ = make(http.Header)
  1944. }
  1945. return c.header_
  1946. }
  1947. func (c *BucketAccessControlsGetCall) doRequest(alt string) (*http.Response, error) {
  1948. reqHeaders := make(http.Header)
  1949. for k, v := range c.header_ {
  1950. reqHeaders[k] = v
  1951. }
  1952. reqHeaders.Set("User-Agent", c.s.userAgent())
  1953. if c.ifNoneMatch_ != "" {
  1954. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1955. }
  1956. var body io.Reader = nil
  1957. c.urlParams_.Set("alt", alt)
  1958. c.urlParams_.Set("prettyPrint", "false")
  1959. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/acl/{entity}")
  1960. urls += "?" + c.urlParams_.Encode()
  1961. req, err := http.NewRequest("GET", urls, body)
  1962. if err != nil {
  1963. return nil, err
  1964. }
  1965. req.Header = reqHeaders
  1966. googleapi.Expand(req.URL, map[string]string{
  1967. "bucket": c.bucket,
  1968. "entity": c.entity,
  1969. })
  1970. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1971. }
  1972. // Do executes the "storage.bucketAccessControls.get" call.
  1973. // Exactly one of *BucketAccessControl or error will be non-nil. Any
  1974. // non-2xx status code is an error. Response headers are in either
  1975. // *BucketAccessControl.ServerResponse.Header or (if a response was
  1976. // returned at all) in error.(*googleapi.Error).Header. Use
  1977. // googleapi.IsNotModified to check whether the returned error was
  1978. // because http.StatusNotModified was returned.
  1979. func (c *BucketAccessControlsGetCall) Do(opts ...googleapi.CallOption) (*BucketAccessControl, error) {
  1980. gensupport.SetOptions(c.urlParams_, opts...)
  1981. res, err := c.doRequest("json")
  1982. if res != nil && res.StatusCode == http.StatusNotModified {
  1983. if res.Body != nil {
  1984. res.Body.Close()
  1985. }
  1986. return nil, &googleapi.Error{
  1987. Code: res.StatusCode,
  1988. Header: res.Header,
  1989. }
  1990. }
  1991. if err != nil {
  1992. return nil, err
  1993. }
  1994. defer googleapi.CloseBody(res)
  1995. if err := googleapi.CheckResponse(res); err != nil {
  1996. return nil, err
  1997. }
  1998. ret := &BucketAccessControl{
  1999. ServerResponse: googleapi.ServerResponse{
  2000. Header: res.Header,
  2001. HTTPStatusCode: res.StatusCode,
  2002. },
  2003. }
  2004. target := &ret
  2005. if err := gensupport.DecodeResponse(target, res); err != nil {
  2006. return nil, err
  2007. }
  2008. return ret, nil
  2009. // {
  2010. // "description": "Returns the ACL entry for the specified entity on the specified bucket.",
  2011. // "httpMethod": "GET",
  2012. // "id": "storage.bucketAccessControls.get",
  2013. // "parameterOrder": [
  2014. // "bucket",
  2015. // "entity"
  2016. // ],
  2017. // "parameters": {
  2018. // "bucket": {
  2019. // "description": "Name of a bucket.",
  2020. // "location": "path",
  2021. // "required": true,
  2022. // "type": "string"
  2023. // },
  2024. // "entity": {
  2025. // "description": "The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.",
  2026. // "location": "path",
  2027. // "required": true,
  2028. // "type": "string"
  2029. // },
  2030. // "userProject": {
  2031. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  2032. // "location": "query",
  2033. // "type": "string"
  2034. // }
  2035. // },
  2036. // "path": "b/{bucket}/acl/{entity}",
  2037. // "response": {
  2038. // "$ref": "BucketAccessControl"
  2039. // },
  2040. // "scopes": [
  2041. // "https://www.googleapis.com/auth/cloud-platform",
  2042. // "https://www.googleapis.com/auth/devstorage.full_control"
  2043. // ]
  2044. // }
  2045. }
  2046. // method id "storage.bucketAccessControls.insert":
  2047. type BucketAccessControlsInsertCall struct {
  2048. s *Service
  2049. bucket string
  2050. bucketaccesscontrol *BucketAccessControl
  2051. urlParams_ gensupport.URLParams
  2052. ctx_ context.Context
  2053. header_ http.Header
  2054. }
  2055. // Insert: Creates a new ACL entry on the specified bucket.
  2056. func (r *BucketAccessControlsService) Insert(bucket string, bucketaccesscontrol *BucketAccessControl) *BucketAccessControlsInsertCall {
  2057. c := &BucketAccessControlsInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2058. c.bucket = bucket
  2059. c.bucketaccesscontrol = bucketaccesscontrol
  2060. return c
  2061. }
  2062. // UserProject sets the optional parameter "userProject": The project to
  2063. // be billed for this request. Required for Requester Pays buckets.
  2064. func (c *BucketAccessControlsInsertCall) UserProject(userProject string) *BucketAccessControlsInsertCall {
  2065. c.urlParams_.Set("userProject", userProject)
  2066. return c
  2067. }
  2068. // Fields allows partial responses to be retrieved. See
  2069. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2070. // for more information.
  2071. func (c *BucketAccessControlsInsertCall) Fields(s ...googleapi.Field) *BucketAccessControlsInsertCall {
  2072. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2073. return c
  2074. }
  2075. // Context sets the context to be used in this call's Do method. Any
  2076. // pending HTTP request will be aborted if the provided context is
  2077. // canceled.
  2078. func (c *BucketAccessControlsInsertCall) Context(ctx context.Context) *BucketAccessControlsInsertCall {
  2079. c.ctx_ = ctx
  2080. return c
  2081. }
  2082. // Header returns an http.Header that can be modified by the caller to
  2083. // add HTTP headers to the request.
  2084. func (c *BucketAccessControlsInsertCall) Header() http.Header {
  2085. if c.header_ == nil {
  2086. c.header_ = make(http.Header)
  2087. }
  2088. return c.header_
  2089. }
  2090. func (c *BucketAccessControlsInsertCall) doRequest(alt string) (*http.Response, error) {
  2091. reqHeaders := make(http.Header)
  2092. for k, v := range c.header_ {
  2093. reqHeaders[k] = v
  2094. }
  2095. reqHeaders.Set("User-Agent", c.s.userAgent())
  2096. var body io.Reader = nil
  2097. body, err := googleapi.WithoutDataWrapper.JSONReader(c.bucketaccesscontrol)
  2098. if err != nil {
  2099. return nil, err
  2100. }
  2101. reqHeaders.Set("Content-Type", "application/json")
  2102. c.urlParams_.Set("alt", alt)
  2103. c.urlParams_.Set("prettyPrint", "false")
  2104. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/acl")
  2105. urls += "?" + c.urlParams_.Encode()
  2106. req, err := http.NewRequest("POST", urls, body)
  2107. if err != nil {
  2108. return nil, err
  2109. }
  2110. req.Header = reqHeaders
  2111. googleapi.Expand(req.URL, map[string]string{
  2112. "bucket": c.bucket,
  2113. })
  2114. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2115. }
  2116. // Do executes the "storage.bucketAccessControls.insert" call.
  2117. // Exactly one of *BucketAccessControl or error will be non-nil. Any
  2118. // non-2xx status code is an error. Response headers are in either
  2119. // *BucketAccessControl.ServerResponse.Header or (if a response was
  2120. // returned at all) in error.(*googleapi.Error).Header. Use
  2121. // googleapi.IsNotModified to check whether the returned error was
  2122. // because http.StatusNotModified was returned.
  2123. func (c *BucketAccessControlsInsertCall) Do(opts ...googleapi.CallOption) (*BucketAccessControl, error) {
  2124. gensupport.SetOptions(c.urlParams_, opts...)
  2125. res, err := c.doRequest("json")
  2126. if res != nil && res.StatusCode == http.StatusNotModified {
  2127. if res.Body != nil {
  2128. res.Body.Close()
  2129. }
  2130. return nil, &googleapi.Error{
  2131. Code: res.StatusCode,
  2132. Header: res.Header,
  2133. }
  2134. }
  2135. if err != nil {
  2136. return nil, err
  2137. }
  2138. defer googleapi.CloseBody(res)
  2139. if err := googleapi.CheckResponse(res); err != nil {
  2140. return nil, err
  2141. }
  2142. ret := &BucketAccessControl{
  2143. ServerResponse: googleapi.ServerResponse{
  2144. Header: res.Header,
  2145. HTTPStatusCode: res.StatusCode,
  2146. },
  2147. }
  2148. target := &ret
  2149. if err := gensupport.DecodeResponse(target, res); err != nil {
  2150. return nil, err
  2151. }
  2152. return ret, nil
  2153. // {
  2154. // "description": "Creates a new ACL entry on the specified bucket.",
  2155. // "httpMethod": "POST",
  2156. // "id": "storage.bucketAccessControls.insert",
  2157. // "parameterOrder": [
  2158. // "bucket"
  2159. // ],
  2160. // "parameters": {
  2161. // "bucket": {
  2162. // "description": "Name of a bucket.",
  2163. // "location": "path",
  2164. // "required": true,
  2165. // "type": "string"
  2166. // },
  2167. // "userProject": {
  2168. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  2169. // "location": "query",
  2170. // "type": "string"
  2171. // }
  2172. // },
  2173. // "path": "b/{bucket}/acl",
  2174. // "request": {
  2175. // "$ref": "BucketAccessControl"
  2176. // },
  2177. // "response": {
  2178. // "$ref": "BucketAccessControl"
  2179. // },
  2180. // "scopes": [
  2181. // "https://www.googleapis.com/auth/cloud-platform",
  2182. // "https://www.googleapis.com/auth/devstorage.full_control"
  2183. // ]
  2184. // }
  2185. }
  2186. // method id "storage.bucketAccessControls.list":
  2187. type BucketAccessControlsListCall struct {
  2188. s *Service
  2189. bucket string
  2190. urlParams_ gensupport.URLParams
  2191. ifNoneMatch_ string
  2192. ctx_ context.Context
  2193. header_ http.Header
  2194. }
  2195. // List: Retrieves ACL entries on the specified bucket.
  2196. func (r *BucketAccessControlsService) List(bucket string) *BucketAccessControlsListCall {
  2197. c := &BucketAccessControlsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2198. c.bucket = bucket
  2199. return c
  2200. }
  2201. // UserProject sets the optional parameter "userProject": The project to
  2202. // be billed for this request. Required for Requester Pays buckets.
  2203. func (c *BucketAccessControlsListCall) UserProject(userProject string) *BucketAccessControlsListCall {
  2204. c.urlParams_.Set("userProject", userProject)
  2205. return c
  2206. }
  2207. // Fields allows partial responses to be retrieved. See
  2208. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2209. // for more information.
  2210. func (c *BucketAccessControlsListCall) Fields(s ...googleapi.Field) *BucketAccessControlsListCall {
  2211. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2212. return c
  2213. }
  2214. // IfNoneMatch sets the optional parameter which makes the operation
  2215. // fail if the object's ETag matches the given value. This is useful for
  2216. // getting updates only after the object has changed since the last
  2217. // request. Use googleapi.IsNotModified to check whether the response
  2218. // error from Do is the result of In-None-Match.
  2219. func (c *BucketAccessControlsListCall) IfNoneMatch(entityTag string) *BucketAccessControlsListCall {
  2220. c.ifNoneMatch_ = entityTag
  2221. return c
  2222. }
  2223. // Context sets the context to be used in this call's Do method. Any
  2224. // pending HTTP request will be aborted if the provided context is
  2225. // canceled.
  2226. func (c *BucketAccessControlsListCall) Context(ctx context.Context) *BucketAccessControlsListCall {
  2227. c.ctx_ = ctx
  2228. return c
  2229. }
  2230. // Header returns an http.Header that can be modified by the caller to
  2231. // add HTTP headers to the request.
  2232. func (c *BucketAccessControlsListCall) Header() http.Header {
  2233. if c.header_ == nil {
  2234. c.header_ = make(http.Header)
  2235. }
  2236. return c.header_
  2237. }
  2238. func (c *BucketAccessControlsListCall) doRequest(alt string) (*http.Response, error) {
  2239. reqHeaders := make(http.Header)
  2240. for k, v := range c.header_ {
  2241. reqHeaders[k] = v
  2242. }
  2243. reqHeaders.Set("User-Agent", c.s.userAgent())
  2244. if c.ifNoneMatch_ != "" {
  2245. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2246. }
  2247. var body io.Reader = nil
  2248. c.urlParams_.Set("alt", alt)
  2249. c.urlParams_.Set("prettyPrint", "false")
  2250. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/acl")
  2251. urls += "?" + c.urlParams_.Encode()
  2252. req, err := http.NewRequest("GET", urls, body)
  2253. if err != nil {
  2254. return nil, err
  2255. }
  2256. req.Header = reqHeaders
  2257. googleapi.Expand(req.URL, map[string]string{
  2258. "bucket": c.bucket,
  2259. })
  2260. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2261. }
  2262. // Do executes the "storage.bucketAccessControls.list" call.
  2263. // Exactly one of *BucketAccessControls or error will be non-nil. Any
  2264. // non-2xx status code is an error. Response headers are in either
  2265. // *BucketAccessControls.ServerResponse.Header or (if a response was
  2266. // returned at all) in error.(*googleapi.Error).Header. Use
  2267. // googleapi.IsNotModified to check whether the returned error was
  2268. // because http.StatusNotModified was returned.
  2269. func (c *BucketAccessControlsListCall) Do(opts ...googleapi.CallOption) (*BucketAccessControls, error) {
  2270. gensupport.SetOptions(c.urlParams_, opts...)
  2271. res, err := c.doRequest("json")
  2272. if res != nil && res.StatusCode == http.StatusNotModified {
  2273. if res.Body != nil {
  2274. res.Body.Close()
  2275. }
  2276. return nil, &googleapi.Error{
  2277. Code: res.StatusCode,
  2278. Header: res.Header,
  2279. }
  2280. }
  2281. if err != nil {
  2282. return nil, err
  2283. }
  2284. defer googleapi.CloseBody(res)
  2285. if err := googleapi.CheckResponse(res); err != nil {
  2286. return nil, err
  2287. }
  2288. ret := &BucketAccessControls{
  2289. ServerResponse: googleapi.ServerResponse{
  2290. Header: res.Header,
  2291. HTTPStatusCode: res.StatusCode,
  2292. },
  2293. }
  2294. target := &ret
  2295. if err := gensupport.DecodeResponse(target, res); err != nil {
  2296. return nil, err
  2297. }
  2298. return ret, nil
  2299. // {
  2300. // "description": "Retrieves ACL entries on the specified bucket.",
  2301. // "httpMethod": "GET",
  2302. // "id": "storage.bucketAccessControls.list",
  2303. // "parameterOrder": [
  2304. // "bucket"
  2305. // ],
  2306. // "parameters": {
  2307. // "bucket": {
  2308. // "description": "Name of a bucket.",
  2309. // "location": "path",
  2310. // "required": true,
  2311. // "type": "string"
  2312. // },
  2313. // "userProject": {
  2314. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  2315. // "location": "query",
  2316. // "type": "string"
  2317. // }
  2318. // },
  2319. // "path": "b/{bucket}/acl",
  2320. // "response": {
  2321. // "$ref": "BucketAccessControls"
  2322. // },
  2323. // "scopes": [
  2324. // "https://www.googleapis.com/auth/cloud-platform",
  2325. // "https://www.googleapis.com/auth/devstorage.full_control"
  2326. // ]
  2327. // }
  2328. }
  2329. // method id "storage.bucketAccessControls.patch":
  2330. type BucketAccessControlsPatchCall struct {
  2331. s *Service
  2332. bucket string
  2333. entity string
  2334. bucketaccesscontrol *BucketAccessControl
  2335. urlParams_ gensupport.URLParams
  2336. ctx_ context.Context
  2337. header_ http.Header
  2338. }
  2339. // Patch: Patches an ACL entry on the specified bucket.
  2340. func (r *BucketAccessControlsService) Patch(bucket string, entity string, bucketaccesscontrol *BucketAccessControl) *BucketAccessControlsPatchCall {
  2341. c := &BucketAccessControlsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2342. c.bucket = bucket
  2343. c.entity = entity
  2344. c.bucketaccesscontrol = bucketaccesscontrol
  2345. return c
  2346. }
  2347. // UserProject sets the optional parameter "userProject": The project to
  2348. // be billed for this request. Required for Requester Pays buckets.
  2349. func (c *BucketAccessControlsPatchCall) UserProject(userProject string) *BucketAccessControlsPatchCall {
  2350. c.urlParams_.Set("userProject", userProject)
  2351. return c
  2352. }
  2353. // Fields allows partial responses to be retrieved. See
  2354. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2355. // for more information.
  2356. func (c *BucketAccessControlsPatchCall) Fields(s ...googleapi.Field) *BucketAccessControlsPatchCall {
  2357. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2358. return c
  2359. }
  2360. // Context sets the context to be used in this call's Do method. Any
  2361. // pending HTTP request will be aborted if the provided context is
  2362. // canceled.
  2363. func (c *BucketAccessControlsPatchCall) Context(ctx context.Context) *BucketAccessControlsPatchCall {
  2364. c.ctx_ = ctx
  2365. return c
  2366. }
  2367. // Header returns an http.Header that can be modified by the caller to
  2368. // add HTTP headers to the request.
  2369. func (c *BucketAccessControlsPatchCall) Header() http.Header {
  2370. if c.header_ == nil {
  2371. c.header_ = make(http.Header)
  2372. }
  2373. return c.header_
  2374. }
  2375. func (c *BucketAccessControlsPatchCall) doRequest(alt string) (*http.Response, error) {
  2376. reqHeaders := make(http.Header)
  2377. for k, v := range c.header_ {
  2378. reqHeaders[k] = v
  2379. }
  2380. reqHeaders.Set("User-Agent", c.s.userAgent())
  2381. var body io.Reader = nil
  2382. body, err := googleapi.WithoutDataWrapper.JSONReader(c.bucketaccesscontrol)
  2383. if err != nil {
  2384. return nil, err
  2385. }
  2386. reqHeaders.Set("Content-Type", "application/json")
  2387. c.urlParams_.Set("alt", alt)
  2388. c.urlParams_.Set("prettyPrint", "false")
  2389. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/acl/{entity}")
  2390. urls += "?" + c.urlParams_.Encode()
  2391. req, err := http.NewRequest("PATCH", urls, body)
  2392. if err != nil {
  2393. return nil, err
  2394. }
  2395. req.Header = reqHeaders
  2396. googleapi.Expand(req.URL, map[string]string{
  2397. "bucket": c.bucket,
  2398. "entity": c.entity,
  2399. })
  2400. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2401. }
  2402. // Do executes the "storage.bucketAccessControls.patch" call.
  2403. // Exactly one of *BucketAccessControl or error will be non-nil. Any
  2404. // non-2xx status code is an error. Response headers are in either
  2405. // *BucketAccessControl.ServerResponse.Header or (if a response was
  2406. // returned at all) in error.(*googleapi.Error).Header. Use
  2407. // googleapi.IsNotModified to check whether the returned error was
  2408. // because http.StatusNotModified was returned.
  2409. func (c *BucketAccessControlsPatchCall) Do(opts ...googleapi.CallOption) (*BucketAccessControl, error) {
  2410. gensupport.SetOptions(c.urlParams_, opts...)
  2411. res, err := c.doRequest("json")
  2412. if res != nil && res.StatusCode == http.StatusNotModified {
  2413. if res.Body != nil {
  2414. res.Body.Close()
  2415. }
  2416. return nil, &googleapi.Error{
  2417. Code: res.StatusCode,
  2418. Header: res.Header,
  2419. }
  2420. }
  2421. if err != nil {
  2422. return nil, err
  2423. }
  2424. defer googleapi.CloseBody(res)
  2425. if err := googleapi.CheckResponse(res); err != nil {
  2426. return nil, err
  2427. }
  2428. ret := &BucketAccessControl{
  2429. ServerResponse: googleapi.ServerResponse{
  2430. Header: res.Header,
  2431. HTTPStatusCode: res.StatusCode,
  2432. },
  2433. }
  2434. target := &ret
  2435. if err := gensupport.DecodeResponse(target, res); err != nil {
  2436. return nil, err
  2437. }
  2438. return ret, nil
  2439. // {
  2440. // "description": "Patches an ACL entry on the specified bucket.",
  2441. // "httpMethod": "PATCH",
  2442. // "id": "storage.bucketAccessControls.patch",
  2443. // "parameterOrder": [
  2444. // "bucket",
  2445. // "entity"
  2446. // ],
  2447. // "parameters": {
  2448. // "bucket": {
  2449. // "description": "Name of a bucket.",
  2450. // "location": "path",
  2451. // "required": true,
  2452. // "type": "string"
  2453. // },
  2454. // "entity": {
  2455. // "description": "The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.",
  2456. // "location": "path",
  2457. // "required": true,
  2458. // "type": "string"
  2459. // },
  2460. // "userProject": {
  2461. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  2462. // "location": "query",
  2463. // "type": "string"
  2464. // }
  2465. // },
  2466. // "path": "b/{bucket}/acl/{entity}",
  2467. // "request": {
  2468. // "$ref": "BucketAccessControl"
  2469. // },
  2470. // "response": {
  2471. // "$ref": "BucketAccessControl"
  2472. // },
  2473. // "scopes": [
  2474. // "https://www.googleapis.com/auth/cloud-platform",
  2475. // "https://www.googleapis.com/auth/devstorage.full_control"
  2476. // ]
  2477. // }
  2478. }
  2479. // method id "storage.bucketAccessControls.update":
  2480. type BucketAccessControlsUpdateCall struct {
  2481. s *Service
  2482. bucket string
  2483. entity string
  2484. bucketaccesscontrol *BucketAccessControl
  2485. urlParams_ gensupport.URLParams
  2486. ctx_ context.Context
  2487. header_ http.Header
  2488. }
  2489. // Update: Updates an ACL entry on the specified bucket.
  2490. func (r *BucketAccessControlsService) Update(bucket string, entity string, bucketaccesscontrol *BucketAccessControl) *BucketAccessControlsUpdateCall {
  2491. c := &BucketAccessControlsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2492. c.bucket = bucket
  2493. c.entity = entity
  2494. c.bucketaccesscontrol = bucketaccesscontrol
  2495. return c
  2496. }
  2497. // UserProject sets the optional parameter "userProject": The project to
  2498. // be billed for this request. Required for Requester Pays buckets.
  2499. func (c *BucketAccessControlsUpdateCall) UserProject(userProject string) *BucketAccessControlsUpdateCall {
  2500. c.urlParams_.Set("userProject", userProject)
  2501. return c
  2502. }
  2503. // Fields allows partial responses to be retrieved. See
  2504. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2505. // for more information.
  2506. func (c *BucketAccessControlsUpdateCall) Fields(s ...googleapi.Field) *BucketAccessControlsUpdateCall {
  2507. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2508. return c
  2509. }
  2510. // Context sets the context to be used in this call's Do method. Any
  2511. // pending HTTP request will be aborted if the provided context is
  2512. // canceled.
  2513. func (c *BucketAccessControlsUpdateCall) Context(ctx context.Context) *BucketAccessControlsUpdateCall {
  2514. c.ctx_ = ctx
  2515. return c
  2516. }
  2517. // Header returns an http.Header that can be modified by the caller to
  2518. // add HTTP headers to the request.
  2519. func (c *BucketAccessControlsUpdateCall) Header() http.Header {
  2520. if c.header_ == nil {
  2521. c.header_ = make(http.Header)
  2522. }
  2523. return c.header_
  2524. }
  2525. func (c *BucketAccessControlsUpdateCall) doRequest(alt string) (*http.Response, error) {
  2526. reqHeaders := make(http.Header)
  2527. for k, v := range c.header_ {
  2528. reqHeaders[k] = v
  2529. }
  2530. reqHeaders.Set("User-Agent", c.s.userAgent())
  2531. var body io.Reader = nil
  2532. body, err := googleapi.WithoutDataWrapper.JSONReader(c.bucketaccesscontrol)
  2533. if err != nil {
  2534. return nil, err
  2535. }
  2536. reqHeaders.Set("Content-Type", "application/json")
  2537. c.urlParams_.Set("alt", alt)
  2538. c.urlParams_.Set("prettyPrint", "false")
  2539. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/acl/{entity}")
  2540. urls += "?" + c.urlParams_.Encode()
  2541. req, err := http.NewRequest("PUT", urls, body)
  2542. if err != nil {
  2543. return nil, err
  2544. }
  2545. req.Header = reqHeaders
  2546. googleapi.Expand(req.URL, map[string]string{
  2547. "bucket": c.bucket,
  2548. "entity": c.entity,
  2549. })
  2550. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2551. }
  2552. // Do executes the "storage.bucketAccessControls.update" call.
  2553. // Exactly one of *BucketAccessControl or error will be non-nil. Any
  2554. // non-2xx status code is an error. Response headers are in either
  2555. // *BucketAccessControl.ServerResponse.Header or (if a response was
  2556. // returned at all) in error.(*googleapi.Error).Header. Use
  2557. // googleapi.IsNotModified to check whether the returned error was
  2558. // because http.StatusNotModified was returned.
  2559. func (c *BucketAccessControlsUpdateCall) Do(opts ...googleapi.CallOption) (*BucketAccessControl, error) {
  2560. gensupport.SetOptions(c.urlParams_, opts...)
  2561. res, err := c.doRequest("json")
  2562. if res != nil && res.StatusCode == http.StatusNotModified {
  2563. if res.Body != nil {
  2564. res.Body.Close()
  2565. }
  2566. return nil, &googleapi.Error{
  2567. Code: res.StatusCode,
  2568. Header: res.Header,
  2569. }
  2570. }
  2571. if err != nil {
  2572. return nil, err
  2573. }
  2574. defer googleapi.CloseBody(res)
  2575. if err := googleapi.CheckResponse(res); err != nil {
  2576. return nil, err
  2577. }
  2578. ret := &BucketAccessControl{
  2579. ServerResponse: googleapi.ServerResponse{
  2580. Header: res.Header,
  2581. HTTPStatusCode: res.StatusCode,
  2582. },
  2583. }
  2584. target := &ret
  2585. if err := gensupport.DecodeResponse(target, res); err != nil {
  2586. return nil, err
  2587. }
  2588. return ret, nil
  2589. // {
  2590. // "description": "Updates an ACL entry on the specified bucket.",
  2591. // "httpMethod": "PUT",
  2592. // "id": "storage.bucketAccessControls.update",
  2593. // "parameterOrder": [
  2594. // "bucket",
  2595. // "entity"
  2596. // ],
  2597. // "parameters": {
  2598. // "bucket": {
  2599. // "description": "Name of a bucket.",
  2600. // "location": "path",
  2601. // "required": true,
  2602. // "type": "string"
  2603. // },
  2604. // "entity": {
  2605. // "description": "The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.",
  2606. // "location": "path",
  2607. // "required": true,
  2608. // "type": "string"
  2609. // },
  2610. // "userProject": {
  2611. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  2612. // "location": "query",
  2613. // "type": "string"
  2614. // }
  2615. // },
  2616. // "path": "b/{bucket}/acl/{entity}",
  2617. // "request": {
  2618. // "$ref": "BucketAccessControl"
  2619. // },
  2620. // "response": {
  2621. // "$ref": "BucketAccessControl"
  2622. // },
  2623. // "scopes": [
  2624. // "https://www.googleapis.com/auth/cloud-platform",
  2625. // "https://www.googleapis.com/auth/devstorage.full_control"
  2626. // ]
  2627. // }
  2628. }
  2629. // method id "storage.buckets.delete":
  2630. type BucketsDeleteCall struct {
  2631. s *Service
  2632. bucket string
  2633. urlParams_ gensupport.URLParams
  2634. ctx_ context.Context
  2635. header_ http.Header
  2636. }
  2637. // Delete: Permanently deletes an empty bucket.
  2638. func (r *BucketsService) Delete(bucket string) *BucketsDeleteCall {
  2639. c := &BucketsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2640. c.bucket = bucket
  2641. return c
  2642. }
  2643. // IfMetagenerationMatch sets the optional parameter
  2644. // "ifMetagenerationMatch": If set, only deletes the bucket if its
  2645. // metageneration matches this value.
  2646. func (c *BucketsDeleteCall) IfMetagenerationMatch(ifMetagenerationMatch int64) *BucketsDeleteCall {
  2647. c.urlParams_.Set("ifMetagenerationMatch", fmt.Sprint(ifMetagenerationMatch))
  2648. return c
  2649. }
  2650. // IfMetagenerationNotMatch sets the optional parameter
  2651. // "ifMetagenerationNotMatch": If set, only deletes the bucket if its
  2652. // metageneration does not match this value.
  2653. func (c *BucketsDeleteCall) IfMetagenerationNotMatch(ifMetagenerationNotMatch int64) *BucketsDeleteCall {
  2654. c.urlParams_.Set("ifMetagenerationNotMatch", fmt.Sprint(ifMetagenerationNotMatch))
  2655. return c
  2656. }
  2657. // UserProject sets the optional parameter "userProject": The project to
  2658. // be billed for this request. Required for Requester Pays buckets.
  2659. func (c *BucketsDeleteCall) UserProject(userProject string) *BucketsDeleteCall {
  2660. c.urlParams_.Set("userProject", userProject)
  2661. return c
  2662. }
  2663. // Fields allows partial responses to be retrieved. See
  2664. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2665. // for more information.
  2666. func (c *BucketsDeleteCall) Fields(s ...googleapi.Field) *BucketsDeleteCall {
  2667. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2668. return c
  2669. }
  2670. // Context sets the context to be used in this call's Do method. Any
  2671. // pending HTTP request will be aborted if the provided context is
  2672. // canceled.
  2673. func (c *BucketsDeleteCall) Context(ctx context.Context) *BucketsDeleteCall {
  2674. c.ctx_ = ctx
  2675. return c
  2676. }
  2677. // Header returns an http.Header that can be modified by the caller to
  2678. // add HTTP headers to the request.
  2679. func (c *BucketsDeleteCall) Header() http.Header {
  2680. if c.header_ == nil {
  2681. c.header_ = make(http.Header)
  2682. }
  2683. return c.header_
  2684. }
  2685. func (c *BucketsDeleteCall) doRequest(alt string) (*http.Response, error) {
  2686. reqHeaders := make(http.Header)
  2687. for k, v := range c.header_ {
  2688. reqHeaders[k] = v
  2689. }
  2690. reqHeaders.Set("User-Agent", c.s.userAgent())
  2691. var body io.Reader = nil
  2692. c.urlParams_.Set("alt", alt)
  2693. c.urlParams_.Set("prettyPrint", "false")
  2694. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}")
  2695. urls += "?" + c.urlParams_.Encode()
  2696. req, err := http.NewRequest("DELETE", urls, body)
  2697. if err != nil {
  2698. return nil, err
  2699. }
  2700. req.Header = reqHeaders
  2701. googleapi.Expand(req.URL, map[string]string{
  2702. "bucket": c.bucket,
  2703. })
  2704. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2705. }
  2706. // Do executes the "storage.buckets.delete" call.
  2707. func (c *BucketsDeleteCall) Do(opts ...googleapi.CallOption) error {
  2708. gensupport.SetOptions(c.urlParams_, opts...)
  2709. res, err := c.doRequest("json")
  2710. if err != nil {
  2711. return err
  2712. }
  2713. defer googleapi.CloseBody(res)
  2714. if err := googleapi.CheckResponse(res); err != nil {
  2715. return err
  2716. }
  2717. return nil
  2718. // {
  2719. // "description": "Permanently deletes an empty bucket.",
  2720. // "httpMethod": "DELETE",
  2721. // "id": "storage.buckets.delete",
  2722. // "parameterOrder": [
  2723. // "bucket"
  2724. // ],
  2725. // "parameters": {
  2726. // "bucket": {
  2727. // "description": "Name of a bucket.",
  2728. // "location": "path",
  2729. // "required": true,
  2730. // "type": "string"
  2731. // },
  2732. // "ifMetagenerationMatch": {
  2733. // "description": "If set, only deletes the bucket if its metageneration matches this value.",
  2734. // "format": "int64",
  2735. // "location": "query",
  2736. // "type": "string"
  2737. // },
  2738. // "ifMetagenerationNotMatch": {
  2739. // "description": "If set, only deletes the bucket if its metageneration does not match this value.",
  2740. // "format": "int64",
  2741. // "location": "query",
  2742. // "type": "string"
  2743. // },
  2744. // "userProject": {
  2745. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  2746. // "location": "query",
  2747. // "type": "string"
  2748. // }
  2749. // },
  2750. // "path": "b/{bucket}",
  2751. // "scopes": [
  2752. // "https://www.googleapis.com/auth/cloud-platform",
  2753. // "https://www.googleapis.com/auth/devstorage.full_control",
  2754. // "https://www.googleapis.com/auth/devstorage.read_write"
  2755. // ]
  2756. // }
  2757. }
  2758. // method id "storage.buckets.get":
  2759. type BucketsGetCall struct {
  2760. s *Service
  2761. bucket string
  2762. urlParams_ gensupport.URLParams
  2763. ifNoneMatch_ string
  2764. ctx_ context.Context
  2765. header_ http.Header
  2766. }
  2767. // Get: Returns metadata for the specified bucket.
  2768. func (r *BucketsService) Get(bucket string) *BucketsGetCall {
  2769. c := &BucketsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2770. c.bucket = bucket
  2771. return c
  2772. }
  2773. // IfMetagenerationMatch sets the optional parameter
  2774. // "ifMetagenerationMatch": Makes the return of the bucket metadata
  2775. // conditional on whether the bucket's current metageneration matches
  2776. // the given value.
  2777. func (c *BucketsGetCall) IfMetagenerationMatch(ifMetagenerationMatch int64) *BucketsGetCall {
  2778. c.urlParams_.Set("ifMetagenerationMatch", fmt.Sprint(ifMetagenerationMatch))
  2779. return c
  2780. }
  2781. // IfMetagenerationNotMatch sets the optional parameter
  2782. // "ifMetagenerationNotMatch": Makes the return of the bucket metadata
  2783. // conditional on whether the bucket's current metageneration does not
  2784. // match the given value.
  2785. func (c *BucketsGetCall) IfMetagenerationNotMatch(ifMetagenerationNotMatch int64) *BucketsGetCall {
  2786. c.urlParams_.Set("ifMetagenerationNotMatch", fmt.Sprint(ifMetagenerationNotMatch))
  2787. return c
  2788. }
  2789. // Projection sets the optional parameter "projection": Set of
  2790. // properties to return. Defaults to noAcl.
  2791. //
  2792. // Possible values:
  2793. // "full" - Include all properties.
  2794. // "noAcl" - Omit owner, acl and defaultObjectAcl properties.
  2795. func (c *BucketsGetCall) Projection(projection string) *BucketsGetCall {
  2796. c.urlParams_.Set("projection", projection)
  2797. return c
  2798. }
  2799. // UserProject sets the optional parameter "userProject": The project to
  2800. // be billed for this request. Required for Requester Pays buckets.
  2801. func (c *BucketsGetCall) UserProject(userProject string) *BucketsGetCall {
  2802. c.urlParams_.Set("userProject", userProject)
  2803. return c
  2804. }
  2805. // Fields allows partial responses to be retrieved. See
  2806. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2807. // for more information.
  2808. func (c *BucketsGetCall) Fields(s ...googleapi.Field) *BucketsGetCall {
  2809. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2810. return c
  2811. }
  2812. // IfNoneMatch sets the optional parameter which makes the operation
  2813. // fail if the object's ETag matches the given value. This is useful for
  2814. // getting updates only after the object has changed since the last
  2815. // request. Use googleapi.IsNotModified to check whether the response
  2816. // error from Do is the result of In-None-Match.
  2817. func (c *BucketsGetCall) IfNoneMatch(entityTag string) *BucketsGetCall {
  2818. c.ifNoneMatch_ = entityTag
  2819. return c
  2820. }
  2821. // Context sets the context to be used in this call's Do method. Any
  2822. // pending HTTP request will be aborted if the provided context is
  2823. // canceled.
  2824. func (c *BucketsGetCall) Context(ctx context.Context) *BucketsGetCall {
  2825. c.ctx_ = ctx
  2826. return c
  2827. }
  2828. // Header returns an http.Header that can be modified by the caller to
  2829. // add HTTP headers to the request.
  2830. func (c *BucketsGetCall) Header() http.Header {
  2831. if c.header_ == nil {
  2832. c.header_ = make(http.Header)
  2833. }
  2834. return c.header_
  2835. }
  2836. func (c *BucketsGetCall) doRequest(alt string) (*http.Response, error) {
  2837. reqHeaders := make(http.Header)
  2838. for k, v := range c.header_ {
  2839. reqHeaders[k] = v
  2840. }
  2841. reqHeaders.Set("User-Agent", c.s.userAgent())
  2842. if c.ifNoneMatch_ != "" {
  2843. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2844. }
  2845. var body io.Reader = nil
  2846. c.urlParams_.Set("alt", alt)
  2847. c.urlParams_.Set("prettyPrint", "false")
  2848. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}")
  2849. urls += "?" + c.urlParams_.Encode()
  2850. req, err := http.NewRequest("GET", urls, body)
  2851. if err != nil {
  2852. return nil, err
  2853. }
  2854. req.Header = reqHeaders
  2855. googleapi.Expand(req.URL, map[string]string{
  2856. "bucket": c.bucket,
  2857. })
  2858. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2859. }
  2860. // Do executes the "storage.buckets.get" call.
  2861. // Exactly one of *Bucket or error will be non-nil. Any non-2xx status
  2862. // code is an error. Response headers are in either
  2863. // *Bucket.ServerResponse.Header or (if a response was returned at all)
  2864. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2865. // check whether the returned error was because http.StatusNotModified
  2866. // was returned.
  2867. func (c *BucketsGetCall) Do(opts ...googleapi.CallOption) (*Bucket, error) {
  2868. gensupport.SetOptions(c.urlParams_, opts...)
  2869. res, err := c.doRequest("json")
  2870. if res != nil && res.StatusCode == http.StatusNotModified {
  2871. if res.Body != nil {
  2872. res.Body.Close()
  2873. }
  2874. return nil, &googleapi.Error{
  2875. Code: res.StatusCode,
  2876. Header: res.Header,
  2877. }
  2878. }
  2879. if err != nil {
  2880. return nil, err
  2881. }
  2882. defer googleapi.CloseBody(res)
  2883. if err := googleapi.CheckResponse(res); err != nil {
  2884. return nil, err
  2885. }
  2886. ret := &Bucket{
  2887. ServerResponse: googleapi.ServerResponse{
  2888. Header: res.Header,
  2889. HTTPStatusCode: res.StatusCode,
  2890. },
  2891. }
  2892. target := &ret
  2893. if err := gensupport.DecodeResponse(target, res); err != nil {
  2894. return nil, err
  2895. }
  2896. return ret, nil
  2897. // {
  2898. // "description": "Returns metadata for the specified bucket.",
  2899. // "httpMethod": "GET",
  2900. // "id": "storage.buckets.get",
  2901. // "parameterOrder": [
  2902. // "bucket"
  2903. // ],
  2904. // "parameters": {
  2905. // "bucket": {
  2906. // "description": "Name of a bucket.",
  2907. // "location": "path",
  2908. // "required": true,
  2909. // "type": "string"
  2910. // },
  2911. // "ifMetagenerationMatch": {
  2912. // "description": "Makes the return of the bucket metadata conditional on whether the bucket's current metageneration matches the given value.",
  2913. // "format": "int64",
  2914. // "location": "query",
  2915. // "type": "string"
  2916. // },
  2917. // "ifMetagenerationNotMatch": {
  2918. // "description": "Makes the return of the bucket metadata conditional on whether the bucket's current metageneration does not match the given value.",
  2919. // "format": "int64",
  2920. // "location": "query",
  2921. // "type": "string"
  2922. // },
  2923. // "projection": {
  2924. // "description": "Set of properties to return. Defaults to noAcl.",
  2925. // "enum": [
  2926. // "full",
  2927. // "noAcl"
  2928. // ],
  2929. // "enumDescriptions": [
  2930. // "Include all properties.",
  2931. // "Omit owner, acl and defaultObjectAcl properties."
  2932. // ],
  2933. // "location": "query",
  2934. // "type": "string"
  2935. // },
  2936. // "userProject": {
  2937. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  2938. // "location": "query",
  2939. // "type": "string"
  2940. // }
  2941. // },
  2942. // "path": "b/{bucket}",
  2943. // "response": {
  2944. // "$ref": "Bucket"
  2945. // },
  2946. // "scopes": [
  2947. // "https://www.googleapis.com/auth/cloud-platform",
  2948. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  2949. // "https://www.googleapis.com/auth/devstorage.full_control",
  2950. // "https://www.googleapis.com/auth/devstorage.read_only",
  2951. // "https://www.googleapis.com/auth/devstorage.read_write"
  2952. // ]
  2953. // }
  2954. }
  2955. // method id "storage.buckets.getIamPolicy":
  2956. type BucketsGetIamPolicyCall struct {
  2957. s *Service
  2958. bucket string
  2959. urlParams_ gensupport.URLParams
  2960. ifNoneMatch_ string
  2961. ctx_ context.Context
  2962. header_ http.Header
  2963. }
  2964. // GetIamPolicy: Returns an IAM policy for the specified bucket.
  2965. func (r *BucketsService) GetIamPolicy(bucket string) *BucketsGetIamPolicyCall {
  2966. c := &BucketsGetIamPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2967. c.bucket = bucket
  2968. return c
  2969. }
  2970. // UserProject sets the optional parameter "userProject": The project to
  2971. // be billed for this request. Required for Requester Pays buckets.
  2972. func (c *BucketsGetIamPolicyCall) UserProject(userProject string) *BucketsGetIamPolicyCall {
  2973. c.urlParams_.Set("userProject", userProject)
  2974. return c
  2975. }
  2976. // Fields allows partial responses to be retrieved. See
  2977. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2978. // for more information.
  2979. func (c *BucketsGetIamPolicyCall) Fields(s ...googleapi.Field) *BucketsGetIamPolicyCall {
  2980. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2981. return c
  2982. }
  2983. // IfNoneMatch sets the optional parameter which makes the operation
  2984. // fail if the object's ETag matches the given value. This is useful for
  2985. // getting updates only after the object has changed since the last
  2986. // request. Use googleapi.IsNotModified to check whether the response
  2987. // error from Do is the result of In-None-Match.
  2988. func (c *BucketsGetIamPolicyCall) IfNoneMatch(entityTag string) *BucketsGetIamPolicyCall {
  2989. c.ifNoneMatch_ = entityTag
  2990. return c
  2991. }
  2992. // Context sets the context to be used in this call's Do method. Any
  2993. // pending HTTP request will be aborted if the provided context is
  2994. // canceled.
  2995. func (c *BucketsGetIamPolicyCall) Context(ctx context.Context) *BucketsGetIamPolicyCall {
  2996. c.ctx_ = ctx
  2997. return c
  2998. }
  2999. // Header returns an http.Header that can be modified by the caller to
  3000. // add HTTP headers to the request.
  3001. func (c *BucketsGetIamPolicyCall) Header() http.Header {
  3002. if c.header_ == nil {
  3003. c.header_ = make(http.Header)
  3004. }
  3005. return c.header_
  3006. }
  3007. func (c *BucketsGetIamPolicyCall) doRequest(alt string) (*http.Response, error) {
  3008. reqHeaders := make(http.Header)
  3009. for k, v := range c.header_ {
  3010. reqHeaders[k] = v
  3011. }
  3012. reqHeaders.Set("User-Agent", c.s.userAgent())
  3013. if c.ifNoneMatch_ != "" {
  3014. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  3015. }
  3016. var body io.Reader = nil
  3017. c.urlParams_.Set("alt", alt)
  3018. c.urlParams_.Set("prettyPrint", "false")
  3019. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/iam")
  3020. urls += "?" + c.urlParams_.Encode()
  3021. req, err := http.NewRequest("GET", urls, body)
  3022. if err != nil {
  3023. return nil, err
  3024. }
  3025. req.Header = reqHeaders
  3026. googleapi.Expand(req.URL, map[string]string{
  3027. "bucket": c.bucket,
  3028. })
  3029. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3030. }
  3031. // Do executes the "storage.buckets.getIamPolicy" call.
  3032. // Exactly one of *Policy or error will be non-nil. Any non-2xx status
  3033. // code is an error. Response headers are in either
  3034. // *Policy.ServerResponse.Header or (if a response was returned at all)
  3035. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  3036. // check whether the returned error was because http.StatusNotModified
  3037. // was returned.
  3038. func (c *BucketsGetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Policy, error) {
  3039. gensupport.SetOptions(c.urlParams_, opts...)
  3040. res, err := c.doRequest("json")
  3041. if res != nil && res.StatusCode == http.StatusNotModified {
  3042. if res.Body != nil {
  3043. res.Body.Close()
  3044. }
  3045. return nil, &googleapi.Error{
  3046. Code: res.StatusCode,
  3047. Header: res.Header,
  3048. }
  3049. }
  3050. if err != nil {
  3051. return nil, err
  3052. }
  3053. defer googleapi.CloseBody(res)
  3054. if err := googleapi.CheckResponse(res); err != nil {
  3055. return nil, err
  3056. }
  3057. ret := &Policy{
  3058. ServerResponse: googleapi.ServerResponse{
  3059. Header: res.Header,
  3060. HTTPStatusCode: res.StatusCode,
  3061. },
  3062. }
  3063. target := &ret
  3064. if err := gensupport.DecodeResponse(target, res); err != nil {
  3065. return nil, err
  3066. }
  3067. return ret, nil
  3068. // {
  3069. // "description": "Returns an IAM policy for the specified bucket.",
  3070. // "httpMethod": "GET",
  3071. // "id": "storage.buckets.getIamPolicy",
  3072. // "parameterOrder": [
  3073. // "bucket"
  3074. // ],
  3075. // "parameters": {
  3076. // "bucket": {
  3077. // "description": "Name of a bucket.",
  3078. // "location": "path",
  3079. // "required": true,
  3080. // "type": "string"
  3081. // },
  3082. // "userProject": {
  3083. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  3084. // "location": "query",
  3085. // "type": "string"
  3086. // }
  3087. // },
  3088. // "path": "b/{bucket}/iam",
  3089. // "response": {
  3090. // "$ref": "Policy"
  3091. // },
  3092. // "scopes": [
  3093. // "https://www.googleapis.com/auth/cloud-platform",
  3094. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  3095. // "https://www.googleapis.com/auth/devstorage.full_control",
  3096. // "https://www.googleapis.com/auth/devstorage.read_only",
  3097. // "https://www.googleapis.com/auth/devstorage.read_write"
  3098. // ]
  3099. // }
  3100. }
  3101. // method id "storage.buckets.insert":
  3102. type BucketsInsertCall struct {
  3103. s *Service
  3104. bucket *Bucket
  3105. urlParams_ gensupport.URLParams
  3106. ctx_ context.Context
  3107. header_ http.Header
  3108. }
  3109. // Insert: Creates a new bucket.
  3110. func (r *BucketsService) Insert(projectid string, bucket *Bucket) *BucketsInsertCall {
  3111. c := &BucketsInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3112. c.urlParams_.Set("project", projectid)
  3113. c.bucket = bucket
  3114. return c
  3115. }
  3116. // PredefinedAcl sets the optional parameter "predefinedAcl": Apply a
  3117. // predefined set of access controls to this bucket.
  3118. //
  3119. // Possible values:
  3120. // "authenticatedRead" - Project team owners get OWNER access, and
  3121. // allAuthenticatedUsers get READER access.
  3122. // "private" - Project team owners get OWNER access.
  3123. // "projectPrivate" - Project team members get access according to
  3124. // their roles.
  3125. // "publicRead" - Project team owners get OWNER access, and allUsers
  3126. // get READER access.
  3127. // "publicReadWrite" - Project team owners get OWNER access, and
  3128. // allUsers get WRITER access.
  3129. func (c *BucketsInsertCall) PredefinedAcl(predefinedAcl string) *BucketsInsertCall {
  3130. c.urlParams_.Set("predefinedAcl", predefinedAcl)
  3131. return c
  3132. }
  3133. // PredefinedDefaultObjectAcl sets the optional parameter
  3134. // "predefinedDefaultObjectAcl": Apply a predefined set of default
  3135. // object access controls to this bucket.
  3136. //
  3137. // Possible values:
  3138. // "authenticatedRead" - Object owner gets OWNER access, and
  3139. // allAuthenticatedUsers get READER access.
  3140. // "bucketOwnerFullControl" - Object owner gets OWNER access, and
  3141. // project team owners get OWNER access.
  3142. // "bucketOwnerRead" - Object owner gets OWNER access, and project
  3143. // team owners get READER access.
  3144. // "private" - Object owner gets OWNER access.
  3145. // "projectPrivate" - Object owner gets OWNER access, and project team
  3146. // members get access according to their roles.
  3147. // "publicRead" - Object owner gets OWNER access, and allUsers get
  3148. // READER access.
  3149. func (c *BucketsInsertCall) PredefinedDefaultObjectAcl(predefinedDefaultObjectAcl string) *BucketsInsertCall {
  3150. c.urlParams_.Set("predefinedDefaultObjectAcl", predefinedDefaultObjectAcl)
  3151. return c
  3152. }
  3153. // Projection sets the optional parameter "projection": Set of
  3154. // properties to return. Defaults to noAcl, unless the bucket resource
  3155. // specifies acl or defaultObjectAcl properties, when it defaults to
  3156. // full.
  3157. //
  3158. // Possible values:
  3159. // "full" - Include all properties.
  3160. // "noAcl" - Omit owner, acl and defaultObjectAcl properties.
  3161. func (c *BucketsInsertCall) Projection(projection string) *BucketsInsertCall {
  3162. c.urlParams_.Set("projection", projection)
  3163. return c
  3164. }
  3165. // UserProject sets the optional parameter "userProject": The project to
  3166. // be billed for this request.
  3167. func (c *BucketsInsertCall) UserProject(userProject string) *BucketsInsertCall {
  3168. c.urlParams_.Set("userProject", userProject)
  3169. return c
  3170. }
  3171. // Fields allows partial responses to be retrieved. See
  3172. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3173. // for more information.
  3174. func (c *BucketsInsertCall) Fields(s ...googleapi.Field) *BucketsInsertCall {
  3175. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3176. return c
  3177. }
  3178. // Context sets the context to be used in this call's Do method. Any
  3179. // pending HTTP request will be aborted if the provided context is
  3180. // canceled.
  3181. func (c *BucketsInsertCall) Context(ctx context.Context) *BucketsInsertCall {
  3182. c.ctx_ = ctx
  3183. return c
  3184. }
  3185. // Header returns an http.Header that can be modified by the caller to
  3186. // add HTTP headers to the request.
  3187. func (c *BucketsInsertCall) Header() http.Header {
  3188. if c.header_ == nil {
  3189. c.header_ = make(http.Header)
  3190. }
  3191. return c.header_
  3192. }
  3193. func (c *BucketsInsertCall) doRequest(alt string) (*http.Response, error) {
  3194. reqHeaders := make(http.Header)
  3195. for k, v := range c.header_ {
  3196. reqHeaders[k] = v
  3197. }
  3198. reqHeaders.Set("User-Agent", c.s.userAgent())
  3199. var body io.Reader = nil
  3200. body, err := googleapi.WithoutDataWrapper.JSONReader(c.bucket)
  3201. if err != nil {
  3202. return nil, err
  3203. }
  3204. reqHeaders.Set("Content-Type", "application/json")
  3205. c.urlParams_.Set("alt", alt)
  3206. c.urlParams_.Set("prettyPrint", "false")
  3207. urls := googleapi.ResolveRelative(c.s.BasePath, "b")
  3208. urls += "?" + c.urlParams_.Encode()
  3209. req, err := http.NewRequest("POST", urls, body)
  3210. if err != nil {
  3211. return nil, err
  3212. }
  3213. req.Header = reqHeaders
  3214. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3215. }
  3216. // Do executes the "storage.buckets.insert" call.
  3217. // Exactly one of *Bucket or error will be non-nil. Any non-2xx status
  3218. // code is an error. Response headers are in either
  3219. // *Bucket.ServerResponse.Header or (if a response was returned at all)
  3220. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  3221. // check whether the returned error was because http.StatusNotModified
  3222. // was returned.
  3223. func (c *BucketsInsertCall) Do(opts ...googleapi.CallOption) (*Bucket, error) {
  3224. gensupport.SetOptions(c.urlParams_, opts...)
  3225. res, err := c.doRequest("json")
  3226. if res != nil && res.StatusCode == http.StatusNotModified {
  3227. if res.Body != nil {
  3228. res.Body.Close()
  3229. }
  3230. return nil, &googleapi.Error{
  3231. Code: res.StatusCode,
  3232. Header: res.Header,
  3233. }
  3234. }
  3235. if err != nil {
  3236. return nil, err
  3237. }
  3238. defer googleapi.CloseBody(res)
  3239. if err := googleapi.CheckResponse(res); err != nil {
  3240. return nil, err
  3241. }
  3242. ret := &Bucket{
  3243. ServerResponse: googleapi.ServerResponse{
  3244. Header: res.Header,
  3245. HTTPStatusCode: res.StatusCode,
  3246. },
  3247. }
  3248. target := &ret
  3249. if err := gensupport.DecodeResponse(target, res); err != nil {
  3250. return nil, err
  3251. }
  3252. return ret, nil
  3253. // {
  3254. // "description": "Creates a new bucket.",
  3255. // "httpMethod": "POST",
  3256. // "id": "storage.buckets.insert",
  3257. // "parameterOrder": [
  3258. // "project"
  3259. // ],
  3260. // "parameters": {
  3261. // "predefinedAcl": {
  3262. // "description": "Apply a predefined set of access controls to this bucket.",
  3263. // "enum": [
  3264. // "authenticatedRead",
  3265. // "private",
  3266. // "projectPrivate",
  3267. // "publicRead",
  3268. // "publicReadWrite"
  3269. // ],
  3270. // "enumDescriptions": [
  3271. // "Project team owners get OWNER access, and allAuthenticatedUsers get READER access.",
  3272. // "Project team owners get OWNER access.",
  3273. // "Project team members get access according to their roles.",
  3274. // "Project team owners get OWNER access, and allUsers get READER access.",
  3275. // "Project team owners get OWNER access, and allUsers get WRITER access."
  3276. // ],
  3277. // "location": "query",
  3278. // "type": "string"
  3279. // },
  3280. // "predefinedDefaultObjectAcl": {
  3281. // "description": "Apply a predefined set of default object access controls to this bucket.",
  3282. // "enum": [
  3283. // "authenticatedRead",
  3284. // "bucketOwnerFullControl",
  3285. // "bucketOwnerRead",
  3286. // "private",
  3287. // "projectPrivate",
  3288. // "publicRead"
  3289. // ],
  3290. // "enumDescriptions": [
  3291. // "Object owner gets OWNER access, and allAuthenticatedUsers get READER access.",
  3292. // "Object owner gets OWNER access, and project team owners get OWNER access.",
  3293. // "Object owner gets OWNER access, and project team owners get READER access.",
  3294. // "Object owner gets OWNER access.",
  3295. // "Object owner gets OWNER access, and project team members get access according to their roles.",
  3296. // "Object owner gets OWNER access, and allUsers get READER access."
  3297. // ],
  3298. // "location": "query",
  3299. // "type": "string"
  3300. // },
  3301. // "project": {
  3302. // "description": "A valid API project identifier.",
  3303. // "location": "query",
  3304. // "required": true,
  3305. // "type": "string"
  3306. // },
  3307. // "projection": {
  3308. // "description": "Set of properties to return. Defaults to noAcl, unless the bucket resource specifies acl or defaultObjectAcl properties, when it defaults to full.",
  3309. // "enum": [
  3310. // "full",
  3311. // "noAcl"
  3312. // ],
  3313. // "enumDescriptions": [
  3314. // "Include all properties.",
  3315. // "Omit owner, acl and defaultObjectAcl properties."
  3316. // ],
  3317. // "location": "query",
  3318. // "type": "string"
  3319. // },
  3320. // "userProject": {
  3321. // "description": "The project to be billed for this request.",
  3322. // "location": "query",
  3323. // "type": "string"
  3324. // }
  3325. // },
  3326. // "path": "b",
  3327. // "request": {
  3328. // "$ref": "Bucket"
  3329. // },
  3330. // "response": {
  3331. // "$ref": "Bucket"
  3332. // },
  3333. // "scopes": [
  3334. // "https://www.googleapis.com/auth/cloud-platform",
  3335. // "https://www.googleapis.com/auth/devstorage.full_control",
  3336. // "https://www.googleapis.com/auth/devstorage.read_write"
  3337. // ]
  3338. // }
  3339. }
  3340. // method id "storage.buckets.list":
  3341. type BucketsListCall struct {
  3342. s *Service
  3343. urlParams_ gensupport.URLParams
  3344. ifNoneMatch_ string
  3345. ctx_ context.Context
  3346. header_ http.Header
  3347. }
  3348. // List: Retrieves a list of buckets for a given project.
  3349. func (r *BucketsService) List(projectid string) *BucketsListCall {
  3350. c := &BucketsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3351. c.urlParams_.Set("project", projectid)
  3352. return c
  3353. }
  3354. // MaxResults sets the optional parameter "maxResults": Maximum number
  3355. // of buckets to return in a single response. The service will use this
  3356. // parameter or 1,000 items, whichever is smaller.
  3357. func (c *BucketsListCall) MaxResults(maxResults int64) *BucketsListCall {
  3358. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  3359. return c
  3360. }
  3361. // PageToken sets the optional parameter "pageToken": A
  3362. // previously-returned page token representing part of the larger set of
  3363. // results to view.
  3364. func (c *BucketsListCall) PageToken(pageToken string) *BucketsListCall {
  3365. c.urlParams_.Set("pageToken", pageToken)
  3366. return c
  3367. }
  3368. // Prefix sets the optional parameter "prefix": Filter results to
  3369. // buckets whose names begin with this prefix.
  3370. func (c *BucketsListCall) Prefix(prefix string) *BucketsListCall {
  3371. c.urlParams_.Set("prefix", prefix)
  3372. return c
  3373. }
  3374. // Projection sets the optional parameter "projection": Set of
  3375. // properties to return. Defaults to noAcl.
  3376. //
  3377. // Possible values:
  3378. // "full" - Include all properties.
  3379. // "noAcl" - Omit owner, acl and defaultObjectAcl properties.
  3380. func (c *BucketsListCall) Projection(projection string) *BucketsListCall {
  3381. c.urlParams_.Set("projection", projection)
  3382. return c
  3383. }
  3384. // UserProject sets the optional parameter "userProject": The project to
  3385. // be billed for this request.
  3386. func (c *BucketsListCall) UserProject(userProject string) *BucketsListCall {
  3387. c.urlParams_.Set("userProject", userProject)
  3388. return c
  3389. }
  3390. // Fields allows partial responses to be retrieved. See
  3391. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3392. // for more information.
  3393. func (c *BucketsListCall) Fields(s ...googleapi.Field) *BucketsListCall {
  3394. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3395. return c
  3396. }
  3397. // IfNoneMatch sets the optional parameter which makes the operation
  3398. // fail if the object's ETag matches the given value. This is useful for
  3399. // getting updates only after the object has changed since the last
  3400. // request. Use googleapi.IsNotModified to check whether the response
  3401. // error from Do is the result of In-None-Match.
  3402. func (c *BucketsListCall) IfNoneMatch(entityTag string) *BucketsListCall {
  3403. c.ifNoneMatch_ = entityTag
  3404. return c
  3405. }
  3406. // Context sets the context to be used in this call's Do method. Any
  3407. // pending HTTP request will be aborted if the provided context is
  3408. // canceled.
  3409. func (c *BucketsListCall) Context(ctx context.Context) *BucketsListCall {
  3410. c.ctx_ = ctx
  3411. return c
  3412. }
  3413. // Header returns an http.Header that can be modified by the caller to
  3414. // add HTTP headers to the request.
  3415. func (c *BucketsListCall) Header() http.Header {
  3416. if c.header_ == nil {
  3417. c.header_ = make(http.Header)
  3418. }
  3419. return c.header_
  3420. }
  3421. func (c *BucketsListCall) doRequest(alt string) (*http.Response, error) {
  3422. reqHeaders := make(http.Header)
  3423. for k, v := range c.header_ {
  3424. reqHeaders[k] = v
  3425. }
  3426. reqHeaders.Set("User-Agent", c.s.userAgent())
  3427. if c.ifNoneMatch_ != "" {
  3428. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  3429. }
  3430. var body io.Reader = nil
  3431. c.urlParams_.Set("alt", alt)
  3432. c.urlParams_.Set("prettyPrint", "false")
  3433. urls := googleapi.ResolveRelative(c.s.BasePath, "b")
  3434. urls += "?" + c.urlParams_.Encode()
  3435. req, err := http.NewRequest("GET", urls, body)
  3436. if err != nil {
  3437. return nil, err
  3438. }
  3439. req.Header = reqHeaders
  3440. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3441. }
  3442. // Do executes the "storage.buckets.list" call.
  3443. // Exactly one of *Buckets or error will be non-nil. Any non-2xx status
  3444. // code is an error. Response headers are in either
  3445. // *Buckets.ServerResponse.Header or (if a response was returned at all)
  3446. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  3447. // check whether the returned error was because http.StatusNotModified
  3448. // was returned.
  3449. func (c *BucketsListCall) Do(opts ...googleapi.CallOption) (*Buckets, error) {
  3450. gensupport.SetOptions(c.urlParams_, opts...)
  3451. res, err := c.doRequest("json")
  3452. if res != nil && res.StatusCode == http.StatusNotModified {
  3453. if res.Body != nil {
  3454. res.Body.Close()
  3455. }
  3456. return nil, &googleapi.Error{
  3457. Code: res.StatusCode,
  3458. Header: res.Header,
  3459. }
  3460. }
  3461. if err != nil {
  3462. return nil, err
  3463. }
  3464. defer googleapi.CloseBody(res)
  3465. if err := googleapi.CheckResponse(res); err != nil {
  3466. return nil, err
  3467. }
  3468. ret := &Buckets{
  3469. ServerResponse: googleapi.ServerResponse{
  3470. Header: res.Header,
  3471. HTTPStatusCode: res.StatusCode,
  3472. },
  3473. }
  3474. target := &ret
  3475. if err := gensupport.DecodeResponse(target, res); err != nil {
  3476. return nil, err
  3477. }
  3478. return ret, nil
  3479. // {
  3480. // "description": "Retrieves a list of buckets for a given project.",
  3481. // "httpMethod": "GET",
  3482. // "id": "storage.buckets.list",
  3483. // "parameterOrder": [
  3484. // "project"
  3485. // ],
  3486. // "parameters": {
  3487. // "maxResults": {
  3488. // "default": "1000",
  3489. // "description": "Maximum number of buckets to return in a single response. The service will use this parameter or 1,000 items, whichever is smaller.",
  3490. // "format": "uint32",
  3491. // "location": "query",
  3492. // "minimum": "0",
  3493. // "type": "integer"
  3494. // },
  3495. // "pageToken": {
  3496. // "description": "A previously-returned page token representing part of the larger set of results to view.",
  3497. // "location": "query",
  3498. // "type": "string"
  3499. // },
  3500. // "prefix": {
  3501. // "description": "Filter results to buckets whose names begin with this prefix.",
  3502. // "location": "query",
  3503. // "type": "string"
  3504. // },
  3505. // "project": {
  3506. // "description": "A valid API project identifier.",
  3507. // "location": "query",
  3508. // "required": true,
  3509. // "type": "string"
  3510. // },
  3511. // "projection": {
  3512. // "description": "Set of properties to return. Defaults to noAcl.",
  3513. // "enum": [
  3514. // "full",
  3515. // "noAcl"
  3516. // ],
  3517. // "enumDescriptions": [
  3518. // "Include all properties.",
  3519. // "Omit owner, acl and defaultObjectAcl properties."
  3520. // ],
  3521. // "location": "query",
  3522. // "type": "string"
  3523. // },
  3524. // "userProject": {
  3525. // "description": "The project to be billed for this request.",
  3526. // "location": "query",
  3527. // "type": "string"
  3528. // }
  3529. // },
  3530. // "path": "b",
  3531. // "response": {
  3532. // "$ref": "Buckets"
  3533. // },
  3534. // "scopes": [
  3535. // "https://www.googleapis.com/auth/cloud-platform",
  3536. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  3537. // "https://www.googleapis.com/auth/devstorage.full_control",
  3538. // "https://www.googleapis.com/auth/devstorage.read_only",
  3539. // "https://www.googleapis.com/auth/devstorage.read_write"
  3540. // ]
  3541. // }
  3542. }
  3543. // Pages invokes f for each page of results.
  3544. // A non-nil error returned from f will halt the iteration.
  3545. // The provided context supersedes any context provided to the Context method.
  3546. func (c *BucketsListCall) Pages(ctx context.Context, f func(*Buckets) error) error {
  3547. c.ctx_ = ctx
  3548. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  3549. for {
  3550. x, err := c.Do()
  3551. if err != nil {
  3552. return err
  3553. }
  3554. if err := f(x); err != nil {
  3555. return err
  3556. }
  3557. if x.NextPageToken == "" {
  3558. return nil
  3559. }
  3560. c.PageToken(x.NextPageToken)
  3561. }
  3562. }
  3563. // method id "storage.buckets.lockRetentionPolicy":
  3564. type BucketsLockRetentionPolicyCall struct {
  3565. s *Service
  3566. bucket string
  3567. urlParams_ gensupport.URLParams
  3568. ctx_ context.Context
  3569. header_ http.Header
  3570. }
  3571. // LockRetentionPolicy: Locks retention policy on a bucket.
  3572. func (r *BucketsService) LockRetentionPolicy(bucket string, ifMetagenerationMatch int64) *BucketsLockRetentionPolicyCall {
  3573. c := &BucketsLockRetentionPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3574. c.bucket = bucket
  3575. c.urlParams_.Set("ifMetagenerationMatch", fmt.Sprint(ifMetagenerationMatch))
  3576. return c
  3577. }
  3578. // UserProject sets the optional parameter "userProject": The project to
  3579. // be billed for this request. Required for Requester Pays buckets.
  3580. func (c *BucketsLockRetentionPolicyCall) UserProject(userProject string) *BucketsLockRetentionPolicyCall {
  3581. c.urlParams_.Set("userProject", userProject)
  3582. return c
  3583. }
  3584. // Fields allows partial responses to be retrieved. See
  3585. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3586. // for more information.
  3587. func (c *BucketsLockRetentionPolicyCall) Fields(s ...googleapi.Field) *BucketsLockRetentionPolicyCall {
  3588. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3589. return c
  3590. }
  3591. // Context sets the context to be used in this call's Do method. Any
  3592. // pending HTTP request will be aborted if the provided context is
  3593. // canceled.
  3594. func (c *BucketsLockRetentionPolicyCall) Context(ctx context.Context) *BucketsLockRetentionPolicyCall {
  3595. c.ctx_ = ctx
  3596. return c
  3597. }
  3598. // Header returns an http.Header that can be modified by the caller to
  3599. // add HTTP headers to the request.
  3600. func (c *BucketsLockRetentionPolicyCall) Header() http.Header {
  3601. if c.header_ == nil {
  3602. c.header_ = make(http.Header)
  3603. }
  3604. return c.header_
  3605. }
  3606. func (c *BucketsLockRetentionPolicyCall) doRequest(alt string) (*http.Response, error) {
  3607. reqHeaders := make(http.Header)
  3608. for k, v := range c.header_ {
  3609. reqHeaders[k] = v
  3610. }
  3611. reqHeaders.Set("User-Agent", c.s.userAgent())
  3612. var body io.Reader = nil
  3613. c.urlParams_.Set("alt", alt)
  3614. c.urlParams_.Set("prettyPrint", "false")
  3615. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/lockRetentionPolicy")
  3616. urls += "?" + c.urlParams_.Encode()
  3617. req, err := http.NewRequest("POST", urls, body)
  3618. if err != nil {
  3619. return nil, err
  3620. }
  3621. req.Header = reqHeaders
  3622. googleapi.Expand(req.URL, map[string]string{
  3623. "bucket": c.bucket,
  3624. })
  3625. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3626. }
  3627. // Do executes the "storage.buckets.lockRetentionPolicy" call.
  3628. // Exactly one of *Bucket or error will be non-nil. Any non-2xx status
  3629. // code is an error. Response headers are in either
  3630. // *Bucket.ServerResponse.Header or (if a response was returned at all)
  3631. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  3632. // check whether the returned error was because http.StatusNotModified
  3633. // was returned.
  3634. func (c *BucketsLockRetentionPolicyCall) Do(opts ...googleapi.CallOption) (*Bucket, error) {
  3635. gensupport.SetOptions(c.urlParams_, opts...)
  3636. res, err := c.doRequest("json")
  3637. if res != nil && res.StatusCode == http.StatusNotModified {
  3638. if res.Body != nil {
  3639. res.Body.Close()
  3640. }
  3641. return nil, &googleapi.Error{
  3642. Code: res.StatusCode,
  3643. Header: res.Header,
  3644. }
  3645. }
  3646. if err != nil {
  3647. return nil, err
  3648. }
  3649. defer googleapi.CloseBody(res)
  3650. if err := googleapi.CheckResponse(res); err != nil {
  3651. return nil, err
  3652. }
  3653. ret := &Bucket{
  3654. ServerResponse: googleapi.ServerResponse{
  3655. Header: res.Header,
  3656. HTTPStatusCode: res.StatusCode,
  3657. },
  3658. }
  3659. target := &ret
  3660. if err := gensupport.DecodeResponse(target, res); err != nil {
  3661. return nil, err
  3662. }
  3663. return ret, nil
  3664. // {
  3665. // "description": "Locks retention policy on a bucket.",
  3666. // "httpMethod": "POST",
  3667. // "id": "storage.buckets.lockRetentionPolicy",
  3668. // "parameterOrder": [
  3669. // "bucket",
  3670. // "ifMetagenerationMatch"
  3671. // ],
  3672. // "parameters": {
  3673. // "bucket": {
  3674. // "description": "Name of a bucket.",
  3675. // "location": "path",
  3676. // "required": true,
  3677. // "type": "string"
  3678. // },
  3679. // "ifMetagenerationMatch": {
  3680. // "description": "Makes the operation conditional on whether bucket's current metageneration matches the given value.",
  3681. // "format": "int64",
  3682. // "location": "query",
  3683. // "required": true,
  3684. // "type": "string"
  3685. // },
  3686. // "userProject": {
  3687. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  3688. // "location": "query",
  3689. // "type": "string"
  3690. // }
  3691. // },
  3692. // "path": "b/{bucket}/lockRetentionPolicy",
  3693. // "response": {
  3694. // "$ref": "Bucket"
  3695. // },
  3696. // "scopes": [
  3697. // "https://www.googleapis.com/auth/cloud-platform",
  3698. // "https://www.googleapis.com/auth/devstorage.full_control",
  3699. // "https://www.googleapis.com/auth/devstorage.read_write"
  3700. // ]
  3701. // }
  3702. }
  3703. // method id "storage.buckets.patch":
  3704. type BucketsPatchCall struct {
  3705. s *Service
  3706. bucket string
  3707. bucket2 *Bucket
  3708. urlParams_ gensupport.URLParams
  3709. ctx_ context.Context
  3710. header_ http.Header
  3711. }
  3712. // Patch: Patches a bucket. Changes to the bucket will be readable
  3713. // immediately after writing, but configuration changes may take time to
  3714. // propagate.
  3715. func (r *BucketsService) Patch(bucket string, bucket2 *Bucket) *BucketsPatchCall {
  3716. c := &BucketsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3717. c.bucket = bucket
  3718. c.bucket2 = bucket2
  3719. return c
  3720. }
  3721. // IfMetagenerationMatch sets the optional parameter
  3722. // "ifMetagenerationMatch": Makes the return of the bucket metadata
  3723. // conditional on whether the bucket's current metageneration matches
  3724. // the given value.
  3725. func (c *BucketsPatchCall) IfMetagenerationMatch(ifMetagenerationMatch int64) *BucketsPatchCall {
  3726. c.urlParams_.Set("ifMetagenerationMatch", fmt.Sprint(ifMetagenerationMatch))
  3727. return c
  3728. }
  3729. // IfMetagenerationNotMatch sets the optional parameter
  3730. // "ifMetagenerationNotMatch": Makes the return of the bucket metadata
  3731. // conditional on whether the bucket's current metageneration does not
  3732. // match the given value.
  3733. func (c *BucketsPatchCall) IfMetagenerationNotMatch(ifMetagenerationNotMatch int64) *BucketsPatchCall {
  3734. c.urlParams_.Set("ifMetagenerationNotMatch", fmt.Sprint(ifMetagenerationNotMatch))
  3735. return c
  3736. }
  3737. // PredefinedAcl sets the optional parameter "predefinedAcl": Apply a
  3738. // predefined set of access controls to this bucket.
  3739. //
  3740. // Possible values:
  3741. // "authenticatedRead" - Project team owners get OWNER access, and
  3742. // allAuthenticatedUsers get READER access.
  3743. // "private" - Project team owners get OWNER access.
  3744. // "projectPrivate" - Project team members get access according to
  3745. // their roles.
  3746. // "publicRead" - Project team owners get OWNER access, and allUsers
  3747. // get READER access.
  3748. // "publicReadWrite" - Project team owners get OWNER access, and
  3749. // allUsers get WRITER access.
  3750. func (c *BucketsPatchCall) PredefinedAcl(predefinedAcl string) *BucketsPatchCall {
  3751. c.urlParams_.Set("predefinedAcl", predefinedAcl)
  3752. return c
  3753. }
  3754. // PredefinedDefaultObjectAcl sets the optional parameter
  3755. // "predefinedDefaultObjectAcl": Apply a predefined set of default
  3756. // object access controls to this bucket.
  3757. //
  3758. // Possible values:
  3759. // "authenticatedRead" - Object owner gets OWNER access, and
  3760. // allAuthenticatedUsers get READER access.
  3761. // "bucketOwnerFullControl" - Object owner gets OWNER access, and
  3762. // project team owners get OWNER access.
  3763. // "bucketOwnerRead" - Object owner gets OWNER access, and project
  3764. // team owners get READER access.
  3765. // "private" - Object owner gets OWNER access.
  3766. // "projectPrivate" - Object owner gets OWNER access, and project team
  3767. // members get access according to their roles.
  3768. // "publicRead" - Object owner gets OWNER access, and allUsers get
  3769. // READER access.
  3770. func (c *BucketsPatchCall) PredefinedDefaultObjectAcl(predefinedDefaultObjectAcl string) *BucketsPatchCall {
  3771. c.urlParams_.Set("predefinedDefaultObjectAcl", predefinedDefaultObjectAcl)
  3772. return c
  3773. }
  3774. // Projection sets the optional parameter "projection": Set of
  3775. // properties to return. Defaults to full.
  3776. //
  3777. // Possible values:
  3778. // "full" - Include all properties.
  3779. // "noAcl" - Omit owner, acl and defaultObjectAcl properties.
  3780. func (c *BucketsPatchCall) Projection(projection string) *BucketsPatchCall {
  3781. c.urlParams_.Set("projection", projection)
  3782. return c
  3783. }
  3784. // UserProject sets the optional parameter "userProject": The project to
  3785. // be billed for this request. Required for Requester Pays buckets.
  3786. func (c *BucketsPatchCall) UserProject(userProject string) *BucketsPatchCall {
  3787. c.urlParams_.Set("userProject", userProject)
  3788. return c
  3789. }
  3790. // Fields allows partial responses to be retrieved. See
  3791. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3792. // for more information.
  3793. func (c *BucketsPatchCall) Fields(s ...googleapi.Field) *BucketsPatchCall {
  3794. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3795. return c
  3796. }
  3797. // Context sets the context to be used in this call's Do method. Any
  3798. // pending HTTP request will be aborted if the provided context is
  3799. // canceled.
  3800. func (c *BucketsPatchCall) Context(ctx context.Context) *BucketsPatchCall {
  3801. c.ctx_ = ctx
  3802. return c
  3803. }
  3804. // Header returns an http.Header that can be modified by the caller to
  3805. // add HTTP headers to the request.
  3806. func (c *BucketsPatchCall) Header() http.Header {
  3807. if c.header_ == nil {
  3808. c.header_ = make(http.Header)
  3809. }
  3810. return c.header_
  3811. }
  3812. func (c *BucketsPatchCall) doRequest(alt string) (*http.Response, error) {
  3813. reqHeaders := make(http.Header)
  3814. for k, v := range c.header_ {
  3815. reqHeaders[k] = v
  3816. }
  3817. reqHeaders.Set("User-Agent", c.s.userAgent())
  3818. var body io.Reader = nil
  3819. body, err := googleapi.WithoutDataWrapper.JSONReader(c.bucket2)
  3820. if err != nil {
  3821. return nil, err
  3822. }
  3823. reqHeaders.Set("Content-Type", "application/json")
  3824. c.urlParams_.Set("alt", alt)
  3825. c.urlParams_.Set("prettyPrint", "false")
  3826. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}")
  3827. urls += "?" + c.urlParams_.Encode()
  3828. req, err := http.NewRequest("PATCH", urls, body)
  3829. if err != nil {
  3830. return nil, err
  3831. }
  3832. req.Header = reqHeaders
  3833. googleapi.Expand(req.URL, map[string]string{
  3834. "bucket": c.bucket,
  3835. })
  3836. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3837. }
  3838. // Do executes the "storage.buckets.patch" call.
  3839. // Exactly one of *Bucket or error will be non-nil. Any non-2xx status
  3840. // code is an error. Response headers are in either
  3841. // *Bucket.ServerResponse.Header or (if a response was returned at all)
  3842. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  3843. // check whether the returned error was because http.StatusNotModified
  3844. // was returned.
  3845. func (c *BucketsPatchCall) Do(opts ...googleapi.CallOption) (*Bucket, error) {
  3846. gensupport.SetOptions(c.urlParams_, opts...)
  3847. res, err := c.doRequest("json")
  3848. if res != nil && res.StatusCode == http.StatusNotModified {
  3849. if res.Body != nil {
  3850. res.Body.Close()
  3851. }
  3852. return nil, &googleapi.Error{
  3853. Code: res.StatusCode,
  3854. Header: res.Header,
  3855. }
  3856. }
  3857. if err != nil {
  3858. return nil, err
  3859. }
  3860. defer googleapi.CloseBody(res)
  3861. if err := googleapi.CheckResponse(res); err != nil {
  3862. return nil, err
  3863. }
  3864. ret := &Bucket{
  3865. ServerResponse: googleapi.ServerResponse{
  3866. Header: res.Header,
  3867. HTTPStatusCode: res.StatusCode,
  3868. },
  3869. }
  3870. target := &ret
  3871. if err := gensupport.DecodeResponse(target, res); err != nil {
  3872. return nil, err
  3873. }
  3874. return ret, nil
  3875. // {
  3876. // "description": "Patches a bucket. Changes to the bucket will be readable immediately after writing, but configuration changes may take time to propagate.",
  3877. // "httpMethod": "PATCH",
  3878. // "id": "storage.buckets.patch",
  3879. // "parameterOrder": [
  3880. // "bucket"
  3881. // ],
  3882. // "parameters": {
  3883. // "bucket": {
  3884. // "description": "Name of a bucket.",
  3885. // "location": "path",
  3886. // "required": true,
  3887. // "type": "string"
  3888. // },
  3889. // "ifMetagenerationMatch": {
  3890. // "description": "Makes the return of the bucket metadata conditional on whether the bucket's current metageneration matches the given value.",
  3891. // "format": "int64",
  3892. // "location": "query",
  3893. // "type": "string"
  3894. // },
  3895. // "ifMetagenerationNotMatch": {
  3896. // "description": "Makes the return of the bucket metadata conditional on whether the bucket's current metageneration does not match the given value.",
  3897. // "format": "int64",
  3898. // "location": "query",
  3899. // "type": "string"
  3900. // },
  3901. // "predefinedAcl": {
  3902. // "description": "Apply a predefined set of access controls to this bucket.",
  3903. // "enum": [
  3904. // "authenticatedRead",
  3905. // "private",
  3906. // "projectPrivate",
  3907. // "publicRead",
  3908. // "publicReadWrite"
  3909. // ],
  3910. // "enumDescriptions": [
  3911. // "Project team owners get OWNER access, and allAuthenticatedUsers get READER access.",
  3912. // "Project team owners get OWNER access.",
  3913. // "Project team members get access according to their roles.",
  3914. // "Project team owners get OWNER access, and allUsers get READER access.",
  3915. // "Project team owners get OWNER access, and allUsers get WRITER access."
  3916. // ],
  3917. // "location": "query",
  3918. // "type": "string"
  3919. // },
  3920. // "predefinedDefaultObjectAcl": {
  3921. // "description": "Apply a predefined set of default object access controls to this bucket.",
  3922. // "enum": [
  3923. // "authenticatedRead",
  3924. // "bucketOwnerFullControl",
  3925. // "bucketOwnerRead",
  3926. // "private",
  3927. // "projectPrivate",
  3928. // "publicRead"
  3929. // ],
  3930. // "enumDescriptions": [
  3931. // "Object owner gets OWNER access, and allAuthenticatedUsers get READER access.",
  3932. // "Object owner gets OWNER access, and project team owners get OWNER access.",
  3933. // "Object owner gets OWNER access, and project team owners get READER access.",
  3934. // "Object owner gets OWNER access.",
  3935. // "Object owner gets OWNER access, and project team members get access according to their roles.",
  3936. // "Object owner gets OWNER access, and allUsers get READER access."
  3937. // ],
  3938. // "location": "query",
  3939. // "type": "string"
  3940. // },
  3941. // "projection": {
  3942. // "description": "Set of properties to return. Defaults to full.",
  3943. // "enum": [
  3944. // "full",
  3945. // "noAcl"
  3946. // ],
  3947. // "enumDescriptions": [
  3948. // "Include all properties.",
  3949. // "Omit owner, acl and defaultObjectAcl properties."
  3950. // ],
  3951. // "location": "query",
  3952. // "type": "string"
  3953. // },
  3954. // "userProject": {
  3955. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  3956. // "location": "query",
  3957. // "type": "string"
  3958. // }
  3959. // },
  3960. // "path": "b/{bucket}",
  3961. // "request": {
  3962. // "$ref": "Bucket"
  3963. // },
  3964. // "response": {
  3965. // "$ref": "Bucket"
  3966. // },
  3967. // "scopes": [
  3968. // "https://www.googleapis.com/auth/cloud-platform",
  3969. // "https://www.googleapis.com/auth/devstorage.full_control"
  3970. // ]
  3971. // }
  3972. }
  3973. // method id "storage.buckets.setIamPolicy":
  3974. type BucketsSetIamPolicyCall struct {
  3975. s *Service
  3976. bucket string
  3977. policy *Policy
  3978. urlParams_ gensupport.URLParams
  3979. ctx_ context.Context
  3980. header_ http.Header
  3981. }
  3982. // SetIamPolicy: Updates an IAM policy for the specified bucket.
  3983. func (r *BucketsService) SetIamPolicy(bucket string, policy *Policy) *BucketsSetIamPolicyCall {
  3984. c := &BucketsSetIamPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3985. c.bucket = bucket
  3986. c.policy = policy
  3987. return c
  3988. }
  3989. // UserProject sets the optional parameter "userProject": The project to
  3990. // be billed for this request. Required for Requester Pays buckets.
  3991. func (c *BucketsSetIamPolicyCall) UserProject(userProject string) *BucketsSetIamPolicyCall {
  3992. c.urlParams_.Set("userProject", userProject)
  3993. return c
  3994. }
  3995. // Fields allows partial responses to be retrieved. See
  3996. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3997. // for more information.
  3998. func (c *BucketsSetIamPolicyCall) Fields(s ...googleapi.Field) *BucketsSetIamPolicyCall {
  3999. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4000. return c
  4001. }
  4002. // Context sets the context to be used in this call's Do method. Any
  4003. // pending HTTP request will be aborted if the provided context is
  4004. // canceled.
  4005. func (c *BucketsSetIamPolicyCall) Context(ctx context.Context) *BucketsSetIamPolicyCall {
  4006. c.ctx_ = ctx
  4007. return c
  4008. }
  4009. // Header returns an http.Header that can be modified by the caller to
  4010. // add HTTP headers to the request.
  4011. func (c *BucketsSetIamPolicyCall) Header() http.Header {
  4012. if c.header_ == nil {
  4013. c.header_ = make(http.Header)
  4014. }
  4015. return c.header_
  4016. }
  4017. func (c *BucketsSetIamPolicyCall) doRequest(alt string) (*http.Response, error) {
  4018. reqHeaders := make(http.Header)
  4019. for k, v := range c.header_ {
  4020. reqHeaders[k] = v
  4021. }
  4022. reqHeaders.Set("User-Agent", c.s.userAgent())
  4023. var body io.Reader = nil
  4024. body, err := googleapi.WithoutDataWrapper.JSONReader(c.policy)
  4025. if err != nil {
  4026. return nil, err
  4027. }
  4028. reqHeaders.Set("Content-Type", "application/json")
  4029. c.urlParams_.Set("alt", alt)
  4030. c.urlParams_.Set("prettyPrint", "false")
  4031. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/iam")
  4032. urls += "?" + c.urlParams_.Encode()
  4033. req, err := http.NewRequest("PUT", urls, body)
  4034. if err != nil {
  4035. return nil, err
  4036. }
  4037. req.Header = reqHeaders
  4038. googleapi.Expand(req.URL, map[string]string{
  4039. "bucket": c.bucket,
  4040. })
  4041. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4042. }
  4043. // Do executes the "storage.buckets.setIamPolicy" call.
  4044. // Exactly one of *Policy or error will be non-nil. Any non-2xx status
  4045. // code is an error. Response headers are in either
  4046. // *Policy.ServerResponse.Header or (if a response was returned at all)
  4047. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  4048. // check whether the returned error was because http.StatusNotModified
  4049. // was returned.
  4050. func (c *BucketsSetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Policy, error) {
  4051. gensupport.SetOptions(c.urlParams_, opts...)
  4052. res, err := c.doRequest("json")
  4053. if res != nil && res.StatusCode == http.StatusNotModified {
  4054. if res.Body != nil {
  4055. res.Body.Close()
  4056. }
  4057. return nil, &googleapi.Error{
  4058. Code: res.StatusCode,
  4059. Header: res.Header,
  4060. }
  4061. }
  4062. if err != nil {
  4063. return nil, err
  4064. }
  4065. defer googleapi.CloseBody(res)
  4066. if err := googleapi.CheckResponse(res); err != nil {
  4067. return nil, err
  4068. }
  4069. ret := &Policy{
  4070. ServerResponse: googleapi.ServerResponse{
  4071. Header: res.Header,
  4072. HTTPStatusCode: res.StatusCode,
  4073. },
  4074. }
  4075. target := &ret
  4076. if err := gensupport.DecodeResponse(target, res); err != nil {
  4077. return nil, err
  4078. }
  4079. return ret, nil
  4080. // {
  4081. // "description": "Updates an IAM policy for the specified bucket.",
  4082. // "httpMethod": "PUT",
  4083. // "id": "storage.buckets.setIamPolicy",
  4084. // "parameterOrder": [
  4085. // "bucket"
  4086. // ],
  4087. // "parameters": {
  4088. // "bucket": {
  4089. // "description": "Name of a bucket.",
  4090. // "location": "path",
  4091. // "required": true,
  4092. // "type": "string"
  4093. // },
  4094. // "userProject": {
  4095. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  4096. // "location": "query",
  4097. // "type": "string"
  4098. // }
  4099. // },
  4100. // "path": "b/{bucket}/iam",
  4101. // "request": {
  4102. // "$ref": "Policy"
  4103. // },
  4104. // "response": {
  4105. // "$ref": "Policy"
  4106. // },
  4107. // "scopes": [
  4108. // "https://www.googleapis.com/auth/cloud-platform",
  4109. // "https://www.googleapis.com/auth/devstorage.full_control",
  4110. // "https://www.googleapis.com/auth/devstorage.read_write"
  4111. // ]
  4112. // }
  4113. }
  4114. // method id "storage.buckets.testIamPermissions":
  4115. type BucketsTestIamPermissionsCall struct {
  4116. s *Service
  4117. bucket string
  4118. urlParams_ gensupport.URLParams
  4119. ifNoneMatch_ string
  4120. ctx_ context.Context
  4121. header_ http.Header
  4122. }
  4123. // TestIamPermissions: Tests a set of permissions on the given bucket to
  4124. // see which, if any, are held by the caller.
  4125. func (r *BucketsService) TestIamPermissions(bucket string, permissions []string) *BucketsTestIamPermissionsCall {
  4126. c := &BucketsTestIamPermissionsCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4127. c.bucket = bucket
  4128. c.urlParams_.SetMulti("permissions", append([]string{}, permissions...))
  4129. return c
  4130. }
  4131. // UserProject sets the optional parameter "userProject": The project to
  4132. // be billed for this request. Required for Requester Pays buckets.
  4133. func (c *BucketsTestIamPermissionsCall) UserProject(userProject string) *BucketsTestIamPermissionsCall {
  4134. c.urlParams_.Set("userProject", userProject)
  4135. return c
  4136. }
  4137. // Fields allows partial responses to be retrieved. See
  4138. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4139. // for more information.
  4140. func (c *BucketsTestIamPermissionsCall) Fields(s ...googleapi.Field) *BucketsTestIamPermissionsCall {
  4141. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4142. return c
  4143. }
  4144. // IfNoneMatch sets the optional parameter which makes the operation
  4145. // fail if the object's ETag matches the given value. This is useful for
  4146. // getting updates only after the object has changed since the last
  4147. // request. Use googleapi.IsNotModified to check whether the response
  4148. // error from Do is the result of In-None-Match.
  4149. func (c *BucketsTestIamPermissionsCall) IfNoneMatch(entityTag string) *BucketsTestIamPermissionsCall {
  4150. c.ifNoneMatch_ = entityTag
  4151. return c
  4152. }
  4153. // Context sets the context to be used in this call's Do method. Any
  4154. // pending HTTP request will be aborted if the provided context is
  4155. // canceled.
  4156. func (c *BucketsTestIamPermissionsCall) Context(ctx context.Context) *BucketsTestIamPermissionsCall {
  4157. c.ctx_ = ctx
  4158. return c
  4159. }
  4160. // Header returns an http.Header that can be modified by the caller to
  4161. // add HTTP headers to the request.
  4162. func (c *BucketsTestIamPermissionsCall) Header() http.Header {
  4163. if c.header_ == nil {
  4164. c.header_ = make(http.Header)
  4165. }
  4166. return c.header_
  4167. }
  4168. func (c *BucketsTestIamPermissionsCall) doRequest(alt string) (*http.Response, error) {
  4169. reqHeaders := make(http.Header)
  4170. for k, v := range c.header_ {
  4171. reqHeaders[k] = v
  4172. }
  4173. reqHeaders.Set("User-Agent", c.s.userAgent())
  4174. if c.ifNoneMatch_ != "" {
  4175. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  4176. }
  4177. var body io.Reader = nil
  4178. c.urlParams_.Set("alt", alt)
  4179. c.urlParams_.Set("prettyPrint", "false")
  4180. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/iam/testPermissions")
  4181. urls += "?" + c.urlParams_.Encode()
  4182. req, err := http.NewRequest("GET", urls, body)
  4183. if err != nil {
  4184. return nil, err
  4185. }
  4186. req.Header = reqHeaders
  4187. googleapi.Expand(req.URL, map[string]string{
  4188. "bucket": c.bucket,
  4189. })
  4190. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4191. }
  4192. // Do executes the "storage.buckets.testIamPermissions" call.
  4193. // Exactly one of *TestIamPermissionsResponse or error will be non-nil.
  4194. // Any non-2xx status code is an error. Response headers are in either
  4195. // *TestIamPermissionsResponse.ServerResponse.Header or (if a response
  4196. // was returned at all) in error.(*googleapi.Error).Header. Use
  4197. // googleapi.IsNotModified to check whether the returned error was
  4198. // because http.StatusNotModified was returned.
  4199. func (c *BucketsTestIamPermissionsCall) Do(opts ...googleapi.CallOption) (*TestIamPermissionsResponse, error) {
  4200. gensupport.SetOptions(c.urlParams_, opts...)
  4201. res, err := c.doRequest("json")
  4202. if res != nil && res.StatusCode == http.StatusNotModified {
  4203. if res.Body != nil {
  4204. res.Body.Close()
  4205. }
  4206. return nil, &googleapi.Error{
  4207. Code: res.StatusCode,
  4208. Header: res.Header,
  4209. }
  4210. }
  4211. if err != nil {
  4212. return nil, err
  4213. }
  4214. defer googleapi.CloseBody(res)
  4215. if err := googleapi.CheckResponse(res); err != nil {
  4216. return nil, err
  4217. }
  4218. ret := &TestIamPermissionsResponse{
  4219. ServerResponse: googleapi.ServerResponse{
  4220. Header: res.Header,
  4221. HTTPStatusCode: res.StatusCode,
  4222. },
  4223. }
  4224. target := &ret
  4225. if err := gensupport.DecodeResponse(target, res); err != nil {
  4226. return nil, err
  4227. }
  4228. return ret, nil
  4229. // {
  4230. // "description": "Tests a set of permissions on the given bucket to see which, if any, are held by the caller.",
  4231. // "httpMethod": "GET",
  4232. // "id": "storage.buckets.testIamPermissions",
  4233. // "parameterOrder": [
  4234. // "bucket",
  4235. // "permissions"
  4236. // ],
  4237. // "parameters": {
  4238. // "bucket": {
  4239. // "description": "Name of a bucket.",
  4240. // "location": "path",
  4241. // "required": true,
  4242. // "type": "string"
  4243. // },
  4244. // "permissions": {
  4245. // "description": "Permissions to test.",
  4246. // "location": "query",
  4247. // "repeated": true,
  4248. // "required": true,
  4249. // "type": "string"
  4250. // },
  4251. // "userProject": {
  4252. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  4253. // "location": "query",
  4254. // "type": "string"
  4255. // }
  4256. // },
  4257. // "path": "b/{bucket}/iam/testPermissions",
  4258. // "response": {
  4259. // "$ref": "TestIamPermissionsResponse"
  4260. // },
  4261. // "scopes": [
  4262. // "https://www.googleapis.com/auth/cloud-platform",
  4263. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  4264. // "https://www.googleapis.com/auth/devstorage.full_control",
  4265. // "https://www.googleapis.com/auth/devstorage.read_only",
  4266. // "https://www.googleapis.com/auth/devstorage.read_write"
  4267. // ]
  4268. // }
  4269. }
  4270. // method id "storage.buckets.update":
  4271. type BucketsUpdateCall struct {
  4272. s *Service
  4273. bucket string
  4274. bucket2 *Bucket
  4275. urlParams_ gensupport.URLParams
  4276. ctx_ context.Context
  4277. header_ http.Header
  4278. }
  4279. // Update: Updates a bucket. Changes to the bucket will be readable
  4280. // immediately after writing, but configuration changes may take time to
  4281. // propagate.
  4282. func (r *BucketsService) Update(bucket string, bucket2 *Bucket) *BucketsUpdateCall {
  4283. c := &BucketsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4284. c.bucket = bucket
  4285. c.bucket2 = bucket2
  4286. return c
  4287. }
  4288. // IfMetagenerationMatch sets the optional parameter
  4289. // "ifMetagenerationMatch": Makes the return of the bucket metadata
  4290. // conditional on whether the bucket's current metageneration matches
  4291. // the given value.
  4292. func (c *BucketsUpdateCall) IfMetagenerationMatch(ifMetagenerationMatch int64) *BucketsUpdateCall {
  4293. c.urlParams_.Set("ifMetagenerationMatch", fmt.Sprint(ifMetagenerationMatch))
  4294. return c
  4295. }
  4296. // IfMetagenerationNotMatch sets the optional parameter
  4297. // "ifMetagenerationNotMatch": Makes the return of the bucket metadata
  4298. // conditional on whether the bucket's current metageneration does not
  4299. // match the given value.
  4300. func (c *BucketsUpdateCall) IfMetagenerationNotMatch(ifMetagenerationNotMatch int64) *BucketsUpdateCall {
  4301. c.urlParams_.Set("ifMetagenerationNotMatch", fmt.Sprint(ifMetagenerationNotMatch))
  4302. return c
  4303. }
  4304. // PredefinedAcl sets the optional parameter "predefinedAcl": Apply a
  4305. // predefined set of access controls to this bucket.
  4306. //
  4307. // Possible values:
  4308. // "authenticatedRead" - Project team owners get OWNER access, and
  4309. // allAuthenticatedUsers get READER access.
  4310. // "private" - Project team owners get OWNER access.
  4311. // "projectPrivate" - Project team members get access according to
  4312. // their roles.
  4313. // "publicRead" - Project team owners get OWNER access, and allUsers
  4314. // get READER access.
  4315. // "publicReadWrite" - Project team owners get OWNER access, and
  4316. // allUsers get WRITER access.
  4317. func (c *BucketsUpdateCall) PredefinedAcl(predefinedAcl string) *BucketsUpdateCall {
  4318. c.urlParams_.Set("predefinedAcl", predefinedAcl)
  4319. return c
  4320. }
  4321. // PredefinedDefaultObjectAcl sets the optional parameter
  4322. // "predefinedDefaultObjectAcl": Apply a predefined set of default
  4323. // object access controls to this bucket.
  4324. //
  4325. // Possible values:
  4326. // "authenticatedRead" - Object owner gets OWNER access, and
  4327. // allAuthenticatedUsers get READER access.
  4328. // "bucketOwnerFullControl" - Object owner gets OWNER access, and
  4329. // project team owners get OWNER access.
  4330. // "bucketOwnerRead" - Object owner gets OWNER access, and project
  4331. // team owners get READER access.
  4332. // "private" - Object owner gets OWNER access.
  4333. // "projectPrivate" - Object owner gets OWNER access, and project team
  4334. // members get access according to their roles.
  4335. // "publicRead" - Object owner gets OWNER access, and allUsers get
  4336. // READER access.
  4337. func (c *BucketsUpdateCall) PredefinedDefaultObjectAcl(predefinedDefaultObjectAcl string) *BucketsUpdateCall {
  4338. c.urlParams_.Set("predefinedDefaultObjectAcl", predefinedDefaultObjectAcl)
  4339. return c
  4340. }
  4341. // Projection sets the optional parameter "projection": Set of
  4342. // properties to return. Defaults to full.
  4343. //
  4344. // Possible values:
  4345. // "full" - Include all properties.
  4346. // "noAcl" - Omit owner, acl and defaultObjectAcl properties.
  4347. func (c *BucketsUpdateCall) Projection(projection string) *BucketsUpdateCall {
  4348. c.urlParams_.Set("projection", projection)
  4349. return c
  4350. }
  4351. // UserProject sets the optional parameter "userProject": The project to
  4352. // be billed for this request. Required for Requester Pays buckets.
  4353. func (c *BucketsUpdateCall) UserProject(userProject string) *BucketsUpdateCall {
  4354. c.urlParams_.Set("userProject", userProject)
  4355. return c
  4356. }
  4357. // Fields allows partial responses to be retrieved. See
  4358. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4359. // for more information.
  4360. func (c *BucketsUpdateCall) Fields(s ...googleapi.Field) *BucketsUpdateCall {
  4361. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4362. return c
  4363. }
  4364. // Context sets the context to be used in this call's Do method. Any
  4365. // pending HTTP request will be aborted if the provided context is
  4366. // canceled.
  4367. func (c *BucketsUpdateCall) Context(ctx context.Context) *BucketsUpdateCall {
  4368. c.ctx_ = ctx
  4369. return c
  4370. }
  4371. // Header returns an http.Header that can be modified by the caller to
  4372. // add HTTP headers to the request.
  4373. func (c *BucketsUpdateCall) Header() http.Header {
  4374. if c.header_ == nil {
  4375. c.header_ = make(http.Header)
  4376. }
  4377. return c.header_
  4378. }
  4379. func (c *BucketsUpdateCall) doRequest(alt string) (*http.Response, error) {
  4380. reqHeaders := make(http.Header)
  4381. for k, v := range c.header_ {
  4382. reqHeaders[k] = v
  4383. }
  4384. reqHeaders.Set("User-Agent", c.s.userAgent())
  4385. var body io.Reader = nil
  4386. body, err := googleapi.WithoutDataWrapper.JSONReader(c.bucket2)
  4387. if err != nil {
  4388. return nil, err
  4389. }
  4390. reqHeaders.Set("Content-Type", "application/json")
  4391. c.urlParams_.Set("alt", alt)
  4392. c.urlParams_.Set("prettyPrint", "false")
  4393. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}")
  4394. urls += "?" + c.urlParams_.Encode()
  4395. req, err := http.NewRequest("PUT", urls, body)
  4396. if err != nil {
  4397. return nil, err
  4398. }
  4399. req.Header = reqHeaders
  4400. googleapi.Expand(req.URL, map[string]string{
  4401. "bucket": c.bucket,
  4402. })
  4403. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4404. }
  4405. // Do executes the "storage.buckets.update" call.
  4406. // Exactly one of *Bucket or error will be non-nil. Any non-2xx status
  4407. // code is an error. Response headers are in either
  4408. // *Bucket.ServerResponse.Header or (if a response was returned at all)
  4409. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  4410. // check whether the returned error was because http.StatusNotModified
  4411. // was returned.
  4412. func (c *BucketsUpdateCall) Do(opts ...googleapi.CallOption) (*Bucket, error) {
  4413. gensupport.SetOptions(c.urlParams_, opts...)
  4414. res, err := c.doRequest("json")
  4415. if res != nil && res.StatusCode == http.StatusNotModified {
  4416. if res.Body != nil {
  4417. res.Body.Close()
  4418. }
  4419. return nil, &googleapi.Error{
  4420. Code: res.StatusCode,
  4421. Header: res.Header,
  4422. }
  4423. }
  4424. if err != nil {
  4425. return nil, err
  4426. }
  4427. defer googleapi.CloseBody(res)
  4428. if err := googleapi.CheckResponse(res); err != nil {
  4429. return nil, err
  4430. }
  4431. ret := &Bucket{
  4432. ServerResponse: googleapi.ServerResponse{
  4433. Header: res.Header,
  4434. HTTPStatusCode: res.StatusCode,
  4435. },
  4436. }
  4437. target := &ret
  4438. if err := gensupport.DecodeResponse(target, res); err != nil {
  4439. return nil, err
  4440. }
  4441. return ret, nil
  4442. // {
  4443. // "description": "Updates a bucket. Changes to the bucket will be readable immediately after writing, but configuration changes may take time to propagate.",
  4444. // "httpMethod": "PUT",
  4445. // "id": "storage.buckets.update",
  4446. // "parameterOrder": [
  4447. // "bucket"
  4448. // ],
  4449. // "parameters": {
  4450. // "bucket": {
  4451. // "description": "Name of a bucket.",
  4452. // "location": "path",
  4453. // "required": true,
  4454. // "type": "string"
  4455. // },
  4456. // "ifMetagenerationMatch": {
  4457. // "description": "Makes the return of the bucket metadata conditional on whether the bucket's current metageneration matches the given value.",
  4458. // "format": "int64",
  4459. // "location": "query",
  4460. // "type": "string"
  4461. // },
  4462. // "ifMetagenerationNotMatch": {
  4463. // "description": "Makes the return of the bucket metadata conditional on whether the bucket's current metageneration does not match the given value.",
  4464. // "format": "int64",
  4465. // "location": "query",
  4466. // "type": "string"
  4467. // },
  4468. // "predefinedAcl": {
  4469. // "description": "Apply a predefined set of access controls to this bucket.",
  4470. // "enum": [
  4471. // "authenticatedRead",
  4472. // "private",
  4473. // "projectPrivate",
  4474. // "publicRead",
  4475. // "publicReadWrite"
  4476. // ],
  4477. // "enumDescriptions": [
  4478. // "Project team owners get OWNER access, and allAuthenticatedUsers get READER access.",
  4479. // "Project team owners get OWNER access.",
  4480. // "Project team members get access according to their roles.",
  4481. // "Project team owners get OWNER access, and allUsers get READER access.",
  4482. // "Project team owners get OWNER access, and allUsers get WRITER access."
  4483. // ],
  4484. // "location": "query",
  4485. // "type": "string"
  4486. // },
  4487. // "predefinedDefaultObjectAcl": {
  4488. // "description": "Apply a predefined set of default object access controls to this bucket.",
  4489. // "enum": [
  4490. // "authenticatedRead",
  4491. // "bucketOwnerFullControl",
  4492. // "bucketOwnerRead",
  4493. // "private",
  4494. // "projectPrivate",
  4495. // "publicRead"
  4496. // ],
  4497. // "enumDescriptions": [
  4498. // "Object owner gets OWNER access, and allAuthenticatedUsers get READER access.",
  4499. // "Object owner gets OWNER access, and project team owners get OWNER access.",
  4500. // "Object owner gets OWNER access, and project team owners get READER access.",
  4501. // "Object owner gets OWNER access.",
  4502. // "Object owner gets OWNER access, and project team members get access according to their roles.",
  4503. // "Object owner gets OWNER access, and allUsers get READER access."
  4504. // ],
  4505. // "location": "query",
  4506. // "type": "string"
  4507. // },
  4508. // "projection": {
  4509. // "description": "Set of properties to return. Defaults to full.",
  4510. // "enum": [
  4511. // "full",
  4512. // "noAcl"
  4513. // ],
  4514. // "enumDescriptions": [
  4515. // "Include all properties.",
  4516. // "Omit owner, acl and defaultObjectAcl properties."
  4517. // ],
  4518. // "location": "query",
  4519. // "type": "string"
  4520. // },
  4521. // "userProject": {
  4522. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  4523. // "location": "query",
  4524. // "type": "string"
  4525. // }
  4526. // },
  4527. // "path": "b/{bucket}",
  4528. // "request": {
  4529. // "$ref": "Bucket"
  4530. // },
  4531. // "response": {
  4532. // "$ref": "Bucket"
  4533. // },
  4534. // "scopes": [
  4535. // "https://www.googleapis.com/auth/cloud-platform",
  4536. // "https://www.googleapis.com/auth/devstorage.full_control"
  4537. // ]
  4538. // }
  4539. }
  4540. // method id "storage.channels.stop":
  4541. type ChannelsStopCall struct {
  4542. s *Service
  4543. channel *Channel
  4544. urlParams_ gensupport.URLParams
  4545. ctx_ context.Context
  4546. header_ http.Header
  4547. }
  4548. // Stop: Stop watching resources through this channel
  4549. func (r *ChannelsService) Stop(channel *Channel) *ChannelsStopCall {
  4550. c := &ChannelsStopCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4551. c.channel = channel
  4552. return c
  4553. }
  4554. // Fields allows partial responses to be retrieved. See
  4555. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4556. // for more information.
  4557. func (c *ChannelsStopCall) Fields(s ...googleapi.Field) *ChannelsStopCall {
  4558. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4559. return c
  4560. }
  4561. // Context sets the context to be used in this call's Do method. Any
  4562. // pending HTTP request will be aborted if the provided context is
  4563. // canceled.
  4564. func (c *ChannelsStopCall) Context(ctx context.Context) *ChannelsStopCall {
  4565. c.ctx_ = ctx
  4566. return c
  4567. }
  4568. // Header returns an http.Header that can be modified by the caller to
  4569. // add HTTP headers to the request.
  4570. func (c *ChannelsStopCall) Header() http.Header {
  4571. if c.header_ == nil {
  4572. c.header_ = make(http.Header)
  4573. }
  4574. return c.header_
  4575. }
  4576. func (c *ChannelsStopCall) doRequest(alt string) (*http.Response, error) {
  4577. reqHeaders := make(http.Header)
  4578. for k, v := range c.header_ {
  4579. reqHeaders[k] = v
  4580. }
  4581. reqHeaders.Set("User-Agent", c.s.userAgent())
  4582. var body io.Reader = nil
  4583. body, err := googleapi.WithoutDataWrapper.JSONReader(c.channel)
  4584. if err != nil {
  4585. return nil, err
  4586. }
  4587. reqHeaders.Set("Content-Type", "application/json")
  4588. c.urlParams_.Set("alt", alt)
  4589. c.urlParams_.Set("prettyPrint", "false")
  4590. urls := googleapi.ResolveRelative(c.s.BasePath, "channels/stop")
  4591. urls += "?" + c.urlParams_.Encode()
  4592. req, err := http.NewRequest("POST", urls, body)
  4593. if err != nil {
  4594. return nil, err
  4595. }
  4596. req.Header = reqHeaders
  4597. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4598. }
  4599. // Do executes the "storage.channels.stop" call.
  4600. func (c *ChannelsStopCall) Do(opts ...googleapi.CallOption) error {
  4601. gensupport.SetOptions(c.urlParams_, opts...)
  4602. res, err := c.doRequest("json")
  4603. if err != nil {
  4604. return err
  4605. }
  4606. defer googleapi.CloseBody(res)
  4607. if err := googleapi.CheckResponse(res); err != nil {
  4608. return err
  4609. }
  4610. return nil
  4611. // {
  4612. // "description": "Stop watching resources through this channel",
  4613. // "httpMethod": "POST",
  4614. // "id": "storage.channels.stop",
  4615. // "path": "channels/stop",
  4616. // "request": {
  4617. // "$ref": "Channel",
  4618. // "parameterName": "resource"
  4619. // },
  4620. // "scopes": [
  4621. // "https://www.googleapis.com/auth/cloud-platform",
  4622. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  4623. // "https://www.googleapis.com/auth/devstorage.full_control",
  4624. // "https://www.googleapis.com/auth/devstorage.read_only",
  4625. // "https://www.googleapis.com/auth/devstorage.read_write"
  4626. // ]
  4627. // }
  4628. }
  4629. // method id "storage.defaultObjectAccessControls.delete":
  4630. type DefaultObjectAccessControlsDeleteCall struct {
  4631. s *Service
  4632. bucket string
  4633. entity string
  4634. urlParams_ gensupport.URLParams
  4635. ctx_ context.Context
  4636. header_ http.Header
  4637. }
  4638. // Delete: Permanently deletes the default object ACL entry for the
  4639. // specified entity on the specified bucket.
  4640. func (r *DefaultObjectAccessControlsService) Delete(bucket string, entity string) *DefaultObjectAccessControlsDeleteCall {
  4641. c := &DefaultObjectAccessControlsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4642. c.bucket = bucket
  4643. c.entity = entity
  4644. return c
  4645. }
  4646. // UserProject sets the optional parameter "userProject": The project to
  4647. // be billed for this request. Required for Requester Pays buckets.
  4648. func (c *DefaultObjectAccessControlsDeleteCall) UserProject(userProject string) *DefaultObjectAccessControlsDeleteCall {
  4649. c.urlParams_.Set("userProject", userProject)
  4650. return c
  4651. }
  4652. // Fields allows partial responses to be retrieved. See
  4653. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4654. // for more information.
  4655. func (c *DefaultObjectAccessControlsDeleteCall) Fields(s ...googleapi.Field) *DefaultObjectAccessControlsDeleteCall {
  4656. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4657. return c
  4658. }
  4659. // Context sets the context to be used in this call's Do method. Any
  4660. // pending HTTP request will be aborted if the provided context is
  4661. // canceled.
  4662. func (c *DefaultObjectAccessControlsDeleteCall) Context(ctx context.Context) *DefaultObjectAccessControlsDeleteCall {
  4663. c.ctx_ = ctx
  4664. return c
  4665. }
  4666. // Header returns an http.Header that can be modified by the caller to
  4667. // add HTTP headers to the request.
  4668. func (c *DefaultObjectAccessControlsDeleteCall) Header() http.Header {
  4669. if c.header_ == nil {
  4670. c.header_ = make(http.Header)
  4671. }
  4672. return c.header_
  4673. }
  4674. func (c *DefaultObjectAccessControlsDeleteCall) doRequest(alt string) (*http.Response, error) {
  4675. reqHeaders := make(http.Header)
  4676. for k, v := range c.header_ {
  4677. reqHeaders[k] = v
  4678. }
  4679. reqHeaders.Set("User-Agent", c.s.userAgent())
  4680. var body io.Reader = nil
  4681. c.urlParams_.Set("alt", alt)
  4682. c.urlParams_.Set("prettyPrint", "false")
  4683. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/defaultObjectAcl/{entity}")
  4684. urls += "?" + c.urlParams_.Encode()
  4685. req, err := http.NewRequest("DELETE", urls, body)
  4686. if err != nil {
  4687. return nil, err
  4688. }
  4689. req.Header = reqHeaders
  4690. googleapi.Expand(req.URL, map[string]string{
  4691. "bucket": c.bucket,
  4692. "entity": c.entity,
  4693. })
  4694. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4695. }
  4696. // Do executes the "storage.defaultObjectAccessControls.delete" call.
  4697. func (c *DefaultObjectAccessControlsDeleteCall) Do(opts ...googleapi.CallOption) error {
  4698. gensupport.SetOptions(c.urlParams_, opts...)
  4699. res, err := c.doRequest("json")
  4700. if err != nil {
  4701. return err
  4702. }
  4703. defer googleapi.CloseBody(res)
  4704. if err := googleapi.CheckResponse(res); err != nil {
  4705. return err
  4706. }
  4707. return nil
  4708. // {
  4709. // "description": "Permanently deletes the default object ACL entry for the specified entity on the specified bucket.",
  4710. // "httpMethod": "DELETE",
  4711. // "id": "storage.defaultObjectAccessControls.delete",
  4712. // "parameterOrder": [
  4713. // "bucket",
  4714. // "entity"
  4715. // ],
  4716. // "parameters": {
  4717. // "bucket": {
  4718. // "description": "Name of a bucket.",
  4719. // "location": "path",
  4720. // "required": true,
  4721. // "type": "string"
  4722. // },
  4723. // "entity": {
  4724. // "description": "The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.",
  4725. // "location": "path",
  4726. // "required": true,
  4727. // "type": "string"
  4728. // },
  4729. // "userProject": {
  4730. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  4731. // "location": "query",
  4732. // "type": "string"
  4733. // }
  4734. // },
  4735. // "path": "b/{bucket}/defaultObjectAcl/{entity}",
  4736. // "scopes": [
  4737. // "https://www.googleapis.com/auth/cloud-platform",
  4738. // "https://www.googleapis.com/auth/devstorage.full_control"
  4739. // ]
  4740. // }
  4741. }
  4742. // method id "storage.defaultObjectAccessControls.get":
  4743. type DefaultObjectAccessControlsGetCall struct {
  4744. s *Service
  4745. bucket string
  4746. entity string
  4747. urlParams_ gensupport.URLParams
  4748. ifNoneMatch_ string
  4749. ctx_ context.Context
  4750. header_ http.Header
  4751. }
  4752. // Get: Returns the default object ACL entry for the specified entity on
  4753. // the specified bucket.
  4754. func (r *DefaultObjectAccessControlsService) Get(bucket string, entity string) *DefaultObjectAccessControlsGetCall {
  4755. c := &DefaultObjectAccessControlsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4756. c.bucket = bucket
  4757. c.entity = entity
  4758. return c
  4759. }
  4760. // UserProject sets the optional parameter "userProject": The project to
  4761. // be billed for this request. Required for Requester Pays buckets.
  4762. func (c *DefaultObjectAccessControlsGetCall) UserProject(userProject string) *DefaultObjectAccessControlsGetCall {
  4763. c.urlParams_.Set("userProject", userProject)
  4764. return c
  4765. }
  4766. // Fields allows partial responses to be retrieved. See
  4767. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4768. // for more information.
  4769. func (c *DefaultObjectAccessControlsGetCall) Fields(s ...googleapi.Field) *DefaultObjectAccessControlsGetCall {
  4770. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4771. return c
  4772. }
  4773. // IfNoneMatch sets the optional parameter which makes the operation
  4774. // fail if the object's ETag matches the given value. This is useful for
  4775. // getting updates only after the object has changed since the last
  4776. // request. Use googleapi.IsNotModified to check whether the response
  4777. // error from Do is the result of In-None-Match.
  4778. func (c *DefaultObjectAccessControlsGetCall) IfNoneMatch(entityTag string) *DefaultObjectAccessControlsGetCall {
  4779. c.ifNoneMatch_ = entityTag
  4780. return c
  4781. }
  4782. // Context sets the context to be used in this call's Do method. Any
  4783. // pending HTTP request will be aborted if the provided context is
  4784. // canceled.
  4785. func (c *DefaultObjectAccessControlsGetCall) Context(ctx context.Context) *DefaultObjectAccessControlsGetCall {
  4786. c.ctx_ = ctx
  4787. return c
  4788. }
  4789. // Header returns an http.Header that can be modified by the caller to
  4790. // add HTTP headers to the request.
  4791. func (c *DefaultObjectAccessControlsGetCall) Header() http.Header {
  4792. if c.header_ == nil {
  4793. c.header_ = make(http.Header)
  4794. }
  4795. return c.header_
  4796. }
  4797. func (c *DefaultObjectAccessControlsGetCall) doRequest(alt string) (*http.Response, error) {
  4798. reqHeaders := make(http.Header)
  4799. for k, v := range c.header_ {
  4800. reqHeaders[k] = v
  4801. }
  4802. reqHeaders.Set("User-Agent", c.s.userAgent())
  4803. if c.ifNoneMatch_ != "" {
  4804. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  4805. }
  4806. var body io.Reader = nil
  4807. c.urlParams_.Set("alt", alt)
  4808. c.urlParams_.Set("prettyPrint", "false")
  4809. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/defaultObjectAcl/{entity}")
  4810. urls += "?" + c.urlParams_.Encode()
  4811. req, err := http.NewRequest("GET", urls, body)
  4812. if err != nil {
  4813. return nil, err
  4814. }
  4815. req.Header = reqHeaders
  4816. googleapi.Expand(req.URL, map[string]string{
  4817. "bucket": c.bucket,
  4818. "entity": c.entity,
  4819. })
  4820. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4821. }
  4822. // Do executes the "storage.defaultObjectAccessControls.get" call.
  4823. // Exactly one of *ObjectAccessControl or error will be non-nil. Any
  4824. // non-2xx status code is an error. Response headers are in either
  4825. // *ObjectAccessControl.ServerResponse.Header or (if a response was
  4826. // returned at all) in error.(*googleapi.Error).Header. Use
  4827. // googleapi.IsNotModified to check whether the returned error was
  4828. // because http.StatusNotModified was returned.
  4829. func (c *DefaultObjectAccessControlsGetCall) Do(opts ...googleapi.CallOption) (*ObjectAccessControl, error) {
  4830. gensupport.SetOptions(c.urlParams_, opts...)
  4831. res, err := c.doRequest("json")
  4832. if res != nil && res.StatusCode == http.StatusNotModified {
  4833. if res.Body != nil {
  4834. res.Body.Close()
  4835. }
  4836. return nil, &googleapi.Error{
  4837. Code: res.StatusCode,
  4838. Header: res.Header,
  4839. }
  4840. }
  4841. if err != nil {
  4842. return nil, err
  4843. }
  4844. defer googleapi.CloseBody(res)
  4845. if err := googleapi.CheckResponse(res); err != nil {
  4846. return nil, err
  4847. }
  4848. ret := &ObjectAccessControl{
  4849. ServerResponse: googleapi.ServerResponse{
  4850. Header: res.Header,
  4851. HTTPStatusCode: res.StatusCode,
  4852. },
  4853. }
  4854. target := &ret
  4855. if err := gensupport.DecodeResponse(target, res); err != nil {
  4856. return nil, err
  4857. }
  4858. return ret, nil
  4859. // {
  4860. // "description": "Returns the default object ACL entry for the specified entity on the specified bucket.",
  4861. // "httpMethod": "GET",
  4862. // "id": "storage.defaultObjectAccessControls.get",
  4863. // "parameterOrder": [
  4864. // "bucket",
  4865. // "entity"
  4866. // ],
  4867. // "parameters": {
  4868. // "bucket": {
  4869. // "description": "Name of a bucket.",
  4870. // "location": "path",
  4871. // "required": true,
  4872. // "type": "string"
  4873. // },
  4874. // "entity": {
  4875. // "description": "The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.",
  4876. // "location": "path",
  4877. // "required": true,
  4878. // "type": "string"
  4879. // },
  4880. // "userProject": {
  4881. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  4882. // "location": "query",
  4883. // "type": "string"
  4884. // }
  4885. // },
  4886. // "path": "b/{bucket}/defaultObjectAcl/{entity}",
  4887. // "response": {
  4888. // "$ref": "ObjectAccessControl"
  4889. // },
  4890. // "scopes": [
  4891. // "https://www.googleapis.com/auth/cloud-platform",
  4892. // "https://www.googleapis.com/auth/devstorage.full_control"
  4893. // ]
  4894. // }
  4895. }
  4896. // method id "storage.defaultObjectAccessControls.insert":
  4897. type DefaultObjectAccessControlsInsertCall struct {
  4898. s *Service
  4899. bucket string
  4900. objectaccesscontrol *ObjectAccessControl
  4901. urlParams_ gensupport.URLParams
  4902. ctx_ context.Context
  4903. header_ http.Header
  4904. }
  4905. // Insert: Creates a new default object ACL entry on the specified
  4906. // bucket.
  4907. func (r *DefaultObjectAccessControlsService) Insert(bucket string, objectaccesscontrol *ObjectAccessControl) *DefaultObjectAccessControlsInsertCall {
  4908. c := &DefaultObjectAccessControlsInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4909. c.bucket = bucket
  4910. c.objectaccesscontrol = objectaccesscontrol
  4911. return c
  4912. }
  4913. // UserProject sets the optional parameter "userProject": The project to
  4914. // be billed for this request. Required for Requester Pays buckets.
  4915. func (c *DefaultObjectAccessControlsInsertCall) UserProject(userProject string) *DefaultObjectAccessControlsInsertCall {
  4916. c.urlParams_.Set("userProject", userProject)
  4917. return c
  4918. }
  4919. // Fields allows partial responses to be retrieved. See
  4920. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4921. // for more information.
  4922. func (c *DefaultObjectAccessControlsInsertCall) Fields(s ...googleapi.Field) *DefaultObjectAccessControlsInsertCall {
  4923. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4924. return c
  4925. }
  4926. // Context sets the context to be used in this call's Do method. Any
  4927. // pending HTTP request will be aborted if the provided context is
  4928. // canceled.
  4929. func (c *DefaultObjectAccessControlsInsertCall) Context(ctx context.Context) *DefaultObjectAccessControlsInsertCall {
  4930. c.ctx_ = ctx
  4931. return c
  4932. }
  4933. // Header returns an http.Header that can be modified by the caller to
  4934. // add HTTP headers to the request.
  4935. func (c *DefaultObjectAccessControlsInsertCall) Header() http.Header {
  4936. if c.header_ == nil {
  4937. c.header_ = make(http.Header)
  4938. }
  4939. return c.header_
  4940. }
  4941. func (c *DefaultObjectAccessControlsInsertCall) doRequest(alt string) (*http.Response, error) {
  4942. reqHeaders := make(http.Header)
  4943. for k, v := range c.header_ {
  4944. reqHeaders[k] = v
  4945. }
  4946. reqHeaders.Set("User-Agent", c.s.userAgent())
  4947. var body io.Reader = nil
  4948. body, err := googleapi.WithoutDataWrapper.JSONReader(c.objectaccesscontrol)
  4949. if err != nil {
  4950. return nil, err
  4951. }
  4952. reqHeaders.Set("Content-Type", "application/json")
  4953. c.urlParams_.Set("alt", alt)
  4954. c.urlParams_.Set("prettyPrint", "false")
  4955. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/defaultObjectAcl")
  4956. urls += "?" + c.urlParams_.Encode()
  4957. req, err := http.NewRequest("POST", urls, body)
  4958. if err != nil {
  4959. return nil, err
  4960. }
  4961. req.Header = reqHeaders
  4962. googleapi.Expand(req.URL, map[string]string{
  4963. "bucket": c.bucket,
  4964. })
  4965. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4966. }
  4967. // Do executes the "storage.defaultObjectAccessControls.insert" call.
  4968. // Exactly one of *ObjectAccessControl or error will be non-nil. Any
  4969. // non-2xx status code is an error. Response headers are in either
  4970. // *ObjectAccessControl.ServerResponse.Header or (if a response was
  4971. // returned at all) in error.(*googleapi.Error).Header. Use
  4972. // googleapi.IsNotModified to check whether the returned error was
  4973. // because http.StatusNotModified was returned.
  4974. func (c *DefaultObjectAccessControlsInsertCall) Do(opts ...googleapi.CallOption) (*ObjectAccessControl, error) {
  4975. gensupport.SetOptions(c.urlParams_, opts...)
  4976. res, err := c.doRequest("json")
  4977. if res != nil && res.StatusCode == http.StatusNotModified {
  4978. if res.Body != nil {
  4979. res.Body.Close()
  4980. }
  4981. return nil, &googleapi.Error{
  4982. Code: res.StatusCode,
  4983. Header: res.Header,
  4984. }
  4985. }
  4986. if err != nil {
  4987. return nil, err
  4988. }
  4989. defer googleapi.CloseBody(res)
  4990. if err := googleapi.CheckResponse(res); err != nil {
  4991. return nil, err
  4992. }
  4993. ret := &ObjectAccessControl{
  4994. ServerResponse: googleapi.ServerResponse{
  4995. Header: res.Header,
  4996. HTTPStatusCode: res.StatusCode,
  4997. },
  4998. }
  4999. target := &ret
  5000. if err := gensupport.DecodeResponse(target, res); err != nil {
  5001. return nil, err
  5002. }
  5003. return ret, nil
  5004. // {
  5005. // "description": "Creates a new default object ACL entry on the specified bucket.",
  5006. // "httpMethod": "POST",
  5007. // "id": "storage.defaultObjectAccessControls.insert",
  5008. // "parameterOrder": [
  5009. // "bucket"
  5010. // ],
  5011. // "parameters": {
  5012. // "bucket": {
  5013. // "description": "Name of a bucket.",
  5014. // "location": "path",
  5015. // "required": true,
  5016. // "type": "string"
  5017. // },
  5018. // "userProject": {
  5019. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  5020. // "location": "query",
  5021. // "type": "string"
  5022. // }
  5023. // },
  5024. // "path": "b/{bucket}/defaultObjectAcl",
  5025. // "request": {
  5026. // "$ref": "ObjectAccessControl"
  5027. // },
  5028. // "response": {
  5029. // "$ref": "ObjectAccessControl"
  5030. // },
  5031. // "scopes": [
  5032. // "https://www.googleapis.com/auth/cloud-platform",
  5033. // "https://www.googleapis.com/auth/devstorage.full_control"
  5034. // ]
  5035. // }
  5036. }
  5037. // method id "storage.defaultObjectAccessControls.list":
  5038. type DefaultObjectAccessControlsListCall struct {
  5039. s *Service
  5040. bucket string
  5041. urlParams_ gensupport.URLParams
  5042. ifNoneMatch_ string
  5043. ctx_ context.Context
  5044. header_ http.Header
  5045. }
  5046. // List: Retrieves default object ACL entries on the specified bucket.
  5047. func (r *DefaultObjectAccessControlsService) List(bucket string) *DefaultObjectAccessControlsListCall {
  5048. c := &DefaultObjectAccessControlsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5049. c.bucket = bucket
  5050. return c
  5051. }
  5052. // IfMetagenerationMatch sets the optional parameter
  5053. // "ifMetagenerationMatch": If present, only return default ACL listing
  5054. // if the bucket's current metageneration matches this value.
  5055. func (c *DefaultObjectAccessControlsListCall) IfMetagenerationMatch(ifMetagenerationMatch int64) *DefaultObjectAccessControlsListCall {
  5056. c.urlParams_.Set("ifMetagenerationMatch", fmt.Sprint(ifMetagenerationMatch))
  5057. return c
  5058. }
  5059. // IfMetagenerationNotMatch sets the optional parameter
  5060. // "ifMetagenerationNotMatch": If present, only return default ACL
  5061. // listing if the bucket's current metageneration does not match the
  5062. // given value.
  5063. func (c *DefaultObjectAccessControlsListCall) IfMetagenerationNotMatch(ifMetagenerationNotMatch int64) *DefaultObjectAccessControlsListCall {
  5064. c.urlParams_.Set("ifMetagenerationNotMatch", fmt.Sprint(ifMetagenerationNotMatch))
  5065. return c
  5066. }
  5067. // UserProject sets the optional parameter "userProject": The project to
  5068. // be billed for this request. Required for Requester Pays buckets.
  5069. func (c *DefaultObjectAccessControlsListCall) UserProject(userProject string) *DefaultObjectAccessControlsListCall {
  5070. c.urlParams_.Set("userProject", userProject)
  5071. return c
  5072. }
  5073. // Fields allows partial responses to be retrieved. See
  5074. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5075. // for more information.
  5076. func (c *DefaultObjectAccessControlsListCall) Fields(s ...googleapi.Field) *DefaultObjectAccessControlsListCall {
  5077. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5078. return c
  5079. }
  5080. // IfNoneMatch sets the optional parameter which makes the operation
  5081. // fail if the object's ETag matches the given value. This is useful for
  5082. // getting updates only after the object has changed since the last
  5083. // request. Use googleapi.IsNotModified to check whether the response
  5084. // error from Do is the result of In-None-Match.
  5085. func (c *DefaultObjectAccessControlsListCall) IfNoneMatch(entityTag string) *DefaultObjectAccessControlsListCall {
  5086. c.ifNoneMatch_ = entityTag
  5087. return c
  5088. }
  5089. // Context sets the context to be used in this call's Do method. Any
  5090. // pending HTTP request will be aborted if the provided context is
  5091. // canceled.
  5092. func (c *DefaultObjectAccessControlsListCall) Context(ctx context.Context) *DefaultObjectAccessControlsListCall {
  5093. c.ctx_ = ctx
  5094. return c
  5095. }
  5096. // Header returns an http.Header that can be modified by the caller to
  5097. // add HTTP headers to the request.
  5098. func (c *DefaultObjectAccessControlsListCall) Header() http.Header {
  5099. if c.header_ == nil {
  5100. c.header_ = make(http.Header)
  5101. }
  5102. return c.header_
  5103. }
  5104. func (c *DefaultObjectAccessControlsListCall) doRequest(alt string) (*http.Response, error) {
  5105. reqHeaders := make(http.Header)
  5106. for k, v := range c.header_ {
  5107. reqHeaders[k] = v
  5108. }
  5109. reqHeaders.Set("User-Agent", c.s.userAgent())
  5110. if c.ifNoneMatch_ != "" {
  5111. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  5112. }
  5113. var body io.Reader = nil
  5114. c.urlParams_.Set("alt", alt)
  5115. c.urlParams_.Set("prettyPrint", "false")
  5116. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/defaultObjectAcl")
  5117. urls += "?" + c.urlParams_.Encode()
  5118. req, err := http.NewRequest("GET", urls, body)
  5119. if err != nil {
  5120. return nil, err
  5121. }
  5122. req.Header = reqHeaders
  5123. googleapi.Expand(req.URL, map[string]string{
  5124. "bucket": c.bucket,
  5125. })
  5126. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5127. }
  5128. // Do executes the "storage.defaultObjectAccessControls.list" call.
  5129. // Exactly one of *ObjectAccessControls or error will be non-nil. Any
  5130. // non-2xx status code is an error. Response headers are in either
  5131. // *ObjectAccessControls.ServerResponse.Header or (if a response was
  5132. // returned at all) in error.(*googleapi.Error).Header. Use
  5133. // googleapi.IsNotModified to check whether the returned error was
  5134. // because http.StatusNotModified was returned.
  5135. func (c *DefaultObjectAccessControlsListCall) Do(opts ...googleapi.CallOption) (*ObjectAccessControls, error) {
  5136. gensupport.SetOptions(c.urlParams_, opts...)
  5137. res, err := c.doRequest("json")
  5138. if res != nil && res.StatusCode == http.StatusNotModified {
  5139. if res.Body != nil {
  5140. res.Body.Close()
  5141. }
  5142. return nil, &googleapi.Error{
  5143. Code: res.StatusCode,
  5144. Header: res.Header,
  5145. }
  5146. }
  5147. if err != nil {
  5148. return nil, err
  5149. }
  5150. defer googleapi.CloseBody(res)
  5151. if err := googleapi.CheckResponse(res); err != nil {
  5152. return nil, err
  5153. }
  5154. ret := &ObjectAccessControls{
  5155. ServerResponse: googleapi.ServerResponse{
  5156. Header: res.Header,
  5157. HTTPStatusCode: res.StatusCode,
  5158. },
  5159. }
  5160. target := &ret
  5161. if err := gensupport.DecodeResponse(target, res); err != nil {
  5162. return nil, err
  5163. }
  5164. return ret, nil
  5165. // {
  5166. // "description": "Retrieves default object ACL entries on the specified bucket.",
  5167. // "httpMethod": "GET",
  5168. // "id": "storage.defaultObjectAccessControls.list",
  5169. // "parameterOrder": [
  5170. // "bucket"
  5171. // ],
  5172. // "parameters": {
  5173. // "bucket": {
  5174. // "description": "Name of a bucket.",
  5175. // "location": "path",
  5176. // "required": true,
  5177. // "type": "string"
  5178. // },
  5179. // "ifMetagenerationMatch": {
  5180. // "description": "If present, only return default ACL listing if the bucket's current metageneration matches this value.",
  5181. // "format": "int64",
  5182. // "location": "query",
  5183. // "type": "string"
  5184. // },
  5185. // "ifMetagenerationNotMatch": {
  5186. // "description": "If present, only return default ACL listing if the bucket's current metageneration does not match the given value.",
  5187. // "format": "int64",
  5188. // "location": "query",
  5189. // "type": "string"
  5190. // },
  5191. // "userProject": {
  5192. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  5193. // "location": "query",
  5194. // "type": "string"
  5195. // }
  5196. // },
  5197. // "path": "b/{bucket}/defaultObjectAcl",
  5198. // "response": {
  5199. // "$ref": "ObjectAccessControls"
  5200. // },
  5201. // "scopes": [
  5202. // "https://www.googleapis.com/auth/cloud-platform",
  5203. // "https://www.googleapis.com/auth/devstorage.full_control"
  5204. // ]
  5205. // }
  5206. }
  5207. // method id "storage.defaultObjectAccessControls.patch":
  5208. type DefaultObjectAccessControlsPatchCall struct {
  5209. s *Service
  5210. bucket string
  5211. entity string
  5212. objectaccesscontrol *ObjectAccessControl
  5213. urlParams_ gensupport.URLParams
  5214. ctx_ context.Context
  5215. header_ http.Header
  5216. }
  5217. // Patch: Patches a default object ACL entry on the specified bucket.
  5218. func (r *DefaultObjectAccessControlsService) Patch(bucket string, entity string, objectaccesscontrol *ObjectAccessControl) *DefaultObjectAccessControlsPatchCall {
  5219. c := &DefaultObjectAccessControlsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5220. c.bucket = bucket
  5221. c.entity = entity
  5222. c.objectaccesscontrol = objectaccesscontrol
  5223. return c
  5224. }
  5225. // UserProject sets the optional parameter "userProject": The project to
  5226. // be billed for this request. Required for Requester Pays buckets.
  5227. func (c *DefaultObjectAccessControlsPatchCall) UserProject(userProject string) *DefaultObjectAccessControlsPatchCall {
  5228. c.urlParams_.Set("userProject", userProject)
  5229. return c
  5230. }
  5231. // Fields allows partial responses to be retrieved. See
  5232. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5233. // for more information.
  5234. func (c *DefaultObjectAccessControlsPatchCall) Fields(s ...googleapi.Field) *DefaultObjectAccessControlsPatchCall {
  5235. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5236. return c
  5237. }
  5238. // Context sets the context to be used in this call's Do method. Any
  5239. // pending HTTP request will be aborted if the provided context is
  5240. // canceled.
  5241. func (c *DefaultObjectAccessControlsPatchCall) Context(ctx context.Context) *DefaultObjectAccessControlsPatchCall {
  5242. c.ctx_ = ctx
  5243. return c
  5244. }
  5245. // Header returns an http.Header that can be modified by the caller to
  5246. // add HTTP headers to the request.
  5247. func (c *DefaultObjectAccessControlsPatchCall) Header() http.Header {
  5248. if c.header_ == nil {
  5249. c.header_ = make(http.Header)
  5250. }
  5251. return c.header_
  5252. }
  5253. func (c *DefaultObjectAccessControlsPatchCall) doRequest(alt string) (*http.Response, error) {
  5254. reqHeaders := make(http.Header)
  5255. for k, v := range c.header_ {
  5256. reqHeaders[k] = v
  5257. }
  5258. reqHeaders.Set("User-Agent", c.s.userAgent())
  5259. var body io.Reader = nil
  5260. body, err := googleapi.WithoutDataWrapper.JSONReader(c.objectaccesscontrol)
  5261. if err != nil {
  5262. return nil, err
  5263. }
  5264. reqHeaders.Set("Content-Type", "application/json")
  5265. c.urlParams_.Set("alt", alt)
  5266. c.urlParams_.Set("prettyPrint", "false")
  5267. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/defaultObjectAcl/{entity}")
  5268. urls += "?" + c.urlParams_.Encode()
  5269. req, err := http.NewRequest("PATCH", urls, body)
  5270. if err != nil {
  5271. return nil, err
  5272. }
  5273. req.Header = reqHeaders
  5274. googleapi.Expand(req.URL, map[string]string{
  5275. "bucket": c.bucket,
  5276. "entity": c.entity,
  5277. })
  5278. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5279. }
  5280. // Do executes the "storage.defaultObjectAccessControls.patch" call.
  5281. // Exactly one of *ObjectAccessControl or error will be non-nil. Any
  5282. // non-2xx status code is an error. Response headers are in either
  5283. // *ObjectAccessControl.ServerResponse.Header or (if a response was
  5284. // returned at all) in error.(*googleapi.Error).Header. Use
  5285. // googleapi.IsNotModified to check whether the returned error was
  5286. // because http.StatusNotModified was returned.
  5287. func (c *DefaultObjectAccessControlsPatchCall) Do(opts ...googleapi.CallOption) (*ObjectAccessControl, error) {
  5288. gensupport.SetOptions(c.urlParams_, opts...)
  5289. res, err := c.doRequest("json")
  5290. if res != nil && res.StatusCode == http.StatusNotModified {
  5291. if res.Body != nil {
  5292. res.Body.Close()
  5293. }
  5294. return nil, &googleapi.Error{
  5295. Code: res.StatusCode,
  5296. Header: res.Header,
  5297. }
  5298. }
  5299. if err != nil {
  5300. return nil, err
  5301. }
  5302. defer googleapi.CloseBody(res)
  5303. if err := googleapi.CheckResponse(res); err != nil {
  5304. return nil, err
  5305. }
  5306. ret := &ObjectAccessControl{
  5307. ServerResponse: googleapi.ServerResponse{
  5308. Header: res.Header,
  5309. HTTPStatusCode: res.StatusCode,
  5310. },
  5311. }
  5312. target := &ret
  5313. if err := gensupport.DecodeResponse(target, res); err != nil {
  5314. return nil, err
  5315. }
  5316. return ret, nil
  5317. // {
  5318. // "description": "Patches a default object ACL entry on the specified bucket.",
  5319. // "httpMethod": "PATCH",
  5320. // "id": "storage.defaultObjectAccessControls.patch",
  5321. // "parameterOrder": [
  5322. // "bucket",
  5323. // "entity"
  5324. // ],
  5325. // "parameters": {
  5326. // "bucket": {
  5327. // "description": "Name of a bucket.",
  5328. // "location": "path",
  5329. // "required": true,
  5330. // "type": "string"
  5331. // },
  5332. // "entity": {
  5333. // "description": "The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.",
  5334. // "location": "path",
  5335. // "required": true,
  5336. // "type": "string"
  5337. // },
  5338. // "userProject": {
  5339. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  5340. // "location": "query",
  5341. // "type": "string"
  5342. // }
  5343. // },
  5344. // "path": "b/{bucket}/defaultObjectAcl/{entity}",
  5345. // "request": {
  5346. // "$ref": "ObjectAccessControl"
  5347. // },
  5348. // "response": {
  5349. // "$ref": "ObjectAccessControl"
  5350. // },
  5351. // "scopes": [
  5352. // "https://www.googleapis.com/auth/cloud-platform",
  5353. // "https://www.googleapis.com/auth/devstorage.full_control"
  5354. // ]
  5355. // }
  5356. }
  5357. // method id "storage.defaultObjectAccessControls.update":
  5358. type DefaultObjectAccessControlsUpdateCall struct {
  5359. s *Service
  5360. bucket string
  5361. entity string
  5362. objectaccesscontrol *ObjectAccessControl
  5363. urlParams_ gensupport.URLParams
  5364. ctx_ context.Context
  5365. header_ http.Header
  5366. }
  5367. // Update: Updates a default object ACL entry on the specified bucket.
  5368. func (r *DefaultObjectAccessControlsService) Update(bucket string, entity string, objectaccesscontrol *ObjectAccessControl) *DefaultObjectAccessControlsUpdateCall {
  5369. c := &DefaultObjectAccessControlsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5370. c.bucket = bucket
  5371. c.entity = entity
  5372. c.objectaccesscontrol = objectaccesscontrol
  5373. return c
  5374. }
  5375. // UserProject sets the optional parameter "userProject": The project to
  5376. // be billed for this request. Required for Requester Pays buckets.
  5377. func (c *DefaultObjectAccessControlsUpdateCall) UserProject(userProject string) *DefaultObjectAccessControlsUpdateCall {
  5378. c.urlParams_.Set("userProject", userProject)
  5379. return c
  5380. }
  5381. // Fields allows partial responses to be retrieved. See
  5382. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5383. // for more information.
  5384. func (c *DefaultObjectAccessControlsUpdateCall) Fields(s ...googleapi.Field) *DefaultObjectAccessControlsUpdateCall {
  5385. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5386. return c
  5387. }
  5388. // Context sets the context to be used in this call's Do method. Any
  5389. // pending HTTP request will be aborted if the provided context is
  5390. // canceled.
  5391. func (c *DefaultObjectAccessControlsUpdateCall) Context(ctx context.Context) *DefaultObjectAccessControlsUpdateCall {
  5392. c.ctx_ = ctx
  5393. return c
  5394. }
  5395. // Header returns an http.Header that can be modified by the caller to
  5396. // add HTTP headers to the request.
  5397. func (c *DefaultObjectAccessControlsUpdateCall) Header() http.Header {
  5398. if c.header_ == nil {
  5399. c.header_ = make(http.Header)
  5400. }
  5401. return c.header_
  5402. }
  5403. func (c *DefaultObjectAccessControlsUpdateCall) doRequest(alt string) (*http.Response, error) {
  5404. reqHeaders := make(http.Header)
  5405. for k, v := range c.header_ {
  5406. reqHeaders[k] = v
  5407. }
  5408. reqHeaders.Set("User-Agent", c.s.userAgent())
  5409. var body io.Reader = nil
  5410. body, err := googleapi.WithoutDataWrapper.JSONReader(c.objectaccesscontrol)
  5411. if err != nil {
  5412. return nil, err
  5413. }
  5414. reqHeaders.Set("Content-Type", "application/json")
  5415. c.urlParams_.Set("alt", alt)
  5416. c.urlParams_.Set("prettyPrint", "false")
  5417. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/defaultObjectAcl/{entity}")
  5418. urls += "?" + c.urlParams_.Encode()
  5419. req, err := http.NewRequest("PUT", urls, body)
  5420. if err != nil {
  5421. return nil, err
  5422. }
  5423. req.Header = reqHeaders
  5424. googleapi.Expand(req.URL, map[string]string{
  5425. "bucket": c.bucket,
  5426. "entity": c.entity,
  5427. })
  5428. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5429. }
  5430. // Do executes the "storage.defaultObjectAccessControls.update" call.
  5431. // Exactly one of *ObjectAccessControl or error will be non-nil. Any
  5432. // non-2xx status code is an error. Response headers are in either
  5433. // *ObjectAccessControl.ServerResponse.Header or (if a response was
  5434. // returned at all) in error.(*googleapi.Error).Header. Use
  5435. // googleapi.IsNotModified to check whether the returned error was
  5436. // because http.StatusNotModified was returned.
  5437. func (c *DefaultObjectAccessControlsUpdateCall) Do(opts ...googleapi.CallOption) (*ObjectAccessControl, error) {
  5438. gensupport.SetOptions(c.urlParams_, opts...)
  5439. res, err := c.doRequest("json")
  5440. if res != nil && res.StatusCode == http.StatusNotModified {
  5441. if res.Body != nil {
  5442. res.Body.Close()
  5443. }
  5444. return nil, &googleapi.Error{
  5445. Code: res.StatusCode,
  5446. Header: res.Header,
  5447. }
  5448. }
  5449. if err != nil {
  5450. return nil, err
  5451. }
  5452. defer googleapi.CloseBody(res)
  5453. if err := googleapi.CheckResponse(res); err != nil {
  5454. return nil, err
  5455. }
  5456. ret := &ObjectAccessControl{
  5457. ServerResponse: googleapi.ServerResponse{
  5458. Header: res.Header,
  5459. HTTPStatusCode: res.StatusCode,
  5460. },
  5461. }
  5462. target := &ret
  5463. if err := gensupport.DecodeResponse(target, res); err != nil {
  5464. return nil, err
  5465. }
  5466. return ret, nil
  5467. // {
  5468. // "description": "Updates a default object ACL entry on the specified bucket.",
  5469. // "httpMethod": "PUT",
  5470. // "id": "storage.defaultObjectAccessControls.update",
  5471. // "parameterOrder": [
  5472. // "bucket",
  5473. // "entity"
  5474. // ],
  5475. // "parameters": {
  5476. // "bucket": {
  5477. // "description": "Name of a bucket.",
  5478. // "location": "path",
  5479. // "required": true,
  5480. // "type": "string"
  5481. // },
  5482. // "entity": {
  5483. // "description": "The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.",
  5484. // "location": "path",
  5485. // "required": true,
  5486. // "type": "string"
  5487. // },
  5488. // "userProject": {
  5489. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  5490. // "location": "query",
  5491. // "type": "string"
  5492. // }
  5493. // },
  5494. // "path": "b/{bucket}/defaultObjectAcl/{entity}",
  5495. // "request": {
  5496. // "$ref": "ObjectAccessControl"
  5497. // },
  5498. // "response": {
  5499. // "$ref": "ObjectAccessControl"
  5500. // },
  5501. // "scopes": [
  5502. // "https://www.googleapis.com/auth/cloud-platform",
  5503. // "https://www.googleapis.com/auth/devstorage.full_control"
  5504. // ]
  5505. // }
  5506. }
  5507. // method id "storage.notifications.delete":
  5508. type NotificationsDeleteCall struct {
  5509. s *Service
  5510. bucket string
  5511. notification string
  5512. urlParams_ gensupport.URLParams
  5513. ctx_ context.Context
  5514. header_ http.Header
  5515. }
  5516. // Delete: Permanently deletes a notification subscription.
  5517. func (r *NotificationsService) Delete(bucket string, notification string) *NotificationsDeleteCall {
  5518. c := &NotificationsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5519. c.bucket = bucket
  5520. c.notification = notification
  5521. return c
  5522. }
  5523. // UserProject sets the optional parameter "userProject": The project to
  5524. // be billed for this request. Required for Requester Pays buckets.
  5525. func (c *NotificationsDeleteCall) UserProject(userProject string) *NotificationsDeleteCall {
  5526. c.urlParams_.Set("userProject", userProject)
  5527. return c
  5528. }
  5529. // Fields allows partial responses to be retrieved. See
  5530. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5531. // for more information.
  5532. func (c *NotificationsDeleteCall) Fields(s ...googleapi.Field) *NotificationsDeleteCall {
  5533. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5534. return c
  5535. }
  5536. // Context sets the context to be used in this call's Do method. Any
  5537. // pending HTTP request will be aborted if the provided context is
  5538. // canceled.
  5539. func (c *NotificationsDeleteCall) Context(ctx context.Context) *NotificationsDeleteCall {
  5540. c.ctx_ = ctx
  5541. return c
  5542. }
  5543. // Header returns an http.Header that can be modified by the caller to
  5544. // add HTTP headers to the request.
  5545. func (c *NotificationsDeleteCall) Header() http.Header {
  5546. if c.header_ == nil {
  5547. c.header_ = make(http.Header)
  5548. }
  5549. return c.header_
  5550. }
  5551. func (c *NotificationsDeleteCall) doRequest(alt string) (*http.Response, error) {
  5552. reqHeaders := make(http.Header)
  5553. for k, v := range c.header_ {
  5554. reqHeaders[k] = v
  5555. }
  5556. reqHeaders.Set("User-Agent", c.s.userAgent())
  5557. var body io.Reader = nil
  5558. c.urlParams_.Set("alt", alt)
  5559. c.urlParams_.Set("prettyPrint", "false")
  5560. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/notificationConfigs/{notification}")
  5561. urls += "?" + c.urlParams_.Encode()
  5562. req, err := http.NewRequest("DELETE", urls, body)
  5563. if err != nil {
  5564. return nil, err
  5565. }
  5566. req.Header = reqHeaders
  5567. googleapi.Expand(req.URL, map[string]string{
  5568. "bucket": c.bucket,
  5569. "notification": c.notification,
  5570. })
  5571. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5572. }
  5573. // Do executes the "storage.notifications.delete" call.
  5574. func (c *NotificationsDeleteCall) Do(opts ...googleapi.CallOption) error {
  5575. gensupport.SetOptions(c.urlParams_, opts...)
  5576. res, err := c.doRequest("json")
  5577. if err != nil {
  5578. return err
  5579. }
  5580. defer googleapi.CloseBody(res)
  5581. if err := googleapi.CheckResponse(res); err != nil {
  5582. return err
  5583. }
  5584. return nil
  5585. // {
  5586. // "description": "Permanently deletes a notification subscription.",
  5587. // "httpMethod": "DELETE",
  5588. // "id": "storage.notifications.delete",
  5589. // "parameterOrder": [
  5590. // "bucket",
  5591. // "notification"
  5592. // ],
  5593. // "parameters": {
  5594. // "bucket": {
  5595. // "description": "The parent bucket of the notification.",
  5596. // "location": "path",
  5597. // "required": true,
  5598. // "type": "string"
  5599. // },
  5600. // "notification": {
  5601. // "description": "ID of the notification to delete.",
  5602. // "location": "path",
  5603. // "required": true,
  5604. // "type": "string"
  5605. // },
  5606. // "userProject": {
  5607. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  5608. // "location": "query",
  5609. // "type": "string"
  5610. // }
  5611. // },
  5612. // "path": "b/{bucket}/notificationConfigs/{notification}",
  5613. // "scopes": [
  5614. // "https://www.googleapis.com/auth/cloud-platform",
  5615. // "https://www.googleapis.com/auth/devstorage.full_control",
  5616. // "https://www.googleapis.com/auth/devstorage.read_write"
  5617. // ]
  5618. // }
  5619. }
  5620. // method id "storage.notifications.get":
  5621. type NotificationsGetCall struct {
  5622. s *Service
  5623. bucket string
  5624. notification string
  5625. urlParams_ gensupport.URLParams
  5626. ifNoneMatch_ string
  5627. ctx_ context.Context
  5628. header_ http.Header
  5629. }
  5630. // Get: View a notification configuration.
  5631. func (r *NotificationsService) Get(bucket string, notification string) *NotificationsGetCall {
  5632. c := &NotificationsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5633. c.bucket = bucket
  5634. c.notification = notification
  5635. return c
  5636. }
  5637. // UserProject sets the optional parameter "userProject": The project to
  5638. // be billed for this request. Required for Requester Pays buckets.
  5639. func (c *NotificationsGetCall) UserProject(userProject string) *NotificationsGetCall {
  5640. c.urlParams_.Set("userProject", userProject)
  5641. return c
  5642. }
  5643. // Fields allows partial responses to be retrieved. See
  5644. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5645. // for more information.
  5646. func (c *NotificationsGetCall) Fields(s ...googleapi.Field) *NotificationsGetCall {
  5647. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5648. return c
  5649. }
  5650. // IfNoneMatch sets the optional parameter which makes the operation
  5651. // fail if the object's ETag matches the given value. This is useful for
  5652. // getting updates only after the object has changed since the last
  5653. // request. Use googleapi.IsNotModified to check whether the response
  5654. // error from Do is the result of In-None-Match.
  5655. func (c *NotificationsGetCall) IfNoneMatch(entityTag string) *NotificationsGetCall {
  5656. c.ifNoneMatch_ = entityTag
  5657. return c
  5658. }
  5659. // Context sets the context to be used in this call's Do method. Any
  5660. // pending HTTP request will be aborted if the provided context is
  5661. // canceled.
  5662. func (c *NotificationsGetCall) Context(ctx context.Context) *NotificationsGetCall {
  5663. c.ctx_ = ctx
  5664. return c
  5665. }
  5666. // Header returns an http.Header that can be modified by the caller to
  5667. // add HTTP headers to the request.
  5668. func (c *NotificationsGetCall) Header() http.Header {
  5669. if c.header_ == nil {
  5670. c.header_ = make(http.Header)
  5671. }
  5672. return c.header_
  5673. }
  5674. func (c *NotificationsGetCall) doRequest(alt string) (*http.Response, error) {
  5675. reqHeaders := make(http.Header)
  5676. for k, v := range c.header_ {
  5677. reqHeaders[k] = v
  5678. }
  5679. reqHeaders.Set("User-Agent", c.s.userAgent())
  5680. if c.ifNoneMatch_ != "" {
  5681. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  5682. }
  5683. var body io.Reader = nil
  5684. c.urlParams_.Set("alt", alt)
  5685. c.urlParams_.Set("prettyPrint", "false")
  5686. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/notificationConfigs/{notification}")
  5687. urls += "?" + c.urlParams_.Encode()
  5688. req, err := http.NewRequest("GET", urls, body)
  5689. if err != nil {
  5690. return nil, err
  5691. }
  5692. req.Header = reqHeaders
  5693. googleapi.Expand(req.URL, map[string]string{
  5694. "bucket": c.bucket,
  5695. "notification": c.notification,
  5696. })
  5697. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5698. }
  5699. // Do executes the "storage.notifications.get" call.
  5700. // Exactly one of *Notification or error will be non-nil. Any non-2xx
  5701. // status code is an error. Response headers are in either
  5702. // *Notification.ServerResponse.Header or (if a response was returned at
  5703. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  5704. // to check whether the returned error was because
  5705. // http.StatusNotModified was returned.
  5706. func (c *NotificationsGetCall) Do(opts ...googleapi.CallOption) (*Notification, error) {
  5707. gensupport.SetOptions(c.urlParams_, opts...)
  5708. res, err := c.doRequest("json")
  5709. if res != nil && res.StatusCode == http.StatusNotModified {
  5710. if res.Body != nil {
  5711. res.Body.Close()
  5712. }
  5713. return nil, &googleapi.Error{
  5714. Code: res.StatusCode,
  5715. Header: res.Header,
  5716. }
  5717. }
  5718. if err != nil {
  5719. return nil, err
  5720. }
  5721. defer googleapi.CloseBody(res)
  5722. if err := googleapi.CheckResponse(res); err != nil {
  5723. return nil, err
  5724. }
  5725. ret := &Notification{
  5726. ServerResponse: googleapi.ServerResponse{
  5727. Header: res.Header,
  5728. HTTPStatusCode: res.StatusCode,
  5729. },
  5730. }
  5731. target := &ret
  5732. if err := gensupport.DecodeResponse(target, res); err != nil {
  5733. return nil, err
  5734. }
  5735. return ret, nil
  5736. // {
  5737. // "description": "View a notification configuration.",
  5738. // "httpMethod": "GET",
  5739. // "id": "storage.notifications.get",
  5740. // "parameterOrder": [
  5741. // "bucket",
  5742. // "notification"
  5743. // ],
  5744. // "parameters": {
  5745. // "bucket": {
  5746. // "description": "The parent bucket of the notification.",
  5747. // "location": "path",
  5748. // "required": true,
  5749. // "type": "string"
  5750. // },
  5751. // "notification": {
  5752. // "description": "Notification ID",
  5753. // "location": "path",
  5754. // "required": true,
  5755. // "type": "string"
  5756. // },
  5757. // "userProject": {
  5758. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  5759. // "location": "query",
  5760. // "type": "string"
  5761. // }
  5762. // },
  5763. // "path": "b/{bucket}/notificationConfigs/{notification}",
  5764. // "response": {
  5765. // "$ref": "Notification"
  5766. // },
  5767. // "scopes": [
  5768. // "https://www.googleapis.com/auth/cloud-platform",
  5769. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  5770. // "https://www.googleapis.com/auth/devstorage.full_control",
  5771. // "https://www.googleapis.com/auth/devstorage.read_only",
  5772. // "https://www.googleapis.com/auth/devstorage.read_write"
  5773. // ]
  5774. // }
  5775. }
  5776. // method id "storage.notifications.insert":
  5777. type NotificationsInsertCall struct {
  5778. s *Service
  5779. bucket string
  5780. notification *Notification
  5781. urlParams_ gensupport.URLParams
  5782. ctx_ context.Context
  5783. header_ http.Header
  5784. }
  5785. // Insert: Creates a notification subscription for a given bucket.
  5786. func (r *NotificationsService) Insert(bucket string, notification *Notification) *NotificationsInsertCall {
  5787. c := &NotificationsInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5788. c.bucket = bucket
  5789. c.notification = notification
  5790. return c
  5791. }
  5792. // UserProject sets the optional parameter "userProject": The project to
  5793. // be billed for this request. Required for Requester Pays buckets.
  5794. func (c *NotificationsInsertCall) UserProject(userProject string) *NotificationsInsertCall {
  5795. c.urlParams_.Set("userProject", userProject)
  5796. return c
  5797. }
  5798. // Fields allows partial responses to be retrieved. See
  5799. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5800. // for more information.
  5801. func (c *NotificationsInsertCall) Fields(s ...googleapi.Field) *NotificationsInsertCall {
  5802. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5803. return c
  5804. }
  5805. // Context sets the context to be used in this call's Do method. Any
  5806. // pending HTTP request will be aborted if the provided context is
  5807. // canceled.
  5808. func (c *NotificationsInsertCall) Context(ctx context.Context) *NotificationsInsertCall {
  5809. c.ctx_ = ctx
  5810. return c
  5811. }
  5812. // Header returns an http.Header that can be modified by the caller to
  5813. // add HTTP headers to the request.
  5814. func (c *NotificationsInsertCall) Header() http.Header {
  5815. if c.header_ == nil {
  5816. c.header_ = make(http.Header)
  5817. }
  5818. return c.header_
  5819. }
  5820. func (c *NotificationsInsertCall) doRequest(alt string) (*http.Response, error) {
  5821. reqHeaders := make(http.Header)
  5822. for k, v := range c.header_ {
  5823. reqHeaders[k] = v
  5824. }
  5825. reqHeaders.Set("User-Agent", c.s.userAgent())
  5826. var body io.Reader = nil
  5827. body, err := googleapi.WithoutDataWrapper.JSONReader(c.notification)
  5828. if err != nil {
  5829. return nil, err
  5830. }
  5831. reqHeaders.Set("Content-Type", "application/json")
  5832. c.urlParams_.Set("alt", alt)
  5833. c.urlParams_.Set("prettyPrint", "false")
  5834. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/notificationConfigs")
  5835. urls += "?" + c.urlParams_.Encode()
  5836. req, err := http.NewRequest("POST", urls, body)
  5837. if err != nil {
  5838. return nil, err
  5839. }
  5840. req.Header = reqHeaders
  5841. googleapi.Expand(req.URL, map[string]string{
  5842. "bucket": c.bucket,
  5843. })
  5844. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5845. }
  5846. // Do executes the "storage.notifications.insert" call.
  5847. // Exactly one of *Notification or error will be non-nil. Any non-2xx
  5848. // status code is an error. Response headers are in either
  5849. // *Notification.ServerResponse.Header or (if a response was returned at
  5850. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  5851. // to check whether the returned error was because
  5852. // http.StatusNotModified was returned.
  5853. func (c *NotificationsInsertCall) Do(opts ...googleapi.CallOption) (*Notification, error) {
  5854. gensupport.SetOptions(c.urlParams_, opts...)
  5855. res, err := c.doRequest("json")
  5856. if res != nil && res.StatusCode == http.StatusNotModified {
  5857. if res.Body != nil {
  5858. res.Body.Close()
  5859. }
  5860. return nil, &googleapi.Error{
  5861. Code: res.StatusCode,
  5862. Header: res.Header,
  5863. }
  5864. }
  5865. if err != nil {
  5866. return nil, err
  5867. }
  5868. defer googleapi.CloseBody(res)
  5869. if err := googleapi.CheckResponse(res); err != nil {
  5870. return nil, err
  5871. }
  5872. ret := &Notification{
  5873. ServerResponse: googleapi.ServerResponse{
  5874. Header: res.Header,
  5875. HTTPStatusCode: res.StatusCode,
  5876. },
  5877. }
  5878. target := &ret
  5879. if err := gensupport.DecodeResponse(target, res); err != nil {
  5880. return nil, err
  5881. }
  5882. return ret, nil
  5883. // {
  5884. // "description": "Creates a notification subscription for a given bucket.",
  5885. // "httpMethod": "POST",
  5886. // "id": "storage.notifications.insert",
  5887. // "parameterOrder": [
  5888. // "bucket"
  5889. // ],
  5890. // "parameters": {
  5891. // "bucket": {
  5892. // "description": "The parent bucket of the notification.",
  5893. // "location": "path",
  5894. // "required": true,
  5895. // "type": "string"
  5896. // },
  5897. // "userProject": {
  5898. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  5899. // "location": "query",
  5900. // "type": "string"
  5901. // }
  5902. // },
  5903. // "path": "b/{bucket}/notificationConfigs",
  5904. // "request": {
  5905. // "$ref": "Notification"
  5906. // },
  5907. // "response": {
  5908. // "$ref": "Notification"
  5909. // },
  5910. // "scopes": [
  5911. // "https://www.googleapis.com/auth/cloud-platform",
  5912. // "https://www.googleapis.com/auth/devstorage.full_control",
  5913. // "https://www.googleapis.com/auth/devstorage.read_write"
  5914. // ]
  5915. // }
  5916. }
  5917. // method id "storage.notifications.list":
  5918. type NotificationsListCall struct {
  5919. s *Service
  5920. bucket string
  5921. urlParams_ gensupport.URLParams
  5922. ifNoneMatch_ string
  5923. ctx_ context.Context
  5924. header_ http.Header
  5925. }
  5926. // List: Retrieves a list of notification subscriptions for a given
  5927. // bucket.
  5928. func (r *NotificationsService) List(bucket string) *NotificationsListCall {
  5929. c := &NotificationsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5930. c.bucket = bucket
  5931. return c
  5932. }
  5933. // UserProject sets the optional parameter "userProject": The project to
  5934. // be billed for this request. Required for Requester Pays buckets.
  5935. func (c *NotificationsListCall) UserProject(userProject string) *NotificationsListCall {
  5936. c.urlParams_.Set("userProject", userProject)
  5937. return c
  5938. }
  5939. // Fields allows partial responses to be retrieved. See
  5940. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5941. // for more information.
  5942. func (c *NotificationsListCall) Fields(s ...googleapi.Field) *NotificationsListCall {
  5943. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5944. return c
  5945. }
  5946. // IfNoneMatch sets the optional parameter which makes the operation
  5947. // fail if the object's ETag matches the given value. This is useful for
  5948. // getting updates only after the object has changed since the last
  5949. // request. Use googleapi.IsNotModified to check whether the response
  5950. // error from Do is the result of In-None-Match.
  5951. func (c *NotificationsListCall) IfNoneMatch(entityTag string) *NotificationsListCall {
  5952. c.ifNoneMatch_ = entityTag
  5953. return c
  5954. }
  5955. // Context sets the context to be used in this call's Do method. Any
  5956. // pending HTTP request will be aborted if the provided context is
  5957. // canceled.
  5958. func (c *NotificationsListCall) Context(ctx context.Context) *NotificationsListCall {
  5959. c.ctx_ = ctx
  5960. return c
  5961. }
  5962. // Header returns an http.Header that can be modified by the caller to
  5963. // add HTTP headers to the request.
  5964. func (c *NotificationsListCall) Header() http.Header {
  5965. if c.header_ == nil {
  5966. c.header_ = make(http.Header)
  5967. }
  5968. return c.header_
  5969. }
  5970. func (c *NotificationsListCall) doRequest(alt string) (*http.Response, error) {
  5971. reqHeaders := make(http.Header)
  5972. for k, v := range c.header_ {
  5973. reqHeaders[k] = v
  5974. }
  5975. reqHeaders.Set("User-Agent", c.s.userAgent())
  5976. if c.ifNoneMatch_ != "" {
  5977. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  5978. }
  5979. var body io.Reader = nil
  5980. c.urlParams_.Set("alt", alt)
  5981. c.urlParams_.Set("prettyPrint", "false")
  5982. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/notificationConfigs")
  5983. urls += "?" + c.urlParams_.Encode()
  5984. req, err := http.NewRequest("GET", urls, body)
  5985. if err != nil {
  5986. return nil, err
  5987. }
  5988. req.Header = reqHeaders
  5989. googleapi.Expand(req.URL, map[string]string{
  5990. "bucket": c.bucket,
  5991. })
  5992. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5993. }
  5994. // Do executes the "storage.notifications.list" call.
  5995. // Exactly one of *Notifications or error will be non-nil. Any non-2xx
  5996. // status code is an error. Response headers are in either
  5997. // *Notifications.ServerResponse.Header or (if a response was returned
  5998. // at all) in error.(*googleapi.Error).Header. Use
  5999. // googleapi.IsNotModified to check whether the returned error was
  6000. // because http.StatusNotModified was returned.
  6001. func (c *NotificationsListCall) Do(opts ...googleapi.CallOption) (*Notifications, error) {
  6002. gensupport.SetOptions(c.urlParams_, opts...)
  6003. res, err := c.doRequest("json")
  6004. if res != nil && res.StatusCode == http.StatusNotModified {
  6005. if res.Body != nil {
  6006. res.Body.Close()
  6007. }
  6008. return nil, &googleapi.Error{
  6009. Code: res.StatusCode,
  6010. Header: res.Header,
  6011. }
  6012. }
  6013. if err != nil {
  6014. return nil, err
  6015. }
  6016. defer googleapi.CloseBody(res)
  6017. if err := googleapi.CheckResponse(res); err != nil {
  6018. return nil, err
  6019. }
  6020. ret := &Notifications{
  6021. ServerResponse: googleapi.ServerResponse{
  6022. Header: res.Header,
  6023. HTTPStatusCode: res.StatusCode,
  6024. },
  6025. }
  6026. target := &ret
  6027. if err := gensupport.DecodeResponse(target, res); err != nil {
  6028. return nil, err
  6029. }
  6030. return ret, nil
  6031. // {
  6032. // "description": "Retrieves a list of notification subscriptions for a given bucket.",
  6033. // "httpMethod": "GET",
  6034. // "id": "storage.notifications.list",
  6035. // "parameterOrder": [
  6036. // "bucket"
  6037. // ],
  6038. // "parameters": {
  6039. // "bucket": {
  6040. // "description": "Name of a Google Cloud Storage bucket.",
  6041. // "location": "path",
  6042. // "required": true,
  6043. // "type": "string"
  6044. // },
  6045. // "userProject": {
  6046. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  6047. // "location": "query",
  6048. // "type": "string"
  6049. // }
  6050. // },
  6051. // "path": "b/{bucket}/notificationConfigs",
  6052. // "response": {
  6053. // "$ref": "Notifications"
  6054. // },
  6055. // "scopes": [
  6056. // "https://www.googleapis.com/auth/cloud-platform",
  6057. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  6058. // "https://www.googleapis.com/auth/devstorage.full_control",
  6059. // "https://www.googleapis.com/auth/devstorage.read_only",
  6060. // "https://www.googleapis.com/auth/devstorage.read_write"
  6061. // ]
  6062. // }
  6063. }
  6064. // method id "storage.objectAccessControls.delete":
  6065. type ObjectAccessControlsDeleteCall struct {
  6066. s *Service
  6067. bucket string
  6068. object string
  6069. entity string
  6070. urlParams_ gensupport.URLParams
  6071. ctx_ context.Context
  6072. header_ http.Header
  6073. }
  6074. // Delete: Permanently deletes the ACL entry for the specified entity on
  6075. // the specified object.
  6076. func (r *ObjectAccessControlsService) Delete(bucket string, object string, entity string) *ObjectAccessControlsDeleteCall {
  6077. c := &ObjectAccessControlsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6078. c.bucket = bucket
  6079. c.object = object
  6080. c.entity = entity
  6081. return c
  6082. }
  6083. // Generation sets the optional parameter "generation": If present,
  6084. // selects a specific revision of this object (as opposed to the latest
  6085. // version, the default).
  6086. func (c *ObjectAccessControlsDeleteCall) Generation(generation int64) *ObjectAccessControlsDeleteCall {
  6087. c.urlParams_.Set("generation", fmt.Sprint(generation))
  6088. return c
  6089. }
  6090. // UserProject sets the optional parameter "userProject": The project to
  6091. // be billed for this request. Required for Requester Pays buckets.
  6092. func (c *ObjectAccessControlsDeleteCall) UserProject(userProject string) *ObjectAccessControlsDeleteCall {
  6093. c.urlParams_.Set("userProject", userProject)
  6094. return c
  6095. }
  6096. // Fields allows partial responses to be retrieved. See
  6097. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6098. // for more information.
  6099. func (c *ObjectAccessControlsDeleteCall) Fields(s ...googleapi.Field) *ObjectAccessControlsDeleteCall {
  6100. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6101. return c
  6102. }
  6103. // Context sets the context to be used in this call's Do method. Any
  6104. // pending HTTP request will be aborted if the provided context is
  6105. // canceled.
  6106. func (c *ObjectAccessControlsDeleteCall) Context(ctx context.Context) *ObjectAccessControlsDeleteCall {
  6107. c.ctx_ = ctx
  6108. return c
  6109. }
  6110. // Header returns an http.Header that can be modified by the caller to
  6111. // add HTTP headers to the request.
  6112. func (c *ObjectAccessControlsDeleteCall) Header() http.Header {
  6113. if c.header_ == nil {
  6114. c.header_ = make(http.Header)
  6115. }
  6116. return c.header_
  6117. }
  6118. func (c *ObjectAccessControlsDeleteCall) doRequest(alt string) (*http.Response, error) {
  6119. reqHeaders := make(http.Header)
  6120. for k, v := range c.header_ {
  6121. reqHeaders[k] = v
  6122. }
  6123. reqHeaders.Set("User-Agent", c.s.userAgent())
  6124. var body io.Reader = nil
  6125. c.urlParams_.Set("alt", alt)
  6126. c.urlParams_.Set("prettyPrint", "false")
  6127. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o/{object}/acl/{entity}")
  6128. urls += "?" + c.urlParams_.Encode()
  6129. req, err := http.NewRequest("DELETE", urls, body)
  6130. if err != nil {
  6131. return nil, err
  6132. }
  6133. req.Header = reqHeaders
  6134. googleapi.Expand(req.URL, map[string]string{
  6135. "bucket": c.bucket,
  6136. "object": c.object,
  6137. "entity": c.entity,
  6138. })
  6139. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6140. }
  6141. // Do executes the "storage.objectAccessControls.delete" call.
  6142. func (c *ObjectAccessControlsDeleteCall) Do(opts ...googleapi.CallOption) error {
  6143. gensupport.SetOptions(c.urlParams_, opts...)
  6144. res, err := c.doRequest("json")
  6145. if err != nil {
  6146. return err
  6147. }
  6148. defer googleapi.CloseBody(res)
  6149. if err := googleapi.CheckResponse(res); err != nil {
  6150. return err
  6151. }
  6152. return nil
  6153. // {
  6154. // "description": "Permanently deletes the ACL entry for the specified entity on the specified object.",
  6155. // "httpMethod": "DELETE",
  6156. // "id": "storage.objectAccessControls.delete",
  6157. // "parameterOrder": [
  6158. // "bucket",
  6159. // "object",
  6160. // "entity"
  6161. // ],
  6162. // "parameters": {
  6163. // "bucket": {
  6164. // "description": "Name of a bucket.",
  6165. // "location": "path",
  6166. // "required": true,
  6167. // "type": "string"
  6168. // },
  6169. // "entity": {
  6170. // "description": "The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.",
  6171. // "location": "path",
  6172. // "required": true,
  6173. // "type": "string"
  6174. // },
  6175. // "generation": {
  6176. // "description": "If present, selects a specific revision of this object (as opposed to the latest version, the default).",
  6177. // "format": "int64",
  6178. // "location": "query",
  6179. // "type": "string"
  6180. // },
  6181. // "object": {
  6182. // "description": "Name of the object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.",
  6183. // "location": "path",
  6184. // "required": true,
  6185. // "type": "string"
  6186. // },
  6187. // "userProject": {
  6188. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  6189. // "location": "query",
  6190. // "type": "string"
  6191. // }
  6192. // },
  6193. // "path": "b/{bucket}/o/{object}/acl/{entity}",
  6194. // "scopes": [
  6195. // "https://www.googleapis.com/auth/cloud-platform",
  6196. // "https://www.googleapis.com/auth/devstorage.full_control"
  6197. // ]
  6198. // }
  6199. }
  6200. // method id "storage.objectAccessControls.get":
  6201. type ObjectAccessControlsGetCall struct {
  6202. s *Service
  6203. bucket string
  6204. object string
  6205. entity string
  6206. urlParams_ gensupport.URLParams
  6207. ifNoneMatch_ string
  6208. ctx_ context.Context
  6209. header_ http.Header
  6210. }
  6211. // Get: Returns the ACL entry for the specified entity on the specified
  6212. // object.
  6213. func (r *ObjectAccessControlsService) Get(bucket string, object string, entity string) *ObjectAccessControlsGetCall {
  6214. c := &ObjectAccessControlsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6215. c.bucket = bucket
  6216. c.object = object
  6217. c.entity = entity
  6218. return c
  6219. }
  6220. // Generation sets the optional parameter "generation": If present,
  6221. // selects a specific revision of this object (as opposed to the latest
  6222. // version, the default).
  6223. func (c *ObjectAccessControlsGetCall) Generation(generation int64) *ObjectAccessControlsGetCall {
  6224. c.urlParams_.Set("generation", fmt.Sprint(generation))
  6225. return c
  6226. }
  6227. // UserProject sets the optional parameter "userProject": The project to
  6228. // be billed for this request. Required for Requester Pays buckets.
  6229. func (c *ObjectAccessControlsGetCall) UserProject(userProject string) *ObjectAccessControlsGetCall {
  6230. c.urlParams_.Set("userProject", userProject)
  6231. return c
  6232. }
  6233. // Fields allows partial responses to be retrieved. See
  6234. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6235. // for more information.
  6236. func (c *ObjectAccessControlsGetCall) Fields(s ...googleapi.Field) *ObjectAccessControlsGetCall {
  6237. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6238. return c
  6239. }
  6240. // IfNoneMatch sets the optional parameter which makes the operation
  6241. // fail if the object's ETag matches the given value. This is useful for
  6242. // getting updates only after the object has changed since the last
  6243. // request. Use googleapi.IsNotModified to check whether the response
  6244. // error from Do is the result of In-None-Match.
  6245. func (c *ObjectAccessControlsGetCall) IfNoneMatch(entityTag string) *ObjectAccessControlsGetCall {
  6246. c.ifNoneMatch_ = entityTag
  6247. return c
  6248. }
  6249. // Context sets the context to be used in this call's Do method. Any
  6250. // pending HTTP request will be aborted if the provided context is
  6251. // canceled.
  6252. func (c *ObjectAccessControlsGetCall) Context(ctx context.Context) *ObjectAccessControlsGetCall {
  6253. c.ctx_ = ctx
  6254. return c
  6255. }
  6256. // Header returns an http.Header that can be modified by the caller to
  6257. // add HTTP headers to the request.
  6258. func (c *ObjectAccessControlsGetCall) Header() http.Header {
  6259. if c.header_ == nil {
  6260. c.header_ = make(http.Header)
  6261. }
  6262. return c.header_
  6263. }
  6264. func (c *ObjectAccessControlsGetCall) doRequest(alt string) (*http.Response, error) {
  6265. reqHeaders := make(http.Header)
  6266. for k, v := range c.header_ {
  6267. reqHeaders[k] = v
  6268. }
  6269. reqHeaders.Set("User-Agent", c.s.userAgent())
  6270. if c.ifNoneMatch_ != "" {
  6271. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  6272. }
  6273. var body io.Reader = nil
  6274. c.urlParams_.Set("alt", alt)
  6275. c.urlParams_.Set("prettyPrint", "false")
  6276. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o/{object}/acl/{entity}")
  6277. urls += "?" + c.urlParams_.Encode()
  6278. req, err := http.NewRequest("GET", urls, body)
  6279. if err != nil {
  6280. return nil, err
  6281. }
  6282. req.Header = reqHeaders
  6283. googleapi.Expand(req.URL, map[string]string{
  6284. "bucket": c.bucket,
  6285. "object": c.object,
  6286. "entity": c.entity,
  6287. })
  6288. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6289. }
  6290. // Do executes the "storage.objectAccessControls.get" call.
  6291. // Exactly one of *ObjectAccessControl or error will be non-nil. Any
  6292. // non-2xx status code is an error. Response headers are in either
  6293. // *ObjectAccessControl.ServerResponse.Header or (if a response was
  6294. // returned at all) in error.(*googleapi.Error).Header. Use
  6295. // googleapi.IsNotModified to check whether the returned error was
  6296. // because http.StatusNotModified was returned.
  6297. func (c *ObjectAccessControlsGetCall) Do(opts ...googleapi.CallOption) (*ObjectAccessControl, error) {
  6298. gensupport.SetOptions(c.urlParams_, opts...)
  6299. res, err := c.doRequest("json")
  6300. if res != nil && res.StatusCode == http.StatusNotModified {
  6301. if res.Body != nil {
  6302. res.Body.Close()
  6303. }
  6304. return nil, &googleapi.Error{
  6305. Code: res.StatusCode,
  6306. Header: res.Header,
  6307. }
  6308. }
  6309. if err != nil {
  6310. return nil, err
  6311. }
  6312. defer googleapi.CloseBody(res)
  6313. if err := googleapi.CheckResponse(res); err != nil {
  6314. return nil, err
  6315. }
  6316. ret := &ObjectAccessControl{
  6317. ServerResponse: googleapi.ServerResponse{
  6318. Header: res.Header,
  6319. HTTPStatusCode: res.StatusCode,
  6320. },
  6321. }
  6322. target := &ret
  6323. if err := gensupport.DecodeResponse(target, res); err != nil {
  6324. return nil, err
  6325. }
  6326. return ret, nil
  6327. // {
  6328. // "description": "Returns the ACL entry for the specified entity on the specified object.",
  6329. // "httpMethod": "GET",
  6330. // "id": "storage.objectAccessControls.get",
  6331. // "parameterOrder": [
  6332. // "bucket",
  6333. // "object",
  6334. // "entity"
  6335. // ],
  6336. // "parameters": {
  6337. // "bucket": {
  6338. // "description": "Name of a bucket.",
  6339. // "location": "path",
  6340. // "required": true,
  6341. // "type": "string"
  6342. // },
  6343. // "entity": {
  6344. // "description": "The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.",
  6345. // "location": "path",
  6346. // "required": true,
  6347. // "type": "string"
  6348. // },
  6349. // "generation": {
  6350. // "description": "If present, selects a specific revision of this object (as opposed to the latest version, the default).",
  6351. // "format": "int64",
  6352. // "location": "query",
  6353. // "type": "string"
  6354. // },
  6355. // "object": {
  6356. // "description": "Name of the object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.",
  6357. // "location": "path",
  6358. // "required": true,
  6359. // "type": "string"
  6360. // },
  6361. // "userProject": {
  6362. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  6363. // "location": "query",
  6364. // "type": "string"
  6365. // }
  6366. // },
  6367. // "path": "b/{bucket}/o/{object}/acl/{entity}",
  6368. // "response": {
  6369. // "$ref": "ObjectAccessControl"
  6370. // },
  6371. // "scopes": [
  6372. // "https://www.googleapis.com/auth/cloud-platform",
  6373. // "https://www.googleapis.com/auth/devstorage.full_control"
  6374. // ]
  6375. // }
  6376. }
  6377. // method id "storage.objectAccessControls.insert":
  6378. type ObjectAccessControlsInsertCall struct {
  6379. s *Service
  6380. bucket string
  6381. object string
  6382. objectaccesscontrol *ObjectAccessControl
  6383. urlParams_ gensupport.URLParams
  6384. ctx_ context.Context
  6385. header_ http.Header
  6386. }
  6387. // Insert: Creates a new ACL entry on the specified object.
  6388. func (r *ObjectAccessControlsService) Insert(bucket string, object string, objectaccesscontrol *ObjectAccessControl) *ObjectAccessControlsInsertCall {
  6389. c := &ObjectAccessControlsInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6390. c.bucket = bucket
  6391. c.object = object
  6392. c.objectaccesscontrol = objectaccesscontrol
  6393. return c
  6394. }
  6395. // Generation sets the optional parameter "generation": If present,
  6396. // selects a specific revision of this object (as opposed to the latest
  6397. // version, the default).
  6398. func (c *ObjectAccessControlsInsertCall) Generation(generation int64) *ObjectAccessControlsInsertCall {
  6399. c.urlParams_.Set("generation", fmt.Sprint(generation))
  6400. return c
  6401. }
  6402. // UserProject sets the optional parameter "userProject": The project to
  6403. // be billed for this request. Required for Requester Pays buckets.
  6404. func (c *ObjectAccessControlsInsertCall) UserProject(userProject string) *ObjectAccessControlsInsertCall {
  6405. c.urlParams_.Set("userProject", userProject)
  6406. return c
  6407. }
  6408. // Fields allows partial responses to be retrieved. See
  6409. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6410. // for more information.
  6411. func (c *ObjectAccessControlsInsertCall) Fields(s ...googleapi.Field) *ObjectAccessControlsInsertCall {
  6412. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6413. return c
  6414. }
  6415. // Context sets the context to be used in this call's Do method. Any
  6416. // pending HTTP request will be aborted if the provided context is
  6417. // canceled.
  6418. func (c *ObjectAccessControlsInsertCall) Context(ctx context.Context) *ObjectAccessControlsInsertCall {
  6419. c.ctx_ = ctx
  6420. return c
  6421. }
  6422. // Header returns an http.Header that can be modified by the caller to
  6423. // add HTTP headers to the request.
  6424. func (c *ObjectAccessControlsInsertCall) Header() http.Header {
  6425. if c.header_ == nil {
  6426. c.header_ = make(http.Header)
  6427. }
  6428. return c.header_
  6429. }
  6430. func (c *ObjectAccessControlsInsertCall) doRequest(alt string) (*http.Response, error) {
  6431. reqHeaders := make(http.Header)
  6432. for k, v := range c.header_ {
  6433. reqHeaders[k] = v
  6434. }
  6435. reqHeaders.Set("User-Agent", c.s.userAgent())
  6436. var body io.Reader = nil
  6437. body, err := googleapi.WithoutDataWrapper.JSONReader(c.objectaccesscontrol)
  6438. if err != nil {
  6439. return nil, err
  6440. }
  6441. reqHeaders.Set("Content-Type", "application/json")
  6442. c.urlParams_.Set("alt", alt)
  6443. c.urlParams_.Set("prettyPrint", "false")
  6444. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o/{object}/acl")
  6445. urls += "?" + c.urlParams_.Encode()
  6446. req, err := http.NewRequest("POST", urls, body)
  6447. if err != nil {
  6448. return nil, err
  6449. }
  6450. req.Header = reqHeaders
  6451. googleapi.Expand(req.URL, map[string]string{
  6452. "bucket": c.bucket,
  6453. "object": c.object,
  6454. })
  6455. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6456. }
  6457. // Do executes the "storage.objectAccessControls.insert" call.
  6458. // Exactly one of *ObjectAccessControl or error will be non-nil. Any
  6459. // non-2xx status code is an error. Response headers are in either
  6460. // *ObjectAccessControl.ServerResponse.Header or (if a response was
  6461. // returned at all) in error.(*googleapi.Error).Header. Use
  6462. // googleapi.IsNotModified to check whether the returned error was
  6463. // because http.StatusNotModified was returned.
  6464. func (c *ObjectAccessControlsInsertCall) Do(opts ...googleapi.CallOption) (*ObjectAccessControl, error) {
  6465. gensupport.SetOptions(c.urlParams_, opts...)
  6466. res, err := c.doRequest("json")
  6467. if res != nil && res.StatusCode == http.StatusNotModified {
  6468. if res.Body != nil {
  6469. res.Body.Close()
  6470. }
  6471. return nil, &googleapi.Error{
  6472. Code: res.StatusCode,
  6473. Header: res.Header,
  6474. }
  6475. }
  6476. if err != nil {
  6477. return nil, err
  6478. }
  6479. defer googleapi.CloseBody(res)
  6480. if err := googleapi.CheckResponse(res); err != nil {
  6481. return nil, err
  6482. }
  6483. ret := &ObjectAccessControl{
  6484. ServerResponse: googleapi.ServerResponse{
  6485. Header: res.Header,
  6486. HTTPStatusCode: res.StatusCode,
  6487. },
  6488. }
  6489. target := &ret
  6490. if err := gensupport.DecodeResponse(target, res); err != nil {
  6491. return nil, err
  6492. }
  6493. return ret, nil
  6494. // {
  6495. // "description": "Creates a new ACL entry on the specified object.",
  6496. // "httpMethod": "POST",
  6497. // "id": "storage.objectAccessControls.insert",
  6498. // "parameterOrder": [
  6499. // "bucket",
  6500. // "object"
  6501. // ],
  6502. // "parameters": {
  6503. // "bucket": {
  6504. // "description": "Name of a bucket.",
  6505. // "location": "path",
  6506. // "required": true,
  6507. // "type": "string"
  6508. // },
  6509. // "generation": {
  6510. // "description": "If present, selects a specific revision of this object (as opposed to the latest version, the default).",
  6511. // "format": "int64",
  6512. // "location": "query",
  6513. // "type": "string"
  6514. // },
  6515. // "object": {
  6516. // "description": "Name of the object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.",
  6517. // "location": "path",
  6518. // "required": true,
  6519. // "type": "string"
  6520. // },
  6521. // "userProject": {
  6522. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  6523. // "location": "query",
  6524. // "type": "string"
  6525. // }
  6526. // },
  6527. // "path": "b/{bucket}/o/{object}/acl",
  6528. // "request": {
  6529. // "$ref": "ObjectAccessControl"
  6530. // },
  6531. // "response": {
  6532. // "$ref": "ObjectAccessControl"
  6533. // },
  6534. // "scopes": [
  6535. // "https://www.googleapis.com/auth/cloud-platform",
  6536. // "https://www.googleapis.com/auth/devstorage.full_control"
  6537. // ]
  6538. // }
  6539. }
  6540. // method id "storage.objectAccessControls.list":
  6541. type ObjectAccessControlsListCall struct {
  6542. s *Service
  6543. bucket string
  6544. object string
  6545. urlParams_ gensupport.URLParams
  6546. ifNoneMatch_ string
  6547. ctx_ context.Context
  6548. header_ http.Header
  6549. }
  6550. // List: Retrieves ACL entries on the specified object.
  6551. func (r *ObjectAccessControlsService) List(bucket string, object string) *ObjectAccessControlsListCall {
  6552. c := &ObjectAccessControlsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6553. c.bucket = bucket
  6554. c.object = object
  6555. return c
  6556. }
  6557. // Generation sets the optional parameter "generation": If present,
  6558. // selects a specific revision of this object (as opposed to the latest
  6559. // version, the default).
  6560. func (c *ObjectAccessControlsListCall) Generation(generation int64) *ObjectAccessControlsListCall {
  6561. c.urlParams_.Set("generation", fmt.Sprint(generation))
  6562. return c
  6563. }
  6564. // UserProject sets the optional parameter "userProject": The project to
  6565. // be billed for this request. Required for Requester Pays buckets.
  6566. func (c *ObjectAccessControlsListCall) UserProject(userProject string) *ObjectAccessControlsListCall {
  6567. c.urlParams_.Set("userProject", userProject)
  6568. return c
  6569. }
  6570. // Fields allows partial responses to be retrieved. See
  6571. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6572. // for more information.
  6573. func (c *ObjectAccessControlsListCall) Fields(s ...googleapi.Field) *ObjectAccessControlsListCall {
  6574. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6575. return c
  6576. }
  6577. // IfNoneMatch sets the optional parameter which makes the operation
  6578. // fail if the object's ETag matches the given value. This is useful for
  6579. // getting updates only after the object has changed since the last
  6580. // request. Use googleapi.IsNotModified to check whether the response
  6581. // error from Do is the result of In-None-Match.
  6582. func (c *ObjectAccessControlsListCall) IfNoneMatch(entityTag string) *ObjectAccessControlsListCall {
  6583. c.ifNoneMatch_ = entityTag
  6584. return c
  6585. }
  6586. // Context sets the context to be used in this call's Do method. Any
  6587. // pending HTTP request will be aborted if the provided context is
  6588. // canceled.
  6589. func (c *ObjectAccessControlsListCall) Context(ctx context.Context) *ObjectAccessControlsListCall {
  6590. c.ctx_ = ctx
  6591. return c
  6592. }
  6593. // Header returns an http.Header that can be modified by the caller to
  6594. // add HTTP headers to the request.
  6595. func (c *ObjectAccessControlsListCall) Header() http.Header {
  6596. if c.header_ == nil {
  6597. c.header_ = make(http.Header)
  6598. }
  6599. return c.header_
  6600. }
  6601. func (c *ObjectAccessControlsListCall) doRequest(alt string) (*http.Response, error) {
  6602. reqHeaders := make(http.Header)
  6603. for k, v := range c.header_ {
  6604. reqHeaders[k] = v
  6605. }
  6606. reqHeaders.Set("User-Agent", c.s.userAgent())
  6607. if c.ifNoneMatch_ != "" {
  6608. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  6609. }
  6610. var body io.Reader = nil
  6611. c.urlParams_.Set("alt", alt)
  6612. c.urlParams_.Set("prettyPrint", "false")
  6613. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o/{object}/acl")
  6614. urls += "?" + c.urlParams_.Encode()
  6615. req, err := http.NewRequest("GET", urls, body)
  6616. if err != nil {
  6617. return nil, err
  6618. }
  6619. req.Header = reqHeaders
  6620. googleapi.Expand(req.URL, map[string]string{
  6621. "bucket": c.bucket,
  6622. "object": c.object,
  6623. })
  6624. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6625. }
  6626. // Do executes the "storage.objectAccessControls.list" call.
  6627. // Exactly one of *ObjectAccessControls or error will be non-nil. Any
  6628. // non-2xx status code is an error. Response headers are in either
  6629. // *ObjectAccessControls.ServerResponse.Header or (if a response was
  6630. // returned at all) in error.(*googleapi.Error).Header. Use
  6631. // googleapi.IsNotModified to check whether the returned error was
  6632. // because http.StatusNotModified was returned.
  6633. func (c *ObjectAccessControlsListCall) Do(opts ...googleapi.CallOption) (*ObjectAccessControls, error) {
  6634. gensupport.SetOptions(c.urlParams_, opts...)
  6635. res, err := c.doRequest("json")
  6636. if res != nil && res.StatusCode == http.StatusNotModified {
  6637. if res.Body != nil {
  6638. res.Body.Close()
  6639. }
  6640. return nil, &googleapi.Error{
  6641. Code: res.StatusCode,
  6642. Header: res.Header,
  6643. }
  6644. }
  6645. if err != nil {
  6646. return nil, err
  6647. }
  6648. defer googleapi.CloseBody(res)
  6649. if err := googleapi.CheckResponse(res); err != nil {
  6650. return nil, err
  6651. }
  6652. ret := &ObjectAccessControls{
  6653. ServerResponse: googleapi.ServerResponse{
  6654. Header: res.Header,
  6655. HTTPStatusCode: res.StatusCode,
  6656. },
  6657. }
  6658. target := &ret
  6659. if err := gensupport.DecodeResponse(target, res); err != nil {
  6660. return nil, err
  6661. }
  6662. return ret, nil
  6663. // {
  6664. // "description": "Retrieves ACL entries on the specified object.",
  6665. // "httpMethod": "GET",
  6666. // "id": "storage.objectAccessControls.list",
  6667. // "parameterOrder": [
  6668. // "bucket",
  6669. // "object"
  6670. // ],
  6671. // "parameters": {
  6672. // "bucket": {
  6673. // "description": "Name of a bucket.",
  6674. // "location": "path",
  6675. // "required": true,
  6676. // "type": "string"
  6677. // },
  6678. // "generation": {
  6679. // "description": "If present, selects a specific revision of this object (as opposed to the latest version, the default).",
  6680. // "format": "int64",
  6681. // "location": "query",
  6682. // "type": "string"
  6683. // },
  6684. // "object": {
  6685. // "description": "Name of the object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.",
  6686. // "location": "path",
  6687. // "required": true,
  6688. // "type": "string"
  6689. // },
  6690. // "userProject": {
  6691. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  6692. // "location": "query",
  6693. // "type": "string"
  6694. // }
  6695. // },
  6696. // "path": "b/{bucket}/o/{object}/acl",
  6697. // "response": {
  6698. // "$ref": "ObjectAccessControls"
  6699. // },
  6700. // "scopes": [
  6701. // "https://www.googleapis.com/auth/cloud-platform",
  6702. // "https://www.googleapis.com/auth/devstorage.full_control"
  6703. // ]
  6704. // }
  6705. }
  6706. // method id "storage.objectAccessControls.patch":
  6707. type ObjectAccessControlsPatchCall struct {
  6708. s *Service
  6709. bucket string
  6710. object string
  6711. entity string
  6712. objectaccesscontrol *ObjectAccessControl
  6713. urlParams_ gensupport.URLParams
  6714. ctx_ context.Context
  6715. header_ http.Header
  6716. }
  6717. // Patch: Patches an ACL entry on the specified object.
  6718. func (r *ObjectAccessControlsService) Patch(bucket string, object string, entity string, objectaccesscontrol *ObjectAccessControl) *ObjectAccessControlsPatchCall {
  6719. c := &ObjectAccessControlsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6720. c.bucket = bucket
  6721. c.object = object
  6722. c.entity = entity
  6723. c.objectaccesscontrol = objectaccesscontrol
  6724. return c
  6725. }
  6726. // Generation sets the optional parameter "generation": If present,
  6727. // selects a specific revision of this object (as opposed to the latest
  6728. // version, the default).
  6729. func (c *ObjectAccessControlsPatchCall) Generation(generation int64) *ObjectAccessControlsPatchCall {
  6730. c.urlParams_.Set("generation", fmt.Sprint(generation))
  6731. return c
  6732. }
  6733. // UserProject sets the optional parameter "userProject": The project to
  6734. // be billed for this request. Required for Requester Pays buckets.
  6735. func (c *ObjectAccessControlsPatchCall) UserProject(userProject string) *ObjectAccessControlsPatchCall {
  6736. c.urlParams_.Set("userProject", userProject)
  6737. return c
  6738. }
  6739. // Fields allows partial responses to be retrieved. See
  6740. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6741. // for more information.
  6742. func (c *ObjectAccessControlsPatchCall) Fields(s ...googleapi.Field) *ObjectAccessControlsPatchCall {
  6743. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6744. return c
  6745. }
  6746. // Context sets the context to be used in this call's Do method. Any
  6747. // pending HTTP request will be aborted if the provided context is
  6748. // canceled.
  6749. func (c *ObjectAccessControlsPatchCall) Context(ctx context.Context) *ObjectAccessControlsPatchCall {
  6750. c.ctx_ = ctx
  6751. return c
  6752. }
  6753. // Header returns an http.Header that can be modified by the caller to
  6754. // add HTTP headers to the request.
  6755. func (c *ObjectAccessControlsPatchCall) Header() http.Header {
  6756. if c.header_ == nil {
  6757. c.header_ = make(http.Header)
  6758. }
  6759. return c.header_
  6760. }
  6761. func (c *ObjectAccessControlsPatchCall) doRequest(alt string) (*http.Response, error) {
  6762. reqHeaders := make(http.Header)
  6763. for k, v := range c.header_ {
  6764. reqHeaders[k] = v
  6765. }
  6766. reqHeaders.Set("User-Agent", c.s.userAgent())
  6767. var body io.Reader = nil
  6768. body, err := googleapi.WithoutDataWrapper.JSONReader(c.objectaccesscontrol)
  6769. if err != nil {
  6770. return nil, err
  6771. }
  6772. reqHeaders.Set("Content-Type", "application/json")
  6773. c.urlParams_.Set("alt", alt)
  6774. c.urlParams_.Set("prettyPrint", "false")
  6775. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o/{object}/acl/{entity}")
  6776. urls += "?" + c.urlParams_.Encode()
  6777. req, err := http.NewRequest("PATCH", urls, body)
  6778. if err != nil {
  6779. return nil, err
  6780. }
  6781. req.Header = reqHeaders
  6782. googleapi.Expand(req.URL, map[string]string{
  6783. "bucket": c.bucket,
  6784. "object": c.object,
  6785. "entity": c.entity,
  6786. })
  6787. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6788. }
  6789. // Do executes the "storage.objectAccessControls.patch" call.
  6790. // Exactly one of *ObjectAccessControl or error will be non-nil. Any
  6791. // non-2xx status code is an error. Response headers are in either
  6792. // *ObjectAccessControl.ServerResponse.Header or (if a response was
  6793. // returned at all) in error.(*googleapi.Error).Header. Use
  6794. // googleapi.IsNotModified to check whether the returned error was
  6795. // because http.StatusNotModified was returned.
  6796. func (c *ObjectAccessControlsPatchCall) Do(opts ...googleapi.CallOption) (*ObjectAccessControl, error) {
  6797. gensupport.SetOptions(c.urlParams_, opts...)
  6798. res, err := c.doRequest("json")
  6799. if res != nil && res.StatusCode == http.StatusNotModified {
  6800. if res.Body != nil {
  6801. res.Body.Close()
  6802. }
  6803. return nil, &googleapi.Error{
  6804. Code: res.StatusCode,
  6805. Header: res.Header,
  6806. }
  6807. }
  6808. if err != nil {
  6809. return nil, err
  6810. }
  6811. defer googleapi.CloseBody(res)
  6812. if err := googleapi.CheckResponse(res); err != nil {
  6813. return nil, err
  6814. }
  6815. ret := &ObjectAccessControl{
  6816. ServerResponse: googleapi.ServerResponse{
  6817. Header: res.Header,
  6818. HTTPStatusCode: res.StatusCode,
  6819. },
  6820. }
  6821. target := &ret
  6822. if err := gensupport.DecodeResponse(target, res); err != nil {
  6823. return nil, err
  6824. }
  6825. return ret, nil
  6826. // {
  6827. // "description": "Patches an ACL entry on the specified object.",
  6828. // "httpMethod": "PATCH",
  6829. // "id": "storage.objectAccessControls.patch",
  6830. // "parameterOrder": [
  6831. // "bucket",
  6832. // "object",
  6833. // "entity"
  6834. // ],
  6835. // "parameters": {
  6836. // "bucket": {
  6837. // "description": "Name of a bucket.",
  6838. // "location": "path",
  6839. // "required": true,
  6840. // "type": "string"
  6841. // },
  6842. // "entity": {
  6843. // "description": "The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.",
  6844. // "location": "path",
  6845. // "required": true,
  6846. // "type": "string"
  6847. // },
  6848. // "generation": {
  6849. // "description": "If present, selects a specific revision of this object (as opposed to the latest version, the default).",
  6850. // "format": "int64",
  6851. // "location": "query",
  6852. // "type": "string"
  6853. // },
  6854. // "object": {
  6855. // "description": "Name of the object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.",
  6856. // "location": "path",
  6857. // "required": true,
  6858. // "type": "string"
  6859. // },
  6860. // "userProject": {
  6861. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  6862. // "location": "query",
  6863. // "type": "string"
  6864. // }
  6865. // },
  6866. // "path": "b/{bucket}/o/{object}/acl/{entity}",
  6867. // "request": {
  6868. // "$ref": "ObjectAccessControl"
  6869. // },
  6870. // "response": {
  6871. // "$ref": "ObjectAccessControl"
  6872. // },
  6873. // "scopes": [
  6874. // "https://www.googleapis.com/auth/cloud-platform",
  6875. // "https://www.googleapis.com/auth/devstorage.full_control"
  6876. // ]
  6877. // }
  6878. }
  6879. // method id "storage.objectAccessControls.update":
  6880. type ObjectAccessControlsUpdateCall struct {
  6881. s *Service
  6882. bucket string
  6883. object string
  6884. entity string
  6885. objectaccesscontrol *ObjectAccessControl
  6886. urlParams_ gensupport.URLParams
  6887. ctx_ context.Context
  6888. header_ http.Header
  6889. }
  6890. // Update: Updates an ACL entry on the specified object.
  6891. func (r *ObjectAccessControlsService) Update(bucket string, object string, entity string, objectaccesscontrol *ObjectAccessControl) *ObjectAccessControlsUpdateCall {
  6892. c := &ObjectAccessControlsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6893. c.bucket = bucket
  6894. c.object = object
  6895. c.entity = entity
  6896. c.objectaccesscontrol = objectaccesscontrol
  6897. return c
  6898. }
  6899. // Generation sets the optional parameter "generation": If present,
  6900. // selects a specific revision of this object (as opposed to the latest
  6901. // version, the default).
  6902. func (c *ObjectAccessControlsUpdateCall) Generation(generation int64) *ObjectAccessControlsUpdateCall {
  6903. c.urlParams_.Set("generation", fmt.Sprint(generation))
  6904. return c
  6905. }
  6906. // UserProject sets the optional parameter "userProject": The project to
  6907. // be billed for this request. Required for Requester Pays buckets.
  6908. func (c *ObjectAccessControlsUpdateCall) UserProject(userProject string) *ObjectAccessControlsUpdateCall {
  6909. c.urlParams_.Set("userProject", userProject)
  6910. return c
  6911. }
  6912. // Fields allows partial responses to be retrieved. See
  6913. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6914. // for more information.
  6915. func (c *ObjectAccessControlsUpdateCall) Fields(s ...googleapi.Field) *ObjectAccessControlsUpdateCall {
  6916. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6917. return c
  6918. }
  6919. // Context sets the context to be used in this call's Do method. Any
  6920. // pending HTTP request will be aborted if the provided context is
  6921. // canceled.
  6922. func (c *ObjectAccessControlsUpdateCall) Context(ctx context.Context) *ObjectAccessControlsUpdateCall {
  6923. c.ctx_ = ctx
  6924. return c
  6925. }
  6926. // Header returns an http.Header that can be modified by the caller to
  6927. // add HTTP headers to the request.
  6928. func (c *ObjectAccessControlsUpdateCall) Header() http.Header {
  6929. if c.header_ == nil {
  6930. c.header_ = make(http.Header)
  6931. }
  6932. return c.header_
  6933. }
  6934. func (c *ObjectAccessControlsUpdateCall) doRequest(alt string) (*http.Response, error) {
  6935. reqHeaders := make(http.Header)
  6936. for k, v := range c.header_ {
  6937. reqHeaders[k] = v
  6938. }
  6939. reqHeaders.Set("User-Agent", c.s.userAgent())
  6940. var body io.Reader = nil
  6941. body, err := googleapi.WithoutDataWrapper.JSONReader(c.objectaccesscontrol)
  6942. if err != nil {
  6943. return nil, err
  6944. }
  6945. reqHeaders.Set("Content-Type", "application/json")
  6946. c.urlParams_.Set("alt", alt)
  6947. c.urlParams_.Set("prettyPrint", "false")
  6948. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o/{object}/acl/{entity}")
  6949. urls += "?" + c.urlParams_.Encode()
  6950. req, err := http.NewRequest("PUT", urls, body)
  6951. if err != nil {
  6952. return nil, err
  6953. }
  6954. req.Header = reqHeaders
  6955. googleapi.Expand(req.URL, map[string]string{
  6956. "bucket": c.bucket,
  6957. "object": c.object,
  6958. "entity": c.entity,
  6959. })
  6960. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6961. }
  6962. // Do executes the "storage.objectAccessControls.update" call.
  6963. // Exactly one of *ObjectAccessControl or error will be non-nil. Any
  6964. // non-2xx status code is an error. Response headers are in either
  6965. // *ObjectAccessControl.ServerResponse.Header or (if a response was
  6966. // returned at all) in error.(*googleapi.Error).Header. Use
  6967. // googleapi.IsNotModified to check whether the returned error was
  6968. // because http.StatusNotModified was returned.
  6969. func (c *ObjectAccessControlsUpdateCall) Do(opts ...googleapi.CallOption) (*ObjectAccessControl, error) {
  6970. gensupport.SetOptions(c.urlParams_, opts...)
  6971. res, err := c.doRequest("json")
  6972. if res != nil && res.StatusCode == http.StatusNotModified {
  6973. if res.Body != nil {
  6974. res.Body.Close()
  6975. }
  6976. return nil, &googleapi.Error{
  6977. Code: res.StatusCode,
  6978. Header: res.Header,
  6979. }
  6980. }
  6981. if err != nil {
  6982. return nil, err
  6983. }
  6984. defer googleapi.CloseBody(res)
  6985. if err := googleapi.CheckResponse(res); err != nil {
  6986. return nil, err
  6987. }
  6988. ret := &ObjectAccessControl{
  6989. ServerResponse: googleapi.ServerResponse{
  6990. Header: res.Header,
  6991. HTTPStatusCode: res.StatusCode,
  6992. },
  6993. }
  6994. target := &ret
  6995. if err := gensupport.DecodeResponse(target, res); err != nil {
  6996. return nil, err
  6997. }
  6998. return ret, nil
  6999. // {
  7000. // "description": "Updates an ACL entry on the specified object.",
  7001. // "httpMethod": "PUT",
  7002. // "id": "storage.objectAccessControls.update",
  7003. // "parameterOrder": [
  7004. // "bucket",
  7005. // "object",
  7006. // "entity"
  7007. // ],
  7008. // "parameters": {
  7009. // "bucket": {
  7010. // "description": "Name of a bucket.",
  7011. // "location": "path",
  7012. // "required": true,
  7013. // "type": "string"
  7014. // },
  7015. // "entity": {
  7016. // "description": "The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.",
  7017. // "location": "path",
  7018. // "required": true,
  7019. // "type": "string"
  7020. // },
  7021. // "generation": {
  7022. // "description": "If present, selects a specific revision of this object (as opposed to the latest version, the default).",
  7023. // "format": "int64",
  7024. // "location": "query",
  7025. // "type": "string"
  7026. // },
  7027. // "object": {
  7028. // "description": "Name of the object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.",
  7029. // "location": "path",
  7030. // "required": true,
  7031. // "type": "string"
  7032. // },
  7033. // "userProject": {
  7034. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  7035. // "location": "query",
  7036. // "type": "string"
  7037. // }
  7038. // },
  7039. // "path": "b/{bucket}/o/{object}/acl/{entity}",
  7040. // "request": {
  7041. // "$ref": "ObjectAccessControl"
  7042. // },
  7043. // "response": {
  7044. // "$ref": "ObjectAccessControl"
  7045. // },
  7046. // "scopes": [
  7047. // "https://www.googleapis.com/auth/cloud-platform",
  7048. // "https://www.googleapis.com/auth/devstorage.full_control"
  7049. // ]
  7050. // }
  7051. }
  7052. // method id "storage.objects.compose":
  7053. type ObjectsComposeCall struct {
  7054. s *Service
  7055. destinationBucket string
  7056. destinationObject string
  7057. composerequest *ComposeRequest
  7058. urlParams_ gensupport.URLParams
  7059. ctx_ context.Context
  7060. header_ http.Header
  7061. }
  7062. // Compose: Concatenates a list of existing objects into a new object in
  7063. // the same bucket.
  7064. func (r *ObjectsService) Compose(destinationBucket string, destinationObject string, composerequest *ComposeRequest) *ObjectsComposeCall {
  7065. c := &ObjectsComposeCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  7066. c.destinationBucket = destinationBucket
  7067. c.destinationObject = destinationObject
  7068. c.composerequest = composerequest
  7069. return c
  7070. }
  7071. // DestinationPredefinedAcl sets the optional parameter
  7072. // "destinationPredefinedAcl": Apply a predefined set of access controls
  7073. // to the destination object.
  7074. //
  7075. // Possible values:
  7076. // "authenticatedRead" - Object owner gets OWNER access, and
  7077. // allAuthenticatedUsers get READER access.
  7078. // "bucketOwnerFullControl" - Object owner gets OWNER access, and
  7079. // project team owners get OWNER access.
  7080. // "bucketOwnerRead" - Object owner gets OWNER access, and project
  7081. // team owners get READER access.
  7082. // "private" - Object owner gets OWNER access.
  7083. // "projectPrivate" - Object owner gets OWNER access, and project team
  7084. // members get access according to their roles.
  7085. // "publicRead" - Object owner gets OWNER access, and allUsers get
  7086. // READER access.
  7087. func (c *ObjectsComposeCall) DestinationPredefinedAcl(destinationPredefinedAcl string) *ObjectsComposeCall {
  7088. c.urlParams_.Set("destinationPredefinedAcl", destinationPredefinedAcl)
  7089. return c
  7090. }
  7091. // IfGenerationMatch sets the optional parameter "ifGenerationMatch":
  7092. // Makes the operation conditional on whether the object's current
  7093. // generation matches the given value. Setting to 0 makes the operation
  7094. // succeed only if there are no live versions of the object.
  7095. func (c *ObjectsComposeCall) IfGenerationMatch(ifGenerationMatch int64) *ObjectsComposeCall {
  7096. c.urlParams_.Set("ifGenerationMatch", fmt.Sprint(ifGenerationMatch))
  7097. return c
  7098. }
  7099. // IfMetagenerationMatch sets the optional parameter
  7100. // "ifMetagenerationMatch": Makes the operation conditional on whether
  7101. // the object's current metageneration matches the given value.
  7102. func (c *ObjectsComposeCall) IfMetagenerationMatch(ifMetagenerationMatch int64) *ObjectsComposeCall {
  7103. c.urlParams_.Set("ifMetagenerationMatch", fmt.Sprint(ifMetagenerationMatch))
  7104. return c
  7105. }
  7106. // KmsKeyName sets the optional parameter "kmsKeyName": Resource name of
  7107. // the Cloud KMS key, of the form
  7108. // projects/my-project/locations/global/keyRings/my-kr/cryptoKeys/my-key,
  7109. // that will be used to encrypt the object. Overrides the object
  7110. // metadata's kms_key_name value, if any.
  7111. func (c *ObjectsComposeCall) KmsKeyName(kmsKeyName string) *ObjectsComposeCall {
  7112. c.urlParams_.Set("kmsKeyName", kmsKeyName)
  7113. return c
  7114. }
  7115. // UserProject sets the optional parameter "userProject": The project to
  7116. // be billed for this request. Required for Requester Pays buckets.
  7117. func (c *ObjectsComposeCall) UserProject(userProject string) *ObjectsComposeCall {
  7118. c.urlParams_.Set("userProject", userProject)
  7119. return c
  7120. }
  7121. // Fields allows partial responses to be retrieved. See
  7122. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  7123. // for more information.
  7124. func (c *ObjectsComposeCall) Fields(s ...googleapi.Field) *ObjectsComposeCall {
  7125. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  7126. return c
  7127. }
  7128. // Context sets the context to be used in this call's Do method. Any
  7129. // pending HTTP request will be aborted if the provided context is
  7130. // canceled.
  7131. func (c *ObjectsComposeCall) Context(ctx context.Context) *ObjectsComposeCall {
  7132. c.ctx_ = ctx
  7133. return c
  7134. }
  7135. // Header returns an http.Header that can be modified by the caller to
  7136. // add HTTP headers to the request.
  7137. func (c *ObjectsComposeCall) Header() http.Header {
  7138. if c.header_ == nil {
  7139. c.header_ = make(http.Header)
  7140. }
  7141. return c.header_
  7142. }
  7143. func (c *ObjectsComposeCall) doRequest(alt string) (*http.Response, error) {
  7144. reqHeaders := make(http.Header)
  7145. for k, v := range c.header_ {
  7146. reqHeaders[k] = v
  7147. }
  7148. reqHeaders.Set("User-Agent", c.s.userAgent())
  7149. var body io.Reader = nil
  7150. body, err := googleapi.WithoutDataWrapper.JSONReader(c.composerequest)
  7151. if err != nil {
  7152. return nil, err
  7153. }
  7154. reqHeaders.Set("Content-Type", "application/json")
  7155. c.urlParams_.Set("alt", alt)
  7156. c.urlParams_.Set("prettyPrint", "false")
  7157. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{destinationBucket}/o/{destinationObject}/compose")
  7158. urls += "?" + c.urlParams_.Encode()
  7159. req, err := http.NewRequest("POST", urls, body)
  7160. if err != nil {
  7161. return nil, err
  7162. }
  7163. req.Header = reqHeaders
  7164. googleapi.Expand(req.URL, map[string]string{
  7165. "destinationBucket": c.destinationBucket,
  7166. "destinationObject": c.destinationObject,
  7167. })
  7168. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  7169. }
  7170. // Do executes the "storage.objects.compose" call.
  7171. // Exactly one of *Object or error will be non-nil. Any non-2xx status
  7172. // code is an error. Response headers are in either
  7173. // *Object.ServerResponse.Header or (if a response was returned at all)
  7174. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  7175. // check whether the returned error was because http.StatusNotModified
  7176. // was returned.
  7177. func (c *ObjectsComposeCall) Do(opts ...googleapi.CallOption) (*Object, error) {
  7178. gensupport.SetOptions(c.urlParams_, opts...)
  7179. res, err := c.doRequest("json")
  7180. if res != nil && res.StatusCode == http.StatusNotModified {
  7181. if res.Body != nil {
  7182. res.Body.Close()
  7183. }
  7184. return nil, &googleapi.Error{
  7185. Code: res.StatusCode,
  7186. Header: res.Header,
  7187. }
  7188. }
  7189. if err != nil {
  7190. return nil, err
  7191. }
  7192. defer googleapi.CloseBody(res)
  7193. if err := googleapi.CheckResponse(res); err != nil {
  7194. return nil, err
  7195. }
  7196. ret := &Object{
  7197. ServerResponse: googleapi.ServerResponse{
  7198. Header: res.Header,
  7199. HTTPStatusCode: res.StatusCode,
  7200. },
  7201. }
  7202. target := &ret
  7203. if err := gensupport.DecodeResponse(target, res); err != nil {
  7204. return nil, err
  7205. }
  7206. return ret, nil
  7207. // {
  7208. // "description": "Concatenates a list of existing objects into a new object in the same bucket.",
  7209. // "httpMethod": "POST",
  7210. // "id": "storage.objects.compose",
  7211. // "parameterOrder": [
  7212. // "destinationBucket",
  7213. // "destinationObject"
  7214. // ],
  7215. // "parameters": {
  7216. // "destinationBucket": {
  7217. // "description": "Name of the bucket containing the source objects. The destination object is stored in this bucket.",
  7218. // "location": "path",
  7219. // "required": true,
  7220. // "type": "string"
  7221. // },
  7222. // "destinationObject": {
  7223. // "description": "Name of the new object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.",
  7224. // "location": "path",
  7225. // "required": true,
  7226. // "type": "string"
  7227. // },
  7228. // "destinationPredefinedAcl": {
  7229. // "description": "Apply a predefined set of access controls to the destination object.",
  7230. // "enum": [
  7231. // "authenticatedRead",
  7232. // "bucketOwnerFullControl",
  7233. // "bucketOwnerRead",
  7234. // "private",
  7235. // "projectPrivate",
  7236. // "publicRead"
  7237. // ],
  7238. // "enumDescriptions": [
  7239. // "Object owner gets OWNER access, and allAuthenticatedUsers get READER access.",
  7240. // "Object owner gets OWNER access, and project team owners get OWNER access.",
  7241. // "Object owner gets OWNER access, and project team owners get READER access.",
  7242. // "Object owner gets OWNER access.",
  7243. // "Object owner gets OWNER access, and project team members get access according to their roles.",
  7244. // "Object owner gets OWNER access, and allUsers get READER access."
  7245. // ],
  7246. // "location": "query",
  7247. // "type": "string"
  7248. // },
  7249. // "ifGenerationMatch": {
  7250. // "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.",
  7251. // "format": "int64",
  7252. // "location": "query",
  7253. // "type": "string"
  7254. // },
  7255. // "ifMetagenerationMatch": {
  7256. // "description": "Makes the operation conditional on whether the object's current metageneration matches the given value.",
  7257. // "format": "int64",
  7258. // "location": "query",
  7259. // "type": "string"
  7260. // },
  7261. // "kmsKeyName": {
  7262. // "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.",
  7263. // "location": "query",
  7264. // "type": "string"
  7265. // },
  7266. // "userProject": {
  7267. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  7268. // "location": "query",
  7269. // "type": "string"
  7270. // }
  7271. // },
  7272. // "path": "b/{destinationBucket}/o/{destinationObject}/compose",
  7273. // "request": {
  7274. // "$ref": "ComposeRequest"
  7275. // },
  7276. // "response": {
  7277. // "$ref": "Object"
  7278. // },
  7279. // "scopes": [
  7280. // "https://www.googleapis.com/auth/cloud-platform",
  7281. // "https://www.googleapis.com/auth/devstorage.full_control",
  7282. // "https://www.googleapis.com/auth/devstorage.read_write"
  7283. // ]
  7284. // }
  7285. }
  7286. // method id "storage.objects.copy":
  7287. type ObjectsCopyCall struct {
  7288. s *Service
  7289. sourceBucket string
  7290. sourceObject string
  7291. destinationBucket string
  7292. destinationObject string
  7293. object *Object
  7294. urlParams_ gensupport.URLParams
  7295. ctx_ context.Context
  7296. header_ http.Header
  7297. }
  7298. // Copy: Copies a source object to a destination object. Optionally
  7299. // overrides metadata.
  7300. func (r *ObjectsService) Copy(sourceBucket string, sourceObject string, destinationBucket string, destinationObject string, object *Object) *ObjectsCopyCall {
  7301. c := &ObjectsCopyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  7302. c.sourceBucket = sourceBucket
  7303. c.sourceObject = sourceObject
  7304. c.destinationBucket = destinationBucket
  7305. c.destinationObject = destinationObject
  7306. c.object = object
  7307. return c
  7308. }
  7309. // DestinationPredefinedAcl sets the optional parameter
  7310. // "destinationPredefinedAcl": Apply a predefined set of access controls
  7311. // to the destination object.
  7312. //
  7313. // Possible values:
  7314. // "authenticatedRead" - Object owner gets OWNER access, and
  7315. // allAuthenticatedUsers get READER access.
  7316. // "bucketOwnerFullControl" - Object owner gets OWNER access, and
  7317. // project team owners get OWNER access.
  7318. // "bucketOwnerRead" - Object owner gets OWNER access, and project
  7319. // team owners get READER access.
  7320. // "private" - Object owner gets OWNER access.
  7321. // "projectPrivate" - Object owner gets OWNER access, and project team
  7322. // members get access according to their roles.
  7323. // "publicRead" - Object owner gets OWNER access, and allUsers get
  7324. // READER access.
  7325. func (c *ObjectsCopyCall) DestinationPredefinedAcl(destinationPredefinedAcl string) *ObjectsCopyCall {
  7326. c.urlParams_.Set("destinationPredefinedAcl", destinationPredefinedAcl)
  7327. return c
  7328. }
  7329. // IfGenerationMatch sets the optional parameter "ifGenerationMatch":
  7330. // Makes the operation conditional on whether the destination object's
  7331. // current generation matches the given value. Setting to 0 makes the
  7332. // operation succeed only if there are no live versions of the object.
  7333. func (c *ObjectsCopyCall) IfGenerationMatch(ifGenerationMatch int64) *ObjectsCopyCall {
  7334. c.urlParams_.Set("ifGenerationMatch", fmt.Sprint(ifGenerationMatch))
  7335. return c
  7336. }
  7337. // IfGenerationNotMatch sets the optional parameter
  7338. // "ifGenerationNotMatch": Makes the operation conditional on whether
  7339. // the destination object's current generation does not match the given
  7340. // value. If no live object exists, the precondition fails. Setting to 0
  7341. // makes the operation succeed only if there is a live version of the
  7342. // object.
  7343. func (c *ObjectsCopyCall) IfGenerationNotMatch(ifGenerationNotMatch int64) *ObjectsCopyCall {
  7344. c.urlParams_.Set("ifGenerationNotMatch", fmt.Sprint(ifGenerationNotMatch))
  7345. return c
  7346. }
  7347. // IfMetagenerationMatch sets the optional parameter
  7348. // "ifMetagenerationMatch": Makes the operation conditional on whether
  7349. // the destination object's current metageneration matches the given
  7350. // value.
  7351. func (c *ObjectsCopyCall) IfMetagenerationMatch(ifMetagenerationMatch int64) *ObjectsCopyCall {
  7352. c.urlParams_.Set("ifMetagenerationMatch", fmt.Sprint(ifMetagenerationMatch))
  7353. return c
  7354. }
  7355. // IfMetagenerationNotMatch sets the optional parameter
  7356. // "ifMetagenerationNotMatch": Makes the operation conditional on
  7357. // whether the destination object's current metageneration does not
  7358. // match the given value.
  7359. func (c *ObjectsCopyCall) IfMetagenerationNotMatch(ifMetagenerationNotMatch int64) *ObjectsCopyCall {
  7360. c.urlParams_.Set("ifMetagenerationNotMatch", fmt.Sprint(ifMetagenerationNotMatch))
  7361. return c
  7362. }
  7363. // IfSourceGenerationMatch sets the optional parameter
  7364. // "ifSourceGenerationMatch": Makes the operation conditional on whether
  7365. // the source object's current generation matches the given value.
  7366. func (c *ObjectsCopyCall) IfSourceGenerationMatch(ifSourceGenerationMatch int64) *ObjectsCopyCall {
  7367. c.urlParams_.Set("ifSourceGenerationMatch", fmt.Sprint(ifSourceGenerationMatch))
  7368. return c
  7369. }
  7370. // IfSourceGenerationNotMatch sets the optional parameter
  7371. // "ifSourceGenerationNotMatch": Makes the operation conditional on
  7372. // whether the source object's current generation does not match the
  7373. // given value.
  7374. func (c *ObjectsCopyCall) IfSourceGenerationNotMatch(ifSourceGenerationNotMatch int64) *ObjectsCopyCall {
  7375. c.urlParams_.Set("ifSourceGenerationNotMatch", fmt.Sprint(ifSourceGenerationNotMatch))
  7376. return c
  7377. }
  7378. // IfSourceMetagenerationMatch sets the optional parameter
  7379. // "ifSourceMetagenerationMatch": Makes the operation conditional on
  7380. // whether the source object's current metageneration matches the given
  7381. // value.
  7382. func (c *ObjectsCopyCall) IfSourceMetagenerationMatch(ifSourceMetagenerationMatch int64) *ObjectsCopyCall {
  7383. c.urlParams_.Set("ifSourceMetagenerationMatch", fmt.Sprint(ifSourceMetagenerationMatch))
  7384. return c
  7385. }
  7386. // IfSourceMetagenerationNotMatch sets the optional parameter
  7387. // "ifSourceMetagenerationNotMatch": Makes the operation conditional on
  7388. // whether the source object's current metageneration does not match the
  7389. // given value.
  7390. func (c *ObjectsCopyCall) IfSourceMetagenerationNotMatch(ifSourceMetagenerationNotMatch int64) *ObjectsCopyCall {
  7391. c.urlParams_.Set("ifSourceMetagenerationNotMatch", fmt.Sprint(ifSourceMetagenerationNotMatch))
  7392. return c
  7393. }
  7394. // Projection sets the optional parameter "projection": Set of
  7395. // properties to return. Defaults to noAcl, unless the object resource
  7396. // specifies the acl property, when it defaults to full.
  7397. //
  7398. // Possible values:
  7399. // "full" - Include all properties.
  7400. // "noAcl" - Omit the owner, acl property.
  7401. func (c *ObjectsCopyCall) Projection(projection string) *ObjectsCopyCall {
  7402. c.urlParams_.Set("projection", projection)
  7403. return c
  7404. }
  7405. // SourceGeneration sets the optional parameter "sourceGeneration": If
  7406. // present, selects a specific revision of the source object (as opposed
  7407. // to the latest version, the default).
  7408. func (c *ObjectsCopyCall) SourceGeneration(sourceGeneration int64) *ObjectsCopyCall {
  7409. c.urlParams_.Set("sourceGeneration", fmt.Sprint(sourceGeneration))
  7410. return c
  7411. }
  7412. // UserProject sets the optional parameter "userProject": The project to
  7413. // be billed for this request. Required for Requester Pays buckets.
  7414. func (c *ObjectsCopyCall) UserProject(userProject string) *ObjectsCopyCall {
  7415. c.urlParams_.Set("userProject", userProject)
  7416. return c
  7417. }
  7418. // Fields allows partial responses to be retrieved. See
  7419. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  7420. // for more information.
  7421. func (c *ObjectsCopyCall) Fields(s ...googleapi.Field) *ObjectsCopyCall {
  7422. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  7423. return c
  7424. }
  7425. // Context sets the context to be used in this call's Do method. Any
  7426. // pending HTTP request will be aborted if the provided context is
  7427. // canceled.
  7428. func (c *ObjectsCopyCall) Context(ctx context.Context) *ObjectsCopyCall {
  7429. c.ctx_ = ctx
  7430. return c
  7431. }
  7432. // Header returns an http.Header that can be modified by the caller to
  7433. // add HTTP headers to the request.
  7434. func (c *ObjectsCopyCall) Header() http.Header {
  7435. if c.header_ == nil {
  7436. c.header_ = make(http.Header)
  7437. }
  7438. return c.header_
  7439. }
  7440. func (c *ObjectsCopyCall) doRequest(alt string) (*http.Response, error) {
  7441. reqHeaders := make(http.Header)
  7442. for k, v := range c.header_ {
  7443. reqHeaders[k] = v
  7444. }
  7445. reqHeaders.Set("User-Agent", c.s.userAgent())
  7446. var body io.Reader = nil
  7447. body, err := googleapi.WithoutDataWrapper.JSONReader(c.object)
  7448. if err != nil {
  7449. return nil, err
  7450. }
  7451. reqHeaders.Set("Content-Type", "application/json")
  7452. c.urlParams_.Set("alt", alt)
  7453. c.urlParams_.Set("prettyPrint", "false")
  7454. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{sourceBucket}/o/{sourceObject}/copyTo/b/{destinationBucket}/o/{destinationObject}")
  7455. urls += "?" + c.urlParams_.Encode()
  7456. req, err := http.NewRequest("POST", urls, body)
  7457. if err != nil {
  7458. return nil, err
  7459. }
  7460. req.Header = reqHeaders
  7461. googleapi.Expand(req.URL, map[string]string{
  7462. "sourceBucket": c.sourceBucket,
  7463. "sourceObject": c.sourceObject,
  7464. "destinationBucket": c.destinationBucket,
  7465. "destinationObject": c.destinationObject,
  7466. })
  7467. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  7468. }
  7469. // Do executes the "storage.objects.copy" call.
  7470. // Exactly one of *Object or error will be non-nil. Any non-2xx status
  7471. // code is an error. Response headers are in either
  7472. // *Object.ServerResponse.Header or (if a response was returned at all)
  7473. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  7474. // check whether the returned error was because http.StatusNotModified
  7475. // was returned.
  7476. func (c *ObjectsCopyCall) Do(opts ...googleapi.CallOption) (*Object, error) {
  7477. gensupport.SetOptions(c.urlParams_, opts...)
  7478. res, err := c.doRequest("json")
  7479. if res != nil && res.StatusCode == http.StatusNotModified {
  7480. if res.Body != nil {
  7481. res.Body.Close()
  7482. }
  7483. return nil, &googleapi.Error{
  7484. Code: res.StatusCode,
  7485. Header: res.Header,
  7486. }
  7487. }
  7488. if err != nil {
  7489. return nil, err
  7490. }
  7491. defer googleapi.CloseBody(res)
  7492. if err := googleapi.CheckResponse(res); err != nil {
  7493. return nil, err
  7494. }
  7495. ret := &Object{
  7496. ServerResponse: googleapi.ServerResponse{
  7497. Header: res.Header,
  7498. HTTPStatusCode: res.StatusCode,
  7499. },
  7500. }
  7501. target := &ret
  7502. if err := gensupport.DecodeResponse(target, res); err != nil {
  7503. return nil, err
  7504. }
  7505. return ret, nil
  7506. // {
  7507. // "description": "Copies a source object to a destination object. Optionally overrides metadata.",
  7508. // "httpMethod": "POST",
  7509. // "id": "storage.objects.copy",
  7510. // "parameterOrder": [
  7511. // "sourceBucket",
  7512. // "sourceObject",
  7513. // "destinationBucket",
  7514. // "destinationObject"
  7515. // ],
  7516. // "parameters": {
  7517. // "destinationBucket": {
  7518. // "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.",
  7519. // "location": "path",
  7520. // "required": true,
  7521. // "type": "string"
  7522. // },
  7523. // "destinationObject": {
  7524. // "description": "Name of the new object. Required when the object metadata is not otherwise provided. Overrides the object metadata's name value, if any.",
  7525. // "location": "path",
  7526. // "required": true,
  7527. // "type": "string"
  7528. // },
  7529. // "destinationPredefinedAcl": {
  7530. // "description": "Apply a predefined set of access controls to the destination object.",
  7531. // "enum": [
  7532. // "authenticatedRead",
  7533. // "bucketOwnerFullControl",
  7534. // "bucketOwnerRead",
  7535. // "private",
  7536. // "projectPrivate",
  7537. // "publicRead"
  7538. // ],
  7539. // "enumDescriptions": [
  7540. // "Object owner gets OWNER access, and allAuthenticatedUsers get READER access.",
  7541. // "Object owner gets OWNER access, and project team owners get OWNER access.",
  7542. // "Object owner gets OWNER access, and project team owners get READER access.",
  7543. // "Object owner gets OWNER access.",
  7544. // "Object owner gets OWNER access, and project team members get access according to their roles.",
  7545. // "Object owner gets OWNER access, and allUsers get READER access."
  7546. // ],
  7547. // "location": "query",
  7548. // "type": "string"
  7549. // },
  7550. // "ifGenerationMatch": {
  7551. // "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.",
  7552. // "format": "int64",
  7553. // "location": "query",
  7554. // "type": "string"
  7555. // },
  7556. // "ifGenerationNotMatch": {
  7557. // "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.",
  7558. // "format": "int64",
  7559. // "location": "query",
  7560. // "type": "string"
  7561. // },
  7562. // "ifMetagenerationMatch": {
  7563. // "description": "Makes the operation conditional on whether the destination object's current metageneration matches the given value.",
  7564. // "format": "int64",
  7565. // "location": "query",
  7566. // "type": "string"
  7567. // },
  7568. // "ifMetagenerationNotMatch": {
  7569. // "description": "Makes the operation conditional on whether the destination object's current metageneration does not match the given value.",
  7570. // "format": "int64",
  7571. // "location": "query",
  7572. // "type": "string"
  7573. // },
  7574. // "ifSourceGenerationMatch": {
  7575. // "description": "Makes the operation conditional on whether the source object's current generation matches the given value.",
  7576. // "format": "int64",
  7577. // "location": "query",
  7578. // "type": "string"
  7579. // },
  7580. // "ifSourceGenerationNotMatch": {
  7581. // "description": "Makes the operation conditional on whether the source object's current generation does not match the given value.",
  7582. // "format": "int64",
  7583. // "location": "query",
  7584. // "type": "string"
  7585. // },
  7586. // "ifSourceMetagenerationMatch": {
  7587. // "description": "Makes the operation conditional on whether the source object's current metageneration matches the given value.",
  7588. // "format": "int64",
  7589. // "location": "query",
  7590. // "type": "string"
  7591. // },
  7592. // "ifSourceMetagenerationNotMatch": {
  7593. // "description": "Makes the operation conditional on whether the source object's current metageneration does not match the given value.",
  7594. // "format": "int64",
  7595. // "location": "query",
  7596. // "type": "string"
  7597. // },
  7598. // "projection": {
  7599. // "description": "Set of properties to return. Defaults to noAcl, unless the object resource specifies the acl property, when it defaults to full.",
  7600. // "enum": [
  7601. // "full",
  7602. // "noAcl"
  7603. // ],
  7604. // "enumDescriptions": [
  7605. // "Include all properties.",
  7606. // "Omit the owner, acl property."
  7607. // ],
  7608. // "location": "query",
  7609. // "type": "string"
  7610. // },
  7611. // "sourceBucket": {
  7612. // "description": "Name of the bucket in which to find the source object.",
  7613. // "location": "path",
  7614. // "required": true,
  7615. // "type": "string"
  7616. // },
  7617. // "sourceGeneration": {
  7618. // "description": "If present, selects a specific revision of the source object (as opposed to the latest version, the default).",
  7619. // "format": "int64",
  7620. // "location": "query",
  7621. // "type": "string"
  7622. // },
  7623. // "sourceObject": {
  7624. // "description": "Name of the source object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.",
  7625. // "location": "path",
  7626. // "required": true,
  7627. // "type": "string"
  7628. // },
  7629. // "userProject": {
  7630. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  7631. // "location": "query",
  7632. // "type": "string"
  7633. // }
  7634. // },
  7635. // "path": "b/{sourceBucket}/o/{sourceObject}/copyTo/b/{destinationBucket}/o/{destinationObject}",
  7636. // "request": {
  7637. // "$ref": "Object"
  7638. // },
  7639. // "response": {
  7640. // "$ref": "Object"
  7641. // },
  7642. // "scopes": [
  7643. // "https://www.googleapis.com/auth/cloud-platform",
  7644. // "https://www.googleapis.com/auth/devstorage.full_control",
  7645. // "https://www.googleapis.com/auth/devstorage.read_write"
  7646. // ]
  7647. // }
  7648. }
  7649. // method id "storage.objects.delete":
  7650. type ObjectsDeleteCall struct {
  7651. s *Service
  7652. bucket string
  7653. object string
  7654. urlParams_ gensupport.URLParams
  7655. ctx_ context.Context
  7656. header_ http.Header
  7657. }
  7658. // Delete: Deletes an object and its metadata. Deletions are permanent
  7659. // if versioning is not enabled for the bucket, or if the generation
  7660. // parameter is used.
  7661. func (r *ObjectsService) Delete(bucket string, object string) *ObjectsDeleteCall {
  7662. c := &ObjectsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  7663. c.bucket = bucket
  7664. c.object = object
  7665. return c
  7666. }
  7667. // Generation sets the optional parameter "generation": If present,
  7668. // permanently deletes a specific revision of this object (as opposed to
  7669. // the latest version, the default).
  7670. func (c *ObjectsDeleteCall) Generation(generation int64) *ObjectsDeleteCall {
  7671. c.urlParams_.Set("generation", fmt.Sprint(generation))
  7672. return c
  7673. }
  7674. // IfGenerationMatch sets the optional parameter "ifGenerationMatch":
  7675. // Makes the operation conditional on whether the object's current
  7676. // generation matches the given value. Setting to 0 makes the operation
  7677. // succeed only if there are no live versions of the object.
  7678. func (c *ObjectsDeleteCall) IfGenerationMatch(ifGenerationMatch int64) *ObjectsDeleteCall {
  7679. c.urlParams_.Set("ifGenerationMatch", fmt.Sprint(ifGenerationMatch))
  7680. return c
  7681. }
  7682. // IfGenerationNotMatch sets the optional parameter
  7683. // "ifGenerationNotMatch": Makes the operation conditional on whether
  7684. // the object's current generation does not match the given value. If no
  7685. // live object exists, the precondition fails. Setting to 0 makes the
  7686. // operation succeed only if there is a live version of the object.
  7687. func (c *ObjectsDeleteCall) IfGenerationNotMatch(ifGenerationNotMatch int64) *ObjectsDeleteCall {
  7688. c.urlParams_.Set("ifGenerationNotMatch", fmt.Sprint(ifGenerationNotMatch))
  7689. return c
  7690. }
  7691. // IfMetagenerationMatch sets the optional parameter
  7692. // "ifMetagenerationMatch": Makes the operation conditional on whether
  7693. // the object's current metageneration matches the given value.
  7694. func (c *ObjectsDeleteCall) IfMetagenerationMatch(ifMetagenerationMatch int64) *ObjectsDeleteCall {
  7695. c.urlParams_.Set("ifMetagenerationMatch", fmt.Sprint(ifMetagenerationMatch))
  7696. return c
  7697. }
  7698. // IfMetagenerationNotMatch sets the optional parameter
  7699. // "ifMetagenerationNotMatch": Makes the operation conditional on
  7700. // whether the object's current metageneration does not match the given
  7701. // value.
  7702. func (c *ObjectsDeleteCall) IfMetagenerationNotMatch(ifMetagenerationNotMatch int64) *ObjectsDeleteCall {
  7703. c.urlParams_.Set("ifMetagenerationNotMatch", fmt.Sprint(ifMetagenerationNotMatch))
  7704. return c
  7705. }
  7706. // UserProject sets the optional parameter "userProject": The project to
  7707. // be billed for this request. Required for Requester Pays buckets.
  7708. func (c *ObjectsDeleteCall) UserProject(userProject string) *ObjectsDeleteCall {
  7709. c.urlParams_.Set("userProject", userProject)
  7710. return c
  7711. }
  7712. // Fields allows partial responses to be retrieved. See
  7713. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  7714. // for more information.
  7715. func (c *ObjectsDeleteCall) Fields(s ...googleapi.Field) *ObjectsDeleteCall {
  7716. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  7717. return c
  7718. }
  7719. // Context sets the context to be used in this call's Do method. Any
  7720. // pending HTTP request will be aborted if the provided context is
  7721. // canceled.
  7722. func (c *ObjectsDeleteCall) Context(ctx context.Context) *ObjectsDeleteCall {
  7723. c.ctx_ = ctx
  7724. return c
  7725. }
  7726. // Header returns an http.Header that can be modified by the caller to
  7727. // add HTTP headers to the request.
  7728. func (c *ObjectsDeleteCall) Header() http.Header {
  7729. if c.header_ == nil {
  7730. c.header_ = make(http.Header)
  7731. }
  7732. return c.header_
  7733. }
  7734. func (c *ObjectsDeleteCall) doRequest(alt string) (*http.Response, error) {
  7735. reqHeaders := make(http.Header)
  7736. for k, v := range c.header_ {
  7737. reqHeaders[k] = v
  7738. }
  7739. reqHeaders.Set("User-Agent", c.s.userAgent())
  7740. var body io.Reader = nil
  7741. c.urlParams_.Set("alt", alt)
  7742. c.urlParams_.Set("prettyPrint", "false")
  7743. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o/{object}")
  7744. urls += "?" + c.urlParams_.Encode()
  7745. req, err := http.NewRequest("DELETE", urls, body)
  7746. if err != nil {
  7747. return nil, err
  7748. }
  7749. req.Header = reqHeaders
  7750. googleapi.Expand(req.URL, map[string]string{
  7751. "bucket": c.bucket,
  7752. "object": c.object,
  7753. })
  7754. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  7755. }
  7756. // Do executes the "storage.objects.delete" call.
  7757. func (c *ObjectsDeleteCall) Do(opts ...googleapi.CallOption) error {
  7758. gensupport.SetOptions(c.urlParams_, opts...)
  7759. res, err := c.doRequest("json")
  7760. if err != nil {
  7761. return err
  7762. }
  7763. defer googleapi.CloseBody(res)
  7764. if err := googleapi.CheckResponse(res); err != nil {
  7765. return err
  7766. }
  7767. return nil
  7768. // {
  7769. // "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.",
  7770. // "httpMethod": "DELETE",
  7771. // "id": "storage.objects.delete",
  7772. // "parameterOrder": [
  7773. // "bucket",
  7774. // "object"
  7775. // ],
  7776. // "parameters": {
  7777. // "bucket": {
  7778. // "description": "Name of the bucket in which the object resides.",
  7779. // "location": "path",
  7780. // "required": true,
  7781. // "type": "string"
  7782. // },
  7783. // "generation": {
  7784. // "description": "If present, permanently deletes a specific revision of this object (as opposed to the latest version, the default).",
  7785. // "format": "int64",
  7786. // "location": "query",
  7787. // "type": "string"
  7788. // },
  7789. // "ifGenerationMatch": {
  7790. // "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.",
  7791. // "format": "int64",
  7792. // "location": "query",
  7793. // "type": "string"
  7794. // },
  7795. // "ifGenerationNotMatch": {
  7796. // "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.",
  7797. // "format": "int64",
  7798. // "location": "query",
  7799. // "type": "string"
  7800. // },
  7801. // "ifMetagenerationMatch": {
  7802. // "description": "Makes the operation conditional on whether the object's current metageneration matches the given value.",
  7803. // "format": "int64",
  7804. // "location": "query",
  7805. // "type": "string"
  7806. // },
  7807. // "ifMetagenerationNotMatch": {
  7808. // "description": "Makes the operation conditional on whether the object's current metageneration does not match the given value.",
  7809. // "format": "int64",
  7810. // "location": "query",
  7811. // "type": "string"
  7812. // },
  7813. // "object": {
  7814. // "description": "Name of the object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.",
  7815. // "location": "path",
  7816. // "required": true,
  7817. // "type": "string"
  7818. // },
  7819. // "userProject": {
  7820. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  7821. // "location": "query",
  7822. // "type": "string"
  7823. // }
  7824. // },
  7825. // "path": "b/{bucket}/o/{object}",
  7826. // "scopes": [
  7827. // "https://www.googleapis.com/auth/cloud-platform",
  7828. // "https://www.googleapis.com/auth/devstorage.full_control",
  7829. // "https://www.googleapis.com/auth/devstorage.read_write"
  7830. // ]
  7831. // }
  7832. }
  7833. // method id "storage.objects.get":
  7834. type ObjectsGetCall struct {
  7835. s *Service
  7836. bucket string
  7837. object string
  7838. urlParams_ gensupport.URLParams
  7839. ifNoneMatch_ string
  7840. ctx_ context.Context
  7841. header_ http.Header
  7842. }
  7843. // Get: Retrieves an object or its metadata.
  7844. func (r *ObjectsService) Get(bucket string, object string) *ObjectsGetCall {
  7845. c := &ObjectsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  7846. c.bucket = bucket
  7847. c.object = object
  7848. return c
  7849. }
  7850. // Generation sets the optional parameter "generation": If present,
  7851. // selects a specific revision of this object (as opposed to the latest
  7852. // version, the default).
  7853. func (c *ObjectsGetCall) Generation(generation int64) *ObjectsGetCall {
  7854. c.urlParams_.Set("generation", fmt.Sprint(generation))
  7855. return c
  7856. }
  7857. // IfGenerationMatch sets the optional parameter "ifGenerationMatch":
  7858. // Makes the operation conditional on whether the object's current
  7859. // generation matches the given value. Setting to 0 makes the operation
  7860. // succeed only if there are no live versions of the object.
  7861. func (c *ObjectsGetCall) IfGenerationMatch(ifGenerationMatch int64) *ObjectsGetCall {
  7862. c.urlParams_.Set("ifGenerationMatch", fmt.Sprint(ifGenerationMatch))
  7863. return c
  7864. }
  7865. // IfGenerationNotMatch sets the optional parameter
  7866. // "ifGenerationNotMatch": Makes the operation conditional on whether
  7867. // the object's current generation does not match the given value. If no
  7868. // live object exists, the precondition fails. Setting to 0 makes the
  7869. // operation succeed only if there is a live version of the object.
  7870. func (c *ObjectsGetCall) IfGenerationNotMatch(ifGenerationNotMatch int64) *ObjectsGetCall {
  7871. c.urlParams_.Set("ifGenerationNotMatch", fmt.Sprint(ifGenerationNotMatch))
  7872. return c
  7873. }
  7874. // IfMetagenerationMatch sets the optional parameter
  7875. // "ifMetagenerationMatch": Makes the operation conditional on whether
  7876. // the object's current metageneration matches the given value.
  7877. func (c *ObjectsGetCall) IfMetagenerationMatch(ifMetagenerationMatch int64) *ObjectsGetCall {
  7878. c.urlParams_.Set("ifMetagenerationMatch", fmt.Sprint(ifMetagenerationMatch))
  7879. return c
  7880. }
  7881. // IfMetagenerationNotMatch sets the optional parameter
  7882. // "ifMetagenerationNotMatch": Makes the operation conditional on
  7883. // whether the object's current metageneration does not match the given
  7884. // value.
  7885. func (c *ObjectsGetCall) IfMetagenerationNotMatch(ifMetagenerationNotMatch int64) *ObjectsGetCall {
  7886. c.urlParams_.Set("ifMetagenerationNotMatch", fmt.Sprint(ifMetagenerationNotMatch))
  7887. return c
  7888. }
  7889. // Projection sets the optional parameter "projection": Set of
  7890. // properties to return. Defaults to noAcl.
  7891. //
  7892. // Possible values:
  7893. // "full" - Include all properties.
  7894. // "noAcl" - Omit the owner, acl property.
  7895. func (c *ObjectsGetCall) Projection(projection string) *ObjectsGetCall {
  7896. c.urlParams_.Set("projection", projection)
  7897. return c
  7898. }
  7899. // UserProject sets the optional parameter "userProject": The project to
  7900. // be billed for this request. Required for Requester Pays buckets.
  7901. func (c *ObjectsGetCall) UserProject(userProject string) *ObjectsGetCall {
  7902. c.urlParams_.Set("userProject", userProject)
  7903. return c
  7904. }
  7905. // Fields allows partial responses to be retrieved. See
  7906. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  7907. // for more information.
  7908. func (c *ObjectsGetCall) Fields(s ...googleapi.Field) *ObjectsGetCall {
  7909. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  7910. return c
  7911. }
  7912. // IfNoneMatch sets the optional parameter which makes the operation
  7913. // fail if the object's ETag matches the given value. This is useful for
  7914. // getting updates only after the object has changed since the last
  7915. // request. Use googleapi.IsNotModified to check whether the response
  7916. // error from Do is the result of In-None-Match.
  7917. func (c *ObjectsGetCall) IfNoneMatch(entityTag string) *ObjectsGetCall {
  7918. c.ifNoneMatch_ = entityTag
  7919. return c
  7920. }
  7921. // Context sets the context to be used in this call's Do and Download
  7922. // methods. Any pending HTTP request will be aborted if the provided
  7923. // context is canceled.
  7924. func (c *ObjectsGetCall) Context(ctx context.Context) *ObjectsGetCall {
  7925. c.ctx_ = ctx
  7926. return c
  7927. }
  7928. // Header returns an http.Header that can be modified by the caller to
  7929. // add HTTP headers to the request.
  7930. func (c *ObjectsGetCall) Header() http.Header {
  7931. if c.header_ == nil {
  7932. c.header_ = make(http.Header)
  7933. }
  7934. return c.header_
  7935. }
  7936. func (c *ObjectsGetCall) doRequest(alt string) (*http.Response, error) {
  7937. reqHeaders := make(http.Header)
  7938. for k, v := range c.header_ {
  7939. reqHeaders[k] = v
  7940. }
  7941. reqHeaders.Set("User-Agent", c.s.userAgent())
  7942. if c.ifNoneMatch_ != "" {
  7943. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  7944. }
  7945. var body io.Reader = nil
  7946. c.urlParams_.Set("alt", alt)
  7947. c.urlParams_.Set("prettyPrint", "false")
  7948. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o/{object}")
  7949. urls += "?" + c.urlParams_.Encode()
  7950. req, err := http.NewRequest("GET", urls, body)
  7951. if err != nil {
  7952. return nil, err
  7953. }
  7954. req.Header = reqHeaders
  7955. googleapi.Expand(req.URL, map[string]string{
  7956. "bucket": c.bucket,
  7957. "object": c.object,
  7958. })
  7959. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  7960. }
  7961. // Download fetches the API endpoint's "media" value, instead of the normal
  7962. // API response value. If the returned error is nil, the Response is guaranteed to
  7963. // have a 2xx status code. Callers must close the Response.Body as usual.
  7964. func (c *ObjectsGetCall) Download(opts ...googleapi.CallOption) (*http.Response, error) {
  7965. gensupport.SetOptions(c.urlParams_, opts...)
  7966. res, err := c.doRequest("media")
  7967. if err != nil {
  7968. return nil, err
  7969. }
  7970. if err := googleapi.CheckMediaResponse(res); err != nil {
  7971. res.Body.Close()
  7972. return nil, err
  7973. }
  7974. return res, nil
  7975. }
  7976. // Do executes the "storage.objects.get" call.
  7977. // Exactly one of *Object or error will be non-nil. Any non-2xx status
  7978. // code is an error. Response headers are in either
  7979. // *Object.ServerResponse.Header or (if a response was returned at all)
  7980. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  7981. // check whether the returned error was because http.StatusNotModified
  7982. // was returned.
  7983. func (c *ObjectsGetCall) Do(opts ...googleapi.CallOption) (*Object, error) {
  7984. gensupport.SetOptions(c.urlParams_, opts...)
  7985. res, err := c.doRequest("json")
  7986. if res != nil && res.StatusCode == http.StatusNotModified {
  7987. if res.Body != nil {
  7988. res.Body.Close()
  7989. }
  7990. return nil, &googleapi.Error{
  7991. Code: res.StatusCode,
  7992. Header: res.Header,
  7993. }
  7994. }
  7995. if err != nil {
  7996. return nil, err
  7997. }
  7998. defer googleapi.CloseBody(res)
  7999. if err := googleapi.CheckResponse(res); err != nil {
  8000. return nil, err
  8001. }
  8002. ret := &Object{
  8003. ServerResponse: googleapi.ServerResponse{
  8004. Header: res.Header,
  8005. HTTPStatusCode: res.StatusCode,
  8006. },
  8007. }
  8008. target := &ret
  8009. if err := gensupport.DecodeResponse(target, res); err != nil {
  8010. return nil, err
  8011. }
  8012. return ret, nil
  8013. // {
  8014. // "description": "Retrieves an object or its metadata.",
  8015. // "httpMethod": "GET",
  8016. // "id": "storage.objects.get",
  8017. // "parameterOrder": [
  8018. // "bucket",
  8019. // "object"
  8020. // ],
  8021. // "parameters": {
  8022. // "bucket": {
  8023. // "description": "Name of the bucket in which the object resides.",
  8024. // "location": "path",
  8025. // "required": true,
  8026. // "type": "string"
  8027. // },
  8028. // "generation": {
  8029. // "description": "If present, selects a specific revision of this object (as opposed to the latest version, the default).",
  8030. // "format": "int64",
  8031. // "location": "query",
  8032. // "type": "string"
  8033. // },
  8034. // "ifGenerationMatch": {
  8035. // "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.",
  8036. // "format": "int64",
  8037. // "location": "query",
  8038. // "type": "string"
  8039. // },
  8040. // "ifGenerationNotMatch": {
  8041. // "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.",
  8042. // "format": "int64",
  8043. // "location": "query",
  8044. // "type": "string"
  8045. // },
  8046. // "ifMetagenerationMatch": {
  8047. // "description": "Makes the operation conditional on whether the object's current metageneration matches the given value.",
  8048. // "format": "int64",
  8049. // "location": "query",
  8050. // "type": "string"
  8051. // },
  8052. // "ifMetagenerationNotMatch": {
  8053. // "description": "Makes the operation conditional on whether the object's current metageneration does not match the given value.",
  8054. // "format": "int64",
  8055. // "location": "query",
  8056. // "type": "string"
  8057. // },
  8058. // "object": {
  8059. // "description": "Name of the object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.",
  8060. // "location": "path",
  8061. // "required": true,
  8062. // "type": "string"
  8063. // },
  8064. // "projection": {
  8065. // "description": "Set of properties to return. Defaults to noAcl.",
  8066. // "enum": [
  8067. // "full",
  8068. // "noAcl"
  8069. // ],
  8070. // "enumDescriptions": [
  8071. // "Include all properties.",
  8072. // "Omit the owner, acl property."
  8073. // ],
  8074. // "location": "query",
  8075. // "type": "string"
  8076. // },
  8077. // "userProject": {
  8078. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  8079. // "location": "query",
  8080. // "type": "string"
  8081. // }
  8082. // },
  8083. // "path": "b/{bucket}/o/{object}",
  8084. // "response": {
  8085. // "$ref": "Object"
  8086. // },
  8087. // "scopes": [
  8088. // "https://www.googleapis.com/auth/cloud-platform",
  8089. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  8090. // "https://www.googleapis.com/auth/devstorage.full_control",
  8091. // "https://www.googleapis.com/auth/devstorage.read_only",
  8092. // "https://www.googleapis.com/auth/devstorage.read_write"
  8093. // ],
  8094. // "supportsMediaDownload": true,
  8095. // "useMediaDownloadService": true
  8096. // }
  8097. }
  8098. // method id "storage.objects.getIamPolicy":
  8099. type ObjectsGetIamPolicyCall struct {
  8100. s *Service
  8101. bucket string
  8102. object string
  8103. urlParams_ gensupport.URLParams
  8104. ifNoneMatch_ string
  8105. ctx_ context.Context
  8106. header_ http.Header
  8107. }
  8108. // GetIamPolicy: Returns an IAM policy for the specified object.
  8109. func (r *ObjectsService) GetIamPolicy(bucket string, object string) *ObjectsGetIamPolicyCall {
  8110. c := &ObjectsGetIamPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  8111. c.bucket = bucket
  8112. c.object = object
  8113. return c
  8114. }
  8115. // Generation sets the optional parameter "generation": If present,
  8116. // selects a specific revision of this object (as opposed to the latest
  8117. // version, the default).
  8118. func (c *ObjectsGetIamPolicyCall) Generation(generation int64) *ObjectsGetIamPolicyCall {
  8119. c.urlParams_.Set("generation", fmt.Sprint(generation))
  8120. return c
  8121. }
  8122. // UserProject sets the optional parameter "userProject": The project to
  8123. // be billed for this request. Required for Requester Pays buckets.
  8124. func (c *ObjectsGetIamPolicyCall) UserProject(userProject string) *ObjectsGetIamPolicyCall {
  8125. c.urlParams_.Set("userProject", userProject)
  8126. return c
  8127. }
  8128. // Fields allows partial responses to be retrieved. See
  8129. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  8130. // for more information.
  8131. func (c *ObjectsGetIamPolicyCall) Fields(s ...googleapi.Field) *ObjectsGetIamPolicyCall {
  8132. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  8133. return c
  8134. }
  8135. // IfNoneMatch sets the optional parameter which makes the operation
  8136. // fail if the object's ETag matches the given value. This is useful for
  8137. // getting updates only after the object has changed since the last
  8138. // request. Use googleapi.IsNotModified to check whether the response
  8139. // error from Do is the result of In-None-Match.
  8140. func (c *ObjectsGetIamPolicyCall) IfNoneMatch(entityTag string) *ObjectsGetIamPolicyCall {
  8141. c.ifNoneMatch_ = entityTag
  8142. return c
  8143. }
  8144. // Context sets the context to be used in this call's Do method. Any
  8145. // pending HTTP request will be aborted if the provided context is
  8146. // canceled.
  8147. func (c *ObjectsGetIamPolicyCall) Context(ctx context.Context) *ObjectsGetIamPolicyCall {
  8148. c.ctx_ = ctx
  8149. return c
  8150. }
  8151. // Header returns an http.Header that can be modified by the caller to
  8152. // add HTTP headers to the request.
  8153. func (c *ObjectsGetIamPolicyCall) Header() http.Header {
  8154. if c.header_ == nil {
  8155. c.header_ = make(http.Header)
  8156. }
  8157. return c.header_
  8158. }
  8159. func (c *ObjectsGetIamPolicyCall) doRequest(alt string) (*http.Response, error) {
  8160. reqHeaders := make(http.Header)
  8161. for k, v := range c.header_ {
  8162. reqHeaders[k] = v
  8163. }
  8164. reqHeaders.Set("User-Agent", c.s.userAgent())
  8165. if c.ifNoneMatch_ != "" {
  8166. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  8167. }
  8168. var body io.Reader = nil
  8169. c.urlParams_.Set("alt", alt)
  8170. c.urlParams_.Set("prettyPrint", "false")
  8171. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o/{object}/iam")
  8172. urls += "?" + c.urlParams_.Encode()
  8173. req, err := http.NewRequest("GET", urls, body)
  8174. if err != nil {
  8175. return nil, err
  8176. }
  8177. req.Header = reqHeaders
  8178. googleapi.Expand(req.URL, map[string]string{
  8179. "bucket": c.bucket,
  8180. "object": c.object,
  8181. })
  8182. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  8183. }
  8184. // Do executes the "storage.objects.getIamPolicy" call.
  8185. // Exactly one of *Policy or error will be non-nil. Any non-2xx status
  8186. // code is an error. Response headers are in either
  8187. // *Policy.ServerResponse.Header or (if a response was returned at all)
  8188. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  8189. // check whether the returned error was because http.StatusNotModified
  8190. // was returned.
  8191. func (c *ObjectsGetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Policy, error) {
  8192. gensupport.SetOptions(c.urlParams_, opts...)
  8193. res, err := c.doRequest("json")
  8194. if res != nil && res.StatusCode == http.StatusNotModified {
  8195. if res.Body != nil {
  8196. res.Body.Close()
  8197. }
  8198. return nil, &googleapi.Error{
  8199. Code: res.StatusCode,
  8200. Header: res.Header,
  8201. }
  8202. }
  8203. if err != nil {
  8204. return nil, err
  8205. }
  8206. defer googleapi.CloseBody(res)
  8207. if err := googleapi.CheckResponse(res); err != nil {
  8208. return nil, err
  8209. }
  8210. ret := &Policy{
  8211. ServerResponse: googleapi.ServerResponse{
  8212. Header: res.Header,
  8213. HTTPStatusCode: res.StatusCode,
  8214. },
  8215. }
  8216. target := &ret
  8217. if err := gensupport.DecodeResponse(target, res); err != nil {
  8218. return nil, err
  8219. }
  8220. return ret, nil
  8221. // {
  8222. // "description": "Returns an IAM policy for the specified object.",
  8223. // "httpMethod": "GET",
  8224. // "id": "storage.objects.getIamPolicy",
  8225. // "parameterOrder": [
  8226. // "bucket",
  8227. // "object"
  8228. // ],
  8229. // "parameters": {
  8230. // "bucket": {
  8231. // "description": "Name of the bucket in which the object resides.",
  8232. // "location": "path",
  8233. // "required": true,
  8234. // "type": "string"
  8235. // },
  8236. // "generation": {
  8237. // "description": "If present, selects a specific revision of this object (as opposed to the latest version, the default).",
  8238. // "format": "int64",
  8239. // "location": "query",
  8240. // "type": "string"
  8241. // },
  8242. // "object": {
  8243. // "description": "Name of the object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.",
  8244. // "location": "path",
  8245. // "required": true,
  8246. // "type": "string"
  8247. // },
  8248. // "userProject": {
  8249. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  8250. // "location": "query",
  8251. // "type": "string"
  8252. // }
  8253. // },
  8254. // "path": "b/{bucket}/o/{object}/iam",
  8255. // "response": {
  8256. // "$ref": "Policy"
  8257. // },
  8258. // "scopes": [
  8259. // "https://www.googleapis.com/auth/cloud-platform",
  8260. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  8261. // "https://www.googleapis.com/auth/devstorage.full_control",
  8262. // "https://www.googleapis.com/auth/devstorage.read_only",
  8263. // "https://www.googleapis.com/auth/devstorage.read_write"
  8264. // ]
  8265. // }
  8266. }
  8267. // method id "storage.objects.insert":
  8268. type ObjectsInsertCall struct {
  8269. s *Service
  8270. bucket string
  8271. object *Object
  8272. urlParams_ gensupport.URLParams
  8273. mediaInfo_ *gensupport.MediaInfo
  8274. ctx_ context.Context
  8275. header_ http.Header
  8276. }
  8277. // Insert: Stores a new object and metadata.
  8278. func (r *ObjectsService) Insert(bucket string, object *Object) *ObjectsInsertCall {
  8279. c := &ObjectsInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  8280. c.bucket = bucket
  8281. c.object = object
  8282. return c
  8283. }
  8284. // ContentEncoding sets the optional parameter "contentEncoding": If
  8285. // set, sets the contentEncoding property of the final object to this
  8286. // value. Setting this parameter is equivalent to setting the
  8287. // contentEncoding metadata property. This can be useful when uploading
  8288. // an object with uploadType=media to indicate the encoding of the
  8289. // content being uploaded.
  8290. func (c *ObjectsInsertCall) ContentEncoding(contentEncoding string) *ObjectsInsertCall {
  8291. c.urlParams_.Set("contentEncoding", contentEncoding)
  8292. return c
  8293. }
  8294. // IfGenerationMatch sets the optional parameter "ifGenerationMatch":
  8295. // Makes the operation conditional on whether the object's current
  8296. // generation matches the given value. Setting to 0 makes the operation
  8297. // succeed only if there are no live versions of the object.
  8298. func (c *ObjectsInsertCall) IfGenerationMatch(ifGenerationMatch int64) *ObjectsInsertCall {
  8299. c.urlParams_.Set("ifGenerationMatch", fmt.Sprint(ifGenerationMatch))
  8300. return c
  8301. }
  8302. // IfGenerationNotMatch sets the optional parameter
  8303. // "ifGenerationNotMatch": Makes the operation conditional on whether
  8304. // the object's current generation does not match the given value. If no
  8305. // live object exists, the precondition fails. Setting to 0 makes the
  8306. // operation succeed only if there is a live version of the object.
  8307. func (c *ObjectsInsertCall) IfGenerationNotMatch(ifGenerationNotMatch int64) *ObjectsInsertCall {
  8308. c.urlParams_.Set("ifGenerationNotMatch", fmt.Sprint(ifGenerationNotMatch))
  8309. return c
  8310. }
  8311. // IfMetagenerationMatch sets the optional parameter
  8312. // "ifMetagenerationMatch": Makes the operation conditional on whether
  8313. // the object's current metageneration matches the given value.
  8314. func (c *ObjectsInsertCall) IfMetagenerationMatch(ifMetagenerationMatch int64) *ObjectsInsertCall {
  8315. c.urlParams_.Set("ifMetagenerationMatch", fmt.Sprint(ifMetagenerationMatch))
  8316. return c
  8317. }
  8318. // IfMetagenerationNotMatch sets the optional parameter
  8319. // "ifMetagenerationNotMatch": Makes the operation conditional on
  8320. // whether the object's current metageneration does not match the given
  8321. // value.
  8322. func (c *ObjectsInsertCall) IfMetagenerationNotMatch(ifMetagenerationNotMatch int64) *ObjectsInsertCall {
  8323. c.urlParams_.Set("ifMetagenerationNotMatch", fmt.Sprint(ifMetagenerationNotMatch))
  8324. return c
  8325. }
  8326. // KmsKeyName sets the optional parameter "kmsKeyName": Resource name of
  8327. // the Cloud KMS key, of the form
  8328. // projects/my-project/locations/global/keyRings/my-kr/cryptoKeys/my-key,
  8329. // that will be used to encrypt the object. Overrides the object
  8330. // metadata's kms_key_name value, if any.
  8331. func (c *ObjectsInsertCall) KmsKeyName(kmsKeyName string) *ObjectsInsertCall {
  8332. c.urlParams_.Set("kmsKeyName", kmsKeyName)
  8333. return c
  8334. }
  8335. // Name sets the optional parameter "name": Name of the object. Required
  8336. // when the object metadata is not otherwise provided. Overrides the
  8337. // object metadata's name value, if any. For information about how to
  8338. // URL encode object names to be path safe, see Encoding URI Path Parts.
  8339. func (c *ObjectsInsertCall) Name(name string) *ObjectsInsertCall {
  8340. c.urlParams_.Set("name", name)
  8341. return c
  8342. }
  8343. // PredefinedAcl sets the optional parameter "predefinedAcl": Apply a
  8344. // predefined set of access controls to this object.
  8345. //
  8346. // Possible values:
  8347. // "authenticatedRead" - Object owner gets OWNER access, and
  8348. // allAuthenticatedUsers get READER access.
  8349. // "bucketOwnerFullControl" - Object owner gets OWNER access, and
  8350. // project team owners get OWNER access.
  8351. // "bucketOwnerRead" - Object owner gets OWNER access, and project
  8352. // team owners get READER access.
  8353. // "private" - Object owner gets OWNER access.
  8354. // "projectPrivate" - Object owner gets OWNER access, and project team
  8355. // members get access according to their roles.
  8356. // "publicRead" - Object owner gets OWNER access, and allUsers get
  8357. // READER access.
  8358. func (c *ObjectsInsertCall) PredefinedAcl(predefinedAcl string) *ObjectsInsertCall {
  8359. c.urlParams_.Set("predefinedAcl", predefinedAcl)
  8360. return c
  8361. }
  8362. // Projection sets the optional parameter "projection": Set of
  8363. // properties to return. Defaults to noAcl, unless the object resource
  8364. // specifies the acl property, when it defaults to full.
  8365. //
  8366. // Possible values:
  8367. // "full" - Include all properties.
  8368. // "noAcl" - Omit the owner, acl property.
  8369. func (c *ObjectsInsertCall) Projection(projection string) *ObjectsInsertCall {
  8370. c.urlParams_.Set("projection", projection)
  8371. return c
  8372. }
  8373. // UserProject sets the optional parameter "userProject": The project to
  8374. // be billed for this request. Required for Requester Pays buckets.
  8375. func (c *ObjectsInsertCall) UserProject(userProject string) *ObjectsInsertCall {
  8376. c.urlParams_.Set("userProject", userProject)
  8377. return c
  8378. }
  8379. // Media specifies the media to upload in one or more chunks. The chunk
  8380. // size may be controlled by supplying a MediaOption generated by
  8381. // googleapi.ChunkSize. The chunk size defaults to
  8382. // googleapi.DefaultUploadChunkSize.The Content-Type header used in the
  8383. // upload request will be determined by sniffing the contents of r,
  8384. // unless a MediaOption generated by googleapi.ContentType is
  8385. // supplied.
  8386. // At most one of Media and ResumableMedia may be set.
  8387. func (c *ObjectsInsertCall) Media(r io.Reader, options ...googleapi.MediaOption) *ObjectsInsertCall {
  8388. if ct := c.object.ContentType; ct != "" {
  8389. options = append([]googleapi.MediaOption{googleapi.ContentType(ct)}, options...)
  8390. }
  8391. c.mediaInfo_ = gensupport.NewInfoFromMedia(r, options)
  8392. return c
  8393. }
  8394. // ResumableMedia specifies the media to upload in chunks and can be
  8395. // canceled with ctx.
  8396. //
  8397. // Deprecated: use Media instead.
  8398. //
  8399. // At most one of Media and ResumableMedia may be set. mediaType
  8400. // identifies the MIME media type of the upload, such as "image/png". If
  8401. // mediaType is "", it will be auto-detected. The provided ctx will
  8402. // supersede any context previously provided to the Context method.
  8403. func (c *ObjectsInsertCall) ResumableMedia(ctx context.Context, r io.ReaderAt, size int64, mediaType string) *ObjectsInsertCall {
  8404. c.ctx_ = ctx
  8405. c.mediaInfo_ = gensupport.NewInfoFromResumableMedia(r, size, mediaType)
  8406. return c
  8407. }
  8408. // ProgressUpdater provides a callback function that will be called
  8409. // after every chunk. It should be a low-latency function in order to
  8410. // not slow down the upload operation. This should only be called when
  8411. // using ResumableMedia (as opposed to Media).
  8412. func (c *ObjectsInsertCall) ProgressUpdater(pu googleapi.ProgressUpdater) *ObjectsInsertCall {
  8413. c.mediaInfo_.SetProgressUpdater(pu)
  8414. return c
  8415. }
  8416. // Fields allows partial responses to be retrieved. See
  8417. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  8418. // for more information.
  8419. func (c *ObjectsInsertCall) Fields(s ...googleapi.Field) *ObjectsInsertCall {
  8420. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  8421. return c
  8422. }
  8423. // Context sets the context to be used in this call's Do method. Any
  8424. // pending HTTP request will be aborted if the provided context is
  8425. // canceled.
  8426. // This context will supersede any context previously provided to the
  8427. // ResumableMedia method.
  8428. func (c *ObjectsInsertCall) Context(ctx context.Context) *ObjectsInsertCall {
  8429. c.ctx_ = ctx
  8430. return c
  8431. }
  8432. // Header returns an http.Header that can be modified by the caller to
  8433. // add HTTP headers to the request.
  8434. func (c *ObjectsInsertCall) Header() http.Header {
  8435. if c.header_ == nil {
  8436. c.header_ = make(http.Header)
  8437. }
  8438. return c.header_
  8439. }
  8440. func (c *ObjectsInsertCall) doRequest(alt string) (*http.Response, error) {
  8441. reqHeaders := make(http.Header)
  8442. for k, v := range c.header_ {
  8443. reqHeaders[k] = v
  8444. }
  8445. reqHeaders.Set("User-Agent", c.s.userAgent())
  8446. var body io.Reader = nil
  8447. body, err := googleapi.WithoutDataWrapper.JSONReader(c.object)
  8448. if err != nil {
  8449. return nil, err
  8450. }
  8451. reqHeaders.Set("Content-Type", "application/json")
  8452. c.urlParams_.Set("alt", alt)
  8453. c.urlParams_.Set("prettyPrint", "false")
  8454. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o")
  8455. if c.mediaInfo_ != nil {
  8456. urls = strings.Replace(urls, "https://www.googleapis.com/", "https://www.googleapis.com/upload/", 1)
  8457. c.urlParams_.Set("uploadType", c.mediaInfo_.UploadType())
  8458. }
  8459. if body == nil {
  8460. body = new(bytes.Buffer)
  8461. reqHeaders.Set("Content-Type", "application/json")
  8462. }
  8463. body, getBody, cleanup := c.mediaInfo_.UploadRequest(reqHeaders, body)
  8464. defer cleanup()
  8465. urls += "?" + c.urlParams_.Encode()
  8466. req, err := http.NewRequest("POST", urls, body)
  8467. if err != nil {
  8468. return nil, err
  8469. }
  8470. req.Header = reqHeaders
  8471. req.GetBody = getBody
  8472. googleapi.Expand(req.URL, map[string]string{
  8473. "bucket": c.bucket,
  8474. })
  8475. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  8476. }
  8477. // Do executes the "storage.objects.insert" call.
  8478. // Exactly one of *Object or error will be non-nil. Any non-2xx status
  8479. // code is an error. Response headers are in either
  8480. // *Object.ServerResponse.Header or (if a response was returned at all)
  8481. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  8482. // check whether the returned error was because http.StatusNotModified
  8483. // was returned.
  8484. func (c *ObjectsInsertCall) Do(opts ...googleapi.CallOption) (*Object, error) {
  8485. gensupport.SetOptions(c.urlParams_, opts...)
  8486. res, err := c.doRequest("json")
  8487. if res != nil && res.StatusCode == http.StatusNotModified {
  8488. if res.Body != nil {
  8489. res.Body.Close()
  8490. }
  8491. return nil, &googleapi.Error{
  8492. Code: res.StatusCode,
  8493. Header: res.Header,
  8494. }
  8495. }
  8496. if err != nil {
  8497. return nil, err
  8498. }
  8499. defer googleapi.CloseBody(res)
  8500. if err := googleapi.CheckResponse(res); err != nil {
  8501. return nil, err
  8502. }
  8503. rx := c.mediaInfo_.ResumableUpload(res.Header.Get("Location"))
  8504. if rx != nil {
  8505. rx.Client = c.s.client
  8506. rx.UserAgent = c.s.userAgent()
  8507. ctx := c.ctx_
  8508. if ctx == nil {
  8509. ctx = context.TODO()
  8510. }
  8511. res, err = rx.Upload(ctx)
  8512. if err != nil {
  8513. return nil, err
  8514. }
  8515. defer res.Body.Close()
  8516. if err := googleapi.CheckResponse(res); err != nil {
  8517. return nil, err
  8518. }
  8519. }
  8520. ret := &Object{
  8521. ServerResponse: googleapi.ServerResponse{
  8522. Header: res.Header,
  8523. HTTPStatusCode: res.StatusCode,
  8524. },
  8525. }
  8526. target := &ret
  8527. if err := gensupport.DecodeResponse(target, res); err != nil {
  8528. return nil, err
  8529. }
  8530. return ret, nil
  8531. // {
  8532. // "description": "Stores a new object and metadata.",
  8533. // "httpMethod": "POST",
  8534. // "id": "storage.objects.insert",
  8535. // "mediaUpload": {
  8536. // "accept": [
  8537. // "*/*"
  8538. // ],
  8539. // "protocols": {
  8540. // "resumable": {
  8541. // "multipart": true,
  8542. // "path": "/resumable/upload/storage/v1/b/{bucket}/o"
  8543. // },
  8544. // "simple": {
  8545. // "multipart": true,
  8546. // "path": "/upload/storage/v1/b/{bucket}/o"
  8547. // }
  8548. // }
  8549. // },
  8550. // "parameterOrder": [
  8551. // "bucket"
  8552. // ],
  8553. // "parameters": {
  8554. // "bucket": {
  8555. // "description": "Name of the bucket in which to store the new object. Overrides the provided object metadata's bucket value, if any.",
  8556. // "location": "path",
  8557. // "required": true,
  8558. // "type": "string"
  8559. // },
  8560. // "contentEncoding": {
  8561. // "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.",
  8562. // "location": "query",
  8563. // "type": "string"
  8564. // },
  8565. // "ifGenerationMatch": {
  8566. // "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.",
  8567. // "format": "int64",
  8568. // "location": "query",
  8569. // "type": "string"
  8570. // },
  8571. // "ifGenerationNotMatch": {
  8572. // "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.",
  8573. // "format": "int64",
  8574. // "location": "query",
  8575. // "type": "string"
  8576. // },
  8577. // "ifMetagenerationMatch": {
  8578. // "description": "Makes the operation conditional on whether the object's current metageneration matches the given value.",
  8579. // "format": "int64",
  8580. // "location": "query",
  8581. // "type": "string"
  8582. // },
  8583. // "ifMetagenerationNotMatch": {
  8584. // "description": "Makes the operation conditional on whether the object's current metageneration does not match the given value.",
  8585. // "format": "int64",
  8586. // "location": "query",
  8587. // "type": "string"
  8588. // },
  8589. // "kmsKeyName": {
  8590. // "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.",
  8591. // "location": "query",
  8592. // "type": "string"
  8593. // },
  8594. // "name": {
  8595. // "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.",
  8596. // "location": "query",
  8597. // "type": "string"
  8598. // },
  8599. // "predefinedAcl": {
  8600. // "description": "Apply a predefined set of access controls to this object.",
  8601. // "enum": [
  8602. // "authenticatedRead",
  8603. // "bucketOwnerFullControl",
  8604. // "bucketOwnerRead",
  8605. // "private",
  8606. // "projectPrivate",
  8607. // "publicRead"
  8608. // ],
  8609. // "enumDescriptions": [
  8610. // "Object owner gets OWNER access, and allAuthenticatedUsers get READER access.",
  8611. // "Object owner gets OWNER access, and project team owners get OWNER access.",
  8612. // "Object owner gets OWNER access, and project team owners get READER access.",
  8613. // "Object owner gets OWNER access.",
  8614. // "Object owner gets OWNER access, and project team members get access according to their roles.",
  8615. // "Object owner gets OWNER access, and allUsers get READER access."
  8616. // ],
  8617. // "location": "query",
  8618. // "type": "string"
  8619. // },
  8620. // "projection": {
  8621. // "description": "Set of properties to return. Defaults to noAcl, unless the object resource specifies the acl property, when it defaults to full.",
  8622. // "enum": [
  8623. // "full",
  8624. // "noAcl"
  8625. // ],
  8626. // "enumDescriptions": [
  8627. // "Include all properties.",
  8628. // "Omit the owner, acl property."
  8629. // ],
  8630. // "location": "query",
  8631. // "type": "string"
  8632. // },
  8633. // "userProject": {
  8634. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  8635. // "location": "query",
  8636. // "type": "string"
  8637. // }
  8638. // },
  8639. // "path": "b/{bucket}/o",
  8640. // "request": {
  8641. // "$ref": "Object"
  8642. // },
  8643. // "response": {
  8644. // "$ref": "Object"
  8645. // },
  8646. // "scopes": [
  8647. // "https://www.googleapis.com/auth/cloud-platform",
  8648. // "https://www.googleapis.com/auth/devstorage.full_control",
  8649. // "https://www.googleapis.com/auth/devstorage.read_write"
  8650. // ],
  8651. // "supportsMediaUpload": true
  8652. // }
  8653. }
  8654. // method id "storage.objects.list":
  8655. type ObjectsListCall struct {
  8656. s *Service
  8657. bucket string
  8658. urlParams_ gensupport.URLParams
  8659. ifNoneMatch_ string
  8660. ctx_ context.Context
  8661. header_ http.Header
  8662. }
  8663. // List: Retrieves a list of objects matching the criteria.
  8664. func (r *ObjectsService) List(bucket string) *ObjectsListCall {
  8665. c := &ObjectsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  8666. c.bucket = bucket
  8667. return c
  8668. }
  8669. // Delimiter sets the optional parameter "delimiter": Returns results in
  8670. // a directory-like mode. items will contain only objects whose names,
  8671. // aside from the prefix, do not contain delimiter. Objects whose names,
  8672. // aside from the prefix, contain delimiter will have their name,
  8673. // truncated after the delimiter, returned in prefixes. Duplicate
  8674. // prefixes are omitted.
  8675. func (c *ObjectsListCall) Delimiter(delimiter string) *ObjectsListCall {
  8676. c.urlParams_.Set("delimiter", delimiter)
  8677. return c
  8678. }
  8679. // IncludeTrailingDelimiter sets the optional parameter
  8680. // "includeTrailingDelimiter": If true, objects that end in exactly one
  8681. // instance of delimiter will have their metadata included in items in
  8682. // addition to prefixes.
  8683. func (c *ObjectsListCall) IncludeTrailingDelimiter(includeTrailingDelimiter bool) *ObjectsListCall {
  8684. c.urlParams_.Set("includeTrailingDelimiter", fmt.Sprint(includeTrailingDelimiter))
  8685. return c
  8686. }
  8687. // MaxResults sets the optional parameter "maxResults": Maximum number
  8688. // of items plus prefixes to return in a single page of responses. As
  8689. // duplicate prefixes are omitted, fewer total results may be returned
  8690. // than requested. The service will use this parameter or 1,000 items,
  8691. // whichever is smaller.
  8692. func (c *ObjectsListCall) MaxResults(maxResults int64) *ObjectsListCall {
  8693. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  8694. return c
  8695. }
  8696. // PageToken sets the optional parameter "pageToken": A
  8697. // previously-returned page token representing part of the larger set of
  8698. // results to view.
  8699. func (c *ObjectsListCall) PageToken(pageToken string) *ObjectsListCall {
  8700. c.urlParams_.Set("pageToken", pageToken)
  8701. return c
  8702. }
  8703. // Prefix sets the optional parameter "prefix": Filter results to
  8704. // objects whose names begin with this prefix.
  8705. func (c *ObjectsListCall) Prefix(prefix string) *ObjectsListCall {
  8706. c.urlParams_.Set("prefix", prefix)
  8707. return c
  8708. }
  8709. // Projection sets the optional parameter "projection": Set of
  8710. // properties to return. Defaults to noAcl.
  8711. //
  8712. // Possible values:
  8713. // "full" - Include all properties.
  8714. // "noAcl" - Omit the owner, acl property.
  8715. func (c *ObjectsListCall) Projection(projection string) *ObjectsListCall {
  8716. c.urlParams_.Set("projection", projection)
  8717. return c
  8718. }
  8719. // UserProject sets the optional parameter "userProject": The project to
  8720. // be billed for this request. Required for Requester Pays buckets.
  8721. func (c *ObjectsListCall) UserProject(userProject string) *ObjectsListCall {
  8722. c.urlParams_.Set("userProject", userProject)
  8723. return c
  8724. }
  8725. // Versions sets the optional parameter "versions": If true, lists all
  8726. // versions of an object as distinct results. The default is false. For
  8727. // more information, see Object Versioning.
  8728. func (c *ObjectsListCall) Versions(versions bool) *ObjectsListCall {
  8729. c.urlParams_.Set("versions", fmt.Sprint(versions))
  8730. return c
  8731. }
  8732. // Fields allows partial responses to be retrieved. See
  8733. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  8734. // for more information.
  8735. func (c *ObjectsListCall) Fields(s ...googleapi.Field) *ObjectsListCall {
  8736. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  8737. return c
  8738. }
  8739. // IfNoneMatch sets the optional parameter which makes the operation
  8740. // fail if the object's ETag matches the given value. This is useful for
  8741. // getting updates only after the object has changed since the last
  8742. // request. Use googleapi.IsNotModified to check whether the response
  8743. // error from Do is the result of In-None-Match.
  8744. func (c *ObjectsListCall) IfNoneMatch(entityTag string) *ObjectsListCall {
  8745. c.ifNoneMatch_ = entityTag
  8746. return c
  8747. }
  8748. // Context sets the context to be used in this call's Do method. Any
  8749. // pending HTTP request will be aborted if the provided context is
  8750. // canceled.
  8751. func (c *ObjectsListCall) Context(ctx context.Context) *ObjectsListCall {
  8752. c.ctx_ = ctx
  8753. return c
  8754. }
  8755. // Header returns an http.Header that can be modified by the caller to
  8756. // add HTTP headers to the request.
  8757. func (c *ObjectsListCall) Header() http.Header {
  8758. if c.header_ == nil {
  8759. c.header_ = make(http.Header)
  8760. }
  8761. return c.header_
  8762. }
  8763. func (c *ObjectsListCall) doRequest(alt string) (*http.Response, error) {
  8764. reqHeaders := make(http.Header)
  8765. for k, v := range c.header_ {
  8766. reqHeaders[k] = v
  8767. }
  8768. reqHeaders.Set("User-Agent", c.s.userAgent())
  8769. if c.ifNoneMatch_ != "" {
  8770. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  8771. }
  8772. var body io.Reader = nil
  8773. c.urlParams_.Set("alt", alt)
  8774. c.urlParams_.Set("prettyPrint", "false")
  8775. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o")
  8776. urls += "?" + c.urlParams_.Encode()
  8777. req, err := http.NewRequest("GET", urls, body)
  8778. if err != nil {
  8779. return nil, err
  8780. }
  8781. req.Header = reqHeaders
  8782. googleapi.Expand(req.URL, map[string]string{
  8783. "bucket": c.bucket,
  8784. })
  8785. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  8786. }
  8787. // Do executes the "storage.objects.list" call.
  8788. // Exactly one of *Objects or error will be non-nil. Any non-2xx status
  8789. // code is an error. Response headers are in either
  8790. // *Objects.ServerResponse.Header or (if a response was returned at all)
  8791. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  8792. // check whether the returned error was because http.StatusNotModified
  8793. // was returned.
  8794. func (c *ObjectsListCall) Do(opts ...googleapi.CallOption) (*Objects, error) {
  8795. gensupport.SetOptions(c.urlParams_, opts...)
  8796. res, err := c.doRequest("json")
  8797. if res != nil && res.StatusCode == http.StatusNotModified {
  8798. if res.Body != nil {
  8799. res.Body.Close()
  8800. }
  8801. return nil, &googleapi.Error{
  8802. Code: res.StatusCode,
  8803. Header: res.Header,
  8804. }
  8805. }
  8806. if err != nil {
  8807. return nil, err
  8808. }
  8809. defer googleapi.CloseBody(res)
  8810. if err := googleapi.CheckResponse(res); err != nil {
  8811. return nil, err
  8812. }
  8813. ret := &Objects{
  8814. ServerResponse: googleapi.ServerResponse{
  8815. Header: res.Header,
  8816. HTTPStatusCode: res.StatusCode,
  8817. },
  8818. }
  8819. target := &ret
  8820. if err := gensupport.DecodeResponse(target, res); err != nil {
  8821. return nil, err
  8822. }
  8823. return ret, nil
  8824. // {
  8825. // "description": "Retrieves a list of objects matching the criteria.",
  8826. // "httpMethod": "GET",
  8827. // "id": "storage.objects.list",
  8828. // "parameterOrder": [
  8829. // "bucket"
  8830. // ],
  8831. // "parameters": {
  8832. // "bucket": {
  8833. // "description": "Name of the bucket in which to look for objects.",
  8834. // "location": "path",
  8835. // "required": true,
  8836. // "type": "string"
  8837. // },
  8838. // "delimiter": {
  8839. // "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.",
  8840. // "location": "query",
  8841. // "type": "string"
  8842. // },
  8843. // "includeTrailingDelimiter": {
  8844. // "description": "If true, objects that end in exactly one instance of delimiter will have their metadata included in items in addition to prefixes.",
  8845. // "location": "query",
  8846. // "type": "boolean"
  8847. // },
  8848. // "maxResults": {
  8849. // "default": "1000",
  8850. // "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.",
  8851. // "format": "uint32",
  8852. // "location": "query",
  8853. // "minimum": "0",
  8854. // "type": "integer"
  8855. // },
  8856. // "pageToken": {
  8857. // "description": "A previously-returned page token representing part of the larger set of results to view.",
  8858. // "location": "query",
  8859. // "type": "string"
  8860. // },
  8861. // "prefix": {
  8862. // "description": "Filter results to objects whose names begin with this prefix.",
  8863. // "location": "query",
  8864. // "type": "string"
  8865. // },
  8866. // "projection": {
  8867. // "description": "Set of properties to return. Defaults to noAcl.",
  8868. // "enum": [
  8869. // "full",
  8870. // "noAcl"
  8871. // ],
  8872. // "enumDescriptions": [
  8873. // "Include all properties.",
  8874. // "Omit the owner, acl property."
  8875. // ],
  8876. // "location": "query",
  8877. // "type": "string"
  8878. // },
  8879. // "userProject": {
  8880. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  8881. // "location": "query",
  8882. // "type": "string"
  8883. // },
  8884. // "versions": {
  8885. // "description": "If true, lists all versions of an object as distinct results. The default is false. For more information, see Object Versioning.",
  8886. // "location": "query",
  8887. // "type": "boolean"
  8888. // }
  8889. // },
  8890. // "path": "b/{bucket}/o",
  8891. // "response": {
  8892. // "$ref": "Objects"
  8893. // },
  8894. // "scopes": [
  8895. // "https://www.googleapis.com/auth/cloud-platform",
  8896. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  8897. // "https://www.googleapis.com/auth/devstorage.full_control",
  8898. // "https://www.googleapis.com/auth/devstorage.read_only",
  8899. // "https://www.googleapis.com/auth/devstorage.read_write"
  8900. // ],
  8901. // "supportsSubscription": true
  8902. // }
  8903. }
  8904. // Pages invokes f for each page of results.
  8905. // A non-nil error returned from f will halt the iteration.
  8906. // The provided context supersedes any context provided to the Context method.
  8907. func (c *ObjectsListCall) Pages(ctx context.Context, f func(*Objects) error) error {
  8908. c.ctx_ = ctx
  8909. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  8910. for {
  8911. x, err := c.Do()
  8912. if err != nil {
  8913. return err
  8914. }
  8915. if err := f(x); err != nil {
  8916. return err
  8917. }
  8918. if x.NextPageToken == "" {
  8919. return nil
  8920. }
  8921. c.PageToken(x.NextPageToken)
  8922. }
  8923. }
  8924. // method id "storage.objects.patch":
  8925. type ObjectsPatchCall struct {
  8926. s *Service
  8927. bucket string
  8928. object string
  8929. object2 *Object
  8930. urlParams_ gensupport.URLParams
  8931. ctx_ context.Context
  8932. header_ http.Header
  8933. }
  8934. // Patch: Patches an object's metadata.
  8935. func (r *ObjectsService) Patch(bucket string, object string, object2 *Object) *ObjectsPatchCall {
  8936. c := &ObjectsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  8937. c.bucket = bucket
  8938. c.object = object
  8939. c.object2 = object2
  8940. return c
  8941. }
  8942. // Generation sets the optional parameter "generation": If present,
  8943. // selects a specific revision of this object (as opposed to the latest
  8944. // version, the default).
  8945. func (c *ObjectsPatchCall) Generation(generation int64) *ObjectsPatchCall {
  8946. c.urlParams_.Set("generation", fmt.Sprint(generation))
  8947. return c
  8948. }
  8949. // IfGenerationMatch sets the optional parameter "ifGenerationMatch":
  8950. // Makes the operation conditional on whether the object's current
  8951. // generation matches the given value. Setting to 0 makes the operation
  8952. // succeed only if there are no live versions of the object.
  8953. func (c *ObjectsPatchCall) IfGenerationMatch(ifGenerationMatch int64) *ObjectsPatchCall {
  8954. c.urlParams_.Set("ifGenerationMatch", fmt.Sprint(ifGenerationMatch))
  8955. return c
  8956. }
  8957. // IfGenerationNotMatch sets the optional parameter
  8958. // "ifGenerationNotMatch": Makes the operation conditional on whether
  8959. // the object's current generation does not match the given value. If no
  8960. // live object exists, the precondition fails. Setting to 0 makes the
  8961. // operation succeed only if there is a live version of the object.
  8962. func (c *ObjectsPatchCall) IfGenerationNotMatch(ifGenerationNotMatch int64) *ObjectsPatchCall {
  8963. c.urlParams_.Set("ifGenerationNotMatch", fmt.Sprint(ifGenerationNotMatch))
  8964. return c
  8965. }
  8966. // IfMetagenerationMatch sets the optional parameter
  8967. // "ifMetagenerationMatch": Makes the operation conditional on whether
  8968. // the object's current metageneration matches the given value.
  8969. func (c *ObjectsPatchCall) IfMetagenerationMatch(ifMetagenerationMatch int64) *ObjectsPatchCall {
  8970. c.urlParams_.Set("ifMetagenerationMatch", fmt.Sprint(ifMetagenerationMatch))
  8971. return c
  8972. }
  8973. // IfMetagenerationNotMatch sets the optional parameter
  8974. // "ifMetagenerationNotMatch": Makes the operation conditional on
  8975. // whether the object's current metageneration does not match the given
  8976. // value.
  8977. func (c *ObjectsPatchCall) IfMetagenerationNotMatch(ifMetagenerationNotMatch int64) *ObjectsPatchCall {
  8978. c.urlParams_.Set("ifMetagenerationNotMatch", fmt.Sprint(ifMetagenerationNotMatch))
  8979. return c
  8980. }
  8981. // PredefinedAcl sets the optional parameter "predefinedAcl": Apply a
  8982. // predefined set of access controls to this object.
  8983. //
  8984. // Possible values:
  8985. // "authenticatedRead" - Object owner gets OWNER access, and
  8986. // allAuthenticatedUsers get READER access.
  8987. // "bucketOwnerFullControl" - Object owner gets OWNER access, and
  8988. // project team owners get OWNER access.
  8989. // "bucketOwnerRead" - Object owner gets OWNER access, and project
  8990. // team owners get READER access.
  8991. // "private" - Object owner gets OWNER access.
  8992. // "projectPrivate" - Object owner gets OWNER access, and project team
  8993. // members get access according to their roles.
  8994. // "publicRead" - Object owner gets OWNER access, and allUsers get
  8995. // READER access.
  8996. func (c *ObjectsPatchCall) PredefinedAcl(predefinedAcl string) *ObjectsPatchCall {
  8997. c.urlParams_.Set("predefinedAcl", predefinedAcl)
  8998. return c
  8999. }
  9000. // Projection sets the optional parameter "projection": Set of
  9001. // properties to return. Defaults to full.
  9002. //
  9003. // Possible values:
  9004. // "full" - Include all properties.
  9005. // "noAcl" - Omit the owner, acl property.
  9006. func (c *ObjectsPatchCall) Projection(projection string) *ObjectsPatchCall {
  9007. c.urlParams_.Set("projection", projection)
  9008. return c
  9009. }
  9010. // UserProject sets the optional parameter "userProject": The project to
  9011. // be billed for this request, for Requester Pays buckets.
  9012. func (c *ObjectsPatchCall) UserProject(userProject string) *ObjectsPatchCall {
  9013. c.urlParams_.Set("userProject", userProject)
  9014. return c
  9015. }
  9016. // Fields allows partial responses to be retrieved. See
  9017. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  9018. // for more information.
  9019. func (c *ObjectsPatchCall) Fields(s ...googleapi.Field) *ObjectsPatchCall {
  9020. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  9021. return c
  9022. }
  9023. // Context sets the context to be used in this call's Do method. Any
  9024. // pending HTTP request will be aborted if the provided context is
  9025. // canceled.
  9026. func (c *ObjectsPatchCall) Context(ctx context.Context) *ObjectsPatchCall {
  9027. c.ctx_ = ctx
  9028. return c
  9029. }
  9030. // Header returns an http.Header that can be modified by the caller to
  9031. // add HTTP headers to the request.
  9032. func (c *ObjectsPatchCall) Header() http.Header {
  9033. if c.header_ == nil {
  9034. c.header_ = make(http.Header)
  9035. }
  9036. return c.header_
  9037. }
  9038. func (c *ObjectsPatchCall) doRequest(alt string) (*http.Response, error) {
  9039. reqHeaders := make(http.Header)
  9040. for k, v := range c.header_ {
  9041. reqHeaders[k] = v
  9042. }
  9043. reqHeaders.Set("User-Agent", c.s.userAgent())
  9044. var body io.Reader = nil
  9045. body, err := googleapi.WithoutDataWrapper.JSONReader(c.object2)
  9046. if err != nil {
  9047. return nil, err
  9048. }
  9049. reqHeaders.Set("Content-Type", "application/json")
  9050. c.urlParams_.Set("alt", alt)
  9051. c.urlParams_.Set("prettyPrint", "false")
  9052. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o/{object}")
  9053. urls += "?" + c.urlParams_.Encode()
  9054. req, err := http.NewRequest("PATCH", urls, body)
  9055. if err != nil {
  9056. return nil, err
  9057. }
  9058. req.Header = reqHeaders
  9059. googleapi.Expand(req.URL, map[string]string{
  9060. "bucket": c.bucket,
  9061. "object": c.object,
  9062. })
  9063. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  9064. }
  9065. // Do executes the "storage.objects.patch" call.
  9066. // Exactly one of *Object or error will be non-nil. Any non-2xx status
  9067. // code is an error. Response headers are in either
  9068. // *Object.ServerResponse.Header or (if a response was returned at all)
  9069. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  9070. // check whether the returned error was because http.StatusNotModified
  9071. // was returned.
  9072. func (c *ObjectsPatchCall) Do(opts ...googleapi.CallOption) (*Object, error) {
  9073. gensupport.SetOptions(c.urlParams_, opts...)
  9074. res, err := c.doRequest("json")
  9075. if res != nil && res.StatusCode == http.StatusNotModified {
  9076. if res.Body != nil {
  9077. res.Body.Close()
  9078. }
  9079. return nil, &googleapi.Error{
  9080. Code: res.StatusCode,
  9081. Header: res.Header,
  9082. }
  9083. }
  9084. if err != nil {
  9085. return nil, err
  9086. }
  9087. defer googleapi.CloseBody(res)
  9088. if err := googleapi.CheckResponse(res); err != nil {
  9089. return nil, err
  9090. }
  9091. ret := &Object{
  9092. ServerResponse: googleapi.ServerResponse{
  9093. Header: res.Header,
  9094. HTTPStatusCode: res.StatusCode,
  9095. },
  9096. }
  9097. target := &ret
  9098. if err := gensupport.DecodeResponse(target, res); err != nil {
  9099. return nil, err
  9100. }
  9101. return ret, nil
  9102. // {
  9103. // "description": "Patches an object's metadata.",
  9104. // "httpMethod": "PATCH",
  9105. // "id": "storage.objects.patch",
  9106. // "parameterOrder": [
  9107. // "bucket",
  9108. // "object"
  9109. // ],
  9110. // "parameters": {
  9111. // "bucket": {
  9112. // "description": "Name of the bucket in which the object resides.",
  9113. // "location": "path",
  9114. // "required": true,
  9115. // "type": "string"
  9116. // },
  9117. // "generation": {
  9118. // "description": "If present, selects a specific revision of this object (as opposed to the latest version, the default).",
  9119. // "format": "int64",
  9120. // "location": "query",
  9121. // "type": "string"
  9122. // },
  9123. // "ifGenerationMatch": {
  9124. // "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.",
  9125. // "format": "int64",
  9126. // "location": "query",
  9127. // "type": "string"
  9128. // },
  9129. // "ifGenerationNotMatch": {
  9130. // "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.",
  9131. // "format": "int64",
  9132. // "location": "query",
  9133. // "type": "string"
  9134. // },
  9135. // "ifMetagenerationMatch": {
  9136. // "description": "Makes the operation conditional on whether the object's current metageneration matches the given value.",
  9137. // "format": "int64",
  9138. // "location": "query",
  9139. // "type": "string"
  9140. // },
  9141. // "ifMetagenerationNotMatch": {
  9142. // "description": "Makes the operation conditional on whether the object's current metageneration does not match the given value.",
  9143. // "format": "int64",
  9144. // "location": "query",
  9145. // "type": "string"
  9146. // },
  9147. // "object": {
  9148. // "description": "Name of the object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.",
  9149. // "location": "path",
  9150. // "required": true,
  9151. // "type": "string"
  9152. // },
  9153. // "predefinedAcl": {
  9154. // "description": "Apply a predefined set of access controls to this object.",
  9155. // "enum": [
  9156. // "authenticatedRead",
  9157. // "bucketOwnerFullControl",
  9158. // "bucketOwnerRead",
  9159. // "private",
  9160. // "projectPrivate",
  9161. // "publicRead"
  9162. // ],
  9163. // "enumDescriptions": [
  9164. // "Object owner gets OWNER access, and allAuthenticatedUsers get READER access.",
  9165. // "Object owner gets OWNER access, and project team owners get OWNER access.",
  9166. // "Object owner gets OWNER access, and project team owners get READER access.",
  9167. // "Object owner gets OWNER access.",
  9168. // "Object owner gets OWNER access, and project team members get access according to their roles.",
  9169. // "Object owner gets OWNER access, and allUsers get READER access."
  9170. // ],
  9171. // "location": "query",
  9172. // "type": "string"
  9173. // },
  9174. // "projection": {
  9175. // "description": "Set of properties to return. Defaults to full.",
  9176. // "enum": [
  9177. // "full",
  9178. // "noAcl"
  9179. // ],
  9180. // "enumDescriptions": [
  9181. // "Include all properties.",
  9182. // "Omit the owner, acl property."
  9183. // ],
  9184. // "location": "query",
  9185. // "type": "string"
  9186. // },
  9187. // "userProject": {
  9188. // "description": "The project to be billed for this request, for Requester Pays buckets.",
  9189. // "location": "query",
  9190. // "type": "string"
  9191. // }
  9192. // },
  9193. // "path": "b/{bucket}/o/{object}",
  9194. // "request": {
  9195. // "$ref": "Object"
  9196. // },
  9197. // "response": {
  9198. // "$ref": "Object"
  9199. // },
  9200. // "scopes": [
  9201. // "https://www.googleapis.com/auth/cloud-platform",
  9202. // "https://www.googleapis.com/auth/devstorage.full_control"
  9203. // ]
  9204. // }
  9205. }
  9206. // method id "storage.objects.rewrite":
  9207. type ObjectsRewriteCall struct {
  9208. s *Service
  9209. sourceBucket string
  9210. sourceObject string
  9211. destinationBucket string
  9212. destinationObject string
  9213. object *Object
  9214. urlParams_ gensupport.URLParams
  9215. ctx_ context.Context
  9216. header_ http.Header
  9217. }
  9218. // Rewrite: Rewrites a source object to a destination object. Optionally
  9219. // overrides metadata.
  9220. func (r *ObjectsService) Rewrite(sourceBucket string, sourceObject string, destinationBucket string, destinationObject string, object *Object) *ObjectsRewriteCall {
  9221. c := &ObjectsRewriteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  9222. c.sourceBucket = sourceBucket
  9223. c.sourceObject = sourceObject
  9224. c.destinationBucket = destinationBucket
  9225. c.destinationObject = destinationObject
  9226. c.object = object
  9227. return c
  9228. }
  9229. // DestinationKmsKeyName sets the optional parameter
  9230. // "destinationKmsKeyName": Resource name of the Cloud KMS key, of the
  9231. // form
  9232. // projects/my-project/locations/global/keyRings/my-kr/cryptoKeys/my-key,
  9233. // that will be used to encrypt the object. Overrides the object
  9234. // metadata's kms_key_name value, if any.
  9235. func (c *ObjectsRewriteCall) DestinationKmsKeyName(destinationKmsKeyName string) *ObjectsRewriteCall {
  9236. c.urlParams_.Set("destinationKmsKeyName", destinationKmsKeyName)
  9237. return c
  9238. }
  9239. // DestinationPredefinedAcl sets the optional parameter
  9240. // "destinationPredefinedAcl": Apply a predefined set of access controls
  9241. // to the destination object.
  9242. //
  9243. // Possible values:
  9244. // "authenticatedRead" - Object owner gets OWNER access, and
  9245. // allAuthenticatedUsers get READER access.
  9246. // "bucketOwnerFullControl" - Object owner gets OWNER access, and
  9247. // project team owners get OWNER access.
  9248. // "bucketOwnerRead" - Object owner gets OWNER access, and project
  9249. // team owners get READER access.
  9250. // "private" - Object owner gets OWNER access.
  9251. // "projectPrivate" - Object owner gets OWNER access, and project team
  9252. // members get access according to their roles.
  9253. // "publicRead" - Object owner gets OWNER access, and allUsers get
  9254. // READER access.
  9255. func (c *ObjectsRewriteCall) DestinationPredefinedAcl(destinationPredefinedAcl string) *ObjectsRewriteCall {
  9256. c.urlParams_.Set("destinationPredefinedAcl", destinationPredefinedAcl)
  9257. return c
  9258. }
  9259. // IfGenerationMatch sets the optional parameter "ifGenerationMatch":
  9260. // Makes the operation conditional on whether the object's current
  9261. // generation matches the given value. Setting to 0 makes the operation
  9262. // succeed only if there are no live versions of the object.
  9263. func (c *ObjectsRewriteCall) IfGenerationMatch(ifGenerationMatch int64) *ObjectsRewriteCall {
  9264. c.urlParams_.Set("ifGenerationMatch", fmt.Sprint(ifGenerationMatch))
  9265. return c
  9266. }
  9267. // IfGenerationNotMatch sets the optional parameter
  9268. // "ifGenerationNotMatch": Makes the operation conditional on whether
  9269. // the object's current generation does not match the given value. If no
  9270. // live object exists, the precondition fails. Setting to 0 makes the
  9271. // operation succeed only if there is a live version of the object.
  9272. func (c *ObjectsRewriteCall) IfGenerationNotMatch(ifGenerationNotMatch int64) *ObjectsRewriteCall {
  9273. c.urlParams_.Set("ifGenerationNotMatch", fmt.Sprint(ifGenerationNotMatch))
  9274. return c
  9275. }
  9276. // IfMetagenerationMatch sets the optional parameter
  9277. // "ifMetagenerationMatch": Makes the operation conditional on whether
  9278. // the destination object's current metageneration matches the given
  9279. // value.
  9280. func (c *ObjectsRewriteCall) IfMetagenerationMatch(ifMetagenerationMatch int64) *ObjectsRewriteCall {
  9281. c.urlParams_.Set("ifMetagenerationMatch", fmt.Sprint(ifMetagenerationMatch))
  9282. return c
  9283. }
  9284. // IfMetagenerationNotMatch sets the optional parameter
  9285. // "ifMetagenerationNotMatch": Makes the operation conditional on
  9286. // whether the destination object's current metageneration does not
  9287. // match the given value.
  9288. func (c *ObjectsRewriteCall) IfMetagenerationNotMatch(ifMetagenerationNotMatch int64) *ObjectsRewriteCall {
  9289. c.urlParams_.Set("ifMetagenerationNotMatch", fmt.Sprint(ifMetagenerationNotMatch))
  9290. return c
  9291. }
  9292. // IfSourceGenerationMatch sets the optional parameter
  9293. // "ifSourceGenerationMatch": Makes the operation conditional on whether
  9294. // the source object's current generation matches the given value.
  9295. func (c *ObjectsRewriteCall) IfSourceGenerationMatch(ifSourceGenerationMatch int64) *ObjectsRewriteCall {
  9296. c.urlParams_.Set("ifSourceGenerationMatch", fmt.Sprint(ifSourceGenerationMatch))
  9297. return c
  9298. }
  9299. // IfSourceGenerationNotMatch sets the optional parameter
  9300. // "ifSourceGenerationNotMatch": Makes the operation conditional on
  9301. // whether the source object's current generation does not match the
  9302. // given value.
  9303. func (c *ObjectsRewriteCall) IfSourceGenerationNotMatch(ifSourceGenerationNotMatch int64) *ObjectsRewriteCall {
  9304. c.urlParams_.Set("ifSourceGenerationNotMatch", fmt.Sprint(ifSourceGenerationNotMatch))
  9305. return c
  9306. }
  9307. // IfSourceMetagenerationMatch sets the optional parameter
  9308. // "ifSourceMetagenerationMatch": Makes the operation conditional on
  9309. // whether the source object's current metageneration matches the given
  9310. // value.
  9311. func (c *ObjectsRewriteCall) IfSourceMetagenerationMatch(ifSourceMetagenerationMatch int64) *ObjectsRewriteCall {
  9312. c.urlParams_.Set("ifSourceMetagenerationMatch", fmt.Sprint(ifSourceMetagenerationMatch))
  9313. return c
  9314. }
  9315. // IfSourceMetagenerationNotMatch sets the optional parameter
  9316. // "ifSourceMetagenerationNotMatch": Makes the operation conditional on
  9317. // whether the source object's current metageneration does not match the
  9318. // given value.
  9319. func (c *ObjectsRewriteCall) IfSourceMetagenerationNotMatch(ifSourceMetagenerationNotMatch int64) *ObjectsRewriteCall {
  9320. c.urlParams_.Set("ifSourceMetagenerationNotMatch", fmt.Sprint(ifSourceMetagenerationNotMatch))
  9321. return c
  9322. }
  9323. // MaxBytesRewrittenPerCall sets the optional parameter
  9324. // "maxBytesRewrittenPerCall": The maximum number of bytes that will be
  9325. // rewritten per rewrite request. Most callers shouldn't need to specify
  9326. // this parameter - it is primarily in place to support testing. If
  9327. // specified the value must be an integral multiple of 1 MiB (1048576).
  9328. // Also, this only applies to requests where the source and destination
  9329. // span locations and/or storage classes. Finally, this value must not
  9330. // change across rewrite calls else you'll get an error that the
  9331. // rewriteToken is invalid.
  9332. func (c *ObjectsRewriteCall) MaxBytesRewrittenPerCall(maxBytesRewrittenPerCall int64) *ObjectsRewriteCall {
  9333. c.urlParams_.Set("maxBytesRewrittenPerCall", fmt.Sprint(maxBytesRewrittenPerCall))
  9334. return c
  9335. }
  9336. // Projection sets the optional parameter "projection": Set of
  9337. // properties to return. Defaults to noAcl, unless the object resource
  9338. // specifies the acl property, when it defaults to full.
  9339. //
  9340. // Possible values:
  9341. // "full" - Include all properties.
  9342. // "noAcl" - Omit the owner, acl property.
  9343. func (c *ObjectsRewriteCall) Projection(projection string) *ObjectsRewriteCall {
  9344. c.urlParams_.Set("projection", projection)
  9345. return c
  9346. }
  9347. // RewriteToken sets the optional parameter "rewriteToken": Include this
  9348. // field (from the previous rewrite response) on each rewrite request
  9349. // after the first one, until the rewrite response 'done' flag is true.
  9350. // Calls that provide a rewriteToken can omit all other request fields,
  9351. // but if included those fields must match the values provided in the
  9352. // first rewrite request.
  9353. func (c *ObjectsRewriteCall) RewriteToken(rewriteToken string) *ObjectsRewriteCall {
  9354. c.urlParams_.Set("rewriteToken", rewriteToken)
  9355. return c
  9356. }
  9357. // SourceGeneration sets the optional parameter "sourceGeneration": If
  9358. // present, selects a specific revision of the source object (as opposed
  9359. // to the latest version, the default).
  9360. func (c *ObjectsRewriteCall) SourceGeneration(sourceGeneration int64) *ObjectsRewriteCall {
  9361. c.urlParams_.Set("sourceGeneration", fmt.Sprint(sourceGeneration))
  9362. return c
  9363. }
  9364. // UserProject sets the optional parameter "userProject": The project to
  9365. // be billed for this request. Required for Requester Pays buckets.
  9366. func (c *ObjectsRewriteCall) UserProject(userProject string) *ObjectsRewriteCall {
  9367. c.urlParams_.Set("userProject", userProject)
  9368. return c
  9369. }
  9370. // Fields allows partial responses to be retrieved. See
  9371. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  9372. // for more information.
  9373. func (c *ObjectsRewriteCall) Fields(s ...googleapi.Field) *ObjectsRewriteCall {
  9374. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  9375. return c
  9376. }
  9377. // Context sets the context to be used in this call's Do method. Any
  9378. // pending HTTP request will be aborted if the provided context is
  9379. // canceled.
  9380. func (c *ObjectsRewriteCall) Context(ctx context.Context) *ObjectsRewriteCall {
  9381. c.ctx_ = ctx
  9382. return c
  9383. }
  9384. // Header returns an http.Header that can be modified by the caller to
  9385. // add HTTP headers to the request.
  9386. func (c *ObjectsRewriteCall) Header() http.Header {
  9387. if c.header_ == nil {
  9388. c.header_ = make(http.Header)
  9389. }
  9390. return c.header_
  9391. }
  9392. func (c *ObjectsRewriteCall) doRequest(alt string) (*http.Response, error) {
  9393. reqHeaders := make(http.Header)
  9394. for k, v := range c.header_ {
  9395. reqHeaders[k] = v
  9396. }
  9397. reqHeaders.Set("User-Agent", c.s.userAgent())
  9398. var body io.Reader = nil
  9399. body, err := googleapi.WithoutDataWrapper.JSONReader(c.object)
  9400. if err != nil {
  9401. return nil, err
  9402. }
  9403. reqHeaders.Set("Content-Type", "application/json")
  9404. c.urlParams_.Set("alt", alt)
  9405. c.urlParams_.Set("prettyPrint", "false")
  9406. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{sourceBucket}/o/{sourceObject}/rewriteTo/b/{destinationBucket}/o/{destinationObject}")
  9407. urls += "?" + c.urlParams_.Encode()
  9408. req, err := http.NewRequest("POST", urls, body)
  9409. if err != nil {
  9410. return nil, err
  9411. }
  9412. req.Header = reqHeaders
  9413. googleapi.Expand(req.URL, map[string]string{
  9414. "sourceBucket": c.sourceBucket,
  9415. "sourceObject": c.sourceObject,
  9416. "destinationBucket": c.destinationBucket,
  9417. "destinationObject": c.destinationObject,
  9418. })
  9419. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  9420. }
  9421. // Do executes the "storage.objects.rewrite" call.
  9422. // Exactly one of *RewriteResponse or error will be non-nil. Any non-2xx
  9423. // status code is an error. Response headers are in either
  9424. // *RewriteResponse.ServerResponse.Header or (if a response was returned
  9425. // at all) in error.(*googleapi.Error).Header. Use
  9426. // googleapi.IsNotModified to check whether the returned error was
  9427. // because http.StatusNotModified was returned.
  9428. func (c *ObjectsRewriteCall) Do(opts ...googleapi.CallOption) (*RewriteResponse, error) {
  9429. gensupport.SetOptions(c.urlParams_, opts...)
  9430. res, err := c.doRequest("json")
  9431. if res != nil && res.StatusCode == http.StatusNotModified {
  9432. if res.Body != nil {
  9433. res.Body.Close()
  9434. }
  9435. return nil, &googleapi.Error{
  9436. Code: res.StatusCode,
  9437. Header: res.Header,
  9438. }
  9439. }
  9440. if err != nil {
  9441. return nil, err
  9442. }
  9443. defer googleapi.CloseBody(res)
  9444. if err := googleapi.CheckResponse(res); err != nil {
  9445. return nil, err
  9446. }
  9447. ret := &RewriteResponse{
  9448. ServerResponse: googleapi.ServerResponse{
  9449. Header: res.Header,
  9450. HTTPStatusCode: res.StatusCode,
  9451. },
  9452. }
  9453. target := &ret
  9454. if err := gensupport.DecodeResponse(target, res); err != nil {
  9455. return nil, err
  9456. }
  9457. return ret, nil
  9458. // {
  9459. // "description": "Rewrites a source object to a destination object. Optionally overrides metadata.",
  9460. // "httpMethod": "POST",
  9461. // "id": "storage.objects.rewrite",
  9462. // "parameterOrder": [
  9463. // "sourceBucket",
  9464. // "sourceObject",
  9465. // "destinationBucket",
  9466. // "destinationObject"
  9467. // ],
  9468. // "parameters": {
  9469. // "destinationBucket": {
  9470. // "description": "Name of the bucket in which to store the new object. Overrides the provided object metadata's bucket value, if any.",
  9471. // "location": "path",
  9472. // "required": true,
  9473. // "type": "string"
  9474. // },
  9475. // "destinationKmsKeyName": {
  9476. // "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.",
  9477. // "location": "query",
  9478. // "type": "string"
  9479. // },
  9480. // "destinationObject": {
  9481. // "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.",
  9482. // "location": "path",
  9483. // "required": true,
  9484. // "type": "string"
  9485. // },
  9486. // "destinationPredefinedAcl": {
  9487. // "description": "Apply a predefined set of access controls to the destination object.",
  9488. // "enum": [
  9489. // "authenticatedRead",
  9490. // "bucketOwnerFullControl",
  9491. // "bucketOwnerRead",
  9492. // "private",
  9493. // "projectPrivate",
  9494. // "publicRead"
  9495. // ],
  9496. // "enumDescriptions": [
  9497. // "Object owner gets OWNER access, and allAuthenticatedUsers get READER access.",
  9498. // "Object owner gets OWNER access, and project team owners get OWNER access.",
  9499. // "Object owner gets OWNER access, and project team owners get READER access.",
  9500. // "Object owner gets OWNER access.",
  9501. // "Object owner gets OWNER access, and project team members get access according to their roles.",
  9502. // "Object owner gets OWNER access, and allUsers get READER access."
  9503. // ],
  9504. // "location": "query",
  9505. // "type": "string"
  9506. // },
  9507. // "ifGenerationMatch": {
  9508. // "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.",
  9509. // "format": "int64",
  9510. // "location": "query",
  9511. // "type": "string"
  9512. // },
  9513. // "ifGenerationNotMatch": {
  9514. // "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.",
  9515. // "format": "int64",
  9516. // "location": "query",
  9517. // "type": "string"
  9518. // },
  9519. // "ifMetagenerationMatch": {
  9520. // "description": "Makes the operation conditional on whether the destination object's current metageneration matches the given value.",
  9521. // "format": "int64",
  9522. // "location": "query",
  9523. // "type": "string"
  9524. // },
  9525. // "ifMetagenerationNotMatch": {
  9526. // "description": "Makes the operation conditional on whether the destination object's current metageneration does not match the given value.",
  9527. // "format": "int64",
  9528. // "location": "query",
  9529. // "type": "string"
  9530. // },
  9531. // "ifSourceGenerationMatch": {
  9532. // "description": "Makes the operation conditional on whether the source object's current generation matches the given value.",
  9533. // "format": "int64",
  9534. // "location": "query",
  9535. // "type": "string"
  9536. // },
  9537. // "ifSourceGenerationNotMatch": {
  9538. // "description": "Makes the operation conditional on whether the source object's current generation does not match the given value.",
  9539. // "format": "int64",
  9540. // "location": "query",
  9541. // "type": "string"
  9542. // },
  9543. // "ifSourceMetagenerationMatch": {
  9544. // "description": "Makes the operation conditional on whether the source object's current metageneration matches the given value.",
  9545. // "format": "int64",
  9546. // "location": "query",
  9547. // "type": "string"
  9548. // },
  9549. // "ifSourceMetagenerationNotMatch": {
  9550. // "description": "Makes the operation conditional on whether the source object's current metageneration does not match the given value.",
  9551. // "format": "int64",
  9552. // "location": "query",
  9553. // "type": "string"
  9554. // },
  9555. // "maxBytesRewrittenPerCall": {
  9556. // "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.",
  9557. // "format": "int64",
  9558. // "location": "query",
  9559. // "type": "string"
  9560. // },
  9561. // "projection": {
  9562. // "description": "Set of properties to return. Defaults to noAcl, unless the object resource specifies the acl property, when it defaults to full.",
  9563. // "enum": [
  9564. // "full",
  9565. // "noAcl"
  9566. // ],
  9567. // "enumDescriptions": [
  9568. // "Include all properties.",
  9569. // "Omit the owner, acl property."
  9570. // ],
  9571. // "location": "query",
  9572. // "type": "string"
  9573. // },
  9574. // "rewriteToken": {
  9575. // "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.",
  9576. // "location": "query",
  9577. // "type": "string"
  9578. // },
  9579. // "sourceBucket": {
  9580. // "description": "Name of the bucket in which to find the source object.",
  9581. // "location": "path",
  9582. // "required": true,
  9583. // "type": "string"
  9584. // },
  9585. // "sourceGeneration": {
  9586. // "description": "If present, selects a specific revision of the source object (as opposed to the latest version, the default).",
  9587. // "format": "int64",
  9588. // "location": "query",
  9589. // "type": "string"
  9590. // },
  9591. // "sourceObject": {
  9592. // "description": "Name of the source object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.",
  9593. // "location": "path",
  9594. // "required": true,
  9595. // "type": "string"
  9596. // },
  9597. // "userProject": {
  9598. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  9599. // "location": "query",
  9600. // "type": "string"
  9601. // }
  9602. // },
  9603. // "path": "b/{sourceBucket}/o/{sourceObject}/rewriteTo/b/{destinationBucket}/o/{destinationObject}",
  9604. // "request": {
  9605. // "$ref": "Object"
  9606. // },
  9607. // "response": {
  9608. // "$ref": "RewriteResponse"
  9609. // },
  9610. // "scopes": [
  9611. // "https://www.googleapis.com/auth/cloud-platform",
  9612. // "https://www.googleapis.com/auth/devstorage.full_control",
  9613. // "https://www.googleapis.com/auth/devstorage.read_write"
  9614. // ]
  9615. // }
  9616. }
  9617. // method id "storage.objects.setIamPolicy":
  9618. type ObjectsSetIamPolicyCall struct {
  9619. s *Service
  9620. bucket string
  9621. object string
  9622. policy *Policy
  9623. urlParams_ gensupport.URLParams
  9624. ctx_ context.Context
  9625. header_ http.Header
  9626. }
  9627. // SetIamPolicy: Updates an IAM policy for the specified object.
  9628. func (r *ObjectsService) SetIamPolicy(bucket string, object string, policy *Policy) *ObjectsSetIamPolicyCall {
  9629. c := &ObjectsSetIamPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  9630. c.bucket = bucket
  9631. c.object = object
  9632. c.policy = policy
  9633. return c
  9634. }
  9635. // Generation sets the optional parameter "generation": If present,
  9636. // selects a specific revision of this object (as opposed to the latest
  9637. // version, the default).
  9638. func (c *ObjectsSetIamPolicyCall) Generation(generation int64) *ObjectsSetIamPolicyCall {
  9639. c.urlParams_.Set("generation", fmt.Sprint(generation))
  9640. return c
  9641. }
  9642. // UserProject sets the optional parameter "userProject": The project to
  9643. // be billed for this request. Required for Requester Pays buckets.
  9644. func (c *ObjectsSetIamPolicyCall) UserProject(userProject string) *ObjectsSetIamPolicyCall {
  9645. c.urlParams_.Set("userProject", userProject)
  9646. return c
  9647. }
  9648. // Fields allows partial responses to be retrieved. See
  9649. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  9650. // for more information.
  9651. func (c *ObjectsSetIamPolicyCall) Fields(s ...googleapi.Field) *ObjectsSetIamPolicyCall {
  9652. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  9653. return c
  9654. }
  9655. // Context sets the context to be used in this call's Do method. Any
  9656. // pending HTTP request will be aborted if the provided context is
  9657. // canceled.
  9658. func (c *ObjectsSetIamPolicyCall) Context(ctx context.Context) *ObjectsSetIamPolicyCall {
  9659. c.ctx_ = ctx
  9660. return c
  9661. }
  9662. // Header returns an http.Header that can be modified by the caller to
  9663. // add HTTP headers to the request.
  9664. func (c *ObjectsSetIamPolicyCall) Header() http.Header {
  9665. if c.header_ == nil {
  9666. c.header_ = make(http.Header)
  9667. }
  9668. return c.header_
  9669. }
  9670. func (c *ObjectsSetIamPolicyCall) doRequest(alt string) (*http.Response, error) {
  9671. reqHeaders := make(http.Header)
  9672. for k, v := range c.header_ {
  9673. reqHeaders[k] = v
  9674. }
  9675. reqHeaders.Set("User-Agent", c.s.userAgent())
  9676. var body io.Reader = nil
  9677. body, err := googleapi.WithoutDataWrapper.JSONReader(c.policy)
  9678. if err != nil {
  9679. return nil, err
  9680. }
  9681. reqHeaders.Set("Content-Type", "application/json")
  9682. c.urlParams_.Set("alt", alt)
  9683. c.urlParams_.Set("prettyPrint", "false")
  9684. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o/{object}/iam")
  9685. urls += "?" + c.urlParams_.Encode()
  9686. req, err := http.NewRequest("PUT", urls, body)
  9687. if err != nil {
  9688. return nil, err
  9689. }
  9690. req.Header = reqHeaders
  9691. googleapi.Expand(req.URL, map[string]string{
  9692. "bucket": c.bucket,
  9693. "object": c.object,
  9694. })
  9695. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  9696. }
  9697. // Do executes the "storage.objects.setIamPolicy" call.
  9698. // Exactly one of *Policy or error will be non-nil. Any non-2xx status
  9699. // code is an error. Response headers are in either
  9700. // *Policy.ServerResponse.Header or (if a response was returned at all)
  9701. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  9702. // check whether the returned error was because http.StatusNotModified
  9703. // was returned.
  9704. func (c *ObjectsSetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Policy, error) {
  9705. gensupport.SetOptions(c.urlParams_, opts...)
  9706. res, err := c.doRequest("json")
  9707. if res != nil && res.StatusCode == http.StatusNotModified {
  9708. if res.Body != nil {
  9709. res.Body.Close()
  9710. }
  9711. return nil, &googleapi.Error{
  9712. Code: res.StatusCode,
  9713. Header: res.Header,
  9714. }
  9715. }
  9716. if err != nil {
  9717. return nil, err
  9718. }
  9719. defer googleapi.CloseBody(res)
  9720. if err := googleapi.CheckResponse(res); err != nil {
  9721. return nil, err
  9722. }
  9723. ret := &Policy{
  9724. ServerResponse: googleapi.ServerResponse{
  9725. Header: res.Header,
  9726. HTTPStatusCode: res.StatusCode,
  9727. },
  9728. }
  9729. target := &ret
  9730. if err := gensupport.DecodeResponse(target, res); err != nil {
  9731. return nil, err
  9732. }
  9733. return ret, nil
  9734. // {
  9735. // "description": "Updates an IAM policy for the specified object.",
  9736. // "httpMethod": "PUT",
  9737. // "id": "storage.objects.setIamPolicy",
  9738. // "parameterOrder": [
  9739. // "bucket",
  9740. // "object"
  9741. // ],
  9742. // "parameters": {
  9743. // "bucket": {
  9744. // "description": "Name of the bucket in which the object resides.",
  9745. // "location": "path",
  9746. // "required": true,
  9747. // "type": "string"
  9748. // },
  9749. // "generation": {
  9750. // "description": "If present, selects a specific revision of this object (as opposed to the latest version, the default).",
  9751. // "format": "int64",
  9752. // "location": "query",
  9753. // "type": "string"
  9754. // },
  9755. // "object": {
  9756. // "description": "Name of the object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.",
  9757. // "location": "path",
  9758. // "required": true,
  9759. // "type": "string"
  9760. // },
  9761. // "userProject": {
  9762. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  9763. // "location": "query",
  9764. // "type": "string"
  9765. // }
  9766. // },
  9767. // "path": "b/{bucket}/o/{object}/iam",
  9768. // "request": {
  9769. // "$ref": "Policy"
  9770. // },
  9771. // "response": {
  9772. // "$ref": "Policy"
  9773. // },
  9774. // "scopes": [
  9775. // "https://www.googleapis.com/auth/cloud-platform",
  9776. // "https://www.googleapis.com/auth/devstorage.full_control",
  9777. // "https://www.googleapis.com/auth/devstorage.read_write"
  9778. // ]
  9779. // }
  9780. }
  9781. // method id "storage.objects.testIamPermissions":
  9782. type ObjectsTestIamPermissionsCall struct {
  9783. s *Service
  9784. bucket string
  9785. object string
  9786. urlParams_ gensupport.URLParams
  9787. ifNoneMatch_ string
  9788. ctx_ context.Context
  9789. header_ http.Header
  9790. }
  9791. // TestIamPermissions: Tests a set of permissions on the given object to
  9792. // see which, if any, are held by the caller.
  9793. func (r *ObjectsService) TestIamPermissions(bucket string, object string, permissions []string) *ObjectsTestIamPermissionsCall {
  9794. c := &ObjectsTestIamPermissionsCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  9795. c.bucket = bucket
  9796. c.object = object
  9797. c.urlParams_.SetMulti("permissions", append([]string{}, permissions...))
  9798. return c
  9799. }
  9800. // Generation sets the optional parameter "generation": If present,
  9801. // selects a specific revision of this object (as opposed to the latest
  9802. // version, the default).
  9803. func (c *ObjectsTestIamPermissionsCall) Generation(generation int64) *ObjectsTestIamPermissionsCall {
  9804. c.urlParams_.Set("generation", fmt.Sprint(generation))
  9805. return c
  9806. }
  9807. // UserProject sets the optional parameter "userProject": The project to
  9808. // be billed for this request. Required for Requester Pays buckets.
  9809. func (c *ObjectsTestIamPermissionsCall) UserProject(userProject string) *ObjectsTestIamPermissionsCall {
  9810. c.urlParams_.Set("userProject", userProject)
  9811. return c
  9812. }
  9813. // Fields allows partial responses to be retrieved. See
  9814. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  9815. // for more information.
  9816. func (c *ObjectsTestIamPermissionsCall) Fields(s ...googleapi.Field) *ObjectsTestIamPermissionsCall {
  9817. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  9818. return c
  9819. }
  9820. // IfNoneMatch sets the optional parameter which makes the operation
  9821. // fail if the object's ETag matches the given value. This is useful for
  9822. // getting updates only after the object has changed since the last
  9823. // request. Use googleapi.IsNotModified to check whether the response
  9824. // error from Do is the result of In-None-Match.
  9825. func (c *ObjectsTestIamPermissionsCall) IfNoneMatch(entityTag string) *ObjectsTestIamPermissionsCall {
  9826. c.ifNoneMatch_ = entityTag
  9827. return c
  9828. }
  9829. // Context sets the context to be used in this call's Do method. Any
  9830. // pending HTTP request will be aborted if the provided context is
  9831. // canceled.
  9832. func (c *ObjectsTestIamPermissionsCall) Context(ctx context.Context) *ObjectsTestIamPermissionsCall {
  9833. c.ctx_ = ctx
  9834. return c
  9835. }
  9836. // Header returns an http.Header that can be modified by the caller to
  9837. // add HTTP headers to the request.
  9838. func (c *ObjectsTestIamPermissionsCall) Header() http.Header {
  9839. if c.header_ == nil {
  9840. c.header_ = make(http.Header)
  9841. }
  9842. return c.header_
  9843. }
  9844. func (c *ObjectsTestIamPermissionsCall) doRequest(alt string) (*http.Response, error) {
  9845. reqHeaders := make(http.Header)
  9846. for k, v := range c.header_ {
  9847. reqHeaders[k] = v
  9848. }
  9849. reqHeaders.Set("User-Agent", c.s.userAgent())
  9850. if c.ifNoneMatch_ != "" {
  9851. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  9852. }
  9853. var body io.Reader = nil
  9854. c.urlParams_.Set("alt", alt)
  9855. c.urlParams_.Set("prettyPrint", "false")
  9856. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o/{object}/iam/testPermissions")
  9857. urls += "?" + c.urlParams_.Encode()
  9858. req, err := http.NewRequest("GET", urls, body)
  9859. if err != nil {
  9860. return nil, err
  9861. }
  9862. req.Header = reqHeaders
  9863. googleapi.Expand(req.URL, map[string]string{
  9864. "bucket": c.bucket,
  9865. "object": c.object,
  9866. })
  9867. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  9868. }
  9869. // Do executes the "storage.objects.testIamPermissions" call.
  9870. // Exactly one of *TestIamPermissionsResponse or error will be non-nil.
  9871. // Any non-2xx status code is an error. Response headers are in either
  9872. // *TestIamPermissionsResponse.ServerResponse.Header or (if a response
  9873. // was returned at all) in error.(*googleapi.Error).Header. Use
  9874. // googleapi.IsNotModified to check whether the returned error was
  9875. // because http.StatusNotModified was returned.
  9876. func (c *ObjectsTestIamPermissionsCall) Do(opts ...googleapi.CallOption) (*TestIamPermissionsResponse, error) {
  9877. gensupport.SetOptions(c.urlParams_, opts...)
  9878. res, err := c.doRequest("json")
  9879. if res != nil && res.StatusCode == http.StatusNotModified {
  9880. if res.Body != nil {
  9881. res.Body.Close()
  9882. }
  9883. return nil, &googleapi.Error{
  9884. Code: res.StatusCode,
  9885. Header: res.Header,
  9886. }
  9887. }
  9888. if err != nil {
  9889. return nil, err
  9890. }
  9891. defer googleapi.CloseBody(res)
  9892. if err := googleapi.CheckResponse(res); err != nil {
  9893. return nil, err
  9894. }
  9895. ret := &TestIamPermissionsResponse{
  9896. ServerResponse: googleapi.ServerResponse{
  9897. Header: res.Header,
  9898. HTTPStatusCode: res.StatusCode,
  9899. },
  9900. }
  9901. target := &ret
  9902. if err := gensupport.DecodeResponse(target, res); err != nil {
  9903. return nil, err
  9904. }
  9905. return ret, nil
  9906. // {
  9907. // "description": "Tests a set of permissions on the given object to see which, if any, are held by the caller.",
  9908. // "httpMethod": "GET",
  9909. // "id": "storage.objects.testIamPermissions",
  9910. // "parameterOrder": [
  9911. // "bucket",
  9912. // "object",
  9913. // "permissions"
  9914. // ],
  9915. // "parameters": {
  9916. // "bucket": {
  9917. // "description": "Name of the bucket in which the object resides.",
  9918. // "location": "path",
  9919. // "required": true,
  9920. // "type": "string"
  9921. // },
  9922. // "generation": {
  9923. // "description": "If present, selects a specific revision of this object (as opposed to the latest version, the default).",
  9924. // "format": "int64",
  9925. // "location": "query",
  9926. // "type": "string"
  9927. // },
  9928. // "object": {
  9929. // "description": "Name of the object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.",
  9930. // "location": "path",
  9931. // "required": true,
  9932. // "type": "string"
  9933. // },
  9934. // "permissions": {
  9935. // "description": "Permissions to test.",
  9936. // "location": "query",
  9937. // "repeated": true,
  9938. // "required": true,
  9939. // "type": "string"
  9940. // },
  9941. // "userProject": {
  9942. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  9943. // "location": "query",
  9944. // "type": "string"
  9945. // }
  9946. // },
  9947. // "path": "b/{bucket}/o/{object}/iam/testPermissions",
  9948. // "response": {
  9949. // "$ref": "TestIamPermissionsResponse"
  9950. // },
  9951. // "scopes": [
  9952. // "https://www.googleapis.com/auth/cloud-platform",
  9953. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  9954. // "https://www.googleapis.com/auth/devstorage.full_control",
  9955. // "https://www.googleapis.com/auth/devstorage.read_only",
  9956. // "https://www.googleapis.com/auth/devstorage.read_write"
  9957. // ]
  9958. // }
  9959. }
  9960. // method id "storage.objects.update":
  9961. type ObjectsUpdateCall struct {
  9962. s *Service
  9963. bucket string
  9964. object string
  9965. object2 *Object
  9966. urlParams_ gensupport.URLParams
  9967. ctx_ context.Context
  9968. header_ http.Header
  9969. }
  9970. // Update: Updates an object's metadata.
  9971. func (r *ObjectsService) Update(bucket string, object string, object2 *Object) *ObjectsUpdateCall {
  9972. c := &ObjectsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  9973. c.bucket = bucket
  9974. c.object = object
  9975. c.object2 = object2
  9976. return c
  9977. }
  9978. // Generation sets the optional parameter "generation": If present,
  9979. // selects a specific revision of this object (as opposed to the latest
  9980. // version, the default).
  9981. func (c *ObjectsUpdateCall) Generation(generation int64) *ObjectsUpdateCall {
  9982. c.urlParams_.Set("generation", fmt.Sprint(generation))
  9983. return c
  9984. }
  9985. // IfGenerationMatch sets the optional parameter "ifGenerationMatch":
  9986. // Makes the operation conditional on whether the object's current
  9987. // generation matches the given value. Setting to 0 makes the operation
  9988. // succeed only if there are no live versions of the object.
  9989. func (c *ObjectsUpdateCall) IfGenerationMatch(ifGenerationMatch int64) *ObjectsUpdateCall {
  9990. c.urlParams_.Set("ifGenerationMatch", fmt.Sprint(ifGenerationMatch))
  9991. return c
  9992. }
  9993. // IfGenerationNotMatch sets the optional parameter
  9994. // "ifGenerationNotMatch": Makes the operation conditional on whether
  9995. // the object's current generation does not match the given value. If no
  9996. // live object exists, the precondition fails. Setting to 0 makes the
  9997. // operation succeed only if there is a live version of the object.
  9998. func (c *ObjectsUpdateCall) IfGenerationNotMatch(ifGenerationNotMatch int64) *ObjectsUpdateCall {
  9999. c.urlParams_.Set("ifGenerationNotMatch", fmt.Sprint(ifGenerationNotMatch))
  10000. return c
  10001. }
  10002. // IfMetagenerationMatch sets the optional parameter
  10003. // "ifMetagenerationMatch": Makes the operation conditional on whether
  10004. // the object's current metageneration matches the given value.
  10005. func (c *ObjectsUpdateCall) IfMetagenerationMatch(ifMetagenerationMatch int64) *ObjectsUpdateCall {
  10006. c.urlParams_.Set("ifMetagenerationMatch", fmt.Sprint(ifMetagenerationMatch))
  10007. return c
  10008. }
  10009. // IfMetagenerationNotMatch sets the optional parameter
  10010. // "ifMetagenerationNotMatch": Makes the operation conditional on
  10011. // whether the object's current metageneration does not match the given
  10012. // value.
  10013. func (c *ObjectsUpdateCall) IfMetagenerationNotMatch(ifMetagenerationNotMatch int64) *ObjectsUpdateCall {
  10014. c.urlParams_.Set("ifMetagenerationNotMatch", fmt.Sprint(ifMetagenerationNotMatch))
  10015. return c
  10016. }
  10017. // PredefinedAcl sets the optional parameter "predefinedAcl": Apply a
  10018. // predefined set of access controls to this object.
  10019. //
  10020. // Possible values:
  10021. // "authenticatedRead" - Object owner gets OWNER access, and
  10022. // allAuthenticatedUsers get READER access.
  10023. // "bucketOwnerFullControl" - Object owner gets OWNER access, and
  10024. // project team owners get OWNER access.
  10025. // "bucketOwnerRead" - Object owner gets OWNER access, and project
  10026. // team owners get READER access.
  10027. // "private" - Object owner gets OWNER access.
  10028. // "projectPrivate" - Object owner gets OWNER access, and project team
  10029. // members get access according to their roles.
  10030. // "publicRead" - Object owner gets OWNER access, and allUsers get
  10031. // READER access.
  10032. func (c *ObjectsUpdateCall) PredefinedAcl(predefinedAcl string) *ObjectsUpdateCall {
  10033. c.urlParams_.Set("predefinedAcl", predefinedAcl)
  10034. return c
  10035. }
  10036. // Projection sets the optional parameter "projection": Set of
  10037. // properties to return. Defaults to full.
  10038. //
  10039. // Possible values:
  10040. // "full" - Include all properties.
  10041. // "noAcl" - Omit the owner, acl property.
  10042. func (c *ObjectsUpdateCall) Projection(projection string) *ObjectsUpdateCall {
  10043. c.urlParams_.Set("projection", projection)
  10044. return c
  10045. }
  10046. // UserProject sets the optional parameter "userProject": The project to
  10047. // be billed for this request. Required for Requester Pays buckets.
  10048. func (c *ObjectsUpdateCall) UserProject(userProject string) *ObjectsUpdateCall {
  10049. c.urlParams_.Set("userProject", userProject)
  10050. return c
  10051. }
  10052. // Fields allows partial responses to be retrieved. See
  10053. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  10054. // for more information.
  10055. func (c *ObjectsUpdateCall) Fields(s ...googleapi.Field) *ObjectsUpdateCall {
  10056. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  10057. return c
  10058. }
  10059. // Context sets the context to be used in this call's Do method. Any
  10060. // pending HTTP request will be aborted if the provided context is
  10061. // canceled.
  10062. func (c *ObjectsUpdateCall) Context(ctx context.Context) *ObjectsUpdateCall {
  10063. c.ctx_ = ctx
  10064. return c
  10065. }
  10066. // Header returns an http.Header that can be modified by the caller to
  10067. // add HTTP headers to the request.
  10068. func (c *ObjectsUpdateCall) Header() http.Header {
  10069. if c.header_ == nil {
  10070. c.header_ = make(http.Header)
  10071. }
  10072. return c.header_
  10073. }
  10074. func (c *ObjectsUpdateCall) doRequest(alt string) (*http.Response, error) {
  10075. reqHeaders := make(http.Header)
  10076. for k, v := range c.header_ {
  10077. reqHeaders[k] = v
  10078. }
  10079. reqHeaders.Set("User-Agent", c.s.userAgent())
  10080. var body io.Reader = nil
  10081. body, err := googleapi.WithoutDataWrapper.JSONReader(c.object2)
  10082. if err != nil {
  10083. return nil, err
  10084. }
  10085. reqHeaders.Set("Content-Type", "application/json")
  10086. c.urlParams_.Set("alt", alt)
  10087. c.urlParams_.Set("prettyPrint", "false")
  10088. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o/{object}")
  10089. urls += "?" + c.urlParams_.Encode()
  10090. req, err := http.NewRequest("PUT", urls, body)
  10091. if err != nil {
  10092. return nil, err
  10093. }
  10094. req.Header = reqHeaders
  10095. googleapi.Expand(req.URL, map[string]string{
  10096. "bucket": c.bucket,
  10097. "object": c.object,
  10098. })
  10099. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  10100. }
  10101. // Do executes the "storage.objects.update" call.
  10102. // Exactly one of *Object or error will be non-nil. Any non-2xx status
  10103. // code is an error. Response headers are in either
  10104. // *Object.ServerResponse.Header or (if a response was returned at all)
  10105. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  10106. // check whether the returned error was because http.StatusNotModified
  10107. // was returned.
  10108. func (c *ObjectsUpdateCall) Do(opts ...googleapi.CallOption) (*Object, error) {
  10109. gensupport.SetOptions(c.urlParams_, opts...)
  10110. res, err := c.doRequest("json")
  10111. if res != nil && res.StatusCode == http.StatusNotModified {
  10112. if res.Body != nil {
  10113. res.Body.Close()
  10114. }
  10115. return nil, &googleapi.Error{
  10116. Code: res.StatusCode,
  10117. Header: res.Header,
  10118. }
  10119. }
  10120. if err != nil {
  10121. return nil, err
  10122. }
  10123. defer googleapi.CloseBody(res)
  10124. if err := googleapi.CheckResponse(res); err != nil {
  10125. return nil, err
  10126. }
  10127. ret := &Object{
  10128. ServerResponse: googleapi.ServerResponse{
  10129. Header: res.Header,
  10130. HTTPStatusCode: res.StatusCode,
  10131. },
  10132. }
  10133. target := &ret
  10134. if err := gensupport.DecodeResponse(target, res); err != nil {
  10135. return nil, err
  10136. }
  10137. return ret, nil
  10138. // {
  10139. // "description": "Updates an object's metadata.",
  10140. // "httpMethod": "PUT",
  10141. // "id": "storage.objects.update",
  10142. // "parameterOrder": [
  10143. // "bucket",
  10144. // "object"
  10145. // ],
  10146. // "parameters": {
  10147. // "bucket": {
  10148. // "description": "Name of the bucket in which the object resides.",
  10149. // "location": "path",
  10150. // "required": true,
  10151. // "type": "string"
  10152. // },
  10153. // "generation": {
  10154. // "description": "If present, selects a specific revision of this object (as opposed to the latest version, the default).",
  10155. // "format": "int64",
  10156. // "location": "query",
  10157. // "type": "string"
  10158. // },
  10159. // "ifGenerationMatch": {
  10160. // "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.",
  10161. // "format": "int64",
  10162. // "location": "query",
  10163. // "type": "string"
  10164. // },
  10165. // "ifGenerationNotMatch": {
  10166. // "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.",
  10167. // "format": "int64",
  10168. // "location": "query",
  10169. // "type": "string"
  10170. // },
  10171. // "ifMetagenerationMatch": {
  10172. // "description": "Makes the operation conditional on whether the object's current metageneration matches the given value.",
  10173. // "format": "int64",
  10174. // "location": "query",
  10175. // "type": "string"
  10176. // },
  10177. // "ifMetagenerationNotMatch": {
  10178. // "description": "Makes the operation conditional on whether the object's current metageneration does not match the given value.",
  10179. // "format": "int64",
  10180. // "location": "query",
  10181. // "type": "string"
  10182. // },
  10183. // "object": {
  10184. // "description": "Name of the object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.",
  10185. // "location": "path",
  10186. // "required": true,
  10187. // "type": "string"
  10188. // },
  10189. // "predefinedAcl": {
  10190. // "description": "Apply a predefined set of access controls to this object.",
  10191. // "enum": [
  10192. // "authenticatedRead",
  10193. // "bucketOwnerFullControl",
  10194. // "bucketOwnerRead",
  10195. // "private",
  10196. // "projectPrivate",
  10197. // "publicRead"
  10198. // ],
  10199. // "enumDescriptions": [
  10200. // "Object owner gets OWNER access, and allAuthenticatedUsers get READER access.",
  10201. // "Object owner gets OWNER access, and project team owners get OWNER access.",
  10202. // "Object owner gets OWNER access, and project team owners get READER access.",
  10203. // "Object owner gets OWNER access.",
  10204. // "Object owner gets OWNER access, and project team members get access according to their roles.",
  10205. // "Object owner gets OWNER access, and allUsers get READER access."
  10206. // ],
  10207. // "location": "query",
  10208. // "type": "string"
  10209. // },
  10210. // "projection": {
  10211. // "description": "Set of properties to return. Defaults to full.",
  10212. // "enum": [
  10213. // "full",
  10214. // "noAcl"
  10215. // ],
  10216. // "enumDescriptions": [
  10217. // "Include all properties.",
  10218. // "Omit the owner, acl property."
  10219. // ],
  10220. // "location": "query",
  10221. // "type": "string"
  10222. // },
  10223. // "userProject": {
  10224. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  10225. // "location": "query",
  10226. // "type": "string"
  10227. // }
  10228. // },
  10229. // "path": "b/{bucket}/o/{object}",
  10230. // "request": {
  10231. // "$ref": "Object"
  10232. // },
  10233. // "response": {
  10234. // "$ref": "Object"
  10235. // },
  10236. // "scopes": [
  10237. // "https://www.googleapis.com/auth/cloud-platform",
  10238. // "https://www.googleapis.com/auth/devstorage.full_control"
  10239. // ]
  10240. // }
  10241. }
  10242. // method id "storage.objects.watchAll":
  10243. type ObjectsWatchAllCall struct {
  10244. s *Service
  10245. bucket string
  10246. channel *Channel
  10247. urlParams_ gensupport.URLParams
  10248. ctx_ context.Context
  10249. header_ http.Header
  10250. }
  10251. // WatchAll: Watch for changes on all objects in a bucket.
  10252. func (r *ObjectsService) WatchAll(bucket string, channel *Channel) *ObjectsWatchAllCall {
  10253. c := &ObjectsWatchAllCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  10254. c.bucket = bucket
  10255. c.channel = channel
  10256. return c
  10257. }
  10258. // Delimiter sets the optional parameter "delimiter": Returns results in
  10259. // a directory-like mode. items will contain only objects whose names,
  10260. // aside from the prefix, do not contain delimiter. Objects whose names,
  10261. // aside from the prefix, contain delimiter will have their name,
  10262. // truncated after the delimiter, returned in prefixes. Duplicate
  10263. // prefixes are omitted.
  10264. func (c *ObjectsWatchAllCall) Delimiter(delimiter string) *ObjectsWatchAllCall {
  10265. c.urlParams_.Set("delimiter", delimiter)
  10266. return c
  10267. }
  10268. // IncludeTrailingDelimiter sets the optional parameter
  10269. // "includeTrailingDelimiter": If true, objects that end in exactly one
  10270. // instance of delimiter will have their metadata included in items in
  10271. // addition to prefixes.
  10272. func (c *ObjectsWatchAllCall) IncludeTrailingDelimiter(includeTrailingDelimiter bool) *ObjectsWatchAllCall {
  10273. c.urlParams_.Set("includeTrailingDelimiter", fmt.Sprint(includeTrailingDelimiter))
  10274. return c
  10275. }
  10276. // MaxResults sets the optional parameter "maxResults": Maximum number
  10277. // of items plus prefixes to return in a single page of responses. As
  10278. // duplicate prefixes are omitted, fewer total results may be returned
  10279. // than requested. The service will use this parameter or 1,000 items,
  10280. // whichever is smaller.
  10281. func (c *ObjectsWatchAllCall) MaxResults(maxResults int64) *ObjectsWatchAllCall {
  10282. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  10283. return c
  10284. }
  10285. // PageToken sets the optional parameter "pageToken": A
  10286. // previously-returned page token representing part of the larger set of
  10287. // results to view.
  10288. func (c *ObjectsWatchAllCall) PageToken(pageToken string) *ObjectsWatchAllCall {
  10289. c.urlParams_.Set("pageToken", pageToken)
  10290. return c
  10291. }
  10292. // Prefix sets the optional parameter "prefix": Filter results to
  10293. // objects whose names begin with this prefix.
  10294. func (c *ObjectsWatchAllCall) Prefix(prefix string) *ObjectsWatchAllCall {
  10295. c.urlParams_.Set("prefix", prefix)
  10296. return c
  10297. }
  10298. // Projection sets the optional parameter "projection": Set of
  10299. // properties to return. Defaults to noAcl.
  10300. //
  10301. // Possible values:
  10302. // "full" - Include all properties.
  10303. // "noAcl" - Omit the owner, acl property.
  10304. func (c *ObjectsWatchAllCall) Projection(projection string) *ObjectsWatchAllCall {
  10305. c.urlParams_.Set("projection", projection)
  10306. return c
  10307. }
  10308. // UserProject sets the optional parameter "userProject": The project to
  10309. // be billed for this request. Required for Requester Pays buckets.
  10310. func (c *ObjectsWatchAllCall) UserProject(userProject string) *ObjectsWatchAllCall {
  10311. c.urlParams_.Set("userProject", userProject)
  10312. return c
  10313. }
  10314. // Versions sets the optional parameter "versions": If true, lists all
  10315. // versions of an object as distinct results. The default is false. For
  10316. // more information, see Object Versioning.
  10317. func (c *ObjectsWatchAllCall) Versions(versions bool) *ObjectsWatchAllCall {
  10318. c.urlParams_.Set("versions", fmt.Sprint(versions))
  10319. return c
  10320. }
  10321. // Fields allows partial responses to be retrieved. See
  10322. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  10323. // for more information.
  10324. func (c *ObjectsWatchAllCall) Fields(s ...googleapi.Field) *ObjectsWatchAllCall {
  10325. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  10326. return c
  10327. }
  10328. // Context sets the context to be used in this call's Do method. Any
  10329. // pending HTTP request will be aborted if the provided context is
  10330. // canceled.
  10331. func (c *ObjectsWatchAllCall) Context(ctx context.Context) *ObjectsWatchAllCall {
  10332. c.ctx_ = ctx
  10333. return c
  10334. }
  10335. // Header returns an http.Header that can be modified by the caller to
  10336. // add HTTP headers to the request.
  10337. func (c *ObjectsWatchAllCall) Header() http.Header {
  10338. if c.header_ == nil {
  10339. c.header_ = make(http.Header)
  10340. }
  10341. return c.header_
  10342. }
  10343. func (c *ObjectsWatchAllCall) doRequest(alt string) (*http.Response, error) {
  10344. reqHeaders := make(http.Header)
  10345. for k, v := range c.header_ {
  10346. reqHeaders[k] = v
  10347. }
  10348. reqHeaders.Set("User-Agent", c.s.userAgent())
  10349. var body io.Reader = nil
  10350. body, err := googleapi.WithoutDataWrapper.JSONReader(c.channel)
  10351. if err != nil {
  10352. return nil, err
  10353. }
  10354. reqHeaders.Set("Content-Type", "application/json")
  10355. c.urlParams_.Set("alt", alt)
  10356. c.urlParams_.Set("prettyPrint", "false")
  10357. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o/watch")
  10358. urls += "?" + c.urlParams_.Encode()
  10359. req, err := http.NewRequest("POST", urls, body)
  10360. if err != nil {
  10361. return nil, err
  10362. }
  10363. req.Header = reqHeaders
  10364. googleapi.Expand(req.URL, map[string]string{
  10365. "bucket": c.bucket,
  10366. })
  10367. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  10368. }
  10369. // Do executes the "storage.objects.watchAll" call.
  10370. // Exactly one of *Channel or error will be non-nil. Any non-2xx status
  10371. // code is an error. Response headers are in either
  10372. // *Channel.ServerResponse.Header or (if a response was returned at all)
  10373. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  10374. // check whether the returned error was because http.StatusNotModified
  10375. // was returned.
  10376. func (c *ObjectsWatchAllCall) Do(opts ...googleapi.CallOption) (*Channel, error) {
  10377. gensupport.SetOptions(c.urlParams_, opts...)
  10378. res, err := c.doRequest("json")
  10379. if res != nil && res.StatusCode == http.StatusNotModified {
  10380. if res.Body != nil {
  10381. res.Body.Close()
  10382. }
  10383. return nil, &googleapi.Error{
  10384. Code: res.StatusCode,
  10385. Header: res.Header,
  10386. }
  10387. }
  10388. if err != nil {
  10389. return nil, err
  10390. }
  10391. defer googleapi.CloseBody(res)
  10392. if err := googleapi.CheckResponse(res); err != nil {
  10393. return nil, err
  10394. }
  10395. ret := &Channel{
  10396. ServerResponse: googleapi.ServerResponse{
  10397. Header: res.Header,
  10398. HTTPStatusCode: res.StatusCode,
  10399. },
  10400. }
  10401. target := &ret
  10402. if err := gensupport.DecodeResponse(target, res); err != nil {
  10403. return nil, err
  10404. }
  10405. return ret, nil
  10406. // {
  10407. // "description": "Watch for changes on all objects in a bucket.",
  10408. // "httpMethod": "POST",
  10409. // "id": "storage.objects.watchAll",
  10410. // "parameterOrder": [
  10411. // "bucket"
  10412. // ],
  10413. // "parameters": {
  10414. // "bucket": {
  10415. // "description": "Name of the bucket in which to look for objects.",
  10416. // "location": "path",
  10417. // "required": true,
  10418. // "type": "string"
  10419. // },
  10420. // "delimiter": {
  10421. // "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.",
  10422. // "location": "query",
  10423. // "type": "string"
  10424. // },
  10425. // "includeTrailingDelimiter": {
  10426. // "description": "If true, objects that end in exactly one instance of delimiter will have their metadata included in items in addition to prefixes.",
  10427. // "location": "query",
  10428. // "type": "boolean"
  10429. // },
  10430. // "maxResults": {
  10431. // "default": "1000",
  10432. // "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.",
  10433. // "format": "uint32",
  10434. // "location": "query",
  10435. // "minimum": "0",
  10436. // "type": "integer"
  10437. // },
  10438. // "pageToken": {
  10439. // "description": "A previously-returned page token representing part of the larger set of results to view.",
  10440. // "location": "query",
  10441. // "type": "string"
  10442. // },
  10443. // "prefix": {
  10444. // "description": "Filter results to objects whose names begin with this prefix.",
  10445. // "location": "query",
  10446. // "type": "string"
  10447. // },
  10448. // "projection": {
  10449. // "description": "Set of properties to return. Defaults to noAcl.",
  10450. // "enum": [
  10451. // "full",
  10452. // "noAcl"
  10453. // ],
  10454. // "enumDescriptions": [
  10455. // "Include all properties.",
  10456. // "Omit the owner, acl property."
  10457. // ],
  10458. // "location": "query",
  10459. // "type": "string"
  10460. // },
  10461. // "userProject": {
  10462. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  10463. // "location": "query",
  10464. // "type": "string"
  10465. // },
  10466. // "versions": {
  10467. // "description": "If true, lists all versions of an object as distinct results. The default is false. For more information, see Object Versioning.",
  10468. // "location": "query",
  10469. // "type": "boolean"
  10470. // }
  10471. // },
  10472. // "path": "b/{bucket}/o/watch",
  10473. // "request": {
  10474. // "$ref": "Channel",
  10475. // "parameterName": "resource"
  10476. // },
  10477. // "response": {
  10478. // "$ref": "Channel"
  10479. // },
  10480. // "scopes": [
  10481. // "https://www.googleapis.com/auth/cloud-platform",
  10482. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  10483. // "https://www.googleapis.com/auth/devstorage.full_control",
  10484. // "https://www.googleapis.com/auth/devstorage.read_only",
  10485. // "https://www.googleapis.com/auth/devstorage.read_write"
  10486. // ],
  10487. // "supportsSubscription": true
  10488. // }
  10489. }
  10490. // method id "storage.projects.serviceAccount.get":
  10491. type ProjectsServiceAccountGetCall struct {
  10492. s *Service
  10493. projectId string
  10494. urlParams_ gensupport.URLParams
  10495. ifNoneMatch_ string
  10496. ctx_ context.Context
  10497. header_ http.Header
  10498. }
  10499. // Get: Get the email address of this project's Google Cloud Storage
  10500. // service account.
  10501. func (r *ProjectsServiceAccountService) Get(projectId string) *ProjectsServiceAccountGetCall {
  10502. c := &ProjectsServiceAccountGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  10503. c.projectId = projectId
  10504. return c
  10505. }
  10506. // UserProject sets the optional parameter "userProject": The project to
  10507. // be billed for this request.
  10508. func (c *ProjectsServiceAccountGetCall) UserProject(userProject string) *ProjectsServiceAccountGetCall {
  10509. c.urlParams_.Set("userProject", userProject)
  10510. return c
  10511. }
  10512. // Fields allows partial responses to be retrieved. See
  10513. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  10514. // for more information.
  10515. func (c *ProjectsServiceAccountGetCall) Fields(s ...googleapi.Field) *ProjectsServiceAccountGetCall {
  10516. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  10517. return c
  10518. }
  10519. // IfNoneMatch sets the optional parameter which makes the operation
  10520. // fail if the object's ETag matches the given value. This is useful for
  10521. // getting updates only after the object has changed since the last
  10522. // request. Use googleapi.IsNotModified to check whether the response
  10523. // error from Do is the result of In-None-Match.
  10524. func (c *ProjectsServiceAccountGetCall) IfNoneMatch(entityTag string) *ProjectsServiceAccountGetCall {
  10525. c.ifNoneMatch_ = entityTag
  10526. return c
  10527. }
  10528. // Context sets the context to be used in this call's Do method. Any
  10529. // pending HTTP request will be aborted if the provided context is
  10530. // canceled.
  10531. func (c *ProjectsServiceAccountGetCall) Context(ctx context.Context) *ProjectsServiceAccountGetCall {
  10532. c.ctx_ = ctx
  10533. return c
  10534. }
  10535. // Header returns an http.Header that can be modified by the caller to
  10536. // add HTTP headers to the request.
  10537. func (c *ProjectsServiceAccountGetCall) Header() http.Header {
  10538. if c.header_ == nil {
  10539. c.header_ = make(http.Header)
  10540. }
  10541. return c.header_
  10542. }
  10543. func (c *ProjectsServiceAccountGetCall) doRequest(alt string) (*http.Response, error) {
  10544. reqHeaders := make(http.Header)
  10545. for k, v := range c.header_ {
  10546. reqHeaders[k] = v
  10547. }
  10548. reqHeaders.Set("User-Agent", c.s.userAgent())
  10549. if c.ifNoneMatch_ != "" {
  10550. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  10551. }
  10552. var body io.Reader = nil
  10553. c.urlParams_.Set("alt", alt)
  10554. c.urlParams_.Set("prettyPrint", "false")
  10555. urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{projectId}/serviceAccount")
  10556. urls += "?" + c.urlParams_.Encode()
  10557. req, err := http.NewRequest("GET", urls, body)
  10558. if err != nil {
  10559. return nil, err
  10560. }
  10561. req.Header = reqHeaders
  10562. googleapi.Expand(req.URL, map[string]string{
  10563. "projectId": c.projectId,
  10564. })
  10565. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  10566. }
  10567. // Do executes the "storage.projects.serviceAccount.get" call.
  10568. // Exactly one of *ServiceAccount or error will be non-nil. Any non-2xx
  10569. // status code is an error. Response headers are in either
  10570. // *ServiceAccount.ServerResponse.Header or (if a response was returned
  10571. // at all) in error.(*googleapi.Error).Header. Use
  10572. // googleapi.IsNotModified to check whether the returned error was
  10573. // because http.StatusNotModified was returned.
  10574. func (c *ProjectsServiceAccountGetCall) Do(opts ...googleapi.CallOption) (*ServiceAccount, error) {
  10575. gensupport.SetOptions(c.urlParams_, opts...)
  10576. res, err := c.doRequest("json")
  10577. if res != nil && res.StatusCode == http.StatusNotModified {
  10578. if res.Body != nil {
  10579. res.Body.Close()
  10580. }
  10581. return nil, &googleapi.Error{
  10582. Code: res.StatusCode,
  10583. Header: res.Header,
  10584. }
  10585. }
  10586. if err != nil {
  10587. return nil, err
  10588. }
  10589. defer googleapi.CloseBody(res)
  10590. if err := googleapi.CheckResponse(res); err != nil {
  10591. return nil, err
  10592. }
  10593. ret := &ServiceAccount{
  10594. ServerResponse: googleapi.ServerResponse{
  10595. Header: res.Header,
  10596. HTTPStatusCode: res.StatusCode,
  10597. },
  10598. }
  10599. target := &ret
  10600. if err := gensupport.DecodeResponse(target, res); err != nil {
  10601. return nil, err
  10602. }
  10603. return ret, nil
  10604. // {
  10605. // "description": "Get the email address of this project's Google Cloud Storage service account.",
  10606. // "httpMethod": "GET",
  10607. // "id": "storage.projects.serviceAccount.get",
  10608. // "parameterOrder": [
  10609. // "projectId"
  10610. // ],
  10611. // "parameters": {
  10612. // "projectId": {
  10613. // "description": "Project ID",
  10614. // "location": "path",
  10615. // "required": true,
  10616. // "type": "string"
  10617. // },
  10618. // "userProject": {
  10619. // "description": "The project to be billed for this request.",
  10620. // "location": "query",
  10621. // "type": "string"
  10622. // }
  10623. // },
  10624. // "path": "projects/{projectId}/serviceAccount",
  10625. // "response": {
  10626. // "$ref": "ServiceAccount"
  10627. // },
  10628. // "scopes": [
  10629. // "https://www.googleapis.com/auth/cloud-platform",
  10630. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  10631. // "https://www.googleapis.com/auth/devstorage.full_control",
  10632. // "https://www.googleapis.com/auth/devstorage.read_only",
  10633. // "https://www.googleapis.com/auth/devstorage.read_write"
  10634. // ]
  10635. // }
  10636. }