Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.
 
 
 

11206 Zeilen
398 KiB

  1. // Package storage provides access to the Cloud Storage JSON API.
  2. //
  3. // See https://developers.google.com/storage/docs/json_api/
  4. //
  5. // Usage example:
  6. //
  7. // import "google.golang.org/api/storage/v1"
  8. // ...
  9. // storageService, err := storage.New(oauthHttpClient)
  10. package storage // import "google.golang.org/api/storage/v1"
  11. import (
  12. "bytes"
  13. "encoding/json"
  14. "errors"
  15. "fmt"
  16. context "golang.org/x/net/context"
  17. ctxhttp "golang.org/x/net/context/ctxhttp"
  18. gensupport "google.golang.org/api/gensupport"
  19. googleapi "google.golang.org/api/googleapi"
  20. "io"
  21. "net/http"
  22. "net/url"
  23. "strconv"
  24. "strings"
  25. )
  26. // Always reference these packages, just in case the auto-generated code
  27. // below doesn't.
  28. var _ = bytes.NewBuffer
  29. var _ = strconv.Itoa
  30. var _ = fmt.Sprintf
  31. var _ = json.NewDecoder
  32. var _ = io.Copy
  33. var _ = url.Parse
  34. var _ = gensupport.MarshalJSON
  35. var _ = googleapi.Version
  36. var _ = errors.New
  37. var _ = strings.Replace
  38. var _ = context.Canceled
  39. var _ = ctxhttp.Do
  40. const apiId = "storage:v1"
  41. const apiName = "storage"
  42. const apiVersion = "v1"
  43. const basePath = "https://www.googleapis.com/storage/v1/"
  44. // OAuth2 scopes used by this API.
  45. const (
  46. // View and manage your data across Google Cloud Platform services
  47. CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platform"
  48. // View your data across Google Cloud Platform services
  49. CloudPlatformReadOnlyScope = "https://www.googleapis.com/auth/cloud-platform.read-only"
  50. // Manage your data and permissions in Google Cloud Storage
  51. DevstorageFullControlScope = "https://www.googleapis.com/auth/devstorage.full_control"
  52. // View your data in Google Cloud Storage
  53. DevstorageReadOnlyScope = "https://www.googleapis.com/auth/devstorage.read_only"
  54. // Manage your data in Google Cloud Storage
  55. DevstorageReadWriteScope = "https://www.googleapis.com/auth/devstorage.read_write"
  56. )
  57. func New(client *http.Client) (*Service, error) {
  58. if client == nil {
  59. return nil, errors.New("client is nil")
  60. }
  61. s := &Service{client: client, BasePath: basePath}
  62. s.BucketAccessControls = NewBucketAccessControlsService(s)
  63. s.Buckets = NewBucketsService(s)
  64. s.Channels = NewChannelsService(s)
  65. s.DefaultObjectAccessControls = NewDefaultObjectAccessControlsService(s)
  66. s.Notifications = NewNotificationsService(s)
  67. s.ObjectAccessControls = NewObjectAccessControlsService(s)
  68. s.Objects = NewObjectsService(s)
  69. s.Projects = NewProjectsService(s)
  70. return s, nil
  71. }
  72. type Service struct {
  73. client *http.Client
  74. BasePath string // API endpoint base URL
  75. UserAgent string // optional additional User-Agent fragment
  76. BucketAccessControls *BucketAccessControlsService
  77. Buckets *BucketsService
  78. Channels *ChannelsService
  79. DefaultObjectAccessControls *DefaultObjectAccessControlsService
  80. Notifications *NotificationsService
  81. ObjectAccessControls *ObjectAccessControlsService
  82. Objects *ObjectsService
  83. Projects *ProjectsService
  84. }
  85. func (s *Service) userAgent() string {
  86. if s.UserAgent == "" {
  87. return googleapi.UserAgent
  88. }
  89. return googleapi.UserAgent + " " + s.UserAgent
  90. }
  91. func NewBucketAccessControlsService(s *Service) *BucketAccessControlsService {
  92. rs := &BucketAccessControlsService{s: s}
  93. return rs
  94. }
  95. type BucketAccessControlsService struct {
  96. s *Service
  97. }
  98. func NewBucketsService(s *Service) *BucketsService {
  99. rs := &BucketsService{s: s}
  100. return rs
  101. }
  102. type BucketsService struct {
  103. s *Service
  104. }
  105. func NewChannelsService(s *Service) *ChannelsService {
  106. rs := &ChannelsService{s: s}
  107. return rs
  108. }
  109. type ChannelsService struct {
  110. s *Service
  111. }
  112. func NewDefaultObjectAccessControlsService(s *Service) *DefaultObjectAccessControlsService {
  113. rs := &DefaultObjectAccessControlsService{s: s}
  114. return rs
  115. }
  116. type DefaultObjectAccessControlsService struct {
  117. s *Service
  118. }
  119. func NewNotificationsService(s *Service) *NotificationsService {
  120. rs := &NotificationsService{s: s}
  121. return rs
  122. }
  123. type NotificationsService struct {
  124. s *Service
  125. }
  126. func NewObjectAccessControlsService(s *Service) *ObjectAccessControlsService {
  127. rs := &ObjectAccessControlsService{s: s}
  128. return rs
  129. }
  130. type ObjectAccessControlsService struct {
  131. s *Service
  132. }
  133. func NewObjectsService(s *Service) *ObjectsService {
  134. rs := &ObjectsService{s: s}
  135. return rs
  136. }
  137. type ObjectsService struct {
  138. s *Service
  139. }
  140. func NewProjectsService(s *Service) *ProjectsService {
  141. rs := &ProjectsService{s: s}
  142. rs.ServiceAccount = NewProjectsServiceAccountService(s)
  143. return rs
  144. }
  145. type ProjectsService struct {
  146. s *Service
  147. ServiceAccount *ProjectsServiceAccountService
  148. }
  149. func NewProjectsServiceAccountService(s *Service) *ProjectsServiceAccountService {
  150. rs := &ProjectsServiceAccountService{s: s}
  151. return rs
  152. }
  153. type ProjectsServiceAccountService struct {
  154. s *Service
  155. }
  156. // Bucket: A bucket.
  157. type Bucket struct {
  158. // Acl: Access controls on the bucket.
  159. Acl []*BucketAccessControl `json:"acl,omitempty"`
  160. // Billing: The bucket's billing configuration.
  161. Billing *BucketBilling `json:"billing,omitempty"`
  162. // Cors: The bucket's Cross-Origin Resource Sharing (CORS)
  163. // configuration.
  164. Cors []*BucketCors `json:"cors,omitempty"`
  165. // DefaultEventBasedHold: The default value for event-based hold on
  166. // newly created objects in this bucket. Event-based hold is a way to
  167. // retain objects indefinitely until an event occurs, signified by the
  168. // hold's release. After being released, such objects will be subject to
  169. // bucket-level retention (if any). One sample use case of this flag is
  170. // for banks to hold loan documents for at least 3 years after loan is
  171. // paid in full. Here, bucket-level retention is 3 years and the event
  172. // is loan being paid in full. In this example, these objects will be
  173. // held intact for any number of years until the event has occurred
  174. // (event-based hold on the object is released) and then 3 more years
  175. // after that. That means retention duration of the objects begins from
  176. // the moment event-based hold transitioned from true to false. Objects
  177. // under event-based hold cannot be deleted, overwritten or archived
  178. // until the hold is removed.
  179. DefaultEventBasedHold bool `json:"defaultEventBasedHold,omitempty"`
  180. // DefaultObjectAcl: Default access controls to apply to new objects
  181. // when no ACL is provided.
  182. DefaultObjectAcl []*ObjectAccessControl `json:"defaultObjectAcl,omitempty"`
  183. // Encryption: Encryption configuration for a bucket.
  184. Encryption *BucketEncryption `json:"encryption,omitempty"`
  185. // Etag: HTTP 1.1 Entity tag for the bucket.
  186. Etag string `json:"etag,omitempty"`
  187. // Id: The ID of the bucket. For buckets, the id and name properties are
  188. // the same.
  189. Id string `json:"id,omitempty"`
  190. // Kind: The kind of item this is. For buckets, this is always
  191. // storage#bucket.
  192. Kind string `json:"kind,omitempty"`
  193. // Labels: User-provided labels, in key/value pairs.
  194. Labels map[string]string `json:"labels,omitempty"`
  195. // Lifecycle: The bucket's lifecycle configuration. See lifecycle
  196. // management for more information.
  197. Lifecycle *BucketLifecycle `json:"lifecycle,omitempty"`
  198. // Location: The location of the bucket. Object data for objects in the
  199. // bucket resides in physical storage within this region. Defaults to
  200. // US. See the developer's guide for the authoritative list.
  201. Location string `json:"location,omitempty"`
  202. // Logging: The bucket's logging configuration, which defines the
  203. // destination bucket and optional name prefix for the current bucket's
  204. // logs.
  205. Logging *BucketLogging `json:"logging,omitempty"`
  206. // Metageneration: The metadata generation of this bucket.
  207. Metageneration int64 `json:"metageneration,omitempty,string"`
  208. // Name: The name of the bucket.
  209. Name string `json:"name,omitempty"`
  210. // Owner: The owner of the bucket. This is always the project team's
  211. // owner group.
  212. Owner *BucketOwner `json:"owner,omitempty"`
  213. // ProjectNumber: The project number of the project the bucket belongs
  214. // to.
  215. ProjectNumber uint64 `json:"projectNumber,omitempty,string"`
  216. // RetentionPolicy: The bucket's retention policy. The retention policy
  217. // enforces a minimum retention time for all objects contained in the
  218. // bucket, based on their creation time. Any attempt to overwrite or
  219. // delete objects younger than the retention period will result in a
  220. // PERMISSION_DENIED error. An unlocked retention policy can be modified
  221. // or removed from the bucket via a storage.buckets.update operation. A
  222. // locked retention policy cannot be removed or shortened in duration
  223. // for the lifetime of the bucket. Attempting to remove or decrease
  224. // period of a locked retention policy will result in a
  225. // PERMISSION_DENIED error.
  226. RetentionPolicy *BucketRetentionPolicy `json:"retentionPolicy,omitempty"`
  227. // SelfLink: The URI of this bucket.
  228. SelfLink string `json:"selfLink,omitempty"`
  229. // StorageClass: The bucket's default storage class, used whenever no
  230. // storageClass is specified for a newly-created object. This defines
  231. // how objects in the bucket are stored and determines the SLA and the
  232. // cost of storage. Values include MULTI_REGIONAL, REGIONAL, STANDARD,
  233. // NEARLINE, COLDLINE, and DURABLE_REDUCED_AVAILABILITY. If this value
  234. // is not specified when the bucket is created, it will default to
  235. // STANDARD. For more information, see storage classes.
  236. StorageClass string `json:"storageClass,omitempty"`
  237. // TimeCreated: The creation time of the bucket in RFC 3339 format.
  238. TimeCreated string `json:"timeCreated,omitempty"`
  239. // Updated: The modification time of the bucket in RFC 3339 format.
  240. Updated string `json:"updated,omitempty"`
  241. // Versioning: The bucket's versioning configuration.
  242. Versioning *BucketVersioning `json:"versioning,omitempty"`
  243. // Website: The bucket's website configuration, controlling how the
  244. // service behaves when accessing bucket contents as a web site. See the
  245. // Static Website Examples for more information.
  246. Website *BucketWebsite `json:"website,omitempty"`
  247. // ServerResponse contains the HTTP response code and headers from the
  248. // server.
  249. googleapi.ServerResponse `json:"-"`
  250. // ForceSendFields is a list of field names (e.g. "Acl") to
  251. // unconditionally include in API requests. By default, fields with
  252. // empty values are omitted from API requests. However, any non-pointer,
  253. // non-interface field appearing in ForceSendFields will be sent to the
  254. // server regardless of whether the field is empty or not. This may be
  255. // used to include empty fields in Patch requests.
  256. ForceSendFields []string `json:"-"`
  257. // NullFields is a list of field names (e.g. "Acl") to include in API
  258. // requests with the JSON null value. By default, fields with empty
  259. // values are omitted from API requests. However, any field with an
  260. // empty value appearing in NullFields will be sent to the server as
  261. // null. It is an error if a field in this list has a non-empty value.
  262. // This may be used to include null fields in Patch requests.
  263. NullFields []string `json:"-"`
  264. }
  265. func (s *Bucket) MarshalJSON() ([]byte, error) {
  266. type NoMethod Bucket
  267. raw := NoMethod(*s)
  268. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  269. }
  270. // BucketBilling: The bucket's billing configuration.
  271. type BucketBilling struct {
  272. // RequesterPays: When set to true, Requester Pays is enabled for this
  273. // bucket.
  274. RequesterPays bool `json:"requesterPays,omitempty"`
  275. // ForceSendFields is a list of field names (e.g. "RequesterPays") to
  276. // unconditionally include in API requests. By default, fields with
  277. // empty values are omitted from API requests. However, any non-pointer,
  278. // non-interface field appearing in ForceSendFields will be sent to the
  279. // server regardless of whether the field is empty or not. This may be
  280. // used to include empty fields in Patch requests.
  281. ForceSendFields []string `json:"-"`
  282. // NullFields is a list of field names (e.g. "RequesterPays") to include
  283. // in API requests with the JSON null value. By default, fields with
  284. // empty values are omitted from API requests. However, any field with
  285. // an empty value appearing in NullFields will be sent to the server as
  286. // null. It is an error if a field in this list has a non-empty value.
  287. // This may be used to include null fields in Patch requests.
  288. NullFields []string `json:"-"`
  289. }
  290. func (s *BucketBilling) MarshalJSON() ([]byte, error) {
  291. type NoMethod BucketBilling
  292. raw := NoMethod(*s)
  293. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  294. }
  295. type BucketCors struct {
  296. // MaxAgeSeconds: The value, in seconds, to return in the
  297. // Access-Control-Max-Age header used in preflight responses.
  298. MaxAgeSeconds int64 `json:"maxAgeSeconds,omitempty"`
  299. // Method: The list of HTTP methods on which to include CORS response
  300. // headers, (GET, OPTIONS, POST, etc) Note: "*" is permitted in the list
  301. // of methods, and means "any method".
  302. Method []string `json:"method,omitempty"`
  303. // Origin: The list of Origins eligible to receive CORS response
  304. // headers. Note: "*" is permitted in the list of origins, and means
  305. // "any Origin".
  306. Origin []string `json:"origin,omitempty"`
  307. // ResponseHeader: The list of HTTP headers other than the simple
  308. // response headers to give permission for the user-agent to share
  309. // across domains.
  310. ResponseHeader []string `json:"responseHeader,omitempty"`
  311. // ForceSendFields is a list of field names (e.g. "MaxAgeSeconds") to
  312. // unconditionally include in API requests. By default, fields with
  313. // empty values are omitted from API requests. However, any non-pointer,
  314. // non-interface field appearing in ForceSendFields will be sent to the
  315. // server regardless of whether the field is empty or not. This may be
  316. // used to include empty fields in Patch requests.
  317. ForceSendFields []string `json:"-"`
  318. // NullFields is a list of field names (e.g. "MaxAgeSeconds") to include
  319. // in API requests with the JSON null value. By default, fields with
  320. // empty values are omitted from API requests. However, any field with
  321. // an empty value appearing in NullFields will be sent to the server as
  322. // null. It is an error if a field in this list has a non-empty value.
  323. // This may be used to include null fields in Patch requests.
  324. NullFields []string `json:"-"`
  325. }
  326. func (s *BucketCors) MarshalJSON() ([]byte, error) {
  327. type NoMethod BucketCors
  328. raw := NoMethod(*s)
  329. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  330. }
  331. // BucketEncryption: Encryption configuration for a bucket.
  332. type BucketEncryption struct {
  333. // DefaultKmsKeyName: A Cloud KMS key that will be used to encrypt
  334. // objects inserted into this bucket, if no encryption method is
  335. // specified.
  336. DefaultKmsKeyName string `json:"defaultKmsKeyName,omitempty"`
  337. // ForceSendFields is a list of field names (e.g. "DefaultKmsKeyName")
  338. // to unconditionally include in API requests. By default, fields with
  339. // empty values are omitted from API requests. However, any non-pointer,
  340. // non-interface field appearing in ForceSendFields will be sent to the
  341. // server regardless of whether the field is empty or not. This may be
  342. // used to include empty fields in Patch requests.
  343. ForceSendFields []string `json:"-"`
  344. // NullFields is a list of field names (e.g. "DefaultKmsKeyName") to
  345. // include in API requests with the JSON null value. By default, fields
  346. // with empty values are omitted from API requests. However, any field
  347. // with an empty value appearing in NullFields will be sent to the
  348. // server as null. It is an error if a field in this list has a
  349. // non-empty value. This may be used to include null fields in Patch
  350. // requests.
  351. NullFields []string `json:"-"`
  352. }
  353. func (s *BucketEncryption) MarshalJSON() ([]byte, error) {
  354. type NoMethod BucketEncryption
  355. raw := NoMethod(*s)
  356. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  357. }
  358. // BucketLifecycle: The bucket's lifecycle configuration. See lifecycle
  359. // management for more information.
  360. type BucketLifecycle struct {
  361. // Rule: A lifecycle management rule, which is made of an action to take
  362. // and the condition(s) under which the action will be taken.
  363. Rule []*BucketLifecycleRule `json:"rule,omitempty"`
  364. // ForceSendFields is a list of field names (e.g. "Rule") to
  365. // unconditionally include in API requests. By default, fields with
  366. // empty values are omitted from API requests. However, any non-pointer,
  367. // non-interface field appearing in ForceSendFields will be sent to the
  368. // server regardless of whether the field is empty or not. This may be
  369. // used to include empty fields in Patch requests.
  370. ForceSendFields []string `json:"-"`
  371. // NullFields is a list of field names (e.g. "Rule") to include in API
  372. // requests with the JSON null value. By default, fields with empty
  373. // values are omitted from API requests. However, any field with an
  374. // empty value appearing in NullFields will be sent to the server as
  375. // null. It is an error if a field in this list has a non-empty value.
  376. // This may be used to include null fields in Patch requests.
  377. NullFields []string `json:"-"`
  378. }
  379. func (s *BucketLifecycle) MarshalJSON() ([]byte, error) {
  380. type NoMethod BucketLifecycle
  381. raw := NoMethod(*s)
  382. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  383. }
  384. type BucketLifecycleRule struct {
  385. // Action: The action to take.
  386. Action *BucketLifecycleRuleAction `json:"action,omitempty"`
  387. // Condition: The condition(s) under which the action will be taken.
  388. Condition *BucketLifecycleRuleCondition `json:"condition,omitempty"`
  389. // ForceSendFields is a list of field names (e.g. "Action") to
  390. // unconditionally include in API requests. By default, fields with
  391. // empty values are omitted from API requests. However, any non-pointer,
  392. // non-interface field appearing in ForceSendFields will be sent to the
  393. // server regardless of whether the field is empty or not. This may be
  394. // used to include empty fields in Patch requests.
  395. ForceSendFields []string `json:"-"`
  396. // NullFields is a list of field names (e.g. "Action") to include in API
  397. // requests with the JSON null value. By default, fields with empty
  398. // values are omitted from API requests. However, any field with an
  399. // empty value appearing in NullFields will be sent to the server as
  400. // null. It is an error if a field in this list has a non-empty value.
  401. // This may be used to include null fields in Patch requests.
  402. NullFields []string `json:"-"`
  403. }
  404. func (s *BucketLifecycleRule) MarshalJSON() ([]byte, error) {
  405. type NoMethod BucketLifecycleRule
  406. raw := NoMethod(*s)
  407. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  408. }
  409. // BucketLifecycleRuleAction: The action to take.
  410. type BucketLifecycleRuleAction struct {
  411. // StorageClass: Target storage class. Required iff the type of the
  412. // action is SetStorageClass.
  413. StorageClass string `json:"storageClass,omitempty"`
  414. // Type: Type of the action. Currently, only Delete and SetStorageClass
  415. // are supported.
  416. Type string `json:"type,omitempty"`
  417. // ForceSendFields is a list of field names (e.g. "StorageClass") to
  418. // unconditionally include in API requests. By default, fields with
  419. // empty values are omitted from API requests. However, any non-pointer,
  420. // non-interface field appearing in ForceSendFields will be sent to the
  421. // server regardless of whether the field is empty or not. This may be
  422. // used to include empty fields in Patch requests.
  423. ForceSendFields []string `json:"-"`
  424. // NullFields is a list of field names (e.g. "StorageClass") to include
  425. // in API requests with the JSON null value. By default, fields with
  426. // empty values are omitted from API requests. However, any field with
  427. // an empty value appearing in NullFields will be sent to the server as
  428. // null. It is an error if a field in this list has a non-empty value.
  429. // This may be used to include null fields in Patch requests.
  430. NullFields []string `json:"-"`
  431. }
  432. func (s *BucketLifecycleRuleAction) MarshalJSON() ([]byte, error) {
  433. type NoMethod BucketLifecycleRuleAction
  434. raw := NoMethod(*s)
  435. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  436. }
  437. // BucketLifecycleRuleCondition: The condition(s) under which the action
  438. // will be taken.
  439. type BucketLifecycleRuleCondition struct {
  440. // Age: Age of an object (in days). This condition is satisfied when an
  441. // object reaches the specified age.
  442. Age int64 `json:"age,omitempty"`
  443. // CreatedBefore: A date in RFC 3339 format with only the date part (for
  444. // instance, "2013-01-15"). This condition is satisfied when an object
  445. // is created before midnight of the specified date in UTC.
  446. CreatedBefore string `json:"createdBefore,omitempty"`
  447. // IsLive: Relevant only for versioned objects. If the value is true,
  448. // this condition matches live objects; if the value is false, it
  449. // matches archived objects.
  450. IsLive *bool `json:"isLive,omitempty"`
  451. // MatchesStorageClass: Objects having any of the storage classes
  452. // specified by this condition will be matched. Values include
  453. // MULTI_REGIONAL, REGIONAL, NEARLINE, COLDLINE, STANDARD, and
  454. // DURABLE_REDUCED_AVAILABILITY.
  455. MatchesStorageClass []string `json:"matchesStorageClass,omitempty"`
  456. // NumNewerVersions: Relevant only for versioned objects. If the value
  457. // is N, this condition is satisfied when there are at least N versions
  458. // (including the live version) newer than this version of the object.
  459. NumNewerVersions int64 `json:"numNewerVersions,omitempty"`
  460. // ForceSendFields is a list of field names (e.g. "Age") to
  461. // unconditionally include in API requests. By default, fields with
  462. // empty values are omitted from API requests. However, any non-pointer,
  463. // non-interface field appearing in ForceSendFields will be sent to the
  464. // server regardless of whether the field is empty or not. This may be
  465. // used to include empty fields in Patch requests.
  466. ForceSendFields []string `json:"-"`
  467. // NullFields is a list of field names (e.g. "Age") to include in API
  468. // requests with the JSON null value. By default, fields with empty
  469. // values are omitted from API requests. However, any field with an
  470. // empty value appearing in NullFields will be sent to the server as
  471. // null. It is an error if a field in this list has a non-empty value.
  472. // This may be used to include null fields in Patch requests.
  473. NullFields []string `json:"-"`
  474. }
  475. func (s *BucketLifecycleRuleCondition) MarshalJSON() ([]byte, error) {
  476. type NoMethod BucketLifecycleRuleCondition
  477. raw := NoMethod(*s)
  478. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  479. }
  480. // BucketLogging: The bucket's logging configuration, which defines the
  481. // destination bucket and optional name prefix for the current bucket's
  482. // logs.
  483. type BucketLogging struct {
  484. // LogBucket: The destination bucket where the current bucket's logs
  485. // should be placed.
  486. LogBucket string `json:"logBucket,omitempty"`
  487. // LogObjectPrefix: A prefix for log object names.
  488. LogObjectPrefix string `json:"logObjectPrefix,omitempty"`
  489. // ForceSendFields is a list of field names (e.g. "LogBucket") to
  490. // unconditionally include in API requests. By default, fields with
  491. // empty values are omitted from API requests. However, any non-pointer,
  492. // non-interface field appearing in ForceSendFields will be sent to the
  493. // server regardless of whether the field is empty or not. This may be
  494. // used to include empty fields in Patch requests.
  495. ForceSendFields []string `json:"-"`
  496. // NullFields is a list of field names (e.g. "LogBucket") to include in
  497. // API requests with the JSON null value. By default, fields with empty
  498. // values are omitted from API requests. However, any field with an
  499. // empty value appearing in NullFields will be sent to the server as
  500. // null. It is an error if a field in this list has a non-empty value.
  501. // This may be used to include null fields in Patch requests.
  502. NullFields []string `json:"-"`
  503. }
  504. func (s *BucketLogging) MarshalJSON() ([]byte, error) {
  505. type NoMethod BucketLogging
  506. raw := NoMethod(*s)
  507. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  508. }
  509. // BucketOwner: The owner of the bucket. This is always the project
  510. // team's owner group.
  511. type BucketOwner struct {
  512. // Entity: The entity, in the form project-owner-projectId.
  513. Entity string `json:"entity,omitempty"`
  514. // EntityId: The ID for the entity.
  515. EntityId string `json:"entityId,omitempty"`
  516. // ForceSendFields is a list of field names (e.g. "Entity") to
  517. // unconditionally include in API requests. By default, fields with
  518. // empty values are omitted from API requests. However, any non-pointer,
  519. // non-interface field appearing in ForceSendFields will be sent to the
  520. // server regardless of whether the field is empty or not. This may be
  521. // used to include empty fields in Patch requests.
  522. ForceSendFields []string `json:"-"`
  523. // NullFields is a list of field names (e.g. "Entity") to include in API
  524. // requests with the JSON null value. By default, fields with empty
  525. // values are omitted from API requests. However, any field with an
  526. // empty value appearing in NullFields will be sent to the server as
  527. // null. It is an error if a field in this list has a non-empty value.
  528. // This may be used to include null fields in Patch requests.
  529. NullFields []string `json:"-"`
  530. }
  531. func (s *BucketOwner) MarshalJSON() ([]byte, error) {
  532. type NoMethod BucketOwner
  533. raw := NoMethod(*s)
  534. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  535. }
  536. // BucketRetentionPolicy: The bucket's retention policy. The retention
  537. // policy enforces a minimum retention time for all objects contained in
  538. // the bucket, based on their creation time. Any attempt to overwrite or
  539. // delete objects younger than the retention period will result in a
  540. // PERMISSION_DENIED error. An unlocked retention policy can be modified
  541. // or removed from the bucket via a storage.buckets.update operation. A
  542. // locked retention policy cannot be removed or shortened in duration
  543. // for the lifetime of the bucket. Attempting to remove or decrease
  544. // period of a locked retention policy will result in a
  545. // PERMISSION_DENIED error.
  546. type BucketRetentionPolicy struct {
  547. // EffectiveTime: Server-determined value that indicates the time from
  548. // which policy was enforced and effective. This value is in RFC 3339
  549. // format.
  550. EffectiveTime string `json:"effectiveTime,omitempty"`
  551. // IsLocked: Once locked, an object retention policy cannot be modified.
  552. IsLocked bool `json:"isLocked,omitempty"`
  553. // RetentionPeriod: The duration in seconds that objects need to be
  554. // retained. Retention duration must be greater than zero and less than
  555. // 100 years. Note that enforcement of retention periods less than a day
  556. // is not guaranteed. Such periods should only be used for testing
  557. // purposes.
  558. RetentionPeriod int64 `json:"retentionPeriod,omitempty,string"`
  559. // ForceSendFields is a list of field names (e.g. "EffectiveTime") to
  560. // unconditionally include in API requests. By default, fields with
  561. // empty values are omitted from API requests. However, any non-pointer,
  562. // non-interface field appearing in ForceSendFields will be sent to the
  563. // server regardless of whether the field is empty or not. This may be
  564. // used to include empty fields in Patch requests.
  565. ForceSendFields []string `json:"-"`
  566. // NullFields is a list of field names (e.g. "EffectiveTime") to include
  567. // in API requests with the JSON null value. By default, fields with
  568. // empty values are omitted from API requests. However, any field with
  569. // an empty value appearing in NullFields will be sent to the server as
  570. // null. It is an error if a field in this list has a non-empty value.
  571. // This may be used to include null fields in Patch requests.
  572. NullFields []string `json:"-"`
  573. }
  574. func (s *BucketRetentionPolicy) MarshalJSON() ([]byte, error) {
  575. type NoMethod BucketRetentionPolicy
  576. raw := NoMethod(*s)
  577. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  578. }
  579. // BucketVersioning: The bucket's versioning configuration.
  580. type BucketVersioning struct {
  581. // Enabled: While set to true, versioning is fully enabled for this
  582. // bucket.
  583. Enabled bool `json:"enabled,omitempty"`
  584. // ForceSendFields is a list of field names (e.g. "Enabled") to
  585. // unconditionally include in API requests. By default, fields with
  586. // empty values are omitted from API requests. However, any non-pointer,
  587. // non-interface field appearing in ForceSendFields will be sent to the
  588. // server regardless of whether the field is empty or not. This may be
  589. // used to include empty fields in Patch requests.
  590. ForceSendFields []string `json:"-"`
  591. // NullFields is a list of field names (e.g. "Enabled") to include in
  592. // API requests with the JSON null value. By default, fields with empty
  593. // values are omitted from API requests. However, any field with an
  594. // empty value appearing in NullFields will be sent to the server as
  595. // null. It is an error if a field in this list has a non-empty value.
  596. // This may be used to include null fields in Patch requests.
  597. NullFields []string `json:"-"`
  598. }
  599. func (s *BucketVersioning) MarshalJSON() ([]byte, error) {
  600. type NoMethod BucketVersioning
  601. raw := NoMethod(*s)
  602. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  603. }
  604. // BucketWebsite: The bucket's website configuration, controlling how
  605. // the service behaves when accessing bucket contents as a web site. See
  606. // the Static Website Examples for more information.
  607. type BucketWebsite struct {
  608. // MainPageSuffix: If the requested object path is missing, the service
  609. // will ensure the path has a trailing '/', append this suffix, and
  610. // attempt to retrieve the resulting object. This allows the creation of
  611. // index.html objects to represent directory pages.
  612. MainPageSuffix string `json:"mainPageSuffix,omitempty"`
  613. // NotFoundPage: If the requested object path is missing, and any
  614. // mainPageSuffix object is missing, if applicable, the service will
  615. // return the named object from this bucket as the content for a 404 Not
  616. // Found result.
  617. NotFoundPage string `json:"notFoundPage,omitempty"`
  618. // ForceSendFields is a list of field names (e.g. "MainPageSuffix") to
  619. // unconditionally include in API requests. By default, fields with
  620. // empty values are omitted from API requests. However, any non-pointer,
  621. // non-interface field appearing in ForceSendFields will be sent to the
  622. // server regardless of whether the field is empty or not. This may be
  623. // used to include empty fields in Patch requests.
  624. ForceSendFields []string `json:"-"`
  625. // NullFields is a list of field names (e.g. "MainPageSuffix") to
  626. // include in API requests with the JSON null value. By default, fields
  627. // with empty values are omitted from API requests. However, any field
  628. // with an empty value appearing in NullFields will be sent to the
  629. // server as null. It is an error if a field in this list has a
  630. // non-empty value. This may be used to include null fields in Patch
  631. // requests.
  632. NullFields []string `json:"-"`
  633. }
  634. func (s *BucketWebsite) MarshalJSON() ([]byte, error) {
  635. type NoMethod BucketWebsite
  636. raw := NoMethod(*s)
  637. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  638. }
  639. // BucketAccessControl: An access-control entry.
  640. type BucketAccessControl struct {
  641. // Bucket: The name of the bucket.
  642. Bucket string `json:"bucket,omitempty"`
  643. // Domain: The domain associated with the entity, if any.
  644. Domain string `json:"domain,omitempty"`
  645. // Email: The email address associated with the entity, if any.
  646. Email string `json:"email,omitempty"`
  647. // Entity: The entity holding the permission, in one of the following
  648. // forms:
  649. // - user-userId
  650. // - user-email
  651. // - group-groupId
  652. // - group-email
  653. // - domain-domain
  654. // - project-team-projectId
  655. // - allUsers
  656. // - allAuthenticatedUsers Examples:
  657. // - The user liz@example.com would be user-liz@example.com.
  658. // - The group example@googlegroups.com would be
  659. // group-example@googlegroups.com.
  660. // - To refer to all members of the Google Apps for Business domain
  661. // example.com, the entity would be domain-example.com.
  662. Entity string `json:"entity,omitempty"`
  663. // EntityId: The ID for the entity, if any.
  664. EntityId string `json:"entityId,omitempty"`
  665. // Etag: HTTP 1.1 Entity tag for the access-control entry.
  666. Etag string `json:"etag,omitempty"`
  667. // Id: The ID of the access-control entry.
  668. Id string `json:"id,omitempty"`
  669. // Kind: The kind of item this is. For bucket access control entries,
  670. // this is always storage#bucketAccessControl.
  671. Kind string `json:"kind,omitempty"`
  672. // ProjectTeam: The project team associated with the entity, if any.
  673. ProjectTeam *BucketAccessControlProjectTeam `json:"projectTeam,omitempty"`
  674. // Role: The access permission for the entity.
  675. Role string `json:"role,omitempty"`
  676. // SelfLink: The link to this access-control entry.
  677. SelfLink string `json:"selfLink,omitempty"`
  678. // ServerResponse contains the HTTP response code and headers from the
  679. // server.
  680. googleapi.ServerResponse `json:"-"`
  681. // ForceSendFields is a list of field names (e.g. "Bucket") to
  682. // unconditionally include in API requests. By default, fields with
  683. // empty values are omitted from API requests. However, any non-pointer,
  684. // non-interface field appearing in ForceSendFields will be sent to the
  685. // server regardless of whether the field is empty or not. This may be
  686. // used to include empty fields in Patch requests.
  687. ForceSendFields []string `json:"-"`
  688. // NullFields is a list of field names (e.g. "Bucket") to include in API
  689. // requests with the JSON null value. By default, fields with empty
  690. // values are omitted from API requests. However, any field with an
  691. // empty value appearing in NullFields will be sent to the server as
  692. // null. It is an error if a field in this list has a non-empty value.
  693. // This may be used to include null fields in Patch requests.
  694. NullFields []string `json:"-"`
  695. }
  696. func (s *BucketAccessControl) MarshalJSON() ([]byte, error) {
  697. type NoMethod BucketAccessControl
  698. raw := NoMethod(*s)
  699. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  700. }
  701. // BucketAccessControlProjectTeam: The project team associated with the
  702. // entity, if any.
  703. type BucketAccessControlProjectTeam struct {
  704. // ProjectNumber: The project number.
  705. ProjectNumber string `json:"projectNumber,omitempty"`
  706. // Team: The team.
  707. Team string `json:"team,omitempty"`
  708. // ForceSendFields is a list of field names (e.g. "ProjectNumber") to
  709. // unconditionally include in API requests. By default, fields with
  710. // empty values are omitted from API requests. However, any non-pointer,
  711. // non-interface field appearing in ForceSendFields will be sent to the
  712. // server regardless of whether the field is empty or not. This may be
  713. // used to include empty fields in Patch requests.
  714. ForceSendFields []string `json:"-"`
  715. // NullFields is a list of field names (e.g. "ProjectNumber") to include
  716. // in API requests with the JSON null value. By default, fields with
  717. // empty values are omitted from API requests. However, any field with
  718. // an empty value appearing in NullFields will be sent to the server as
  719. // null. It is an error if a field in this list has a non-empty value.
  720. // This may be used to include null fields in Patch requests.
  721. NullFields []string `json:"-"`
  722. }
  723. func (s *BucketAccessControlProjectTeam) MarshalJSON() ([]byte, error) {
  724. type NoMethod BucketAccessControlProjectTeam
  725. raw := NoMethod(*s)
  726. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  727. }
  728. // BucketAccessControls: An access-control list.
  729. type BucketAccessControls struct {
  730. // Items: The list of items.
  731. Items []*BucketAccessControl `json:"items,omitempty"`
  732. // Kind: The kind of item this is. For lists of bucket access control
  733. // entries, this is always storage#bucketAccessControls.
  734. Kind string `json:"kind,omitempty"`
  735. // ServerResponse contains the HTTP response code and headers from the
  736. // server.
  737. googleapi.ServerResponse `json:"-"`
  738. // ForceSendFields is a list of field names (e.g. "Items") to
  739. // unconditionally include in API requests. By default, fields with
  740. // empty values are omitted from API requests. However, any non-pointer,
  741. // non-interface field appearing in ForceSendFields will be sent to the
  742. // server regardless of whether the field is empty or not. This may be
  743. // used to include empty fields in Patch requests.
  744. ForceSendFields []string `json:"-"`
  745. // NullFields is a list of field names (e.g. "Items") to include in API
  746. // requests with the JSON null value. By default, fields with empty
  747. // values are omitted from API requests. However, any field with an
  748. // empty value appearing in NullFields will be sent to the server as
  749. // null. It is an error if a field in this list has a non-empty value.
  750. // This may be used to include null fields in Patch requests.
  751. NullFields []string `json:"-"`
  752. }
  753. func (s *BucketAccessControls) MarshalJSON() ([]byte, error) {
  754. type NoMethod BucketAccessControls
  755. raw := NoMethod(*s)
  756. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  757. }
  758. // Buckets: A list of buckets.
  759. type Buckets struct {
  760. // Items: The list of items.
  761. Items []*Bucket `json:"items,omitempty"`
  762. // Kind: The kind of item this is. For lists of buckets, this is always
  763. // storage#buckets.
  764. Kind string `json:"kind,omitempty"`
  765. // NextPageToken: The continuation token, used to page through large
  766. // result sets. Provide this value in a subsequent request to return the
  767. // next page of results.
  768. NextPageToken string `json:"nextPageToken,omitempty"`
  769. // ServerResponse contains the HTTP response code and headers from the
  770. // server.
  771. googleapi.ServerResponse `json:"-"`
  772. // ForceSendFields is a list of field names (e.g. "Items") to
  773. // unconditionally include in API requests. By default, fields with
  774. // empty values are omitted from API requests. However, any non-pointer,
  775. // non-interface field appearing in ForceSendFields will be sent to the
  776. // server regardless of whether the field is empty or not. This may be
  777. // used to include empty fields in Patch requests.
  778. ForceSendFields []string `json:"-"`
  779. // NullFields is a list of field names (e.g. "Items") to include in API
  780. // requests with the JSON null value. By default, fields with empty
  781. // values are omitted from API requests. However, any field with an
  782. // empty value appearing in NullFields will be sent to the server as
  783. // null. It is an error if a field in this list has a non-empty value.
  784. // This may be used to include null fields in Patch requests.
  785. NullFields []string `json:"-"`
  786. }
  787. func (s *Buckets) MarshalJSON() ([]byte, error) {
  788. type NoMethod Buckets
  789. raw := NoMethod(*s)
  790. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  791. }
  792. // Channel: An notification channel used to watch for resource changes.
  793. type Channel struct {
  794. // Address: The address where notifications are delivered for this
  795. // channel.
  796. Address string `json:"address,omitempty"`
  797. // Expiration: Date and time of notification channel expiration,
  798. // expressed as a Unix timestamp, in milliseconds. Optional.
  799. Expiration int64 `json:"expiration,omitempty,string"`
  800. // Id: A UUID or similar unique string that identifies this channel.
  801. Id string `json:"id,omitempty"`
  802. // Kind: Identifies this as a notification channel used to watch for
  803. // changes to a resource. Value: the fixed string "api#channel".
  804. Kind string `json:"kind,omitempty"`
  805. // Params: Additional parameters controlling delivery channel behavior.
  806. // Optional.
  807. Params map[string]string `json:"params,omitempty"`
  808. // Payload: A Boolean value to indicate whether payload is wanted.
  809. // Optional.
  810. Payload bool `json:"payload,omitempty"`
  811. // ResourceId: An opaque ID that identifies the resource being watched
  812. // on this channel. Stable across different API versions.
  813. ResourceId string `json:"resourceId,omitempty"`
  814. // ResourceUri: A version-specific identifier for the watched resource.
  815. ResourceUri string `json:"resourceUri,omitempty"`
  816. // Token: An arbitrary string delivered to the target address with each
  817. // notification delivered over this channel. Optional.
  818. Token string `json:"token,omitempty"`
  819. // Type: The type of delivery mechanism used for this channel.
  820. Type string `json:"type,omitempty"`
  821. // ServerResponse contains the HTTP response code and headers from the
  822. // server.
  823. googleapi.ServerResponse `json:"-"`
  824. // ForceSendFields is a list of field names (e.g. "Address") to
  825. // unconditionally include in API requests. By default, fields with
  826. // empty values are omitted from API requests. However, any non-pointer,
  827. // non-interface field appearing in ForceSendFields will be sent to the
  828. // server regardless of whether the field is empty or not. This may be
  829. // used to include empty fields in Patch requests.
  830. ForceSendFields []string `json:"-"`
  831. // NullFields is a list of field names (e.g. "Address") to include in
  832. // API requests with the JSON null value. By default, fields with empty
  833. // values are omitted from API requests. However, any field with an
  834. // empty value appearing in NullFields will be sent to the server as
  835. // null. It is an error if a field in this list has a non-empty value.
  836. // This may be used to include null fields in Patch requests.
  837. NullFields []string `json:"-"`
  838. }
  839. func (s *Channel) MarshalJSON() ([]byte, error) {
  840. type NoMethod Channel
  841. raw := NoMethod(*s)
  842. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  843. }
  844. // ComposeRequest: A Compose request.
  845. type ComposeRequest struct {
  846. // Destination: Properties of the resulting object.
  847. Destination *Object `json:"destination,omitempty"`
  848. // Kind: The kind of item this is.
  849. Kind string `json:"kind,omitempty"`
  850. // SourceObjects: The list of source objects that will be concatenated
  851. // into a single object.
  852. SourceObjects []*ComposeRequestSourceObjects `json:"sourceObjects,omitempty"`
  853. // ForceSendFields is a list of field names (e.g. "Destination") to
  854. // unconditionally include in API requests. By default, fields with
  855. // empty values are omitted from API requests. However, any non-pointer,
  856. // non-interface field appearing in ForceSendFields will be sent to the
  857. // server regardless of whether the field is empty or not. This may be
  858. // used to include empty fields in Patch requests.
  859. ForceSendFields []string `json:"-"`
  860. // NullFields is a list of field names (e.g. "Destination") to include
  861. // in API requests with the JSON null value. By default, fields with
  862. // empty values are omitted from API requests. However, any field with
  863. // an empty value appearing in NullFields will be sent to the server as
  864. // null. It is an error if a field in this list has a non-empty value.
  865. // This may be used to include null fields in Patch requests.
  866. NullFields []string `json:"-"`
  867. }
  868. func (s *ComposeRequest) MarshalJSON() ([]byte, error) {
  869. type NoMethod ComposeRequest
  870. raw := NoMethod(*s)
  871. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  872. }
  873. type ComposeRequestSourceObjects struct {
  874. // Generation: The generation of this object to use as the source.
  875. Generation int64 `json:"generation,omitempty,string"`
  876. // Name: The source object's name. The source object's bucket is
  877. // implicitly the destination bucket.
  878. Name string `json:"name,omitempty"`
  879. // ObjectPreconditions: Conditions that must be met for this operation
  880. // to execute.
  881. ObjectPreconditions *ComposeRequestSourceObjectsObjectPreconditions `json:"objectPreconditions,omitempty"`
  882. // ForceSendFields is a list of field names (e.g. "Generation") to
  883. // unconditionally include in API requests. By default, fields with
  884. // empty values are omitted from API requests. However, any non-pointer,
  885. // non-interface field appearing in ForceSendFields will be sent to the
  886. // server regardless of whether the field is empty or not. This may be
  887. // used to include empty fields in Patch requests.
  888. ForceSendFields []string `json:"-"`
  889. // NullFields is a list of field names (e.g. "Generation") to include in
  890. // API requests with the JSON null value. By default, fields with empty
  891. // values are omitted from API requests. However, any field with an
  892. // empty value appearing in NullFields will be sent to the server as
  893. // null. It is an error if a field in this list has a non-empty value.
  894. // This may be used to include null fields in Patch requests.
  895. NullFields []string `json:"-"`
  896. }
  897. func (s *ComposeRequestSourceObjects) MarshalJSON() ([]byte, error) {
  898. type NoMethod ComposeRequestSourceObjects
  899. raw := NoMethod(*s)
  900. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  901. }
  902. // ComposeRequestSourceObjectsObjectPreconditions: Conditions that must
  903. // be met for this operation to execute.
  904. type ComposeRequestSourceObjectsObjectPreconditions struct {
  905. // IfGenerationMatch: Only perform the composition if the generation of
  906. // the source object that would be used matches this value. If this
  907. // value and a generation are both specified, they must be the same
  908. // value or the call will fail.
  909. IfGenerationMatch int64 `json:"ifGenerationMatch,omitempty,string"`
  910. // ForceSendFields is a list of field names (e.g. "IfGenerationMatch")
  911. // to unconditionally include in API requests. By default, fields with
  912. // empty values are omitted from API requests. However, any non-pointer,
  913. // non-interface field appearing in ForceSendFields will be sent to the
  914. // server regardless of whether the field is empty or not. This may be
  915. // used to include empty fields in Patch requests.
  916. ForceSendFields []string `json:"-"`
  917. // NullFields is a list of field names (e.g. "IfGenerationMatch") to
  918. // include in API requests with the JSON null value. By default, fields
  919. // with empty values are omitted from API requests. However, any field
  920. // with an empty value appearing in NullFields will be sent to the
  921. // server as null. It is an error if a field in this list has a
  922. // non-empty value. This may be used to include null fields in Patch
  923. // requests.
  924. NullFields []string `json:"-"`
  925. }
  926. func (s *ComposeRequestSourceObjectsObjectPreconditions) MarshalJSON() ([]byte, error) {
  927. type NoMethod ComposeRequestSourceObjectsObjectPreconditions
  928. raw := NoMethod(*s)
  929. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  930. }
  931. // Notification: A subscription to receive Google PubSub notifications.
  932. type Notification struct {
  933. // CustomAttributes: An optional list of additional attributes to attach
  934. // to each Cloud PubSub message published for this notification
  935. // subscription.
  936. CustomAttributes map[string]string `json:"custom_attributes,omitempty"`
  937. // Etag: HTTP 1.1 Entity tag for this subscription notification.
  938. Etag string `json:"etag,omitempty"`
  939. // EventTypes: If present, only send notifications about listed event
  940. // types. If empty, sent notifications for all event types.
  941. EventTypes []string `json:"event_types,omitempty"`
  942. // Id: The ID of the notification.
  943. Id string `json:"id,omitempty"`
  944. // Kind: The kind of item this is. For notifications, this is always
  945. // storage#notification.
  946. Kind string `json:"kind,omitempty"`
  947. // ObjectNamePrefix: If present, only apply this notification
  948. // configuration to object names that begin with this prefix.
  949. ObjectNamePrefix string `json:"object_name_prefix,omitempty"`
  950. // PayloadFormat: The desired content of the Payload.
  951. PayloadFormat string `json:"payload_format,omitempty"`
  952. // SelfLink: The canonical URL of this notification.
  953. SelfLink string `json:"selfLink,omitempty"`
  954. // Topic: The Cloud PubSub topic to which this subscription publishes.
  955. // Formatted as:
  956. // '//pubsub.googleapis.com/projects/{project-identifier}/topics/{my-topi
  957. // c}'
  958. Topic string `json:"topic,omitempty"`
  959. // ServerResponse contains the HTTP response code and headers from the
  960. // server.
  961. googleapi.ServerResponse `json:"-"`
  962. // ForceSendFields is a list of field names (e.g. "CustomAttributes") to
  963. // unconditionally include in API requests. By default, fields with
  964. // empty values are omitted from API requests. However, any non-pointer,
  965. // non-interface field appearing in ForceSendFields will be sent to the
  966. // server regardless of whether the field is empty or not. This may be
  967. // used to include empty fields in Patch requests.
  968. ForceSendFields []string `json:"-"`
  969. // NullFields is a list of field names (e.g. "CustomAttributes") to
  970. // include in API requests with the JSON null value. By default, fields
  971. // with empty values are omitted from API requests. However, any field
  972. // with an empty value appearing in NullFields will be sent to the
  973. // server as null. It is an error if a field in this list has a
  974. // non-empty value. This may be used to include null fields in Patch
  975. // requests.
  976. NullFields []string `json:"-"`
  977. }
  978. func (s *Notification) MarshalJSON() ([]byte, error) {
  979. type NoMethod Notification
  980. raw := NoMethod(*s)
  981. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  982. }
  983. // Notifications: A list of notification subscriptions.
  984. type Notifications struct {
  985. // Items: The list of items.
  986. Items []*Notification `json:"items,omitempty"`
  987. // Kind: The kind of item this is. For lists of notifications, this is
  988. // always storage#notifications.
  989. Kind string `json:"kind,omitempty"`
  990. // ServerResponse contains the HTTP response code and headers from the
  991. // server.
  992. googleapi.ServerResponse `json:"-"`
  993. // ForceSendFields is a list of field names (e.g. "Items") to
  994. // unconditionally include in API requests. By default, fields with
  995. // empty values are omitted from API requests. However, any non-pointer,
  996. // non-interface field appearing in ForceSendFields will be sent to the
  997. // server regardless of whether the field is empty or not. This may be
  998. // used to include empty fields in Patch requests.
  999. ForceSendFields []string `json:"-"`
  1000. // NullFields is a list of field names (e.g. "Items") to include in API
  1001. // requests with the JSON null value. By default, fields with empty
  1002. // values are omitted from API requests. However, any field with an
  1003. // empty value appearing in NullFields will be sent to the server as
  1004. // null. It is an error if a field in this list has a non-empty value.
  1005. // This may be used to include null fields in Patch requests.
  1006. NullFields []string `json:"-"`
  1007. }
  1008. func (s *Notifications) MarshalJSON() ([]byte, error) {
  1009. type NoMethod Notifications
  1010. raw := NoMethod(*s)
  1011. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1012. }
  1013. // Object: An object.
  1014. type Object struct {
  1015. // Acl: Access controls on the object.
  1016. Acl []*ObjectAccessControl `json:"acl,omitempty"`
  1017. // Bucket: The name of the bucket containing this object.
  1018. Bucket string `json:"bucket,omitempty"`
  1019. // CacheControl: Cache-Control directive for the object data. If
  1020. // omitted, and the object is accessible to all anonymous users, the
  1021. // default will be public, max-age=3600.
  1022. CacheControl string `json:"cacheControl,omitempty"`
  1023. // ComponentCount: Number of underlying components that make up this
  1024. // object. Components are accumulated by compose operations.
  1025. ComponentCount int64 `json:"componentCount,omitempty"`
  1026. // ContentDisposition: Content-Disposition of the object data.
  1027. ContentDisposition string `json:"contentDisposition,omitempty"`
  1028. // ContentEncoding: Content-Encoding of the object data.
  1029. ContentEncoding string `json:"contentEncoding,omitempty"`
  1030. // ContentLanguage: Content-Language of the object data.
  1031. ContentLanguage string `json:"contentLanguage,omitempty"`
  1032. // ContentType: Content-Type of the object data. If an object is stored
  1033. // without a Content-Type, it is served as application/octet-stream.
  1034. ContentType string `json:"contentType,omitempty"`
  1035. // Crc32c: CRC32c checksum, as described in RFC 4960, Appendix B;
  1036. // encoded using base64 in big-endian byte order. For more information
  1037. // about using the CRC32c checksum, see Hashes and ETags: Best
  1038. // Practices.
  1039. Crc32c string `json:"crc32c,omitempty"`
  1040. // CustomerEncryption: Metadata of customer-supplied encryption key, if
  1041. // the object is encrypted by such a key.
  1042. CustomerEncryption *ObjectCustomerEncryption `json:"customerEncryption,omitempty"`
  1043. // Etag: HTTP 1.1 Entity tag for the object.
  1044. Etag string `json:"etag,omitempty"`
  1045. // EventBasedHold: Whether an object is under event-based hold.
  1046. // Event-based hold is a way to retain objects until an event occurs,
  1047. // which is signified by the hold's release (i.e. this value is set to
  1048. // false). After being released (set to false), such objects will be
  1049. // subject to bucket-level retention (if any). One sample use case of
  1050. // this flag is for banks to hold loan documents for at least 3 years
  1051. // after loan is paid in full. Here, bucket-level retention is 3 years
  1052. // and the event is the loan being paid in full. In this example, these
  1053. // objects will be held intact for any number of years until the event
  1054. // has occurred (event-based hold on the object is released) and then 3
  1055. // more years after that. That means retention duration of the objects
  1056. // begins from the moment event-based hold transitioned from true to
  1057. // false.
  1058. EventBasedHold bool `json:"eventBasedHold,omitempty"`
  1059. // Generation: The content generation of this object. Used for object
  1060. // versioning.
  1061. Generation int64 `json:"generation,omitempty,string"`
  1062. // Id: The ID of the object, including the bucket name, object name, and
  1063. // generation number.
  1064. Id string `json:"id,omitempty"`
  1065. // Kind: The kind of item this is. For objects, this is always
  1066. // storage#object.
  1067. Kind string `json:"kind,omitempty"`
  1068. // KmsKeyName: Cloud KMS Key used to encrypt this object, if the object
  1069. // is encrypted by such a key. Limited availability; usable only by
  1070. // enabled projects.
  1071. KmsKeyName string `json:"kmsKeyName,omitempty"`
  1072. // Md5Hash: MD5 hash of the data; encoded using base64. For more
  1073. // information about using the MD5 hash, see Hashes and ETags: Best
  1074. // Practices.
  1075. Md5Hash string `json:"md5Hash,omitempty"`
  1076. // MediaLink: Media download link.
  1077. MediaLink string `json:"mediaLink,omitempty"`
  1078. // Metadata: User-provided metadata, in key/value pairs.
  1079. Metadata map[string]string `json:"metadata,omitempty"`
  1080. // Metageneration: The version of the metadata for this object at this
  1081. // generation. Used for preconditions and for detecting changes in
  1082. // metadata. A metageneration number is only meaningful in the context
  1083. // of a particular generation of a particular object.
  1084. Metageneration int64 `json:"metageneration,omitempty,string"`
  1085. // Name: The name of the object. Required if not specified by URL
  1086. // parameter.
  1087. Name string `json:"name,omitempty"`
  1088. // Owner: The owner of the object. This will always be the uploader of
  1089. // the object.
  1090. Owner *ObjectOwner `json:"owner,omitempty"`
  1091. // RetentionExpirationTime: A server-determined value that specifies the
  1092. // earliest time that the object's retention period expires. This value
  1093. // is in RFC 3339 format. Note 1: This field is not provided for objects
  1094. // with an active event-based hold, since retention expiration is
  1095. // unknown until the hold is removed. Note 2: This value can be provided
  1096. // even when temporary hold is set (so that the user can reason about
  1097. // policy without having to first unset the temporary hold).
  1098. RetentionExpirationTime string `json:"retentionExpirationTime,omitempty"`
  1099. // SelfLink: The link to this object.
  1100. SelfLink string `json:"selfLink,omitempty"`
  1101. // Size: Content-Length of the data in bytes.
  1102. Size uint64 `json:"size,omitempty,string"`
  1103. // StorageClass: Storage class of the object.
  1104. StorageClass string `json:"storageClass,omitempty"`
  1105. // TemporaryHold: Whether an object is under temporary hold. While this
  1106. // flag is set to true, the object is protected against deletion and
  1107. // overwrites. A common use case of this flag is regulatory
  1108. // investigations where objects need to be retained while the
  1109. // investigation is ongoing. Note that unlike event-based hold,
  1110. // temporary hold does not impact retention expiration time of an
  1111. // object.
  1112. TemporaryHold bool `json:"temporaryHold,omitempty"`
  1113. // TimeCreated: The creation time of the object in RFC 3339 format.
  1114. TimeCreated string `json:"timeCreated,omitempty"`
  1115. // TimeDeleted: The deletion time of the object in RFC 3339 format. Will
  1116. // be returned if and only if this version of the object has been
  1117. // deleted.
  1118. TimeDeleted string `json:"timeDeleted,omitempty"`
  1119. // TimeStorageClassUpdated: The time at which the object's storage class
  1120. // was last changed. When the object is initially created, it will be
  1121. // set to timeCreated.
  1122. TimeStorageClassUpdated string `json:"timeStorageClassUpdated,omitempty"`
  1123. // Updated: The modification time of the object metadata in RFC 3339
  1124. // format.
  1125. Updated string `json:"updated,omitempty"`
  1126. // ServerResponse contains the HTTP response code and headers from the
  1127. // server.
  1128. googleapi.ServerResponse `json:"-"`
  1129. // ForceSendFields is a list of field names (e.g. "Acl") to
  1130. // unconditionally include in API requests. By default, fields with
  1131. // empty values are omitted from API requests. However, any non-pointer,
  1132. // non-interface field appearing in ForceSendFields will be sent to the
  1133. // server regardless of whether the field is empty or not. This may be
  1134. // used to include empty fields in Patch requests.
  1135. ForceSendFields []string `json:"-"`
  1136. // NullFields is a list of field names (e.g. "Acl") to include in API
  1137. // requests with the JSON null value. By default, fields with empty
  1138. // values are omitted from API requests. However, any field with an
  1139. // empty value appearing in NullFields will be sent to the server as
  1140. // null. It is an error if a field in this list has a non-empty value.
  1141. // This may be used to include null fields in Patch requests.
  1142. NullFields []string `json:"-"`
  1143. }
  1144. func (s *Object) MarshalJSON() ([]byte, error) {
  1145. type NoMethod Object
  1146. raw := NoMethod(*s)
  1147. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1148. }
  1149. // ObjectCustomerEncryption: Metadata of customer-supplied encryption
  1150. // key, if the object is encrypted by such a key.
  1151. type ObjectCustomerEncryption struct {
  1152. // EncryptionAlgorithm: The encryption algorithm.
  1153. EncryptionAlgorithm string `json:"encryptionAlgorithm,omitempty"`
  1154. // KeySha256: SHA256 hash value of the encryption key.
  1155. KeySha256 string `json:"keySha256,omitempty"`
  1156. // ForceSendFields is a list of field names (e.g. "EncryptionAlgorithm")
  1157. // to unconditionally include in API requests. By default, fields with
  1158. // empty values are omitted from API requests. However, any non-pointer,
  1159. // non-interface field appearing in ForceSendFields will be sent to the
  1160. // server regardless of whether the field is empty or not. This may be
  1161. // used to include empty fields in Patch requests.
  1162. ForceSendFields []string `json:"-"`
  1163. // NullFields is a list of field names (e.g. "EncryptionAlgorithm") to
  1164. // include in API requests with the JSON null value. By default, fields
  1165. // with empty values are omitted from API requests. However, any field
  1166. // with an empty value appearing in NullFields will be sent to the
  1167. // server as null. It is an error if a field in this list has a
  1168. // non-empty value. This may be used to include null fields in Patch
  1169. // requests.
  1170. NullFields []string `json:"-"`
  1171. }
  1172. func (s *ObjectCustomerEncryption) MarshalJSON() ([]byte, error) {
  1173. type NoMethod ObjectCustomerEncryption
  1174. raw := NoMethod(*s)
  1175. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1176. }
  1177. // ObjectOwner: The owner of the object. This will always be the
  1178. // uploader of the object.
  1179. type ObjectOwner struct {
  1180. // Entity: The entity, in the form user-userId.
  1181. Entity string `json:"entity,omitempty"`
  1182. // EntityId: The ID for the entity.
  1183. EntityId string `json:"entityId,omitempty"`
  1184. // ForceSendFields is a list of field names (e.g. "Entity") to
  1185. // unconditionally include in API requests. By default, fields with
  1186. // empty values are omitted from API requests. However, any non-pointer,
  1187. // non-interface field appearing in ForceSendFields will be sent to the
  1188. // server regardless of whether the field is empty or not. This may be
  1189. // used to include empty fields in Patch requests.
  1190. ForceSendFields []string `json:"-"`
  1191. // NullFields is a list of field names (e.g. "Entity") to include in API
  1192. // requests with the JSON null value. By default, fields with empty
  1193. // values are omitted from API requests. However, any field with an
  1194. // empty value appearing in NullFields will be sent to the server as
  1195. // null. It is an error if a field in this list has a non-empty value.
  1196. // This may be used to include null fields in Patch requests.
  1197. NullFields []string `json:"-"`
  1198. }
  1199. func (s *ObjectOwner) MarshalJSON() ([]byte, error) {
  1200. type NoMethod ObjectOwner
  1201. raw := NoMethod(*s)
  1202. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1203. }
  1204. // ObjectAccessControl: An access-control entry.
  1205. type ObjectAccessControl struct {
  1206. // Bucket: The name of the bucket.
  1207. Bucket string `json:"bucket,omitempty"`
  1208. // Domain: The domain associated with the entity, if any.
  1209. Domain string `json:"domain,omitempty"`
  1210. // Email: The email address associated with the entity, if any.
  1211. Email string `json:"email,omitempty"`
  1212. // Entity: The entity holding the permission, in one of the following
  1213. // forms:
  1214. // - user-userId
  1215. // - user-email
  1216. // - group-groupId
  1217. // - group-email
  1218. // - domain-domain
  1219. // - project-team-projectId
  1220. // - allUsers
  1221. // - allAuthenticatedUsers Examples:
  1222. // - The user liz@example.com would be user-liz@example.com.
  1223. // - The group example@googlegroups.com would be
  1224. // group-example@googlegroups.com.
  1225. // - To refer to all members of the Google Apps for Business domain
  1226. // example.com, the entity would be domain-example.com.
  1227. Entity string `json:"entity,omitempty"`
  1228. // EntityId: The ID for the entity, if any.
  1229. EntityId string `json:"entityId,omitempty"`
  1230. // Etag: HTTP 1.1 Entity tag for the access-control entry.
  1231. Etag string `json:"etag,omitempty"`
  1232. // Generation: The content generation of the object, if applied to an
  1233. // object.
  1234. Generation int64 `json:"generation,omitempty,string"`
  1235. // Id: The ID of the access-control entry.
  1236. Id string `json:"id,omitempty"`
  1237. // Kind: The kind of item this is. For object access control entries,
  1238. // this is always storage#objectAccessControl.
  1239. Kind string `json:"kind,omitempty"`
  1240. // Object: The name of the object, if applied to an object.
  1241. Object string `json:"object,omitempty"`
  1242. // ProjectTeam: The project team associated with the entity, if any.
  1243. ProjectTeam *ObjectAccessControlProjectTeam `json:"projectTeam,omitempty"`
  1244. // Role: The access permission for the entity.
  1245. Role string `json:"role,omitempty"`
  1246. // SelfLink: The link to this access-control entry.
  1247. SelfLink string `json:"selfLink,omitempty"`
  1248. // ServerResponse contains the HTTP response code and headers from the
  1249. // server.
  1250. googleapi.ServerResponse `json:"-"`
  1251. // ForceSendFields is a list of field names (e.g. "Bucket") to
  1252. // unconditionally include in API requests. By default, fields with
  1253. // empty values are omitted from API requests. However, any non-pointer,
  1254. // non-interface field appearing in ForceSendFields will be sent to the
  1255. // server regardless of whether the field is empty or not. This may be
  1256. // used to include empty fields in Patch requests.
  1257. ForceSendFields []string `json:"-"`
  1258. // NullFields is a list of field names (e.g. "Bucket") to include in API
  1259. // requests with the JSON null value. By default, fields with empty
  1260. // values are omitted from API requests. However, any field with an
  1261. // empty value appearing in NullFields will be sent to the server as
  1262. // null. It is an error if a field in this list has a non-empty value.
  1263. // This may be used to include null fields in Patch requests.
  1264. NullFields []string `json:"-"`
  1265. }
  1266. func (s *ObjectAccessControl) MarshalJSON() ([]byte, error) {
  1267. type NoMethod ObjectAccessControl
  1268. raw := NoMethod(*s)
  1269. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1270. }
  1271. // ObjectAccessControlProjectTeam: The project team associated with the
  1272. // entity, if any.
  1273. type ObjectAccessControlProjectTeam struct {
  1274. // ProjectNumber: The project number.
  1275. ProjectNumber string `json:"projectNumber,omitempty"`
  1276. // Team: The team.
  1277. Team string `json:"team,omitempty"`
  1278. // ForceSendFields is a list of field names (e.g. "ProjectNumber") to
  1279. // unconditionally include in API requests. By default, fields with
  1280. // empty values are omitted from API requests. However, any non-pointer,
  1281. // non-interface field appearing in ForceSendFields will be sent to the
  1282. // server regardless of whether the field is empty or not. This may be
  1283. // used to include empty fields in Patch requests.
  1284. ForceSendFields []string `json:"-"`
  1285. // NullFields is a list of field names (e.g. "ProjectNumber") to include
  1286. // in API requests with the JSON null value. By default, fields with
  1287. // empty values are omitted from API requests. However, any field with
  1288. // an empty value appearing in NullFields will be sent to the server as
  1289. // null. It is an error if a field in this list has a non-empty value.
  1290. // This may be used to include null fields in Patch requests.
  1291. NullFields []string `json:"-"`
  1292. }
  1293. func (s *ObjectAccessControlProjectTeam) MarshalJSON() ([]byte, error) {
  1294. type NoMethod ObjectAccessControlProjectTeam
  1295. raw := NoMethod(*s)
  1296. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1297. }
  1298. // ObjectAccessControls: An access-control list.
  1299. type ObjectAccessControls struct {
  1300. // Items: The list of items.
  1301. Items []*ObjectAccessControl `json:"items,omitempty"`
  1302. // Kind: The kind of item this is. For lists of object access control
  1303. // entries, this is always storage#objectAccessControls.
  1304. Kind string `json:"kind,omitempty"`
  1305. // ServerResponse contains the HTTP response code and headers from the
  1306. // server.
  1307. googleapi.ServerResponse `json:"-"`
  1308. // ForceSendFields is a list of field names (e.g. "Items") to
  1309. // unconditionally include in API requests. By default, fields with
  1310. // empty values are omitted from API requests. However, any non-pointer,
  1311. // non-interface field appearing in ForceSendFields will be sent to the
  1312. // server regardless of whether the field is empty or not. This may be
  1313. // used to include empty fields in Patch requests.
  1314. ForceSendFields []string `json:"-"`
  1315. // NullFields is a list of field names (e.g. "Items") to include in API
  1316. // requests with the JSON null value. By default, fields with empty
  1317. // values are omitted from API requests. However, any field with an
  1318. // empty value appearing in NullFields will be sent to the server as
  1319. // null. It is an error if a field in this list has a non-empty value.
  1320. // This may be used to include null fields in Patch requests.
  1321. NullFields []string `json:"-"`
  1322. }
  1323. func (s *ObjectAccessControls) MarshalJSON() ([]byte, error) {
  1324. type NoMethod ObjectAccessControls
  1325. raw := NoMethod(*s)
  1326. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1327. }
  1328. // Objects: A list of objects.
  1329. type Objects struct {
  1330. // Items: The list of items.
  1331. Items []*Object `json:"items,omitempty"`
  1332. // Kind: The kind of item this is. For lists of objects, this is always
  1333. // storage#objects.
  1334. Kind string `json:"kind,omitempty"`
  1335. // NextPageToken: The continuation token, used to page through large
  1336. // result sets. Provide this value in a subsequent request to return the
  1337. // next page of results.
  1338. NextPageToken string `json:"nextPageToken,omitempty"`
  1339. // Prefixes: The list of prefixes of objects matching-but-not-listed up
  1340. // to and including the requested delimiter.
  1341. Prefixes []string `json:"prefixes,omitempty"`
  1342. // ServerResponse contains the HTTP response code and headers from the
  1343. // server.
  1344. googleapi.ServerResponse `json:"-"`
  1345. // ForceSendFields is a list of field names (e.g. "Items") to
  1346. // unconditionally include in API requests. By default, fields with
  1347. // empty values are omitted from API requests. However, any non-pointer,
  1348. // non-interface field appearing in ForceSendFields will be sent to the
  1349. // server regardless of whether the field is empty or not. This may be
  1350. // used to include empty fields in Patch requests.
  1351. ForceSendFields []string `json:"-"`
  1352. // NullFields is a list of field names (e.g. "Items") to include in API
  1353. // requests with the JSON null value. By default, fields with empty
  1354. // values are omitted from API requests. However, any field with an
  1355. // empty value appearing in NullFields will be sent to the server as
  1356. // null. It is an error if a field in this list has a non-empty value.
  1357. // This may be used to include null fields in Patch requests.
  1358. NullFields []string `json:"-"`
  1359. }
  1360. func (s *Objects) MarshalJSON() ([]byte, error) {
  1361. type NoMethod Objects
  1362. raw := NoMethod(*s)
  1363. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1364. }
  1365. // Policy: A bucket/object IAM policy.
  1366. type Policy struct {
  1367. // Bindings: An association between a role, which comes with a set of
  1368. // permissions, and members who may assume that role.
  1369. Bindings []*PolicyBindings `json:"bindings,omitempty"`
  1370. // Etag: HTTP 1.1 Entity tag for the policy.
  1371. Etag string `json:"etag,omitempty"`
  1372. // Kind: The kind of item this is. For policies, this is always
  1373. // storage#policy. This field is ignored on input.
  1374. Kind string `json:"kind,omitempty"`
  1375. // ResourceId: The ID of the resource to which this policy belongs. Will
  1376. // be of the form projects/_/buckets/bucket for buckets, and
  1377. // projects/_/buckets/bucket/objects/object for objects. A specific
  1378. // generation may be specified by appending #generationNumber to the end
  1379. // of the object name, e.g.
  1380. // projects/_/buckets/my-bucket/objects/data.txt#17. The current
  1381. // generation can be denoted with #0. This field is ignored on input.
  1382. ResourceId string `json:"resourceId,omitempty"`
  1383. // ServerResponse contains the HTTP response code and headers from the
  1384. // server.
  1385. googleapi.ServerResponse `json:"-"`
  1386. // ForceSendFields is a list of field names (e.g. "Bindings") to
  1387. // unconditionally include in API requests. By default, fields with
  1388. // empty values are omitted from API requests. However, any non-pointer,
  1389. // non-interface field appearing in ForceSendFields will be sent to the
  1390. // server regardless of whether the field is empty or not. This may be
  1391. // used to include empty fields in Patch requests.
  1392. ForceSendFields []string `json:"-"`
  1393. // NullFields is a list of field names (e.g. "Bindings") to include in
  1394. // API requests with the JSON null value. By default, fields with empty
  1395. // values are omitted from API requests. However, any field with an
  1396. // empty value appearing in NullFields will be sent to the server as
  1397. // null. It is an error if a field in this list has a non-empty value.
  1398. // This may be used to include null fields in Patch requests.
  1399. NullFields []string `json:"-"`
  1400. }
  1401. func (s *Policy) MarshalJSON() ([]byte, error) {
  1402. type NoMethod Policy
  1403. raw := NoMethod(*s)
  1404. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1405. }
  1406. type PolicyBindings struct {
  1407. Condition interface{} `json:"condition,omitempty"`
  1408. // Members: A collection of identifiers for members who may assume the
  1409. // provided role. Recognized identifiers are as follows:
  1410. // - allUsers — A special identifier that represents anyone on the
  1411. // internet; with or without a Google account.
  1412. // - allAuthenticatedUsers — A special identifier that represents
  1413. // anyone who is authenticated with a Google account or a service
  1414. // account.
  1415. // - user:emailid — An email address that represents a specific
  1416. // account. For example, user:alice@gmail.com or user:joe@example.com.
  1417. //
  1418. // - serviceAccount:emailid — An email address that represents a
  1419. // service account. For example,
  1420. // serviceAccount:my-other-app@appspot.gserviceaccount.com .
  1421. // - group:emailid — An email address that represents a Google group.
  1422. // For example, group:admins@example.com.
  1423. // - domain:domain — A Google Apps domain name that represents all the
  1424. // users of that domain. For example, domain:google.com or
  1425. // domain:example.com.
  1426. // - projectOwner:projectid — Owners of the given project. For
  1427. // example, projectOwner:my-example-project
  1428. // - projectEditor:projectid — Editors of the given project. For
  1429. // example, projectEditor:my-example-project
  1430. // - projectViewer:projectid — Viewers of the given project. For
  1431. // example, projectViewer:my-example-project
  1432. Members []string `json:"members,omitempty"`
  1433. // Role: The role to which members belong. Two types of roles are
  1434. // supported: new IAM roles, which grant permissions that do not map
  1435. // directly to those provided by ACLs, and legacy IAM roles, which do
  1436. // map directly to ACL permissions. All roles are of the format
  1437. // roles/storage.specificRole.
  1438. // The new IAM roles are:
  1439. // - roles/storage.admin — Full control of Google Cloud Storage
  1440. // resources.
  1441. // - roles/storage.objectViewer — Read-Only access to Google Cloud
  1442. // Storage objects.
  1443. // - roles/storage.objectCreator — Access to create objects in Google
  1444. // Cloud Storage.
  1445. // - roles/storage.objectAdmin — Full control of Google Cloud Storage
  1446. // objects. The legacy IAM roles are:
  1447. // - roles/storage.legacyObjectReader — Read-only access to objects
  1448. // without listing. Equivalent to an ACL entry on an object with the
  1449. // READER role.
  1450. // - roles/storage.legacyObjectOwner — Read/write access to existing
  1451. // objects without listing. Equivalent to an ACL entry on an object with
  1452. // the OWNER role.
  1453. // - roles/storage.legacyBucketReader — Read access to buckets with
  1454. // object listing. Equivalent to an ACL entry on a bucket with the
  1455. // READER role.
  1456. // - roles/storage.legacyBucketWriter — Read access to buckets with
  1457. // object listing/creation/deletion. Equivalent to an ACL entry on a
  1458. // bucket with the WRITER role.
  1459. // - roles/storage.legacyBucketOwner — Read and write access to
  1460. // existing buckets with object listing/creation/deletion. Equivalent to
  1461. // an ACL entry on a bucket with the OWNER role.
  1462. Role string `json:"role,omitempty"`
  1463. // ForceSendFields is a list of field names (e.g. "Condition") to
  1464. // unconditionally include in API requests. By default, fields with
  1465. // empty values are omitted from API requests. However, any non-pointer,
  1466. // non-interface field appearing in ForceSendFields will be sent to the
  1467. // server regardless of whether the field is empty or not. This may be
  1468. // used to include empty fields in Patch requests.
  1469. ForceSendFields []string `json:"-"`
  1470. // NullFields is a list of field names (e.g. "Condition") to include in
  1471. // API requests with the JSON null value. By default, fields with empty
  1472. // values are omitted from API requests. However, any field with an
  1473. // empty value appearing in NullFields will be sent to the server as
  1474. // null. It is an error if a field in this list has a non-empty value.
  1475. // This may be used to include null fields in Patch requests.
  1476. NullFields []string `json:"-"`
  1477. }
  1478. func (s *PolicyBindings) MarshalJSON() ([]byte, error) {
  1479. type NoMethod PolicyBindings
  1480. raw := NoMethod(*s)
  1481. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1482. }
  1483. // RewriteResponse: A rewrite response.
  1484. type RewriteResponse struct {
  1485. // Done: true if the copy is finished; otherwise, false if the copy is
  1486. // in progress. This property is always present in the response.
  1487. Done bool `json:"done,omitempty"`
  1488. // Kind: The kind of item this is.
  1489. Kind string `json:"kind,omitempty"`
  1490. // ObjectSize: The total size of the object being copied in bytes. This
  1491. // property is always present in the response.
  1492. ObjectSize int64 `json:"objectSize,omitempty,string"`
  1493. // Resource: A resource containing the metadata for the copied-to
  1494. // object. This property is present in the response only when copying
  1495. // completes.
  1496. Resource *Object `json:"resource,omitempty"`
  1497. // RewriteToken: A token to use in subsequent requests to continue
  1498. // copying data. This token is present in the response only when there
  1499. // is more data to copy.
  1500. RewriteToken string `json:"rewriteToken,omitempty"`
  1501. // TotalBytesRewritten: The total bytes written so far, which can be
  1502. // used to provide a waiting user with a progress indicator. This
  1503. // property is always present in the response.
  1504. TotalBytesRewritten int64 `json:"totalBytesRewritten,omitempty,string"`
  1505. // ServerResponse contains the HTTP response code and headers from the
  1506. // server.
  1507. googleapi.ServerResponse `json:"-"`
  1508. // ForceSendFields is a list of field names (e.g. "Done") to
  1509. // unconditionally include in API requests. By default, fields with
  1510. // empty values are omitted from API requests. However, any non-pointer,
  1511. // non-interface field appearing in ForceSendFields will be sent to the
  1512. // server regardless of whether the field is empty or not. This may be
  1513. // used to include empty fields in Patch requests.
  1514. ForceSendFields []string `json:"-"`
  1515. // NullFields is a list of field names (e.g. "Done") to include in API
  1516. // requests with the JSON null value. By default, fields with empty
  1517. // values are omitted from API requests. However, any field with an
  1518. // empty value appearing in NullFields will be sent to the server as
  1519. // null. It is an error if a field in this list has a non-empty value.
  1520. // This may be used to include null fields in Patch requests.
  1521. NullFields []string `json:"-"`
  1522. }
  1523. func (s *RewriteResponse) MarshalJSON() ([]byte, error) {
  1524. type NoMethod RewriteResponse
  1525. raw := NoMethod(*s)
  1526. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1527. }
  1528. // ServiceAccount: A subscription to receive Google PubSub
  1529. // notifications.
  1530. type ServiceAccount struct {
  1531. // EmailAddress: The ID of the notification.
  1532. EmailAddress string `json:"email_address,omitempty"`
  1533. // Kind: The kind of item this is. For notifications, this is always
  1534. // storage#notification.
  1535. Kind string `json:"kind,omitempty"`
  1536. // ServerResponse contains the HTTP response code and headers from the
  1537. // server.
  1538. googleapi.ServerResponse `json:"-"`
  1539. // ForceSendFields is a list of field names (e.g. "EmailAddress") to
  1540. // unconditionally include in API requests. By default, fields with
  1541. // empty values are omitted from API requests. However, any non-pointer,
  1542. // non-interface field appearing in ForceSendFields will be sent to the
  1543. // server regardless of whether the field is empty or not. This may be
  1544. // used to include empty fields in Patch requests.
  1545. ForceSendFields []string `json:"-"`
  1546. // NullFields is a list of field names (e.g. "EmailAddress") to include
  1547. // in API requests with the JSON null value. By default, fields with
  1548. // empty values are omitted from API requests. However, any field with
  1549. // an empty value appearing in NullFields will be sent to the server as
  1550. // null. It is an error if a field in this list has a non-empty value.
  1551. // This may be used to include null fields in Patch requests.
  1552. NullFields []string `json:"-"`
  1553. }
  1554. func (s *ServiceAccount) MarshalJSON() ([]byte, error) {
  1555. type NoMethod ServiceAccount
  1556. raw := NoMethod(*s)
  1557. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1558. }
  1559. // TestIamPermissionsResponse: A
  1560. // storage.(buckets|objects).testIamPermissions response.
  1561. type TestIamPermissionsResponse struct {
  1562. // Kind: The kind of item this is.
  1563. Kind string `json:"kind,omitempty"`
  1564. // Permissions: The permissions held by the caller. Permissions are
  1565. // always of the format storage.resource.capability, where resource is
  1566. // one of buckets or objects. The supported permissions are as follows:
  1567. //
  1568. // - storage.buckets.delete — Delete bucket.
  1569. // - storage.buckets.get — Read bucket metadata.
  1570. // - storage.buckets.getIamPolicy — Read bucket IAM policy.
  1571. // - storage.buckets.create — Create bucket.
  1572. // - storage.buckets.list — List buckets.
  1573. // - storage.buckets.setIamPolicy — Update bucket IAM policy.
  1574. // - storage.buckets.update — Update bucket metadata.
  1575. // - storage.objects.delete — Delete object.
  1576. // - storage.objects.get — Read object data and metadata.
  1577. // - storage.objects.getIamPolicy — Read object IAM policy.
  1578. // - storage.objects.create — Create object.
  1579. // - storage.objects.list — List objects.
  1580. // - storage.objects.setIamPolicy — Update object IAM policy.
  1581. // - storage.objects.update — Update object metadata.
  1582. Permissions []string `json:"permissions,omitempty"`
  1583. // ServerResponse contains the HTTP response code and headers from the
  1584. // server.
  1585. googleapi.ServerResponse `json:"-"`
  1586. // ForceSendFields is a list of field names (e.g. "Kind") to
  1587. // unconditionally include in API requests. By default, fields with
  1588. // empty values are omitted from API requests. However, any non-pointer,
  1589. // non-interface field appearing in ForceSendFields will be sent to the
  1590. // server regardless of whether the field is empty or not. This may be
  1591. // used to include empty fields in Patch requests.
  1592. ForceSendFields []string `json:"-"`
  1593. // NullFields is a list of field names (e.g. "Kind") to include in API
  1594. // requests with the JSON null value. By default, fields with empty
  1595. // values are omitted from API requests. However, any field with an
  1596. // empty value appearing in NullFields will be sent to the server as
  1597. // null. It is an error if a field in this list has a non-empty value.
  1598. // This may be used to include null fields in Patch requests.
  1599. NullFields []string `json:"-"`
  1600. }
  1601. func (s *TestIamPermissionsResponse) MarshalJSON() ([]byte, error) {
  1602. type NoMethod TestIamPermissionsResponse
  1603. raw := NoMethod(*s)
  1604. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1605. }
  1606. // method id "storage.bucketAccessControls.delete":
  1607. type BucketAccessControlsDeleteCall struct {
  1608. s *Service
  1609. bucket string
  1610. entity string
  1611. urlParams_ gensupport.URLParams
  1612. ctx_ context.Context
  1613. header_ http.Header
  1614. }
  1615. // Delete: Permanently deletes the ACL entry for the specified entity on
  1616. // the specified bucket.
  1617. func (r *BucketAccessControlsService) Delete(bucket string, entity string) *BucketAccessControlsDeleteCall {
  1618. c := &BucketAccessControlsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1619. c.bucket = bucket
  1620. c.entity = entity
  1621. return c
  1622. }
  1623. // UserProject sets the optional parameter "userProject": The project to
  1624. // be billed for this request. Required for Requester Pays buckets.
  1625. func (c *BucketAccessControlsDeleteCall) UserProject(userProject string) *BucketAccessControlsDeleteCall {
  1626. c.urlParams_.Set("userProject", userProject)
  1627. return c
  1628. }
  1629. // Fields allows partial responses to be retrieved. See
  1630. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1631. // for more information.
  1632. func (c *BucketAccessControlsDeleteCall) Fields(s ...googleapi.Field) *BucketAccessControlsDeleteCall {
  1633. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1634. return c
  1635. }
  1636. // Context sets the context to be used in this call's Do method. Any
  1637. // pending HTTP request will be aborted if the provided context is
  1638. // canceled.
  1639. func (c *BucketAccessControlsDeleteCall) Context(ctx context.Context) *BucketAccessControlsDeleteCall {
  1640. c.ctx_ = ctx
  1641. return c
  1642. }
  1643. // Header returns an http.Header that can be modified by the caller to
  1644. // add HTTP headers to the request.
  1645. func (c *BucketAccessControlsDeleteCall) Header() http.Header {
  1646. if c.header_ == nil {
  1647. c.header_ = make(http.Header)
  1648. }
  1649. return c.header_
  1650. }
  1651. func (c *BucketAccessControlsDeleteCall) doRequest(alt string) (*http.Response, error) {
  1652. reqHeaders := make(http.Header)
  1653. for k, v := range c.header_ {
  1654. reqHeaders[k] = v
  1655. }
  1656. reqHeaders.Set("User-Agent", c.s.userAgent())
  1657. var body io.Reader = nil
  1658. c.urlParams_.Set("alt", alt)
  1659. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/acl/{entity}")
  1660. urls += "?" + c.urlParams_.Encode()
  1661. req, _ := http.NewRequest("DELETE", urls, body)
  1662. req.Header = reqHeaders
  1663. googleapi.Expand(req.URL, map[string]string{
  1664. "bucket": c.bucket,
  1665. "entity": c.entity,
  1666. })
  1667. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1668. }
  1669. // Do executes the "storage.bucketAccessControls.delete" call.
  1670. func (c *BucketAccessControlsDeleteCall) Do(opts ...googleapi.CallOption) error {
  1671. gensupport.SetOptions(c.urlParams_, opts...)
  1672. res, err := c.doRequest("json")
  1673. if err != nil {
  1674. return err
  1675. }
  1676. defer googleapi.CloseBody(res)
  1677. if err := googleapi.CheckResponse(res); err != nil {
  1678. return err
  1679. }
  1680. return nil
  1681. // {
  1682. // "description": "Permanently deletes the ACL entry for the specified entity on the specified bucket.",
  1683. // "httpMethod": "DELETE",
  1684. // "id": "storage.bucketAccessControls.delete",
  1685. // "parameterOrder": [
  1686. // "bucket",
  1687. // "entity"
  1688. // ],
  1689. // "parameters": {
  1690. // "bucket": {
  1691. // "description": "Name of a bucket.",
  1692. // "location": "path",
  1693. // "required": true,
  1694. // "type": "string"
  1695. // },
  1696. // "entity": {
  1697. // "description": "The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.",
  1698. // "location": "path",
  1699. // "required": true,
  1700. // "type": "string"
  1701. // },
  1702. // "userProject": {
  1703. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  1704. // "location": "query",
  1705. // "type": "string"
  1706. // }
  1707. // },
  1708. // "path": "b/{bucket}/acl/{entity}",
  1709. // "scopes": [
  1710. // "https://www.googleapis.com/auth/cloud-platform",
  1711. // "https://www.googleapis.com/auth/devstorage.full_control"
  1712. // ]
  1713. // }
  1714. }
  1715. // method id "storage.bucketAccessControls.get":
  1716. type BucketAccessControlsGetCall struct {
  1717. s *Service
  1718. bucket string
  1719. entity string
  1720. urlParams_ gensupport.URLParams
  1721. ifNoneMatch_ string
  1722. ctx_ context.Context
  1723. header_ http.Header
  1724. }
  1725. // Get: Returns the ACL entry for the specified entity on the specified
  1726. // bucket.
  1727. func (r *BucketAccessControlsService) Get(bucket string, entity string) *BucketAccessControlsGetCall {
  1728. c := &BucketAccessControlsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1729. c.bucket = bucket
  1730. c.entity = entity
  1731. return c
  1732. }
  1733. // UserProject sets the optional parameter "userProject": The project to
  1734. // be billed for this request. Required for Requester Pays buckets.
  1735. func (c *BucketAccessControlsGetCall) UserProject(userProject string) *BucketAccessControlsGetCall {
  1736. c.urlParams_.Set("userProject", userProject)
  1737. return c
  1738. }
  1739. // Fields allows partial responses to be retrieved. See
  1740. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1741. // for more information.
  1742. func (c *BucketAccessControlsGetCall) Fields(s ...googleapi.Field) *BucketAccessControlsGetCall {
  1743. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1744. return c
  1745. }
  1746. // IfNoneMatch sets the optional parameter which makes the operation
  1747. // fail if the object's ETag matches the given value. This is useful for
  1748. // getting updates only after the object has changed since the last
  1749. // request. Use googleapi.IsNotModified to check whether the response
  1750. // error from Do is the result of In-None-Match.
  1751. func (c *BucketAccessControlsGetCall) IfNoneMatch(entityTag string) *BucketAccessControlsGetCall {
  1752. c.ifNoneMatch_ = entityTag
  1753. return c
  1754. }
  1755. // Context sets the context to be used in this call's Do method. Any
  1756. // pending HTTP request will be aborted if the provided context is
  1757. // canceled.
  1758. func (c *BucketAccessControlsGetCall) Context(ctx context.Context) *BucketAccessControlsGetCall {
  1759. c.ctx_ = ctx
  1760. return c
  1761. }
  1762. // Header returns an http.Header that can be modified by the caller to
  1763. // add HTTP headers to the request.
  1764. func (c *BucketAccessControlsGetCall) Header() http.Header {
  1765. if c.header_ == nil {
  1766. c.header_ = make(http.Header)
  1767. }
  1768. return c.header_
  1769. }
  1770. func (c *BucketAccessControlsGetCall) doRequest(alt string) (*http.Response, error) {
  1771. reqHeaders := make(http.Header)
  1772. for k, v := range c.header_ {
  1773. reqHeaders[k] = v
  1774. }
  1775. reqHeaders.Set("User-Agent", c.s.userAgent())
  1776. if c.ifNoneMatch_ != "" {
  1777. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1778. }
  1779. var body io.Reader = nil
  1780. c.urlParams_.Set("alt", alt)
  1781. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/acl/{entity}")
  1782. urls += "?" + c.urlParams_.Encode()
  1783. req, _ := http.NewRequest("GET", urls, body)
  1784. req.Header = reqHeaders
  1785. googleapi.Expand(req.URL, map[string]string{
  1786. "bucket": c.bucket,
  1787. "entity": c.entity,
  1788. })
  1789. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1790. }
  1791. // Do executes the "storage.bucketAccessControls.get" call.
  1792. // Exactly one of *BucketAccessControl or error will be non-nil. Any
  1793. // non-2xx status code is an error. Response headers are in either
  1794. // *BucketAccessControl.ServerResponse.Header or (if a response was
  1795. // returned at all) in error.(*googleapi.Error).Header. Use
  1796. // googleapi.IsNotModified to check whether the returned error was
  1797. // because http.StatusNotModified was returned.
  1798. func (c *BucketAccessControlsGetCall) Do(opts ...googleapi.CallOption) (*BucketAccessControl, error) {
  1799. gensupport.SetOptions(c.urlParams_, opts...)
  1800. res, err := c.doRequest("json")
  1801. if res != nil && res.StatusCode == http.StatusNotModified {
  1802. if res.Body != nil {
  1803. res.Body.Close()
  1804. }
  1805. return nil, &googleapi.Error{
  1806. Code: res.StatusCode,
  1807. Header: res.Header,
  1808. }
  1809. }
  1810. if err != nil {
  1811. return nil, err
  1812. }
  1813. defer googleapi.CloseBody(res)
  1814. if err := googleapi.CheckResponse(res); err != nil {
  1815. return nil, err
  1816. }
  1817. ret := &BucketAccessControl{
  1818. ServerResponse: googleapi.ServerResponse{
  1819. Header: res.Header,
  1820. HTTPStatusCode: res.StatusCode,
  1821. },
  1822. }
  1823. target := &ret
  1824. if err := gensupport.DecodeResponse(target, res); err != nil {
  1825. return nil, err
  1826. }
  1827. return ret, nil
  1828. // {
  1829. // "description": "Returns the ACL entry for the specified entity on the specified bucket.",
  1830. // "httpMethod": "GET",
  1831. // "id": "storage.bucketAccessControls.get",
  1832. // "parameterOrder": [
  1833. // "bucket",
  1834. // "entity"
  1835. // ],
  1836. // "parameters": {
  1837. // "bucket": {
  1838. // "description": "Name of a bucket.",
  1839. // "location": "path",
  1840. // "required": true,
  1841. // "type": "string"
  1842. // },
  1843. // "entity": {
  1844. // "description": "The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.",
  1845. // "location": "path",
  1846. // "required": true,
  1847. // "type": "string"
  1848. // },
  1849. // "userProject": {
  1850. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  1851. // "location": "query",
  1852. // "type": "string"
  1853. // }
  1854. // },
  1855. // "path": "b/{bucket}/acl/{entity}",
  1856. // "response": {
  1857. // "$ref": "BucketAccessControl"
  1858. // },
  1859. // "scopes": [
  1860. // "https://www.googleapis.com/auth/cloud-platform",
  1861. // "https://www.googleapis.com/auth/devstorage.full_control"
  1862. // ]
  1863. // }
  1864. }
  1865. // method id "storage.bucketAccessControls.insert":
  1866. type BucketAccessControlsInsertCall struct {
  1867. s *Service
  1868. bucket string
  1869. bucketaccesscontrol *BucketAccessControl
  1870. urlParams_ gensupport.URLParams
  1871. ctx_ context.Context
  1872. header_ http.Header
  1873. }
  1874. // Insert: Creates a new ACL entry on the specified bucket.
  1875. func (r *BucketAccessControlsService) Insert(bucket string, bucketaccesscontrol *BucketAccessControl) *BucketAccessControlsInsertCall {
  1876. c := &BucketAccessControlsInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1877. c.bucket = bucket
  1878. c.bucketaccesscontrol = bucketaccesscontrol
  1879. return c
  1880. }
  1881. // UserProject sets the optional parameter "userProject": The project to
  1882. // be billed for this request. Required for Requester Pays buckets.
  1883. func (c *BucketAccessControlsInsertCall) UserProject(userProject string) *BucketAccessControlsInsertCall {
  1884. c.urlParams_.Set("userProject", userProject)
  1885. return c
  1886. }
  1887. // Fields allows partial responses to be retrieved. See
  1888. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1889. // for more information.
  1890. func (c *BucketAccessControlsInsertCall) Fields(s ...googleapi.Field) *BucketAccessControlsInsertCall {
  1891. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1892. return c
  1893. }
  1894. // Context sets the context to be used in this call's Do method. Any
  1895. // pending HTTP request will be aborted if the provided context is
  1896. // canceled.
  1897. func (c *BucketAccessControlsInsertCall) Context(ctx context.Context) *BucketAccessControlsInsertCall {
  1898. c.ctx_ = ctx
  1899. return c
  1900. }
  1901. // Header returns an http.Header that can be modified by the caller to
  1902. // add HTTP headers to the request.
  1903. func (c *BucketAccessControlsInsertCall) Header() http.Header {
  1904. if c.header_ == nil {
  1905. c.header_ = make(http.Header)
  1906. }
  1907. return c.header_
  1908. }
  1909. func (c *BucketAccessControlsInsertCall) doRequest(alt string) (*http.Response, error) {
  1910. reqHeaders := make(http.Header)
  1911. for k, v := range c.header_ {
  1912. reqHeaders[k] = v
  1913. }
  1914. reqHeaders.Set("User-Agent", c.s.userAgent())
  1915. var body io.Reader = nil
  1916. body, err := googleapi.WithoutDataWrapper.JSONReader(c.bucketaccesscontrol)
  1917. if err != nil {
  1918. return nil, err
  1919. }
  1920. reqHeaders.Set("Content-Type", "application/json")
  1921. c.urlParams_.Set("alt", alt)
  1922. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/acl")
  1923. urls += "?" + c.urlParams_.Encode()
  1924. req, _ := http.NewRequest("POST", urls, body)
  1925. req.Header = reqHeaders
  1926. googleapi.Expand(req.URL, map[string]string{
  1927. "bucket": c.bucket,
  1928. })
  1929. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1930. }
  1931. // Do executes the "storage.bucketAccessControls.insert" call.
  1932. // Exactly one of *BucketAccessControl or error will be non-nil. Any
  1933. // non-2xx status code is an error. Response headers are in either
  1934. // *BucketAccessControl.ServerResponse.Header or (if a response was
  1935. // returned at all) in error.(*googleapi.Error).Header. Use
  1936. // googleapi.IsNotModified to check whether the returned error was
  1937. // because http.StatusNotModified was returned.
  1938. func (c *BucketAccessControlsInsertCall) Do(opts ...googleapi.CallOption) (*BucketAccessControl, error) {
  1939. gensupport.SetOptions(c.urlParams_, opts...)
  1940. res, err := c.doRequest("json")
  1941. if res != nil && res.StatusCode == http.StatusNotModified {
  1942. if res.Body != nil {
  1943. res.Body.Close()
  1944. }
  1945. return nil, &googleapi.Error{
  1946. Code: res.StatusCode,
  1947. Header: res.Header,
  1948. }
  1949. }
  1950. if err != nil {
  1951. return nil, err
  1952. }
  1953. defer googleapi.CloseBody(res)
  1954. if err := googleapi.CheckResponse(res); err != nil {
  1955. return nil, err
  1956. }
  1957. ret := &BucketAccessControl{
  1958. ServerResponse: googleapi.ServerResponse{
  1959. Header: res.Header,
  1960. HTTPStatusCode: res.StatusCode,
  1961. },
  1962. }
  1963. target := &ret
  1964. if err := gensupport.DecodeResponse(target, res); err != nil {
  1965. return nil, err
  1966. }
  1967. return ret, nil
  1968. // {
  1969. // "description": "Creates a new ACL entry on the specified bucket.",
  1970. // "httpMethod": "POST",
  1971. // "id": "storage.bucketAccessControls.insert",
  1972. // "parameterOrder": [
  1973. // "bucket"
  1974. // ],
  1975. // "parameters": {
  1976. // "bucket": {
  1977. // "description": "Name of a bucket.",
  1978. // "location": "path",
  1979. // "required": true,
  1980. // "type": "string"
  1981. // },
  1982. // "userProject": {
  1983. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  1984. // "location": "query",
  1985. // "type": "string"
  1986. // }
  1987. // },
  1988. // "path": "b/{bucket}/acl",
  1989. // "request": {
  1990. // "$ref": "BucketAccessControl"
  1991. // },
  1992. // "response": {
  1993. // "$ref": "BucketAccessControl"
  1994. // },
  1995. // "scopes": [
  1996. // "https://www.googleapis.com/auth/cloud-platform",
  1997. // "https://www.googleapis.com/auth/devstorage.full_control"
  1998. // ]
  1999. // }
  2000. }
  2001. // method id "storage.bucketAccessControls.list":
  2002. type BucketAccessControlsListCall struct {
  2003. s *Service
  2004. bucket string
  2005. urlParams_ gensupport.URLParams
  2006. ifNoneMatch_ string
  2007. ctx_ context.Context
  2008. header_ http.Header
  2009. }
  2010. // List: Retrieves ACL entries on the specified bucket.
  2011. func (r *BucketAccessControlsService) List(bucket string) *BucketAccessControlsListCall {
  2012. c := &BucketAccessControlsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2013. c.bucket = bucket
  2014. return c
  2015. }
  2016. // UserProject sets the optional parameter "userProject": The project to
  2017. // be billed for this request. Required for Requester Pays buckets.
  2018. func (c *BucketAccessControlsListCall) UserProject(userProject string) *BucketAccessControlsListCall {
  2019. c.urlParams_.Set("userProject", userProject)
  2020. return c
  2021. }
  2022. // Fields allows partial responses to be retrieved. See
  2023. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2024. // for more information.
  2025. func (c *BucketAccessControlsListCall) Fields(s ...googleapi.Field) *BucketAccessControlsListCall {
  2026. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2027. return c
  2028. }
  2029. // IfNoneMatch sets the optional parameter which makes the operation
  2030. // fail if the object's ETag matches the given value. This is useful for
  2031. // getting updates only after the object has changed since the last
  2032. // request. Use googleapi.IsNotModified to check whether the response
  2033. // error from Do is the result of In-None-Match.
  2034. func (c *BucketAccessControlsListCall) IfNoneMatch(entityTag string) *BucketAccessControlsListCall {
  2035. c.ifNoneMatch_ = entityTag
  2036. return c
  2037. }
  2038. // Context sets the context to be used in this call's Do method. Any
  2039. // pending HTTP request will be aborted if the provided context is
  2040. // canceled.
  2041. func (c *BucketAccessControlsListCall) Context(ctx context.Context) *BucketAccessControlsListCall {
  2042. c.ctx_ = ctx
  2043. return c
  2044. }
  2045. // Header returns an http.Header that can be modified by the caller to
  2046. // add HTTP headers to the request.
  2047. func (c *BucketAccessControlsListCall) Header() http.Header {
  2048. if c.header_ == nil {
  2049. c.header_ = make(http.Header)
  2050. }
  2051. return c.header_
  2052. }
  2053. func (c *BucketAccessControlsListCall) doRequest(alt string) (*http.Response, error) {
  2054. reqHeaders := make(http.Header)
  2055. for k, v := range c.header_ {
  2056. reqHeaders[k] = v
  2057. }
  2058. reqHeaders.Set("User-Agent", c.s.userAgent())
  2059. if c.ifNoneMatch_ != "" {
  2060. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2061. }
  2062. var body io.Reader = nil
  2063. c.urlParams_.Set("alt", alt)
  2064. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/acl")
  2065. urls += "?" + c.urlParams_.Encode()
  2066. req, _ := http.NewRequest("GET", urls, body)
  2067. req.Header = reqHeaders
  2068. googleapi.Expand(req.URL, map[string]string{
  2069. "bucket": c.bucket,
  2070. })
  2071. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2072. }
  2073. // Do executes the "storage.bucketAccessControls.list" call.
  2074. // Exactly one of *BucketAccessControls or error will be non-nil. Any
  2075. // non-2xx status code is an error. Response headers are in either
  2076. // *BucketAccessControls.ServerResponse.Header or (if a response was
  2077. // returned at all) in error.(*googleapi.Error).Header. Use
  2078. // googleapi.IsNotModified to check whether the returned error was
  2079. // because http.StatusNotModified was returned.
  2080. func (c *BucketAccessControlsListCall) Do(opts ...googleapi.CallOption) (*BucketAccessControls, error) {
  2081. gensupport.SetOptions(c.urlParams_, opts...)
  2082. res, err := c.doRequest("json")
  2083. if res != nil && res.StatusCode == http.StatusNotModified {
  2084. if res.Body != nil {
  2085. res.Body.Close()
  2086. }
  2087. return nil, &googleapi.Error{
  2088. Code: res.StatusCode,
  2089. Header: res.Header,
  2090. }
  2091. }
  2092. if err != nil {
  2093. return nil, err
  2094. }
  2095. defer googleapi.CloseBody(res)
  2096. if err := googleapi.CheckResponse(res); err != nil {
  2097. return nil, err
  2098. }
  2099. ret := &BucketAccessControls{
  2100. ServerResponse: googleapi.ServerResponse{
  2101. Header: res.Header,
  2102. HTTPStatusCode: res.StatusCode,
  2103. },
  2104. }
  2105. target := &ret
  2106. if err := gensupport.DecodeResponse(target, res); err != nil {
  2107. return nil, err
  2108. }
  2109. return ret, nil
  2110. // {
  2111. // "description": "Retrieves ACL entries on the specified bucket.",
  2112. // "httpMethod": "GET",
  2113. // "id": "storage.bucketAccessControls.list",
  2114. // "parameterOrder": [
  2115. // "bucket"
  2116. // ],
  2117. // "parameters": {
  2118. // "bucket": {
  2119. // "description": "Name of a bucket.",
  2120. // "location": "path",
  2121. // "required": true,
  2122. // "type": "string"
  2123. // },
  2124. // "userProject": {
  2125. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  2126. // "location": "query",
  2127. // "type": "string"
  2128. // }
  2129. // },
  2130. // "path": "b/{bucket}/acl",
  2131. // "response": {
  2132. // "$ref": "BucketAccessControls"
  2133. // },
  2134. // "scopes": [
  2135. // "https://www.googleapis.com/auth/cloud-platform",
  2136. // "https://www.googleapis.com/auth/devstorage.full_control"
  2137. // ]
  2138. // }
  2139. }
  2140. // method id "storage.bucketAccessControls.patch":
  2141. type BucketAccessControlsPatchCall struct {
  2142. s *Service
  2143. bucket string
  2144. entity string
  2145. bucketaccesscontrol *BucketAccessControl
  2146. urlParams_ gensupport.URLParams
  2147. ctx_ context.Context
  2148. header_ http.Header
  2149. }
  2150. // Patch: Patches an ACL entry on the specified bucket.
  2151. func (r *BucketAccessControlsService) Patch(bucket string, entity string, bucketaccesscontrol *BucketAccessControl) *BucketAccessControlsPatchCall {
  2152. c := &BucketAccessControlsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2153. c.bucket = bucket
  2154. c.entity = entity
  2155. c.bucketaccesscontrol = bucketaccesscontrol
  2156. return c
  2157. }
  2158. // UserProject sets the optional parameter "userProject": The project to
  2159. // be billed for this request. Required for Requester Pays buckets.
  2160. func (c *BucketAccessControlsPatchCall) UserProject(userProject string) *BucketAccessControlsPatchCall {
  2161. c.urlParams_.Set("userProject", userProject)
  2162. return c
  2163. }
  2164. // Fields allows partial responses to be retrieved. See
  2165. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2166. // for more information.
  2167. func (c *BucketAccessControlsPatchCall) Fields(s ...googleapi.Field) *BucketAccessControlsPatchCall {
  2168. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2169. return c
  2170. }
  2171. // Context sets the context to be used in this call's Do method. Any
  2172. // pending HTTP request will be aborted if the provided context is
  2173. // canceled.
  2174. func (c *BucketAccessControlsPatchCall) Context(ctx context.Context) *BucketAccessControlsPatchCall {
  2175. c.ctx_ = ctx
  2176. return c
  2177. }
  2178. // Header returns an http.Header that can be modified by the caller to
  2179. // add HTTP headers to the request.
  2180. func (c *BucketAccessControlsPatchCall) Header() http.Header {
  2181. if c.header_ == nil {
  2182. c.header_ = make(http.Header)
  2183. }
  2184. return c.header_
  2185. }
  2186. func (c *BucketAccessControlsPatchCall) doRequest(alt string) (*http.Response, error) {
  2187. reqHeaders := make(http.Header)
  2188. for k, v := range c.header_ {
  2189. reqHeaders[k] = v
  2190. }
  2191. reqHeaders.Set("User-Agent", c.s.userAgent())
  2192. var body io.Reader = nil
  2193. body, err := googleapi.WithoutDataWrapper.JSONReader(c.bucketaccesscontrol)
  2194. if err != nil {
  2195. return nil, err
  2196. }
  2197. reqHeaders.Set("Content-Type", "application/json")
  2198. c.urlParams_.Set("alt", alt)
  2199. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/acl/{entity}")
  2200. urls += "?" + c.urlParams_.Encode()
  2201. req, _ := http.NewRequest("PATCH", urls, body)
  2202. req.Header = reqHeaders
  2203. googleapi.Expand(req.URL, map[string]string{
  2204. "bucket": c.bucket,
  2205. "entity": c.entity,
  2206. })
  2207. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2208. }
  2209. // Do executes the "storage.bucketAccessControls.patch" call.
  2210. // Exactly one of *BucketAccessControl or error will be non-nil. Any
  2211. // non-2xx status code is an error. Response headers are in either
  2212. // *BucketAccessControl.ServerResponse.Header or (if a response was
  2213. // returned at all) in error.(*googleapi.Error).Header. Use
  2214. // googleapi.IsNotModified to check whether the returned error was
  2215. // because http.StatusNotModified was returned.
  2216. func (c *BucketAccessControlsPatchCall) Do(opts ...googleapi.CallOption) (*BucketAccessControl, error) {
  2217. gensupport.SetOptions(c.urlParams_, opts...)
  2218. res, err := c.doRequest("json")
  2219. if res != nil && res.StatusCode == http.StatusNotModified {
  2220. if res.Body != nil {
  2221. res.Body.Close()
  2222. }
  2223. return nil, &googleapi.Error{
  2224. Code: res.StatusCode,
  2225. Header: res.Header,
  2226. }
  2227. }
  2228. if err != nil {
  2229. return nil, err
  2230. }
  2231. defer googleapi.CloseBody(res)
  2232. if err := googleapi.CheckResponse(res); err != nil {
  2233. return nil, err
  2234. }
  2235. ret := &BucketAccessControl{
  2236. ServerResponse: googleapi.ServerResponse{
  2237. Header: res.Header,
  2238. HTTPStatusCode: res.StatusCode,
  2239. },
  2240. }
  2241. target := &ret
  2242. if err := gensupport.DecodeResponse(target, res); err != nil {
  2243. return nil, err
  2244. }
  2245. return ret, nil
  2246. // {
  2247. // "description": "Patches an ACL entry on the specified bucket.",
  2248. // "httpMethod": "PATCH",
  2249. // "id": "storage.bucketAccessControls.patch",
  2250. // "parameterOrder": [
  2251. // "bucket",
  2252. // "entity"
  2253. // ],
  2254. // "parameters": {
  2255. // "bucket": {
  2256. // "description": "Name of a bucket.",
  2257. // "location": "path",
  2258. // "required": true,
  2259. // "type": "string"
  2260. // },
  2261. // "entity": {
  2262. // "description": "The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.",
  2263. // "location": "path",
  2264. // "required": true,
  2265. // "type": "string"
  2266. // },
  2267. // "userProject": {
  2268. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  2269. // "location": "query",
  2270. // "type": "string"
  2271. // }
  2272. // },
  2273. // "path": "b/{bucket}/acl/{entity}",
  2274. // "request": {
  2275. // "$ref": "BucketAccessControl"
  2276. // },
  2277. // "response": {
  2278. // "$ref": "BucketAccessControl"
  2279. // },
  2280. // "scopes": [
  2281. // "https://www.googleapis.com/auth/cloud-platform",
  2282. // "https://www.googleapis.com/auth/devstorage.full_control"
  2283. // ]
  2284. // }
  2285. }
  2286. // method id "storage.bucketAccessControls.update":
  2287. type BucketAccessControlsUpdateCall struct {
  2288. s *Service
  2289. bucket string
  2290. entity string
  2291. bucketaccesscontrol *BucketAccessControl
  2292. urlParams_ gensupport.URLParams
  2293. ctx_ context.Context
  2294. header_ http.Header
  2295. }
  2296. // Update: Updates an ACL entry on the specified bucket.
  2297. func (r *BucketAccessControlsService) Update(bucket string, entity string, bucketaccesscontrol *BucketAccessControl) *BucketAccessControlsUpdateCall {
  2298. c := &BucketAccessControlsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2299. c.bucket = bucket
  2300. c.entity = entity
  2301. c.bucketaccesscontrol = bucketaccesscontrol
  2302. return c
  2303. }
  2304. // UserProject sets the optional parameter "userProject": The project to
  2305. // be billed for this request. Required for Requester Pays buckets.
  2306. func (c *BucketAccessControlsUpdateCall) UserProject(userProject string) *BucketAccessControlsUpdateCall {
  2307. c.urlParams_.Set("userProject", userProject)
  2308. return c
  2309. }
  2310. // Fields allows partial responses to be retrieved. See
  2311. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2312. // for more information.
  2313. func (c *BucketAccessControlsUpdateCall) Fields(s ...googleapi.Field) *BucketAccessControlsUpdateCall {
  2314. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2315. return c
  2316. }
  2317. // Context sets the context to be used in this call's Do method. Any
  2318. // pending HTTP request will be aborted if the provided context is
  2319. // canceled.
  2320. func (c *BucketAccessControlsUpdateCall) Context(ctx context.Context) *BucketAccessControlsUpdateCall {
  2321. c.ctx_ = ctx
  2322. return c
  2323. }
  2324. // Header returns an http.Header that can be modified by the caller to
  2325. // add HTTP headers to the request.
  2326. func (c *BucketAccessControlsUpdateCall) Header() http.Header {
  2327. if c.header_ == nil {
  2328. c.header_ = make(http.Header)
  2329. }
  2330. return c.header_
  2331. }
  2332. func (c *BucketAccessControlsUpdateCall) doRequest(alt string) (*http.Response, error) {
  2333. reqHeaders := make(http.Header)
  2334. for k, v := range c.header_ {
  2335. reqHeaders[k] = v
  2336. }
  2337. reqHeaders.Set("User-Agent", c.s.userAgent())
  2338. var body io.Reader = nil
  2339. body, err := googleapi.WithoutDataWrapper.JSONReader(c.bucketaccesscontrol)
  2340. if err != nil {
  2341. return nil, err
  2342. }
  2343. reqHeaders.Set("Content-Type", "application/json")
  2344. c.urlParams_.Set("alt", alt)
  2345. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/acl/{entity}")
  2346. urls += "?" + c.urlParams_.Encode()
  2347. req, _ := http.NewRequest("PUT", urls, body)
  2348. req.Header = reqHeaders
  2349. googleapi.Expand(req.URL, map[string]string{
  2350. "bucket": c.bucket,
  2351. "entity": c.entity,
  2352. })
  2353. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2354. }
  2355. // Do executes the "storage.bucketAccessControls.update" call.
  2356. // Exactly one of *BucketAccessControl or error will be non-nil. Any
  2357. // non-2xx status code is an error. Response headers are in either
  2358. // *BucketAccessControl.ServerResponse.Header or (if a response was
  2359. // returned at all) in error.(*googleapi.Error).Header. Use
  2360. // googleapi.IsNotModified to check whether the returned error was
  2361. // because http.StatusNotModified was returned.
  2362. func (c *BucketAccessControlsUpdateCall) Do(opts ...googleapi.CallOption) (*BucketAccessControl, error) {
  2363. gensupport.SetOptions(c.urlParams_, opts...)
  2364. res, err := c.doRequest("json")
  2365. if res != nil && res.StatusCode == http.StatusNotModified {
  2366. if res.Body != nil {
  2367. res.Body.Close()
  2368. }
  2369. return nil, &googleapi.Error{
  2370. Code: res.StatusCode,
  2371. Header: res.Header,
  2372. }
  2373. }
  2374. if err != nil {
  2375. return nil, err
  2376. }
  2377. defer googleapi.CloseBody(res)
  2378. if err := googleapi.CheckResponse(res); err != nil {
  2379. return nil, err
  2380. }
  2381. ret := &BucketAccessControl{
  2382. ServerResponse: googleapi.ServerResponse{
  2383. Header: res.Header,
  2384. HTTPStatusCode: res.StatusCode,
  2385. },
  2386. }
  2387. target := &ret
  2388. if err := gensupport.DecodeResponse(target, res); err != nil {
  2389. return nil, err
  2390. }
  2391. return ret, nil
  2392. // {
  2393. // "description": "Updates an ACL entry on the specified bucket.",
  2394. // "httpMethod": "PUT",
  2395. // "id": "storage.bucketAccessControls.update",
  2396. // "parameterOrder": [
  2397. // "bucket",
  2398. // "entity"
  2399. // ],
  2400. // "parameters": {
  2401. // "bucket": {
  2402. // "description": "Name of a bucket.",
  2403. // "location": "path",
  2404. // "required": true,
  2405. // "type": "string"
  2406. // },
  2407. // "entity": {
  2408. // "description": "The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.",
  2409. // "location": "path",
  2410. // "required": true,
  2411. // "type": "string"
  2412. // },
  2413. // "userProject": {
  2414. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  2415. // "location": "query",
  2416. // "type": "string"
  2417. // }
  2418. // },
  2419. // "path": "b/{bucket}/acl/{entity}",
  2420. // "request": {
  2421. // "$ref": "BucketAccessControl"
  2422. // },
  2423. // "response": {
  2424. // "$ref": "BucketAccessControl"
  2425. // },
  2426. // "scopes": [
  2427. // "https://www.googleapis.com/auth/cloud-platform",
  2428. // "https://www.googleapis.com/auth/devstorage.full_control"
  2429. // ]
  2430. // }
  2431. }
  2432. // method id "storage.buckets.delete":
  2433. type BucketsDeleteCall struct {
  2434. s *Service
  2435. bucket string
  2436. urlParams_ gensupport.URLParams
  2437. ctx_ context.Context
  2438. header_ http.Header
  2439. }
  2440. // Delete: Permanently deletes an empty bucket.
  2441. func (r *BucketsService) Delete(bucket string) *BucketsDeleteCall {
  2442. c := &BucketsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2443. c.bucket = bucket
  2444. return c
  2445. }
  2446. // IfMetagenerationMatch sets the optional parameter
  2447. // "ifMetagenerationMatch": If set, only deletes the bucket if its
  2448. // metageneration matches this value.
  2449. func (c *BucketsDeleteCall) IfMetagenerationMatch(ifMetagenerationMatch int64) *BucketsDeleteCall {
  2450. c.urlParams_.Set("ifMetagenerationMatch", fmt.Sprint(ifMetagenerationMatch))
  2451. return c
  2452. }
  2453. // IfMetagenerationNotMatch sets the optional parameter
  2454. // "ifMetagenerationNotMatch": If set, only deletes the bucket if its
  2455. // metageneration does not match this value.
  2456. func (c *BucketsDeleteCall) IfMetagenerationNotMatch(ifMetagenerationNotMatch int64) *BucketsDeleteCall {
  2457. c.urlParams_.Set("ifMetagenerationNotMatch", fmt.Sprint(ifMetagenerationNotMatch))
  2458. return c
  2459. }
  2460. // UserProject sets the optional parameter "userProject": The project to
  2461. // be billed for this request. Required for Requester Pays buckets.
  2462. func (c *BucketsDeleteCall) UserProject(userProject string) *BucketsDeleteCall {
  2463. c.urlParams_.Set("userProject", userProject)
  2464. return c
  2465. }
  2466. // Fields allows partial responses to be retrieved. See
  2467. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2468. // for more information.
  2469. func (c *BucketsDeleteCall) Fields(s ...googleapi.Field) *BucketsDeleteCall {
  2470. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2471. return c
  2472. }
  2473. // Context sets the context to be used in this call's Do method. Any
  2474. // pending HTTP request will be aborted if the provided context is
  2475. // canceled.
  2476. func (c *BucketsDeleteCall) Context(ctx context.Context) *BucketsDeleteCall {
  2477. c.ctx_ = ctx
  2478. return c
  2479. }
  2480. // Header returns an http.Header that can be modified by the caller to
  2481. // add HTTP headers to the request.
  2482. func (c *BucketsDeleteCall) Header() http.Header {
  2483. if c.header_ == nil {
  2484. c.header_ = make(http.Header)
  2485. }
  2486. return c.header_
  2487. }
  2488. func (c *BucketsDeleteCall) doRequest(alt string) (*http.Response, error) {
  2489. reqHeaders := make(http.Header)
  2490. for k, v := range c.header_ {
  2491. reqHeaders[k] = v
  2492. }
  2493. reqHeaders.Set("User-Agent", c.s.userAgent())
  2494. var body io.Reader = nil
  2495. c.urlParams_.Set("alt", alt)
  2496. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}")
  2497. urls += "?" + c.urlParams_.Encode()
  2498. req, _ := http.NewRequest("DELETE", urls, body)
  2499. req.Header = reqHeaders
  2500. googleapi.Expand(req.URL, map[string]string{
  2501. "bucket": c.bucket,
  2502. })
  2503. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2504. }
  2505. // Do executes the "storage.buckets.delete" call.
  2506. func (c *BucketsDeleteCall) Do(opts ...googleapi.CallOption) error {
  2507. gensupport.SetOptions(c.urlParams_, opts...)
  2508. res, err := c.doRequest("json")
  2509. if err != nil {
  2510. return err
  2511. }
  2512. defer googleapi.CloseBody(res)
  2513. if err := googleapi.CheckResponse(res); err != nil {
  2514. return err
  2515. }
  2516. return nil
  2517. // {
  2518. // "description": "Permanently deletes an empty bucket.",
  2519. // "httpMethod": "DELETE",
  2520. // "id": "storage.buckets.delete",
  2521. // "parameterOrder": [
  2522. // "bucket"
  2523. // ],
  2524. // "parameters": {
  2525. // "bucket": {
  2526. // "description": "Name of a bucket.",
  2527. // "location": "path",
  2528. // "required": true,
  2529. // "type": "string"
  2530. // },
  2531. // "ifMetagenerationMatch": {
  2532. // "description": "If set, only deletes the bucket if its metageneration matches this value.",
  2533. // "format": "int64",
  2534. // "location": "query",
  2535. // "type": "string"
  2536. // },
  2537. // "ifMetagenerationNotMatch": {
  2538. // "description": "If set, only deletes the bucket if its metageneration does not match this value.",
  2539. // "format": "int64",
  2540. // "location": "query",
  2541. // "type": "string"
  2542. // },
  2543. // "userProject": {
  2544. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  2545. // "location": "query",
  2546. // "type": "string"
  2547. // }
  2548. // },
  2549. // "path": "b/{bucket}",
  2550. // "scopes": [
  2551. // "https://www.googleapis.com/auth/cloud-platform",
  2552. // "https://www.googleapis.com/auth/devstorage.full_control",
  2553. // "https://www.googleapis.com/auth/devstorage.read_write"
  2554. // ]
  2555. // }
  2556. }
  2557. // method id "storage.buckets.get":
  2558. type BucketsGetCall struct {
  2559. s *Service
  2560. bucket string
  2561. urlParams_ gensupport.URLParams
  2562. ifNoneMatch_ string
  2563. ctx_ context.Context
  2564. header_ http.Header
  2565. }
  2566. // Get: Returns metadata for the specified bucket.
  2567. func (r *BucketsService) Get(bucket string) *BucketsGetCall {
  2568. c := &BucketsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2569. c.bucket = bucket
  2570. return c
  2571. }
  2572. // IfMetagenerationMatch sets the optional parameter
  2573. // "ifMetagenerationMatch": Makes the return of the bucket metadata
  2574. // conditional on whether the bucket's current metageneration matches
  2575. // the given value.
  2576. func (c *BucketsGetCall) IfMetagenerationMatch(ifMetagenerationMatch int64) *BucketsGetCall {
  2577. c.urlParams_.Set("ifMetagenerationMatch", fmt.Sprint(ifMetagenerationMatch))
  2578. return c
  2579. }
  2580. // IfMetagenerationNotMatch sets the optional parameter
  2581. // "ifMetagenerationNotMatch": Makes the return of the bucket metadata
  2582. // conditional on whether the bucket's current metageneration does not
  2583. // match the given value.
  2584. func (c *BucketsGetCall) IfMetagenerationNotMatch(ifMetagenerationNotMatch int64) *BucketsGetCall {
  2585. c.urlParams_.Set("ifMetagenerationNotMatch", fmt.Sprint(ifMetagenerationNotMatch))
  2586. return c
  2587. }
  2588. // Projection sets the optional parameter "projection": Set of
  2589. // properties to return. Defaults to noAcl.
  2590. //
  2591. // Possible values:
  2592. // "full" - Include all properties.
  2593. // "noAcl" - Omit owner, acl and defaultObjectAcl properties.
  2594. func (c *BucketsGetCall) Projection(projection string) *BucketsGetCall {
  2595. c.urlParams_.Set("projection", projection)
  2596. return c
  2597. }
  2598. // UserProject sets the optional parameter "userProject": The project to
  2599. // be billed for this request. Required for Requester Pays buckets.
  2600. func (c *BucketsGetCall) UserProject(userProject string) *BucketsGetCall {
  2601. c.urlParams_.Set("userProject", userProject)
  2602. return c
  2603. }
  2604. // Fields allows partial responses to be retrieved. See
  2605. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2606. // for more information.
  2607. func (c *BucketsGetCall) Fields(s ...googleapi.Field) *BucketsGetCall {
  2608. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2609. return c
  2610. }
  2611. // IfNoneMatch sets the optional parameter which makes the operation
  2612. // fail if the object's ETag matches the given value. This is useful for
  2613. // getting updates only after the object has changed since the last
  2614. // request. Use googleapi.IsNotModified to check whether the response
  2615. // error from Do is the result of In-None-Match.
  2616. func (c *BucketsGetCall) IfNoneMatch(entityTag string) *BucketsGetCall {
  2617. c.ifNoneMatch_ = entityTag
  2618. return c
  2619. }
  2620. // Context sets the context to be used in this call's Do method. Any
  2621. // pending HTTP request will be aborted if the provided context is
  2622. // canceled.
  2623. func (c *BucketsGetCall) Context(ctx context.Context) *BucketsGetCall {
  2624. c.ctx_ = ctx
  2625. return c
  2626. }
  2627. // Header returns an http.Header that can be modified by the caller to
  2628. // add HTTP headers to the request.
  2629. func (c *BucketsGetCall) Header() http.Header {
  2630. if c.header_ == nil {
  2631. c.header_ = make(http.Header)
  2632. }
  2633. return c.header_
  2634. }
  2635. func (c *BucketsGetCall) doRequest(alt string) (*http.Response, error) {
  2636. reqHeaders := make(http.Header)
  2637. for k, v := range c.header_ {
  2638. reqHeaders[k] = v
  2639. }
  2640. reqHeaders.Set("User-Agent", c.s.userAgent())
  2641. if c.ifNoneMatch_ != "" {
  2642. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2643. }
  2644. var body io.Reader = nil
  2645. c.urlParams_.Set("alt", alt)
  2646. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}")
  2647. urls += "?" + c.urlParams_.Encode()
  2648. req, _ := http.NewRequest("GET", urls, body)
  2649. req.Header = reqHeaders
  2650. googleapi.Expand(req.URL, map[string]string{
  2651. "bucket": c.bucket,
  2652. })
  2653. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2654. }
  2655. // Do executes the "storage.buckets.get" call.
  2656. // Exactly one of *Bucket or error will be non-nil. Any non-2xx status
  2657. // code is an error. Response headers are in either
  2658. // *Bucket.ServerResponse.Header or (if a response was returned at all)
  2659. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2660. // check whether the returned error was because http.StatusNotModified
  2661. // was returned.
  2662. func (c *BucketsGetCall) Do(opts ...googleapi.CallOption) (*Bucket, error) {
  2663. gensupport.SetOptions(c.urlParams_, opts...)
  2664. res, err := c.doRequest("json")
  2665. if res != nil && res.StatusCode == http.StatusNotModified {
  2666. if res.Body != nil {
  2667. res.Body.Close()
  2668. }
  2669. return nil, &googleapi.Error{
  2670. Code: res.StatusCode,
  2671. Header: res.Header,
  2672. }
  2673. }
  2674. if err != nil {
  2675. return nil, err
  2676. }
  2677. defer googleapi.CloseBody(res)
  2678. if err := googleapi.CheckResponse(res); err != nil {
  2679. return nil, err
  2680. }
  2681. ret := &Bucket{
  2682. ServerResponse: googleapi.ServerResponse{
  2683. Header: res.Header,
  2684. HTTPStatusCode: res.StatusCode,
  2685. },
  2686. }
  2687. target := &ret
  2688. if err := gensupport.DecodeResponse(target, res); err != nil {
  2689. return nil, err
  2690. }
  2691. return ret, nil
  2692. // {
  2693. // "description": "Returns metadata for the specified bucket.",
  2694. // "httpMethod": "GET",
  2695. // "id": "storage.buckets.get",
  2696. // "parameterOrder": [
  2697. // "bucket"
  2698. // ],
  2699. // "parameters": {
  2700. // "bucket": {
  2701. // "description": "Name of a bucket.",
  2702. // "location": "path",
  2703. // "required": true,
  2704. // "type": "string"
  2705. // },
  2706. // "ifMetagenerationMatch": {
  2707. // "description": "Makes the return of the bucket metadata conditional on whether the bucket's current metageneration matches the given value.",
  2708. // "format": "int64",
  2709. // "location": "query",
  2710. // "type": "string"
  2711. // },
  2712. // "ifMetagenerationNotMatch": {
  2713. // "description": "Makes the return of the bucket metadata conditional on whether the bucket's current metageneration does not match the given value.",
  2714. // "format": "int64",
  2715. // "location": "query",
  2716. // "type": "string"
  2717. // },
  2718. // "projection": {
  2719. // "description": "Set of properties to return. Defaults to noAcl.",
  2720. // "enum": [
  2721. // "full",
  2722. // "noAcl"
  2723. // ],
  2724. // "enumDescriptions": [
  2725. // "Include all properties.",
  2726. // "Omit owner, acl and defaultObjectAcl properties."
  2727. // ],
  2728. // "location": "query",
  2729. // "type": "string"
  2730. // },
  2731. // "userProject": {
  2732. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  2733. // "location": "query",
  2734. // "type": "string"
  2735. // }
  2736. // },
  2737. // "path": "b/{bucket}",
  2738. // "response": {
  2739. // "$ref": "Bucket"
  2740. // },
  2741. // "scopes": [
  2742. // "https://www.googleapis.com/auth/cloud-platform",
  2743. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  2744. // "https://www.googleapis.com/auth/devstorage.full_control",
  2745. // "https://www.googleapis.com/auth/devstorage.read_only",
  2746. // "https://www.googleapis.com/auth/devstorage.read_write"
  2747. // ]
  2748. // }
  2749. }
  2750. // method id "storage.buckets.getIamPolicy":
  2751. type BucketsGetIamPolicyCall struct {
  2752. s *Service
  2753. bucket string
  2754. urlParams_ gensupport.URLParams
  2755. ifNoneMatch_ string
  2756. ctx_ context.Context
  2757. header_ http.Header
  2758. }
  2759. // GetIamPolicy: Returns an IAM policy for the specified bucket.
  2760. func (r *BucketsService) GetIamPolicy(bucket string) *BucketsGetIamPolicyCall {
  2761. c := &BucketsGetIamPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2762. c.bucket = bucket
  2763. return c
  2764. }
  2765. // UserProject sets the optional parameter "userProject": The project to
  2766. // be billed for this request. Required for Requester Pays buckets.
  2767. func (c *BucketsGetIamPolicyCall) UserProject(userProject string) *BucketsGetIamPolicyCall {
  2768. c.urlParams_.Set("userProject", userProject)
  2769. return c
  2770. }
  2771. // Fields allows partial responses to be retrieved. See
  2772. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2773. // for more information.
  2774. func (c *BucketsGetIamPolicyCall) Fields(s ...googleapi.Field) *BucketsGetIamPolicyCall {
  2775. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2776. return c
  2777. }
  2778. // IfNoneMatch sets the optional parameter which makes the operation
  2779. // fail if the object's ETag matches the given value. This is useful for
  2780. // getting updates only after the object has changed since the last
  2781. // request. Use googleapi.IsNotModified to check whether the response
  2782. // error from Do is the result of In-None-Match.
  2783. func (c *BucketsGetIamPolicyCall) IfNoneMatch(entityTag string) *BucketsGetIamPolicyCall {
  2784. c.ifNoneMatch_ = entityTag
  2785. return c
  2786. }
  2787. // Context sets the context to be used in this call's Do method. Any
  2788. // pending HTTP request will be aborted if the provided context is
  2789. // canceled.
  2790. func (c *BucketsGetIamPolicyCall) Context(ctx context.Context) *BucketsGetIamPolicyCall {
  2791. c.ctx_ = ctx
  2792. return c
  2793. }
  2794. // Header returns an http.Header that can be modified by the caller to
  2795. // add HTTP headers to the request.
  2796. func (c *BucketsGetIamPolicyCall) Header() http.Header {
  2797. if c.header_ == nil {
  2798. c.header_ = make(http.Header)
  2799. }
  2800. return c.header_
  2801. }
  2802. func (c *BucketsGetIamPolicyCall) doRequest(alt string) (*http.Response, error) {
  2803. reqHeaders := make(http.Header)
  2804. for k, v := range c.header_ {
  2805. reqHeaders[k] = v
  2806. }
  2807. reqHeaders.Set("User-Agent", c.s.userAgent())
  2808. if c.ifNoneMatch_ != "" {
  2809. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2810. }
  2811. var body io.Reader = nil
  2812. c.urlParams_.Set("alt", alt)
  2813. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/iam")
  2814. urls += "?" + c.urlParams_.Encode()
  2815. req, _ := http.NewRequest("GET", urls, body)
  2816. req.Header = reqHeaders
  2817. googleapi.Expand(req.URL, map[string]string{
  2818. "bucket": c.bucket,
  2819. })
  2820. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2821. }
  2822. // Do executes the "storage.buckets.getIamPolicy" call.
  2823. // Exactly one of *Policy or error will be non-nil. Any non-2xx status
  2824. // code is an error. Response headers are in either
  2825. // *Policy.ServerResponse.Header or (if a response was returned at all)
  2826. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2827. // check whether the returned error was because http.StatusNotModified
  2828. // was returned.
  2829. func (c *BucketsGetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Policy, error) {
  2830. gensupport.SetOptions(c.urlParams_, opts...)
  2831. res, err := c.doRequest("json")
  2832. if res != nil && res.StatusCode == http.StatusNotModified {
  2833. if res.Body != nil {
  2834. res.Body.Close()
  2835. }
  2836. return nil, &googleapi.Error{
  2837. Code: res.StatusCode,
  2838. Header: res.Header,
  2839. }
  2840. }
  2841. if err != nil {
  2842. return nil, err
  2843. }
  2844. defer googleapi.CloseBody(res)
  2845. if err := googleapi.CheckResponse(res); err != nil {
  2846. return nil, err
  2847. }
  2848. ret := &Policy{
  2849. ServerResponse: googleapi.ServerResponse{
  2850. Header: res.Header,
  2851. HTTPStatusCode: res.StatusCode,
  2852. },
  2853. }
  2854. target := &ret
  2855. if err := gensupport.DecodeResponse(target, res); err != nil {
  2856. return nil, err
  2857. }
  2858. return ret, nil
  2859. // {
  2860. // "description": "Returns an IAM policy for the specified bucket.",
  2861. // "httpMethod": "GET",
  2862. // "id": "storage.buckets.getIamPolicy",
  2863. // "parameterOrder": [
  2864. // "bucket"
  2865. // ],
  2866. // "parameters": {
  2867. // "bucket": {
  2868. // "description": "Name of a bucket.",
  2869. // "location": "path",
  2870. // "required": true,
  2871. // "type": "string"
  2872. // },
  2873. // "userProject": {
  2874. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  2875. // "location": "query",
  2876. // "type": "string"
  2877. // }
  2878. // },
  2879. // "path": "b/{bucket}/iam",
  2880. // "response": {
  2881. // "$ref": "Policy"
  2882. // },
  2883. // "scopes": [
  2884. // "https://www.googleapis.com/auth/cloud-platform",
  2885. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  2886. // "https://www.googleapis.com/auth/devstorage.full_control",
  2887. // "https://www.googleapis.com/auth/devstorage.read_only",
  2888. // "https://www.googleapis.com/auth/devstorage.read_write"
  2889. // ]
  2890. // }
  2891. }
  2892. // method id "storage.buckets.insert":
  2893. type BucketsInsertCall struct {
  2894. s *Service
  2895. bucket *Bucket
  2896. urlParams_ gensupport.URLParams
  2897. ctx_ context.Context
  2898. header_ http.Header
  2899. }
  2900. // Insert: Creates a new bucket.
  2901. func (r *BucketsService) Insert(projectid string, bucket *Bucket) *BucketsInsertCall {
  2902. c := &BucketsInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2903. c.urlParams_.Set("project", projectid)
  2904. c.bucket = bucket
  2905. return c
  2906. }
  2907. // PredefinedAcl sets the optional parameter "predefinedAcl": Apply a
  2908. // predefined set of access controls to this bucket.
  2909. //
  2910. // Possible values:
  2911. // "authenticatedRead" - Project team owners get OWNER access, and
  2912. // allAuthenticatedUsers get READER access.
  2913. // "private" - Project team owners get OWNER access.
  2914. // "projectPrivate" - Project team members get access according to
  2915. // their roles.
  2916. // "publicRead" - Project team owners get OWNER access, and allUsers
  2917. // get READER access.
  2918. // "publicReadWrite" - Project team owners get OWNER access, and
  2919. // allUsers get WRITER access.
  2920. func (c *BucketsInsertCall) PredefinedAcl(predefinedAcl string) *BucketsInsertCall {
  2921. c.urlParams_.Set("predefinedAcl", predefinedAcl)
  2922. return c
  2923. }
  2924. // PredefinedDefaultObjectAcl sets the optional parameter
  2925. // "predefinedDefaultObjectAcl": Apply a predefined set of default
  2926. // object access controls to this bucket.
  2927. //
  2928. // Possible values:
  2929. // "authenticatedRead" - Object owner gets OWNER access, and
  2930. // allAuthenticatedUsers get READER access.
  2931. // "bucketOwnerFullControl" - Object owner gets OWNER access, and
  2932. // project team owners get OWNER access.
  2933. // "bucketOwnerRead" - Object owner gets OWNER access, and project
  2934. // team owners get READER access.
  2935. // "private" - Object owner gets OWNER access.
  2936. // "projectPrivate" - Object owner gets OWNER access, and project team
  2937. // members get access according to their roles.
  2938. // "publicRead" - Object owner gets OWNER access, and allUsers get
  2939. // READER access.
  2940. func (c *BucketsInsertCall) PredefinedDefaultObjectAcl(predefinedDefaultObjectAcl string) *BucketsInsertCall {
  2941. c.urlParams_.Set("predefinedDefaultObjectAcl", predefinedDefaultObjectAcl)
  2942. return c
  2943. }
  2944. // Projection sets the optional parameter "projection": Set of
  2945. // properties to return. Defaults to noAcl, unless the bucket resource
  2946. // specifies acl or defaultObjectAcl properties, when it defaults to
  2947. // full.
  2948. //
  2949. // Possible values:
  2950. // "full" - Include all properties.
  2951. // "noAcl" - Omit owner, acl and defaultObjectAcl properties.
  2952. func (c *BucketsInsertCall) Projection(projection string) *BucketsInsertCall {
  2953. c.urlParams_.Set("projection", projection)
  2954. return c
  2955. }
  2956. // UserProject sets the optional parameter "userProject": The project to
  2957. // be billed for this request.
  2958. func (c *BucketsInsertCall) UserProject(userProject string) *BucketsInsertCall {
  2959. c.urlParams_.Set("userProject", userProject)
  2960. return c
  2961. }
  2962. // Fields allows partial responses to be retrieved. See
  2963. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2964. // for more information.
  2965. func (c *BucketsInsertCall) Fields(s ...googleapi.Field) *BucketsInsertCall {
  2966. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2967. return c
  2968. }
  2969. // Context sets the context to be used in this call's Do method. Any
  2970. // pending HTTP request will be aborted if the provided context is
  2971. // canceled.
  2972. func (c *BucketsInsertCall) Context(ctx context.Context) *BucketsInsertCall {
  2973. c.ctx_ = ctx
  2974. return c
  2975. }
  2976. // Header returns an http.Header that can be modified by the caller to
  2977. // add HTTP headers to the request.
  2978. func (c *BucketsInsertCall) Header() http.Header {
  2979. if c.header_ == nil {
  2980. c.header_ = make(http.Header)
  2981. }
  2982. return c.header_
  2983. }
  2984. func (c *BucketsInsertCall) doRequest(alt string) (*http.Response, error) {
  2985. reqHeaders := make(http.Header)
  2986. for k, v := range c.header_ {
  2987. reqHeaders[k] = v
  2988. }
  2989. reqHeaders.Set("User-Agent", c.s.userAgent())
  2990. var body io.Reader = nil
  2991. body, err := googleapi.WithoutDataWrapper.JSONReader(c.bucket)
  2992. if err != nil {
  2993. return nil, err
  2994. }
  2995. reqHeaders.Set("Content-Type", "application/json")
  2996. c.urlParams_.Set("alt", alt)
  2997. urls := googleapi.ResolveRelative(c.s.BasePath, "b")
  2998. urls += "?" + c.urlParams_.Encode()
  2999. req, _ := http.NewRequest("POST", urls, body)
  3000. req.Header = reqHeaders
  3001. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3002. }
  3003. // Do executes the "storage.buckets.insert" call.
  3004. // Exactly one of *Bucket or error will be non-nil. Any non-2xx status
  3005. // code is an error. Response headers are in either
  3006. // *Bucket.ServerResponse.Header or (if a response was returned at all)
  3007. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  3008. // check whether the returned error was because http.StatusNotModified
  3009. // was returned.
  3010. func (c *BucketsInsertCall) Do(opts ...googleapi.CallOption) (*Bucket, error) {
  3011. gensupport.SetOptions(c.urlParams_, opts...)
  3012. res, err := c.doRequest("json")
  3013. if res != nil && res.StatusCode == http.StatusNotModified {
  3014. if res.Body != nil {
  3015. res.Body.Close()
  3016. }
  3017. return nil, &googleapi.Error{
  3018. Code: res.StatusCode,
  3019. Header: res.Header,
  3020. }
  3021. }
  3022. if err != nil {
  3023. return nil, err
  3024. }
  3025. defer googleapi.CloseBody(res)
  3026. if err := googleapi.CheckResponse(res); err != nil {
  3027. return nil, err
  3028. }
  3029. ret := &Bucket{
  3030. ServerResponse: googleapi.ServerResponse{
  3031. Header: res.Header,
  3032. HTTPStatusCode: res.StatusCode,
  3033. },
  3034. }
  3035. target := &ret
  3036. if err := gensupport.DecodeResponse(target, res); err != nil {
  3037. return nil, err
  3038. }
  3039. return ret, nil
  3040. // {
  3041. // "description": "Creates a new bucket.",
  3042. // "httpMethod": "POST",
  3043. // "id": "storage.buckets.insert",
  3044. // "parameterOrder": [
  3045. // "project"
  3046. // ],
  3047. // "parameters": {
  3048. // "predefinedAcl": {
  3049. // "description": "Apply a predefined set of access controls to this bucket.",
  3050. // "enum": [
  3051. // "authenticatedRead",
  3052. // "private",
  3053. // "projectPrivate",
  3054. // "publicRead",
  3055. // "publicReadWrite"
  3056. // ],
  3057. // "enumDescriptions": [
  3058. // "Project team owners get OWNER access, and allAuthenticatedUsers get READER access.",
  3059. // "Project team owners get OWNER access.",
  3060. // "Project team members get access according to their roles.",
  3061. // "Project team owners get OWNER access, and allUsers get READER access.",
  3062. // "Project team owners get OWNER access, and allUsers get WRITER access."
  3063. // ],
  3064. // "location": "query",
  3065. // "type": "string"
  3066. // },
  3067. // "predefinedDefaultObjectAcl": {
  3068. // "description": "Apply a predefined set of default object access controls to this bucket.",
  3069. // "enum": [
  3070. // "authenticatedRead",
  3071. // "bucketOwnerFullControl",
  3072. // "bucketOwnerRead",
  3073. // "private",
  3074. // "projectPrivate",
  3075. // "publicRead"
  3076. // ],
  3077. // "enumDescriptions": [
  3078. // "Object owner gets OWNER access, and allAuthenticatedUsers get READER access.",
  3079. // "Object owner gets OWNER access, and project team owners get OWNER access.",
  3080. // "Object owner gets OWNER access, and project team owners get READER access.",
  3081. // "Object owner gets OWNER access.",
  3082. // "Object owner gets OWNER access, and project team members get access according to their roles.",
  3083. // "Object owner gets OWNER access, and allUsers get READER access."
  3084. // ],
  3085. // "location": "query",
  3086. // "type": "string"
  3087. // },
  3088. // "project": {
  3089. // "description": "A valid API project identifier.",
  3090. // "location": "query",
  3091. // "required": true,
  3092. // "type": "string"
  3093. // },
  3094. // "projection": {
  3095. // "description": "Set of properties to return. Defaults to noAcl, unless the bucket resource specifies acl or defaultObjectAcl properties, when it defaults to full.",
  3096. // "enum": [
  3097. // "full",
  3098. // "noAcl"
  3099. // ],
  3100. // "enumDescriptions": [
  3101. // "Include all properties.",
  3102. // "Omit owner, acl and defaultObjectAcl properties."
  3103. // ],
  3104. // "location": "query",
  3105. // "type": "string"
  3106. // },
  3107. // "userProject": {
  3108. // "description": "The project to be billed for this request.",
  3109. // "location": "query",
  3110. // "type": "string"
  3111. // }
  3112. // },
  3113. // "path": "b",
  3114. // "request": {
  3115. // "$ref": "Bucket"
  3116. // },
  3117. // "response": {
  3118. // "$ref": "Bucket"
  3119. // },
  3120. // "scopes": [
  3121. // "https://www.googleapis.com/auth/cloud-platform",
  3122. // "https://www.googleapis.com/auth/devstorage.full_control",
  3123. // "https://www.googleapis.com/auth/devstorage.read_write"
  3124. // ]
  3125. // }
  3126. }
  3127. // method id "storage.buckets.list":
  3128. type BucketsListCall struct {
  3129. s *Service
  3130. urlParams_ gensupport.URLParams
  3131. ifNoneMatch_ string
  3132. ctx_ context.Context
  3133. header_ http.Header
  3134. }
  3135. // List: Retrieves a list of buckets for a given project.
  3136. func (r *BucketsService) List(projectid string) *BucketsListCall {
  3137. c := &BucketsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3138. c.urlParams_.Set("project", projectid)
  3139. return c
  3140. }
  3141. // MaxResults sets the optional parameter "maxResults": Maximum number
  3142. // of buckets to return in a single response. The service will use this
  3143. // parameter or 1,000 items, whichever is smaller.
  3144. func (c *BucketsListCall) MaxResults(maxResults int64) *BucketsListCall {
  3145. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  3146. return c
  3147. }
  3148. // PageToken sets the optional parameter "pageToken": A
  3149. // previously-returned page token representing part of the larger set of
  3150. // results to view.
  3151. func (c *BucketsListCall) PageToken(pageToken string) *BucketsListCall {
  3152. c.urlParams_.Set("pageToken", pageToken)
  3153. return c
  3154. }
  3155. // Prefix sets the optional parameter "prefix": Filter results to
  3156. // buckets whose names begin with this prefix.
  3157. func (c *BucketsListCall) Prefix(prefix string) *BucketsListCall {
  3158. c.urlParams_.Set("prefix", prefix)
  3159. return c
  3160. }
  3161. // Projection sets the optional parameter "projection": Set of
  3162. // properties to return. Defaults to noAcl.
  3163. //
  3164. // Possible values:
  3165. // "full" - Include all properties.
  3166. // "noAcl" - Omit owner, acl and defaultObjectAcl properties.
  3167. func (c *BucketsListCall) Projection(projection string) *BucketsListCall {
  3168. c.urlParams_.Set("projection", projection)
  3169. return c
  3170. }
  3171. // UserProject sets the optional parameter "userProject": The project to
  3172. // be billed for this request.
  3173. func (c *BucketsListCall) UserProject(userProject string) *BucketsListCall {
  3174. c.urlParams_.Set("userProject", userProject)
  3175. return c
  3176. }
  3177. // Fields allows partial responses to be retrieved. See
  3178. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3179. // for more information.
  3180. func (c *BucketsListCall) Fields(s ...googleapi.Field) *BucketsListCall {
  3181. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3182. return c
  3183. }
  3184. // IfNoneMatch sets the optional parameter which makes the operation
  3185. // fail if the object's ETag matches the given value. This is useful for
  3186. // getting updates only after the object has changed since the last
  3187. // request. Use googleapi.IsNotModified to check whether the response
  3188. // error from Do is the result of In-None-Match.
  3189. func (c *BucketsListCall) IfNoneMatch(entityTag string) *BucketsListCall {
  3190. c.ifNoneMatch_ = entityTag
  3191. return c
  3192. }
  3193. // Context sets the context to be used in this call's Do method. Any
  3194. // pending HTTP request will be aborted if the provided context is
  3195. // canceled.
  3196. func (c *BucketsListCall) Context(ctx context.Context) *BucketsListCall {
  3197. c.ctx_ = ctx
  3198. return c
  3199. }
  3200. // Header returns an http.Header that can be modified by the caller to
  3201. // add HTTP headers to the request.
  3202. func (c *BucketsListCall) Header() http.Header {
  3203. if c.header_ == nil {
  3204. c.header_ = make(http.Header)
  3205. }
  3206. return c.header_
  3207. }
  3208. func (c *BucketsListCall) doRequest(alt string) (*http.Response, error) {
  3209. reqHeaders := make(http.Header)
  3210. for k, v := range c.header_ {
  3211. reqHeaders[k] = v
  3212. }
  3213. reqHeaders.Set("User-Agent", c.s.userAgent())
  3214. if c.ifNoneMatch_ != "" {
  3215. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  3216. }
  3217. var body io.Reader = nil
  3218. c.urlParams_.Set("alt", alt)
  3219. urls := googleapi.ResolveRelative(c.s.BasePath, "b")
  3220. urls += "?" + c.urlParams_.Encode()
  3221. req, _ := http.NewRequest("GET", urls, body)
  3222. req.Header = reqHeaders
  3223. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3224. }
  3225. // Do executes the "storage.buckets.list" call.
  3226. // Exactly one of *Buckets or error will be non-nil. Any non-2xx status
  3227. // code is an error. Response headers are in either
  3228. // *Buckets.ServerResponse.Header or (if a response was returned at all)
  3229. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  3230. // check whether the returned error was because http.StatusNotModified
  3231. // was returned.
  3232. func (c *BucketsListCall) Do(opts ...googleapi.CallOption) (*Buckets, error) {
  3233. gensupport.SetOptions(c.urlParams_, opts...)
  3234. res, err := c.doRequest("json")
  3235. if res != nil && res.StatusCode == http.StatusNotModified {
  3236. if res.Body != nil {
  3237. res.Body.Close()
  3238. }
  3239. return nil, &googleapi.Error{
  3240. Code: res.StatusCode,
  3241. Header: res.Header,
  3242. }
  3243. }
  3244. if err != nil {
  3245. return nil, err
  3246. }
  3247. defer googleapi.CloseBody(res)
  3248. if err := googleapi.CheckResponse(res); err != nil {
  3249. return nil, err
  3250. }
  3251. ret := &Buckets{
  3252. ServerResponse: googleapi.ServerResponse{
  3253. Header: res.Header,
  3254. HTTPStatusCode: res.StatusCode,
  3255. },
  3256. }
  3257. target := &ret
  3258. if err := gensupport.DecodeResponse(target, res); err != nil {
  3259. return nil, err
  3260. }
  3261. return ret, nil
  3262. // {
  3263. // "description": "Retrieves a list of buckets for a given project.",
  3264. // "httpMethod": "GET",
  3265. // "id": "storage.buckets.list",
  3266. // "parameterOrder": [
  3267. // "project"
  3268. // ],
  3269. // "parameters": {
  3270. // "maxResults": {
  3271. // "default": "1000",
  3272. // "description": "Maximum number of buckets to return in a single response. The service will use this parameter or 1,000 items, whichever is smaller.",
  3273. // "format": "uint32",
  3274. // "location": "query",
  3275. // "minimum": "0",
  3276. // "type": "integer"
  3277. // },
  3278. // "pageToken": {
  3279. // "description": "A previously-returned page token representing part of the larger set of results to view.",
  3280. // "location": "query",
  3281. // "type": "string"
  3282. // },
  3283. // "prefix": {
  3284. // "description": "Filter results to buckets whose names begin with this prefix.",
  3285. // "location": "query",
  3286. // "type": "string"
  3287. // },
  3288. // "project": {
  3289. // "description": "A valid API project identifier.",
  3290. // "location": "query",
  3291. // "required": true,
  3292. // "type": "string"
  3293. // },
  3294. // "projection": {
  3295. // "description": "Set of properties to return. Defaults to noAcl.",
  3296. // "enum": [
  3297. // "full",
  3298. // "noAcl"
  3299. // ],
  3300. // "enumDescriptions": [
  3301. // "Include all properties.",
  3302. // "Omit owner, acl and defaultObjectAcl properties."
  3303. // ],
  3304. // "location": "query",
  3305. // "type": "string"
  3306. // },
  3307. // "userProject": {
  3308. // "description": "The project to be billed for this request.",
  3309. // "location": "query",
  3310. // "type": "string"
  3311. // }
  3312. // },
  3313. // "path": "b",
  3314. // "response": {
  3315. // "$ref": "Buckets"
  3316. // },
  3317. // "scopes": [
  3318. // "https://www.googleapis.com/auth/cloud-platform",
  3319. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  3320. // "https://www.googleapis.com/auth/devstorage.full_control",
  3321. // "https://www.googleapis.com/auth/devstorage.read_only",
  3322. // "https://www.googleapis.com/auth/devstorage.read_write"
  3323. // ]
  3324. // }
  3325. }
  3326. // Pages invokes f for each page of results.
  3327. // A non-nil error returned from f will halt the iteration.
  3328. // The provided context supersedes any context provided to the Context method.
  3329. func (c *BucketsListCall) Pages(ctx context.Context, f func(*Buckets) error) error {
  3330. c.ctx_ = ctx
  3331. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  3332. for {
  3333. x, err := c.Do()
  3334. if err != nil {
  3335. return err
  3336. }
  3337. if err := f(x); err != nil {
  3338. return err
  3339. }
  3340. if x.NextPageToken == "" {
  3341. return nil
  3342. }
  3343. c.PageToken(x.NextPageToken)
  3344. }
  3345. }
  3346. // method id "storage.buckets.lockRetentionPolicy":
  3347. type BucketsLockRetentionPolicyCall struct {
  3348. s *Service
  3349. bucket string
  3350. urlParams_ gensupport.URLParams
  3351. ctx_ context.Context
  3352. header_ http.Header
  3353. }
  3354. // LockRetentionPolicy: Locks retention policy on a bucket.
  3355. func (r *BucketsService) LockRetentionPolicy(bucket string, ifMetagenerationMatch int64) *BucketsLockRetentionPolicyCall {
  3356. c := &BucketsLockRetentionPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3357. c.bucket = bucket
  3358. c.urlParams_.Set("ifMetagenerationMatch", fmt.Sprint(ifMetagenerationMatch))
  3359. return c
  3360. }
  3361. // UserProject sets the optional parameter "userProject": The project to
  3362. // be billed for this request. Required for Requester Pays buckets.
  3363. func (c *BucketsLockRetentionPolicyCall) UserProject(userProject string) *BucketsLockRetentionPolicyCall {
  3364. c.urlParams_.Set("userProject", userProject)
  3365. return c
  3366. }
  3367. // Fields allows partial responses to be retrieved. See
  3368. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3369. // for more information.
  3370. func (c *BucketsLockRetentionPolicyCall) Fields(s ...googleapi.Field) *BucketsLockRetentionPolicyCall {
  3371. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3372. return c
  3373. }
  3374. // Context sets the context to be used in this call's Do method. Any
  3375. // pending HTTP request will be aborted if the provided context is
  3376. // canceled.
  3377. func (c *BucketsLockRetentionPolicyCall) Context(ctx context.Context) *BucketsLockRetentionPolicyCall {
  3378. c.ctx_ = ctx
  3379. return c
  3380. }
  3381. // Header returns an http.Header that can be modified by the caller to
  3382. // add HTTP headers to the request.
  3383. func (c *BucketsLockRetentionPolicyCall) Header() http.Header {
  3384. if c.header_ == nil {
  3385. c.header_ = make(http.Header)
  3386. }
  3387. return c.header_
  3388. }
  3389. func (c *BucketsLockRetentionPolicyCall) doRequest(alt string) (*http.Response, error) {
  3390. reqHeaders := make(http.Header)
  3391. for k, v := range c.header_ {
  3392. reqHeaders[k] = v
  3393. }
  3394. reqHeaders.Set("User-Agent", c.s.userAgent())
  3395. var body io.Reader = nil
  3396. c.urlParams_.Set("alt", alt)
  3397. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/lockRetentionPolicy")
  3398. urls += "?" + c.urlParams_.Encode()
  3399. req, _ := http.NewRequest("POST", urls, body)
  3400. req.Header = reqHeaders
  3401. googleapi.Expand(req.URL, map[string]string{
  3402. "bucket": c.bucket,
  3403. })
  3404. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3405. }
  3406. // Do executes the "storage.buckets.lockRetentionPolicy" call.
  3407. // Exactly one of *Bucket or error will be non-nil. Any non-2xx status
  3408. // code is an error. Response headers are in either
  3409. // *Bucket.ServerResponse.Header or (if a response was returned at all)
  3410. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  3411. // check whether the returned error was because http.StatusNotModified
  3412. // was returned.
  3413. func (c *BucketsLockRetentionPolicyCall) Do(opts ...googleapi.CallOption) (*Bucket, error) {
  3414. gensupport.SetOptions(c.urlParams_, opts...)
  3415. res, err := c.doRequest("json")
  3416. if res != nil && res.StatusCode == http.StatusNotModified {
  3417. if res.Body != nil {
  3418. res.Body.Close()
  3419. }
  3420. return nil, &googleapi.Error{
  3421. Code: res.StatusCode,
  3422. Header: res.Header,
  3423. }
  3424. }
  3425. if err != nil {
  3426. return nil, err
  3427. }
  3428. defer googleapi.CloseBody(res)
  3429. if err := googleapi.CheckResponse(res); err != nil {
  3430. return nil, err
  3431. }
  3432. ret := &Bucket{
  3433. ServerResponse: googleapi.ServerResponse{
  3434. Header: res.Header,
  3435. HTTPStatusCode: res.StatusCode,
  3436. },
  3437. }
  3438. target := &ret
  3439. if err := gensupport.DecodeResponse(target, res); err != nil {
  3440. return nil, err
  3441. }
  3442. return ret, nil
  3443. // {
  3444. // "description": "Locks retention policy on a bucket.",
  3445. // "httpMethod": "POST",
  3446. // "id": "storage.buckets.lockRetentionPolicy",
  3447. // "parameterOrder": [
  3448. // "bucket",
  3449. // "ifMetagenerationMatch"
  3450. // ],
  3451. // "parameters": {
  3452. // "bucket": {
  3453. // "description": "Name of a bucket.",
  3454. // "location": "path",
  3455. // "required": true,
  3456. // "type": "string"
  3457. // },
  3458. // "ifMetagenerationMatch": {
  3459. // "description": "Makes the operation conditional on whether bucket's current metageneration matches the given value.",
  3460. // "format": "int64",
  3461. // "location": "query",
  3462. // "required": true,
  3463. // "type": "string"
  3464. // },
  3465. // "userProject": {
  3466. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  3467. // "location": "query",
  3468. // "type": "string"
  3469. // }
  3470. // },
  3471. // "path": "b/{bucket}/lockRetentionPolicy",
  3472. // "response": {
  3473. // "$ref": "Bucket"
  3474. // },
  3475. // "scopes": [
  3476. // "https://www.googleapis.com/auth/cloud-platform",
  3477. // "https://www.googleapis.com/auth/devstorage.full_control",
  3478. // "https://www.googleapis.com/auth/devstorage.read_write"
  3479. // ]
  3480. // }
  3481. }
  3482. // method id "storage.buckets.patch":
  3483. type BucketsPatchCall struct {
  3484. s *Service
  3485. bucket string
  3486. bucket2 *Bucket
  3487. urlParams_ gensupport.URLParams
  3488. ctx_ context.Context
  3489. header_ http.Header
  3490. }
  3491. // Patch: Updates a bucket. Changes to the bucket will be readable
  3492. // immediately after writing, but configuration changes may take time to
  3493. // propagate. This method supports patch semantics.
  3494. func (r *BucketsService) Patch(bucket string, bucket2 *Bucket) *BucketsPatchCall {
  3495. c := &BucketsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3496. c.bucket = bucket
  3497. c.bucket2 = bucket2
  3498. return c
  3499. }
  3500. // IfMetagenerationMatch sets the optional parameter
  3501. // "ifMetagenerationMatch": Makes the return of the bucket metadata
  3502. // conditional on whether the bucket's current metageneration matches
  3503. // the given value.
  3504. func (c *BucketsPatchCall) IfMetagenerationMatch(ifMetagenerationMatch int64) *BucketsPatchCall {
  3505. c.urlParams_.Set("ifMetagenerationMatch", fmt.Sprint(ifMetagenerationMatch))
  3506. return c
  3507. }
  3508. // IfMetagenerationNotMatch sets the optional parameter
  3509. // "ifMetagenerationNotMatch": Makes the return of the bucket metadata
  3510. // conditional on whether the bucket's current metageneration does not
  3511. // match the given value.
  3512. func (c *BucketsPatchCall) IfMetagenerationNotMatch(ifMetagenerationNotMatch int64) *BucketsPatchCall {
  3513. c.urlParams_.Set("ifMetagenerationNotMatch", fmt.Sprint(ifMetagenerationNotMatch))
  3514. return c
  3515. }
  3516. // PredefinedAcl sets the optional parameter "predefinedAcl": Apply a
  3517. // predefined set of access controls to this bucket.
  3518. //
  3519. // Possible values:
  3520. // "authenticatedRead" - Project team owners get OWNER access, and
  3521. // allAuthenticatedUsers get READER access.
  3522. // "private" - Project team owners get OWNER access.
  3523. // "projectPrivate" - Project team members get access according to
  3524. // their roles.
  3525. // "publicRead" - Project team owners get OWNER access, and allUsers
  3526. // get READER access.
  3527. // "publicReadWrite" - Project team owners get OWNER access, and
  3528. // allUsers get WRITER access.
  3529. func (c *BucketsPatchCall) PredefinedAcl(predefinedAcl string) *BucketsPatchCall {
  3530. c.urlParams_.Set("predefinedAcl", predefinedAcl)
  3531. return c
  3532. }
  3533. // PredefinedDefaultObjectAcl sets the optional parameter
  3534. // "predefinedDefaultObjectAcl": Apply a predefined set of default
  3535. // object access controls to this bucket.
  3536. //
  3537. // Possible values:
  3538. // "authenticatedRead" - Object owner gets OWNER access, and
  3539. // allAuthenticatedUsers get READER access.
  3540. // "bucketOwnerFullControl" - Object owner gets OWNER access, and
  3541. // project team owners get OWNER access.
  3542. // "bucketOwnerRead" - Object owner gets OWNER access, and project
  3543. // team owners get READER access.
  3544. // "private" - Object owner gets OWNER access.
  3545. // "projectPrivate" - Object owner gets OWNER access, and project team
  3546. // members get access according to their roles.
  3547. // "publicRead" - Object owner gets OWNER access, and allUsers get
  3548. // READER access.
  3549. func (c *BucketsPatchCall) PredefinedDefaultObjectAcl(predefinedDefaultObjectAcl string) *BucketsPatchCall {
  3550. c.urlParams_.Set("predefinedDefaultObjectAcl", predefinedDefaultObjectAcl)
  3551. return c
  3552. }
  3553. // Projection sets the optional parameter "projection": Set of
  3554. // properties to return. Defaults to full.
  3555. //
  3556. // Possible values:
  3557. // "full" - Include all properties.
  3558. // "noAcl" - Omit owner, acl and defaultObjectAcl properties.
  3559. func (c *BucketsPatchCall) Projection(projection string) *BucketsPatchCall {
  3560. c.urlParams_.Set("projection", projection)
  3561. return c
  3562. }
  3563. // UserProject sets the optional parameter "userProject": The project to
  3564. // be billed for this request. Required for Requester Pays buckets.
  3565. func (c *BucketsPatchCall) UserProject(userProject string) *BucketsPatchCall {
  3566. c.urlParams_.Set("userProject", userProject)
  3567. return c
  3568. }
  3569. // Fields allows partial responses to be retrieved. See
  3570. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3571. // for more information.
  3572. func (c *BucketsPatchCall) Fields(s ...googleapi.Field) *BucketsPatchCall {
  3573. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3574. return c
  3575. }
  3576. // Context sets the context to be used in this call's Do method. Any
  3577. // pending HTTP request will be aborted if the provided context is
  3578. // canceled.
  3579. func (c *BucketsPatchCall) Context(ctx context.Context) *BucketsPatchCall {
  3580. c.ctx_ = ctx
  3581. return c
  3582. }
  3583. // Header returns an http.Header that can be modified by the caller to
  3584. // add HTTP headers to the request.
  3585. func (c *BucketsPatchCall) Header() http.Header {
  3586. if c.header_ == nil {
  3587. c.header_ = make(http.Header)
  3588. }
  3589. return c.header_
  3590. }
  3591. func (c *BucketsPatchCall) doRequest(alt string) (*http.Response, error) {
  3592. reqHeaders := make(http.Header)
  3593. for k, v := range c.header_ {
  3594. reqHeaders[k] = v
  3595. }
  3596. reqHeaders.Set("User-Agent", c.s.userAgent())
  3597. var body io.Reader = nil
  3598. body, err := googleapi.WithoutDataWrapper.JSONReader(c.bucket2)
  3599. if err != nil {
  3600. return nil, err
  3601. }
  3602. reqHeaders.Set("Content-Type", "application/json")
  3603. c.urlParams_.Set("alt", alt)
  3604. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}")
  3605. urls += "?" + c.urlParams_.Encode()
  3606. req, _ := http.NewRequest("PATCH", urls, body)
  3607. req.Header = reqHeaders
  3608. googleapi.Expand(req.URL, map[string]string{
  3609. "bucket": c.bucket,
  3610. })
  3611. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3612. }
  3613. // Do executes the "storage.buckets.patch" call.
  3614. // Exactly one of *Bucket or error will be non-nil. Any non-2xx status
  3615. // code is an error. Response headers are in either
  3616. // *Bucket.ServerResponse.Header or (if a response was returned at all)
  3617. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  3618. // check whether the returned error was because http.StatusNotModified
  3619. // was returned.
  3620. func (c *BucketsPatchCall) Do(opts ...googleapi.CallOption) (*Bucket, error) {
  3621. gensupport.SetOptions(c.urlParams_, opts...)
  3622. res, err := c.doRequest("json")
  3623. if res != nil && res.StatusCode == http.StatusNotModified {
  3624. if res.Body != nil {
  3625. res.Body.Close()
  3626. }
  3627. return nil, &googleapi.Error{
  3628. Code: res.StatusCode,
  3629. Header: res.Header,
  3630. }
  3631. }
  3632. if err != nil {
  3633. return nil, err
  3634. }
  3635. defer googleapi.CloseBody(res)
  3636. if err := googleapi.CheckResponse(res); err != nil {
  3637. return nil, err
  3638. }
  3639. ret := &Bucket{
  3640. ServerResponse: googleapi.ServerResponse{
  3641. Header: res.Header,
  3642. HTTPStatusCode: res.StatusCode,
  3643. },
  3644. }
  3645. target := &ret
  3646. if err := gensupport.DecodeResponse(target, res); err != nil {
  3647. return nil, err
  3648. }
  3649. return ret, nil
  3650. // {
  3651. // "description": "Updates a bucket. Changes to the bucket will be readable immediately after writing, but configuration changes may take time to propagate. This method supports patch semantics.",
  3652. // "httpMethod": "PATCH",
  3653. // "id": "storage.buckets.patch",
  3654. // "parameterOrder": [
  3655. // "bucket"
  3656. // ],
  3657. // "parameters": {
  3658. // "bucket": {
  3659. // "description": "Name of a bucket.",
  3660. // "location": "path",
  3661. // "required": true,
  3662. // "type": "string"
  3663. // },
  3664. // "ifMetagenerationMatch": {
  3665. // "description": "Makes the return of the bucket metadata conditional on whether the bucket's current metageneration matches the given value.",
  3666. // "format": "int64",
  3667. // "location": "query",
  3668. // "type": "string"
  3669. // },
  3670. // "ifMetagenerationNotMatch": {
  3671. // "description": "Makes the return of the bucket metadata conditional on whether the bucket's current metageneration does not match the given value.",
  3672. // "format": "int64",
  3673. // "location": "query",
  3674. // "type": "string"
  3675. // },
  3676. // "predefinedAcl": {
  3677. // "description": "Apply a predefined set of access controls to this bucket.",
  3678. // "enum": [
  3679. // "authenticatedRead",
  3680. // "private",
  3681. // "projectPrivate",
  3682. // "publicRead",
  3683. // "publicReadWrite"
  3684. // ],
  3685. // "enumDescriptions": [
  3686. // "Project team owners get OWNER access, and allAuthenticatedUsers get READER access.",
  3687. // "Project team owners get OWNER access.",
  3688. // "Project team members get access according to their roles.",
  3689. // "Project team owners get OWNER access, and allUsers get READER access.",
  3690. // "Project team owners get OWNER access, and allUsers get WRITER access."
  3691. // ],
  3692. // "location": "query",
  3693. // "type": "string"
  3694. // },
  3695. // "predefinedDefaultObjectAcl": {
  3696. // "description": "Apply a predefined set of default object access controls to this bucket.",
  3697. // "enum": [
  3698. // "authenticatedRead",
  3699. // "bucketOwnerFullControl",
  3700. // "bucketOwnerRead",
  3701. // "private",
  3702. // "projectPrivate",
  3703. // "publicRead"
  3704. // ],
  3705. // "enumDescriptions": [
  3706. // "Object owner gets OWNER access, and allAuthenticatedUsers get READER access.",
  3707. // "Object owner gets OWNER access, and project team owners get OWNER access.",
  3708. // "Object owner gets OWNER access, and project team owners get READER access.",
  3709. // "Object owner gets OWNER access.",
  3710. // "Object owner gets OWNER access, and project team members get access according to their roles.",
  3711. // "Object owner gets OWNER access, and allUsers get READER access."
  3712. // ],
  3713. // "location": "query",
  3714. // "type": "string"
  3715. // },
  3716. // "projection": {
  3717. // "description": "Set of properties to return. Defaults to full.",
  3718. // "enum": [
  3719. // "full",
  3720. // "noAcl"
  3721. // ],
  3722. // "enumDescriptions": [
  3723. // "Include all properties.",
  3724. // "Omit owner, acl and defaultObjectAcl properties."
  3725. // ],
  3726. // "location": "query",
  3727. // "type": "string"
  3728. // },
  3729. // "userProject": {
  3730. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  3731. // "location": "query",
  3732. // "type": "string"
  3733. // }
  3734. // },
  3735. // "path": "b/{bucket}",
  3736. // "request": {
  3737. // "$ref": "Bucket"
  3738. // },
  3739. // "response": {
  3740. // "$ref": "Bucket"
  3741. // },
  3742. // "scopes": [
  3743. // "https://www.googleapis.com/auth/cloud-platform",
  3744. // "https://www.googleapis.com/auth/devstorage.full_control"
  3745. // ]
  3746. // }
  3747. }
  3748. // method id "storage.buckets.setIamPolicy":
  3749. type BucketsSetIamPolicyCall struct {
  3750. s *Service
  3751. bucket string
  3752. policy *Policy
  3753. urlParams_ gensupport.URLParams
  3754. ctx_ context.Context
  3755. header_ http.Header
  3756. }
  3757. // SetIamPolicy: Updates an IAM policy for the specified bucket.
  3758. func (r *BucketsService) SetIamPolicy(bucket string, policy *Policy) *BucketsSetIamPolicyCall {
  3759. c := &BucketsSetIamPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3760. c.bucket = bucket
  3761. c.policy = policy
  3762. return c
  3763. }
  3764. // UserProject sets the optional parameter "userProject": The project to
  3765. // be billed for this request. Required for Requester Pays buckets.
  3766. func (c *BucketsSetIamPolicyCall) UserProject(userProject string) *BucketsSetIamPolicyCall {
  3767. c.urlParams_.Set("userProject", userProject)
  3768. return c
  3769. }
  3770. // Fields allows partial responses to be retrieved. See
  3771. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3772. // for more information.
  3773. func (c *BucketsSetIamPolicyCall) Fields(s ...googleapi.Field) *BucketsSetIamPolicyCall {
  3774. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3775. return c
  3776. }
  3777. // Context sets the context to be used in this call's Do method. Any
  3778. // pending HTTP request will be aborted if the provided context is
  3779. // canceled.
  3780. func (c *BucketsSetIamPolicyCall) Context(ctx context.Context) *BucketsSetIamPolicyCall {
  3781. c.ctx_ = ctx
  3782. return c
  3783. }
  3784. // Header returns an http.Header that can be modified by the caller to
  3785. // add HTTP headers to the request.
  3786. func (c *BucketsSetIamPolicyCall) Header() http.Header {
  3787. if c.header_ == nil {
  3788. c.header_ = make(http.Header)
  3789. }
  3790. return c.header_
  3791. }
  3792. func (c *BucketsSetIamPolicyCall) doRequest(alt string) (*http.Response, error) {
  3793. reqHeaders := make(http.Header)
  3794. for k, v := range c.header_ {
  3795. reqHeaders[k] = v
  3796. }
  3797. reqHeaders.Set("User-Agent", c.s.userAgent())
  3798. var body io.Reader = nil
  3799. body, err := googleapi.WithoutDataWrapper.JSONReader(c.policy)
  3800. if err != nil {
  3801. return nil, err
  3802. }
  3803. reqHeaders.Set("Content-Type", "application/json")
  3804. c.urlParams_.Set("alt", alt)
  3805. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/iam")
  3806. urls += "?" + c.urlParams_.Encode()
  3807. req, _ := http.NewRequest("PUT", urls, body)
  3808. req.Header = reqHeaders
  3809. googleapi.Expand(req.URL, map[string]string{
  3810. "bucket": c.bucket,
  3811. })
  3812. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3813. }
  3814. // Do executes the "storage.buckets.setIamPolicy" call.
  3815. // Exactly one of *Policy or error will be non-nil. Any non-2xx status
  3816. // code is an error. Response headers are in either
  3817. // *Policy.ServerResponse.Header or (if a response was returned at all)
  3818. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  3819. // check whether the returned error was because http.StatusNotModified
  3820. // was returned.
  3821. func (c *BucketsSetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Policy, error) {
  3822. gensupport.SetOptions(c.urlParams_, opts...)
  3823. res, err := c.doRequest("json")
  3824. if res != nil && res.StatusCode == http.StatusNotModified {
  3825. if res.Body != nil {
  3826. res.Body.Close()
  3827. }
  3828. return nil, &googleapi.Error{
  3829. Code: res.StatusCode,
  3830. Header: res.Header,
  3831. }
  3832. }
  3833. if err != nil {
  3834. return nil, err
  3835. }
  3836. defer googleapi.CloseBody(res)
  3837. if err := googleapi.CheckResponse(res); err != nil {
  3838. return nil, err
  3839. }
  3840. ret := &Policy{
  3841. ServerResponse: googleapi.ServerResponse{
  3842. Header: res.Header,
  3843. HTTPStatusCode: res.StatusCode,
  3844. },
  3845. }
  3846. target := &ret
  3847. if err := gensupport.DecodeResponse(target, res); err != nil {
  3848. return nil, err
  3849. }
  3850. return ret, nil
  3851. // {
  3852. // "description": "Updates an IAM policy for the specified bucket.",
  3853. // "httpMethod": "PUT",
  3854. // "id": "storage.buckets.setIamPolicy",
  3855. // "parameterOrder": [
  3856. // "bucket"
  3857. // ],
  3858. // "parameters": {
  3859. // "bucket": {
  3860. // "description": "Name of a bucket.",
  3861. // "location": "path",
  3862. // "required": true,
  3863. // "type": "string"
  3864. // },
  3865. // "userProject": {
  3866. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  3867. // "location": "query",
  3868. // "type": "string"
  3869. // }
  3870. // },
  3871. // "path": "b/{bucket}/iam",
  3872. // "request": {
  3873. // "$ref": "Policy"
  3874. // },
  3875. // "response": {
  3876. // "$ref": "Policy"
  3877. // },
  3878. // "scopes": [
  3879. // "https://www.googleapis.com/auth/cloud-platform",
  3880. // "https://www.googleapis.com/auth/devstorage.full_control",
  3881. // "https://www.googleapis.com/auth/devstorage.read_write"
  3882. // ]
  3883. // }
  3884. }
  3885. // method id "storage.buckets.testIamPermissions":
  3886. type BucketsTestIamPermissionsCall struct {
  3887. s *Service
  3888. bucket string
  3889. urlParams_ gensupport.URLParams
  3890. ifNoneMatch_ string
  3891. ctx_ context.Context
  3892. header_ http.Header
  3893. }
  3894. // TestIamPermissions: Tests a set of permissions on the given bucket to
  3895. // see which, if any, are held by the caller.
  3896. func (r *BucketsService) TestIamPermissions(bucket string, permissions []string) *BucketsTestIamPermissionsCall {
  3897. c := &BucketsTestIamPermissionsCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3898. c.bucket = bucket
  3899. c.urlParams_.SetMulti("permissions", append([]string{}, permissions...))
  3900. return c
  3901. }
  3902. // UserProject sets the optional parameter "userProject": The project to
  3903. // be billed for this request. Required for Requester Pays buckets.
  3904. func (c *BucketsTestIamPermissionsCall) UserProject(userProject string) *BucketsTestIamPermissionsCall {
  3905. c.urlParams_.Set("userProject", userProject)
  3906. return c
  3907. }
  3908. // Fields allows partial responses to be retrieved. See
  3909. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3910. // for more information.
  3911. func (c *BucketsTestIamPermissionsCall) Fields(s ...googleapi.Field) *BucketsTestIamPermissionsCall {
  3912. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3913. return c
  3914. }
  3915. // IfNoneMatch sets the optional parameter which makes the operation
  3916. // fail if the object's ETag matches the given value. This is useful for
  3917. // getting updates only after the object has changed since the last
  3918. // request. Use googleapi.IsNotModified to check whether the response
  3919. // error from Do is the result of In-None-Match.
  3920. func (c *BucketsTestIamPermissionsCall) IfNoneMatch(entityTag string) *BucketsTestIamPermissionsCall {
  3921. c.ifNoneMatch_ = entityTag
  3922. return c
  3923. }
  3924. // Context sets the context to be used in this call's Do method. Any
  3925. // pending HTTP request will be aborted if the provided context is
  3926. // canceled.
  3927. func (c *BucketsTestIamPermissionsCall) Context(ctx context.Context) *BucketsTestIamPermissionsCall {
  3928. c.ctx_ = ctx
  3929. return c
  3930. }
  3931. // Header returns an http.Header that can be modified by the caller to
  3932. // add HTTP headers to the request.
  3933. func (c *BucketsTestIamPermissionsCall) Header() http.Header {
  3934. if c.header_ == nil {
  3935. c.header_ = make(http.Header)
  3936. }
  3937. return c.header_
  3938. }
  3939. func (c *BucketsTestIamPermissionsCall) doRequest(alt string) (*http.Response, error) {
  3940. reqHeaders := make(http.Header)
  3941. for k, v := range c.header_ {
  3942. reqHeaders[k] = v
  3943. }
  3944. reqHeaders.Set("User-Agent", c.s.userAgent())
  3945. if c.ifNoneMatch_ != "" {
  3946. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  3947. }
  3948. var body io.Reader = nil
  3949. c.urlParams_.Set("alt", alt)
  3950. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/iam/testPermissions")
  3951. urls += "?" + c.urlParams_.Encode()
  3952. req, _ := http.NewRequest("GET", urls, body)
  3953. req.Header = reqHeaders
  3954. googleapi.Expand(req.URL, map[string]string{
  3955. "bucket": c.bucket,
  3956. })
  3957. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3958. }
  3959. // Do executes the "storage.buckets.testIamPermissions" call.
  3960. // Exactly one of *TestIamPermissionsResponse or error will be non-nil.
  3961. // Any non-2xx status code is an error. Response headers are in either
  3962. // *TestIamPermissionsResponse.ServerResponse.Header or (if a response
  3963. // was returned at all) in error.(*googleapi.Error).Header. Use
  3964. // googleapi.IsNotModified to check whether the returned error was
  3965. // because http.StatusNotModified was returned.
  3966. func (c *BucketsTestIamPermissionsCall) Do(opts ...googleapi.CallOption) (*TestIamPermissionsResponse, error) {
  3967. gensupport.SetOptions(c.urlParams_, opts...)
  3968. res, err := c.doRequest("json")
  3969. if res != nil && res.StatusCode == http.StatusNotModified {
  3970. if res.Body != nil {
  3971. res.Body.Close()
  3972. }
  3973. return nil, &googleapi.Error{
  3974. Code: res.StatusCode,
  3975. Header: res.Header,
  3976. }
  3977. }
  3978. if err != nil {
  3979. return nil, err
  3980. }
  3981. defer googleapi.CloseBody(res)
  3982. if err := googleapi.CheckResponse(res); err != nil {
  3983. return nil, err
  3984. }
  3985. ret := &TestIamPermissionsResponse{
  3986. ServerResponse: googleapi.ServerResponse{
  3987. Header: res.Header,
  3988. HTTPStatusCode: res.StatusCode,
  3989. },
  3990. }
  3991. target := &ret
  3992. if err := gensupport.DecodeResponse(target, res); err != nil {
  3993. return nil, err
  3994. }
  3995. return ret, nil
  3996. // {
  3997. // "description": "Tests a set of permissions on the given bucket to see which, if any, are held by the caller.",
  3998. // "httpMethod": "GET",
  3999. // "id": "storage.buckets.testIamPermissions",
  4000. // "parameterOrder": [
  4001. // "bucket",
  4002. // "permissions"
  4003. // ],
  4004. // "parameters": {
  4005. // "bucket": {
  4006. // "description": "Name of a bucket.",
  4007. // "location": "path",
  4008. // "required": true,
  4009. // "type": "string"
  4010. // },
  4011. // "permissions": {
  4012. // "description": "Permissions to test.",
  4013. // "location": "query",
  4014. // "repeated": true,
  4015. // "required": true,
  4016. // "type": "string"
  4017. // },
  4018. // "userProject": {
  4019. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  4020. // "location": "query",
  4021. // "type": "string"
  4022. // }
  4023. // },
  4024. // "path": "b/{bucket}/iam/testPermissions",
  4025. // "response": {
  4026. // "$ref": "TestIamPermissionsResponse"
  4027. // },
  4028. // "scopes": [
  4029. // "https://www.googleapis.com/auth/cloud-platform",
  4030. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  4031. // "https://www.googleapis.com/auth/devstorage.full_control",
  4032. // "https://www.googleapis.com/auth/devstorage.read_only",
  4033. // "https://www.googleapis.com/auth/devstorage.read_write"
  4034. // ]
  4035. // }
  4036. }
  4037. // method id "storage.buckets.update":
  4038. type BucketsUpdateCall struct {
  4039. s *Service
  4040. bucket string
  4041. bucket2 *Bucket
  4042. urlParams_ gensupport.URLParams
  4043. ctx_ context.Context
  4044. header_ http.Header
  4045. }
  4046. // Update: Updates a bucket. Changes to the bucket will be readable
  4047. // immediately after writing, but configuration changes may take time to
  4048. // propagate.
  4049. func (r *BucketsService) Update(bucket string, bucket2 *Bucket) *BucketsUpdateCall {
  4050. c := &BucketsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4051. c.bucket = bucket
  4052. c.bucket2 = bucket2
  4053. return c
  4054. }
  4055. // IfMetagenerationMatch sets the optional parameter
  4056. // "ifMetagenerationMatch": Makes the return of the bucket metadata
  4057. // conditional on whether the bucket's current metageneration matches
  4058. // the given value.
  4059. func (c *BucketsUpdateCall) IfMetagenerationMatch(ifMetagenerationMatch int64) *BucketsUpdateCall {
  4060. c.urlParams_.Set("ifMetagenerationMatch", fmt.Sprint(ifMetagenerationMatch))
  4061. return c
  4062. }
  4063. // IfMetagenerationNotMatch sets the optional parameter
  4064. // "ifMetagenerationNotMatch": Makes the return of the bucket metadata
  4065. // conditional on whether the bucket's current metageneration does not
  4066. // match the given value.
  4067. func (c *BucketsUpdateCall) IfMetagenerationNotMatch(ifMetagenerationNotMatch int64) *BucketsUpdateCall {
  4068. c.urlParams_.Set("ifMetagenerationNotMatch", fmt.Sprint(ifMetagenerationNotMatch))
  4069. return c
  4070. }
  4071. // PredefinedAcl sets the optional parameter "predefinedAcl": Apply a
  4072. // predefined set of access controls to this bucket.
  4073. //
  4074. // Possible values:
  4075. // "authenticatedRead" - Project team owners get OWNER access, and
  4076. // allAuthenticatedUsers get READER access.
  4077. // "private" - Project team owners get OWNER access.
  4078. // "projectPrivate" - Project team members get access according to
  4079. // their roles.
  4080. // "publicRead" - Project team owners get OWNER access, and allUsers
  4081. // get READER access.
  4082. // "publicReadWrite" - Project team owners get OWNER access, and
  4083. // allUsers get WRITER access.
  4084. func (c *BucketsUpdateCall) PredefinedAcl(predefinedAcl string) *BucketsUpdateCall {
  4085. c.urlParams_.Set("predefinedAcl", predefinedAcl)
  4086. return c
  4087. }
  4088. // PredefinedDefaultObjectAcl sets the optional parameter
  4089. // "predefinedDefaultObjectAcl": Apply a predefined set of default
  4090. // object access controls to this bucket.
  4091. //
  4092. // Possible values:
  4093. // "authenticatedRead" - Object owner gets OWNER access, and
  4094. // allAuthenticatedUsers get READER access.
  4095. // "bucketOwnerFullControl" - Object owner gets OWNER access, and
  4096. // project team owners get OWNER access.
  4097. // "bucketOwnerRead" - Object owner gets OWNER access, and project
  4098. // team owners get READER access.
  4099. // "private" - Object owner gets OWNER access.
  4100. // "projectPrivate" - Object owner gets OWNER access, and project team
  4101. // members get access according to their roles.
  4102. // "publicRead" - Object owner gets OWNER access, and allUsers get
  4103. // READER access.
  4104. func (c *BucketsUpdateCall) PredefinedDefaultObjectAcl(predefinedDefaultObjectAcl string) *BucketsUpdateCall {
  4105. c.urlParams_.Set("predefinedDefaultObjectAcl", predefinedDefaultObjectAcl)
  4106. return c
  4107. }
  4108. // Projection sets the optional parameter "projection": Set of
  4109. // properties to return. Defaults to full.
  4110. //
  4111. // Possible values:
  4112. // "full" - Include all properties.
  4113. // "noAcl" - Omit owner, acl and defaultObjectAcl properties.
  4114. func (c *BucketsUpdateCall) Projection(projection string) *BucketsUpdateCall {
  4115. c.urlParams_.Set("projection", projection)
  4116. return c
  4117. }
  4118. // UserProject sets the optional parameter "userProject": The project to
  4119. // be billed for this request. Required for Requester Pays buckets.
  4120. func (c *BucketsUpdateCall) UserProject(userProject string) *BucketsUpdateCall {
  4121. c.urlParams_.Set("userProject", userProject)
  4122. return c
  4123. }
  4124. // Fields allows partial responses to be retrieved. See
  4125. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4126. // for more information.
  4127. func (c *BucketsUpdateCall) Fields(s ...googleapi.Field) *BucketsUpdateCall {
  4128. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4129. return c
  4130. }
  4131. // Context sets the context to be used in this call's Do method. Any
  4132. // pending HTTP request will be aborted if the provided context is
  4133. // canceled.
  4134. func (c *BucketsUpdateCall) Context(ctx context.Context) *BucketsUpdateCall {
  4135. c.ctx_ = ctx
  4136. return c
  4137. }
  4138. // Header returns an http.Header that can be modified by the caller to
  4139. // add HTTP headers to the request.
  4140. func (c *BucketsUpdateCall) Header() http.Header {
  4141. if c.header_ == nil {
  4142. c.header_ = make(http.Header)
  4143. }
  4144. return c.header_
  4145. }
  4146. func (c *BucketsUpdateCall) doRequest(alt string) (*http.Response, error) {
  4147. reqHeaders := make(http.Header)
  4148. for k, v := range c.header_ {
  4149. reqHeaders[k] = v
  4150. }
  4151. reqHeaders.Set("User-Agent", c.s.userAgent())
  4152. var body io.Reader = nil
  4153. body, err := googleapi.WithoutDataWrapper.JSONReader(c.bucket2)
  4154. if err != nil {
  4155. return nil, err
  4156. }
  4157. reqHeaders.Set("Content-Type", "application/json")
  4158. c.urlParams_.Set("alt", alt)
  4159. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}")
  4160. urls += "?" + c.urlParams_.Encode()
  4161. req, _ := http.NewRequest("PUT", urls, body)
  4162. req.Header = reqHeaders
  4163. googleapi.Expand(req.URL, map[string]string{
  4164. "bucket": c.bucket,
  4165. })
  4166. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4167. }
  4168. // Do executes the "storage.buckets.update" call.
  4169. // Exactly one of *Bucket or error will be non-nil. Any non-2xx status
  4170. // code is an error. Response headers are in either
  4171. // *Bucket.ServerResponse.Header or (if a response was returned at all)
  4172. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  4173. // check whether the returned error was because http.StatusNotModified
  4174. // was returned.
  4175. func (c *BucketsUpdateCall) Do(opts ...googleapi.CallOption) (*Bucket, error) {
  4176. gensupport.SetOptions(c.urlParams_, opts...)
  4177. res, err := c.doRequest("json")
  4178. if res != nil && res.StatusCode == http.StatusNotModified {
  4179. if res.Body != nil {
  4180. res.Body.Close()
  4181. }
  4182. return nil, &googleapi.Error{
  4183. Code: res.StatusCode,
  4184. Header: res.Header,
  4185. }
  4186. }
  4187. if err != nil {
  4188. return nil, err
  4189. }
  4190. defer googleapi.CloseBody(res)
  4191. if err := googleapi.CheckResponse(res); err != nil {
  4192. return nil, err
  4193. }
  4194. ret := &Bucket{
  4195. ServerResponse: googleapi.ServerResponse{
  4196. Header: res.Header,
  4197. HTTPStatusCode: res.StatusCode,
  4198. },
  4199. }
  4200. target := &ret
  4201. if err := gensupport.DecodeResponse(target, res); err != nil {
  4202. return nil, err
  4203. }
  4204. return ret, nil
  4205. // {
  4206. // "description": "Updates a bucket. Changes to the bucket will be readable immediately after writing, but configuration changes may take time to propagate.",
  4207. // "httpMethod": "PUT",
  4208. // "id": "storage.buckets.update",
  4209. // "parameterOrder": [
  4210. // "bucket"
  4211. // ],
  4212. // "parameters": {
  4213. // "bucket": {
  4214. // "description": "Name of a bucket.",
  4215. // "location": "path",
  4216. // "required": true,
  4217. // "type": "string"
  4218. // },
  4219. // "ifMetagenerationMatch": {
  4220. // "description": "Makes the return of the bucket metadata conditional on whether the bucket's current metageneration matches the given value.",
  4221. // "format": "int64",
  4222. // "location": "query",
  4223. // "type": "string"
  4224. // },
  4225. // "ifMetagenerationNotMatch": {
  4226. // "description": "Makes the return of the bucket metadata conditional on whether the bucket's current metageneration does not match the given value.",
  4227. // "format": "int64",
  4228. // "location": "query",
  4229. // "type": "string"
  4230. // },
  4231. // "predefinedAcl": {
  4232. // "description": "Apply a predefined set of access controls to this bucket.",
  4233. // "enum": [
  4234. // "authenticatedRead",
  4235. // "private",
  4236. // "projectPrivate",
  4237. // "publicRead",
  4238. // "publicReadWrite"
  4239. // ],
  4240. // "enumDescriptions": [
  4241. // "Project team owners get OWNER access, and allAuthenticatedUsers get READER access.",
  4242. // "Project team owners get OWNER access.",
  4243. // "Project team members get access according to their roles.",
  4244. // "Project team owners get OWNER access, and allUsers get READER access.",
  4245. // "Project team owners get OWNER access, and allUsers get WRITER access."
  4246. // ],
  4247. // "location": "query",
  4248. // "type": "string"
  4249. // },
  4250. // "predefinedDefaultObjectAcl": {
  4251. // "description": "Apply a predefined set of default object access controls to this bucket.",
  4252. // "enum": [
  4253. // "authenticatedRead",
  4254. // "bucketOwnerFullControl",
  4255. // "bucketOwnerRead",
  4256. // "private",
  4257. // "projectPrivate",
  4258. // "publicRead"
  4259. // ],
  4260. // "enumDescriptions": [
  4261. // "Object owner gets OWNER access, and allAuthenticatedUsers get READER access.",
  4262. // "Object owner gets OWNER access, and project team owners get OWNER access.",
  4263. // "Object owner gets OWNER access, and project team owners get READER access.",
  4264. // "Object owner gets OWNER access.",
  4265. // "Object owner gets OWNER access, and project team members get access according to their roles.",
  4266. // "Object owner gets OWNER access, and allUsers get READER access."
  4267. // ],
  4268. // "location": "query",
  4269. // "type": "string"
  4270. // },
  4271. // "projection": {
  4272. // "description": "Set of properties to return. Defaults to full.",
  4273. // "enum": [
  4274. // "full",
  4275. // "noAcl"
  4276. // ],
  4277. // "enumDescriptions": [
  4278. // "Include all properties.",
  4279. // "Omit owner, acl and defaultObjectAcl properties."
  4280. // ],
  4281. // "location": "query",
  4282. // "type": "string"
  4283. // },
  4284. // "userProject": {
  4285. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  4286. // "location": "query",
  4287. // "type": "string"
  4288. // }
  4289. // },
  4290. // "path": "b/{bucket}",
  4291. // "request": {
  4292. // "$ref": "Bucket"
  4293. // },
  4294. // "response": {
  4295. // "$ref": "Bucket"
  4296. // },
  4297. // "scopes": [
  4298. // "https://www.googleapis.com/auth/cloud-platform",
  4299. // "https://www.googleapis.com/auth/devstorage.full_control"
  4300. // ]
  4301. // }
  4302. }
  4303. // method id "storage.channels.stop":
  4304. type ChannelsStopCall struct {
  4305. s *Service
  4306. channel *Channel
  4307. urlParams_ gensupport.URLParams
  4308. ctx_ context.Context
  4309. header_ http.Header
  4310. }
  4311. // Stop: Stop watching resources through this channel
  4312. func (r *ChannelsService) Stop(channel *Channel) *ChannelsStopCall {
  4313. c := &ChannelsStopCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4314. c.channel = channel
  4315. return c
  4316. }
  4317. // Fields allows partial responses to be retrieved. See
  4318. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4319. // for more information.
  4320. func (c *ChannelsStopCall) Fields(s ...googleapi.Field) *ChannelsStopCall {
  4321. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4322. return c
  4323. }
  4324. // Context sets the context to be used in this call's Do method. Any
  4325. // pending HTTP request will be aborted if the provided context is
  4326. // canceled.
  4327. func (c *ChannelsStopCall) Context(ctx context.Context) *ChannelsStopCall {
  4328. c.ctx_ = ctx
  4329. return c
  4330. }
  4331. // Header returns an http.Header that can be modified by the caller to
  4332. // add HTTP headers to the request.
  4333. func (c *ChannelsStopCall) Header() http.Header {
  4334. if c.header_ == nil {
  4335. c.header_ = make(http.Header)
  4336. }
  4337. return c.header_
  4338. }
  4339. func (c *ChannelsStopCall) doRequest(alt string) (*http.Response, error) {
  4340. reqHeaders := make(http.Header)
  4341. for k, v := range c.header_ {
  4342. reqHeaders[k] = v
  4343. }
  4344. reqHeaders.Set("User-Agent", c.s.userAgent())
  4345. var body io.Reader = nil
  4346. body, err := googleapi.WithoutDataWrapper.JSONReader(c.channel)
  4347. if err != nil {
  4348. return nil, err
  4349. }
  4350. reqHeaders.Set("Content-Type", "application/json")
  4351. c.urlParams_.Set("alt", alt)
  4352. urls := googleapi.ResolveRelative(c.s.BasePath, "channels/stop")
  4353. urls += "?" + c.urlParams_.Encode()
  4354. req, _ := http.NewRequest("POST", urls, body)
  4355. req.Header = reqHeaders
  4356. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4357. }
  4358. // Do executes the "storage.channels.stop" call.
  4359. func (c *ChannelsStopCall) Do(opts ...googleapi.CallOption) error {
  4360. gensupport.SetOptions(c.urlParams_, opts...)
  4361. res, err := c.doRequest("json")
  4362. if err != nil {
  4363. return err
  4364. }
  4365. defer googleapi.CloseBody(res)
  4366. if err := googleapi.CheckResponse(res); err != nil {
  4367. return err
  4368. }
  4369. return nil
  4370. // {
  4371. // "description": "Stop watching resources through this channel",
  4372. // "httpMethod": "POST",
  4373. // "id": "storage.channels.stop",
  4374. // "path": "channels/stop",
  4375. // "request": {
  4376. // "$ref": "Channel",
  4377. // "parameterName": "resource"
  4378. // },
  4379. // "scopes": [
  4380. // "https://www.googleapis.com/auth/cloud-platform",
  4381. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  4382. // "https://www.googleapis.com/auth/devstorage.full_control",
  4383. // "https://www.googleapis.com/auth/devstorage.read_only",
  4384. // "https://www.googleapis.com/auth/devstorage.read_write"
  4385. // ]
  4386. // }
  4387. }
  4388. // method id "storage.defaultObjectAccessControls.delete":
  4389. type DefaultObjectAccessControlsDeleteCall struct {
  4390. s *Service
  4391. bucket string
  4392. entity string
  4393. urlParams_ gensupport.URLParams
  4394. ctx_ context.Context
  4395. header_ http.Header
  4396. }
  4397. // Delete: Permanently deletes the default object ACL entry for the
  4398. // specified entity on the specified bucket.
  4399. func (r *DefaultObjectAccessControlsService) Delete(bucket string, entity string) *DefaultObjectAccessControlsDeleteCall {
  4400. c := &DefaultObjectAccessControlsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4401. c.bucket = bucket
  4402. c.entity = entity
  4403. return c
  4404. }
  4405. // UserProject sets the optional parameter "userProject": The project to
  4406. // be billed for this request. Required for Requester Pays buckets.
  4407. func (c *DefaultObjectAccessControlsDeleteCall) UserProject(userProject string) *DefaultObjectAccessControlsDeleteCall {
  4408. c.urlParams_.Set("userProject", userProject)
  4409. return c
  4410. }
  4411. // Fields allows partial responses to be retrieved. See
  4412. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4413. // for more information.
  4414. func (c *DefaultObjectAccessControlsDeleteCall) Fields(s ...googleapi.Field) *DefaultObjectAccessControlsDeleteCall {
  4415. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4416. return c
  4417. }
  4418. // Context sets the context to be used in this call's Do method. Any
  4419. // pending HTTP request will be aborted if the provided context is
  4420. // canceled.
  4421. func (c *DefaultObjectAccessControlsDeleteCall) Context(ctx context.Context) *DefaultObjectAccessControlsDeleteCall {
  4422. c.ctx_ = ctx
  4423. return c
  4424. }
  4425. // Header returns an http.Header that can be modified by the caller to
  4426. // add HTTP headers to the request.
  4427. func (c *DefaultObjectAccessControlsDeleteCall) Header() http.Header {
  4428. if c.header_ == nil {
  4429. c.header_ = make(http.Header)
  4430. }
  4431. return c.header_
  4432. }
  4433. func (c *DefaultObjectAccessControlsDeleteCall) doRequest(alt string) (*http.Response, error) {
  4434. reqHeaders := make(http.Header)
  4435. for k, v := range c.header_ {
  4436. reqHeaders[k] = v
  4437. }
  4438. reqHeaders.Set("User-Agent", c.s.userAgent())
  4439. var body io.Reader = nil
  4440. c.urlParams_.Set("alt", alt)
  4441. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/defaultObjectAcl/{entity}")
  4442. urls += "?" + c.urlParams_.Encode()
  4443. req, _ := http.NewRequest("DELETE", urls, body)
  4444. req.Header = reqHeaders
  4445. googleapi.Expand(req.URL, map[string]string{
  4446. "bucket": c.bucket,
  4447. "entity": c.entity,
  4448. })
  4449. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4450. }
  4451. // Do executes the "storage.defaultObjectAccessControls.delete" call.
  4452. func (c *DefaultObjectAccessControlsDeleteCall) Do(opts ...googleapi.CallOption) error {
  4453. gensupport.SetOptions(c.urlParams_, opts...)
  4454. res, err := c.doRequest("json")
  4455. if err != nil {
  4456. return err
  4457. }
  4458. defer googleapi.CloseBody(res)
  4459. if err := googleapi.CheckResponse(res); err != nil {
  4460. return err
  4461. }
  4462. return nil
  4463. // {
  4464. // "description": "Permanently deletes the default object ACL entry for the specified entity on the specified bucket.",
  4465. // "httpMethod": "DELETE",
  4466. // "id": "storage.defaultObjectAccessControls.delete",
  4467. // "parameterOrder": [
  4468. // "bucket",
  4469. // "entity"
  4470. // ],
  4471. // "parameters": {
  4472. // "bucket": {
  4473. // "description": "Name of a bucket.",
  4474. // "location": "path",
  4475. // "required": true,
  4476. // "type": "string"
  4477. // },
  4478. // "entity": {
  4479. // "description": "The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.",
  4480. // "location": "path",
  4481. // "required": true,
  4482. // "type": "string"
  4483. // },
  4484. // "userProject": {
  4485. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  4486. // "location": "query",
  4487. // "type": "string"
  4488. // }
  4489. // },
  4490. // "path": "b/{bucket}/defaultObjectAcl/{entity}",
  4491. // "scopes": [
  4492. // "https://www.googleapis.com/auth/cloud-platform",
  4493. // "https://www.googleapis.com/auth/devstorage.full_control"
  4494. // ]
  4495. // }
  4496. }
  4497. // method id "storage.defaultObjectAccessControls.get":
  4498. type DefaultObjectAccessControlsGetCall struct {
  4499. s *Service
  4500. bucket string
  4501. entity string
  4502. urlParams_ gensupport.URLParams
  4503. ifNoneMatch_ string
  4504. ctx_ context.Context
  4505. header_ http.Header
  4506. }
  4507. // Get: Returns the default object ACL entry for the specified entity on
  4508. // the specified bucket.
  4509. func (r *DefaultObjectAccessControlsService) Get(bucket string, entity string) *DefaultObjectAccessControlsGetCall {
  4510. c := &DefaultObjectAccessControlsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4511. c.bucket = bucket
  4512. c.entity = entity
  4513. return c
  4514. }
  4515. // UserProject sets the optional parameter "userProject": The project to
  4516. // be billed for this request. Required for Requester Pays buckets.
  4517. func (c *DefaultObjectAccessControlsGetCall) UserProject(userProject string) *DefaultObjectAccessControlsGetCall {
  4518. c.urlParams_.Set("userProject", userProject)
  4519. return c
  4520. }
  4521. // Fields allows partial responses to be retrieved. See
  4522. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4523. // for more information.
  4524. func (c *DefaultObjectAccessControlsGetCall) Fields(s ...googleapi.Field) *DefaultObjectAccessControlsGetCall {
  4525. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4526. return c
  4527. }
  4528. // IfNoneMatch sets the optional parameter which makes the operation
  4529. // fail if the object's ETag matches the given value. This is useful for
  4530. // getting updates only after the object has changed since the last
  4531. // request. Use googleapi.IsNotModified to check whether the response
  4532. // error from Do is the result of In-None-Match.
  4533. func (c *DefaultObjectAccessControlsGetCall) IfNoneMatch(entityTag string) *DefaultObjectAccessControlsGetCall {
  4534. c.ifNoneMatch_ = entityTag
  4535. return c
  4536. }
  4537. // Context sets the context to be used in this call's Do method. Any
  4538. // pending HTTP request will be aborted if the provided context is
  4539. // canceled.
  4540. func (c *DefaultObjectAccessControlsGetCall) Context(ctx context.Context) *DefaultObjectAccessControlsGetCall {
  4541. c.ctx_ = ctx
  4542. return c
  4543. }
  4544. // Header returns an http.Header that can be modified by the caller to
  4545. // add HTTP headers to the request.
  4546. func (c *DefaultObjectAccessControlsGetCall) Header() http.Header {
  4547. if c.header_ == nil {
  4548. c.header_ = make(http.Header)
  4549. }
  4550. return c.header_
  4551. }
  4552. func (c *DefaultObjectAccessControlsGetCall) doRequest(alt string) (*http.Response, error) {
  4553. reqHeaders := make(http.Header)
  4554. for k, v := range c.header_ {
  4555. reqHeaders[k] = v
  4556. }
  4557. reqHeaders.Set("User-Agent", c.s.userAgent())
  4558. if c.ifNoneMatch_ != "" {
  4559. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  4560. }
  4561. var body io.Reader = nil
  4562. c.urlParams_.Set("alt", alt)
  4563. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/defaultObjectAcl/{entity}")
  4564. urls += "?" + c.urlParams_.Encode()
  4565. req, _ := http.NewRequest("GET", urls, body)
  4566. req.Header = reqHeaders
  4567. googleapi.Expand(req.URL, map[string]string{
  4568. "bucket": c.bucket,
  4569. "entity": c.entity,
  4570. })
  4571. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4572. }
  4573. // Do executes the "storage.defaultObjectAccessControls.get" call.
  4574. // Exactly one of *ObjectAccessControl or error will be non-nil. Any
  4575. // non-2xx status code is an error. Response headers are in either
  4576. // *ObjectAccessControl.ServerResponse.Header or (if a response was
  4577. // returned at all) in error.(*googleapi.Error).Header. Use
  4578. // googleapi.IsNotModified to check whether the returned error was
  4579. // because http.StatusNotModified was returned.
  4580. func (c *DefaultObjectAccessControlsGetCall) Do(opts ...googleapi.CallOption) (*ObjectAccessControl, error) {
  4581. gensupport.SetOptions(c.urlParams_, opts...)
  4582. res, err := c.doRequest("json")
  4583. if res != nil && res.StatusCode == http.StatusNotModified {
  4584. if res.Body != nil {
  4585. res.Body.Close()
  4586. }
  4587. return nil, &googleapi.Error{
  4588. Code: res.StatusCode,
  4589. Header: res.Header,
  4590. }
  4591. }
  4592. if err != nil {
  4593. return nil, err
  4594. }
  4595. defer googleapi.CloseBody(res)
  4596. if err := googleapi.CheckResponse(res); err != nil {
  4597. return nil, err
  4598. }
  4599. ret := &ObjectAccessControl{
  4600. ServerResponse: googleapi.ServerResponse{
  4601. Header: res.Header,
  4602. HTTPStatusCode: res.StatusCode,
  4603. },
  4604. }
  4605. target := &ret
  4606. if err := gensupport.DecodeResponse(target, res); err != nil {
  4607. return nil, err
  4608. }
  4609. return ret, nil
  4610. // {
  4611. // "description": "Returns the default object ACL entry for the specified entity on the specified bucket.",
  4612. // "httpMethod": "GET",
  4613. // "id": "storage.defaultObjectAccessControls.get",
  4614. // "parameterOrder": [
  4615. // "bucket",
  4616. // "entity"
  4617. // ],
  4618. // "parameters": {
  4619. // "bucket": {
  4620. // "description": "Name of a bucket.",
  4621. // "location": "path",
  4622. // "required": true,
  4623. // "type": "string"
  4624. // },
  4625. // "entity": {
  4626. // "description": "The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.",
  4627. // "location": "path",
  4628. // "required": true,
  4629. // "type": "string"
  4630. // },
  4631. // "userProject": {
  4632. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  4633. // "location": "query",
  4634. // "type": "string"
  4635. // }
  4636. // },
  4637. // "path": "b/{bucket}/defaultObjectAcl/{entity}",
  4638. // "response": {
  4639. // "$ref": "ObjectAccessControl"
  4640. // },
  4641. // "scopes": [
  4642. // "https://www.googleapis.com/auth/cloud-platform",
  4643. // "https://www.googleapis.com/auth/devstorage.full_control"
  4644. // ]
  4645. // }
  4646. }
  4647. // method id "storage.defaultObjectAccessControls.insert":
  4648. type DefaultObjectAccessControlsInsertCall struct {
  4649. s *Service
  4650. bucket string
  4651. objectaccesscontrol *ObjectAccessControl
  4652. urlParams_ gensupport.URLParams
  4653. ctx_ context.Context
  4654. header_ http.Header
  4655. }
  4656. // Insert: Creates a new default object ACL entry on the specified
  4657. // bucket.
  4658. func (r *DefaultObjectAccessControlsService) Insert(bucket string, objectaccesscontrol *ObjectAccessControl) *DefaultObjectAccessControlsInsertCall {
  4659. c := &DefaultObjectAccessControlsInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4660. c.bucket = bucket
  4661. c.objectaccesscontrol = objectaccesscontrol
  4662. return c
  4663. }
  4664. // UserProject sets the optional parameter "userProject": The project to
  4665. // be billed for this request. Required for Requester Pays buckets.
  4666. func (c *DefaultObjectAccessControlsInsertCall) UserProject(userProject string) *DefaultObjectAccessControlsInsertCall {
  4667. c.urlParams_.Set("userProject", userProject)
  4668. return c
  4669. }
  4670. // Fields allows partial responses to be retrieved. See
  4671. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4672. // for more information.
  4673. func (c *DefaultObjectAccessControlsInsertCall) Fields(s ...googleapi.Field) *DefaultObjectAccessControlsInsertCall {
  4674. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4675. return c
  4676. }
  4677. // Context sets the context to be used in this call's Do method. Any
  4678. // pending HTTP request will be aborted if the provided context is
  4679. // canceled.
  4680. func (c *DefaultObjectAccessControlsInsertCall) Context(ctx context.Context) *DefaultObjectAccessControlsInsertCall {
  4681. c.ctx_ = ctx
  4682. return c
  4683. }
  4684. // Header returns an http.Header that can be modified by the caller to
  4685. // add HTTP headers to the request.
  4686. func (c *DefaultObjectAccessControlsInsertCall) Header() http.Header {
  4687. if c.header_ == nil {
  4688. c.header_ = make(http.Header)
  4689. }
  4690. return c.header_
  4691. }
  4692. func (c *DefaultObjectAccessControlsInsertCall) doRequest(alt string) (*http.Response, error) {
  4693. reqHeaders := make(http.Header)
  4694. for k, v := range c.header_ {
  4695. reqHeaders[k] = v
  4696. }
  4697. reqHeaders.Set("User-Agent", c.s.userAgent())
  4698. var body io.Reader = nil
  4699. body, err := googleapi.WithoutDataWrapper.JSONReader(c.objectaccesscontrol)
  4700. if err != nil {
  4701. return nil, err
  4702. }
  4703. reqHeaders.Set("Content-Type", "application/json")
  4704. c.urlParams_.Set("alt", alt)
  4705. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/defaultObjectAcl")
  4706. urls += "?" + c.urlParams_.Encode()
  4707. req, _ := http.NewRequest("POST", urls, body)
  4708. req.Header = reqHeaders
  4709. googleapi.Expand(req.URL, map[string]string{
  4710. "bucket": c.bucket,
  4711. })
  4712. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4713. }
  4714. // Do executes the "storage.defaultObjectAccessControls.insert" call.
  4715. // Exactly one of *ObjectAccessControl or error will be non-nil. Any
  4716. // non-2xx status code is an error. Response headers are in either
  4717. // *ObjectAccessControl.ServerResponse.Header or (if a response was
  4718. // returned at all) in error.(*googleapi.Error).Header. Use
  4719. // googleapi.IsNotModified to check whether the returned error was
  4720. // because http.StatusNotModified was returned.
  4721. func (c *DefaultObjectAccessControlsInsertCall) Do(opts ...googleapi.CallOption) (*ObjectAccessControl, error) {
  4722. gensupport.SetOptions(c.urlParams_, opts...)
  4723. res, err := c.doRequest("json")
  4724. if res != nil && res.StatusCode == http.StatusNotModified {
  4725. if res.Body != nil {
  4726. res.Body.Close()
  4727. }
  4728. return nil, &googleapi.Error{
  4729. Code: res.StatusCode,
  4730. Header: res.Header,
  4731. }
  4732. }
  4733. if err != nil {
  4734. return nil, err
  4735. }
  4736. defer googleapi.CloseBody(res)
  4737. if err := googleapi.CheckResponse(res); err != nil {
  4738. return nil, err
  4739. }
  4740. ret := &ObjectAccessControl{
  4741. ServerResponse: googleapi.ServerResponse{
  4742. Header: res.Header,
  4743. HTTPStatusCode: res.StatusCode,
  4744. },
  4745. }
  4746. target := &ret
  4747. if err := gensupport.DecodeResponse(target, res); err != nil {
  4748. return nil, err
  4749. }
  4750. return ret, nil
  4751. // {
  4752. // "description": "Creates a new default object ACL entry on the specified bucket.",
  4753. // "httpMethod": "POST",
  4754. // "id": "storage.defaultObjectAccessControls.insert",
  4755. // "parameterOrder": [
  4756. // "bucket"
  4757. // ],
  4758. // "parameters": {
  4759. // "bucket": {
  4760. // "description": "Name of a bucket.",
  4761. // "location": "path",
  4762. // "required": true,
  4763. // "type": "string"
  4764. // },
  4765. // "userProject": {
  4766. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  4767. // "location": "query",
  4768. // "type": "string"
  4769. // }
  4770. // },
  4771. // "path": "b/{bucket}/defaultObjectAcl",
  4772. // "request": {
  4773. // "$ref": "ObjectAccessControl"
  4774. // },
  4775. // "response": {
  4776. // "$ref": "ObjectAccessControl"
  4777. // },
  4778. // "scopes": [
  4779. // "https://www.googleapis.com/auth/cloud-platform",
  4780. // "https://www.googleapis.com/auth/devstorage.full_control"
  4781. // ]
  4782. // }
  4783. }
  4784. // method id "storage.defaultObjectAccessControls.list":
  4785. type DefaultObjectAccessControlsListCall struct {
  4786. s *Service
  4787. bucket string
  4788. urlParams_ gensupport.URLParams
  4789. ifNoneMatch_ string
  4790. ctx_ context.Context
  4791. header_ http.Header
  4792. }
  4793. // List: Retrieves default object ACL entries on the specified bucket.
  4794. func (r *DefaultObjectAccessControlsService) List(bucket string) *DefaultObjectAccessControlsListCall {
  4795. c := &DefaultObjectAccessControlsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4796. c.bucket = bucket
  4797. return c
  4798. }
  4799. // IfMetagenerationMatch sets the optional parameter
  4800. // "ifMetagenerationMatch": If present, only return default ACL listing
  4801. // if the bucket's current metageneration matches this value.
  4802. func (c *DefaultObjectAccessControlsListCall) IfMetagenerationMatch(ifMetagenerationMatch int64) *DefaultObjectAccessControlsListCall {
  4803. c.urlParams_.Set("ifMetagenerationMatch", fmt.Sprint(ifMetagenerationMatch))
  4804. return c
  4805. }
  4806. // IfMetagenerationNotMatch sets the optional parameter
  4807. // "ifMetagenerationNotMatch": If present, only return default ACL
  4808. // listing if the bucket's current metageneration does not match the
  4809. // given value.
  4810. func (c *DefaultObjectAccessControlsListCall) IfMetagenerationNotMatch(ifMetagenerationNotMatch int64) *DefaultObjectAccessControlsListCall {
  4811. c.urlParams_.Set("ifMetagenerationNotMatch", fmt.Sprint(ifMetagenerationNotMatch))
  4812. return c
  4813. }
  4814. // UserProject sets the optional parameter "userProject": The project to
  4815. // be billed for this request. Required for Requester Pays buckets.
  4816. func (c *DefaultObjectAccessControlsListCall) UserProject(userProject string) *DefaultObjectAccessControlsListCall {
  4817. c.urlParams_.Set("userProject", userProject)
  4818. return c
  4819. }
  4820. // Fields allows partial responses to be retrieved. See
  4821. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4822. // for more information.
  4823. func (c *DefaultObjectAccessControlsListCall) Fields(s ...googleapi.Field) *DefaultObjectAccessControlsListCall {
  4824. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4825. return c
  4826. }
  4827. // IfNoneMatch sets the optional parameter which makes the operation
  4828. // fail if the object's ETag matches the given value. This is useful for
  4829. // getting updates only after the object has changed since the last
  4830. // request. Use googleapi.IsNotModified to check whether the response
  4831. // error from Do is the result of In-None-Match.
  4832. func (c *DefaultObjectAccessControlsListCall) IfNoneMatch(entityTag string) *DefaultObjectAccessControlsListCall {
  4833. c.ifNoneMatch_ = entityTag
  4834. return c
  4835. }
  4836. // Context sets the context to be used in this call's Do method. Any
  4837. // pending HTTP request will be aborted if the provided context is
  4838. // canceled.
  4839. func (c *DefaultObjectAccessControlsListCall) Context(ctx context.Context) *DefaultObjectAccessControlsListCall {
  4840. c.ctx_ = ctx
  4841. return c
  4842. }
  4843. // Header returns an http.Header that can be modified by the caller to
  4844. // add HTTP headers to the request.
  4845. func (c *DefaultObjectAccessControlsListCall) Header() http.Header {
  4846. if c.header_ == nil {
  4847. c.header_ = make(http.Header)
  4848. }
  4849. return c.header_
  4850. }
  4851. func (c *DefaultObjectAccessControlsListCall) doRequest(alt string) (*http.Response, error) {
  4852. reqHeaders := make(http.Header)
  4853. for k, v := range c.header_ {
  4854. reqHeaders[k] = v
  4855. }
  4856. reqHeaders.Set("User-Agent", c.s.userAgent())
  4857. if c.ifNoneMatch_ != "" {
  4858. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  4859. }
  4860. var body io.Reader = nil
  4861. c.urlParams_.Set("alt", alt)
  4862. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/defaultObjectAcl")
  4863. urls += "?" + c.urlParams_.Encode()
  4864. req, _ := http.NewRequest("GET", urls, body)
  4865. req.Header = reqHeaders
  4866. googleapi.Expand(req.URL, map[string]string{
  4867. "bucket": c.bucket,
  4868. })
  4869. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4870. }
  4871. // Do executes the "storage.defaultObjectAccessControls.list" call.
  4872. // Exactly one of *ObjectAccessControls or error will be non-nil. Any
  4873. // non-2xx status code is an error. Response headers are in either
  4874. // *ObjectAccessControls.ServerResponse.Header or (if a response was
  4875. // returned at all) in error.(*googleapi.Error).Header. Use
  4876. // googleapi.IsNotModified to check whether the returned error was
  4877. // because http.StatusNotModified was returned.
  4878. func (c *DefaultObjectAccessControlsListCall) Do(opts ...googleapi.CallOption) (*ObjectAccessControls, error) {
  4879. gensupport.SetOptions(c.urlParams_, opts...)
  4880. res, err := c.doRequest("json")
  4881. if res != nil && res.StatusCode == http.StatusNotModified {
  4882. if res.Body != nil {
  4883. res.Body.Close()
  4884. }
  4885. return nil, &googleapi.Error{
  4886. Code: res.StatusCode,
  4887. Header: res.Header,
  4888. }
  4889. }
  4890. if err != nil {
  4891. return nil, err
  4892. }
  4893. defer googleapi.CloseBody(res)
  4894. if err := googleapi.CheckResponse(res); err != nil {
  4895. return nil, err
  4896. }
  4897. ret := &ObjectAccessControls{
  4898. ServerResponse: googleapi.ServerResponse{
  4899. Header: res.Header,
  4900. HTTPStatusCode: res.StatusCode,
  4901. },
  4902. }
  4903. target := &ret
  4904. if err := gensupport.DecodeResponse(target, res); err != nil {
  4905. return nil, err
  4906. }
  4907. return ret, nil
  4908. // {
  4909. // "description": "Retrieves default object ACL entries on the specified bucket.",
  4910. // "httpMethod": "GET",
  4911. // "id": "storage.defaultObjectAccessControls.list",
  4912. // "parameterOrder": [
  4913. // "bucket"
  4914. // ],
  4915. // "parameters": {
  4916. // "bucket": {
  4917. // "description": "Name of a bucket.",
  4918. // "location": "path",
  4919. // "required": true,
  4920. // "type": "string"
  4921. // },
  4922. // "ifMetagenerationMatch": {
  4923. // "description": "If present, only return default ACL listing if the bucket's current metageneration matches this value.",
  4924. // "format": "int64",
  4925. // "location": "query",
  4926. // "type": "string"
  4927. // },
  4928. // "ifMetagenerationNotMatch": {
  4929. // "description": "If present, only return default ACL listing if the bucket's current metageneration does not match the given value.",
  4930. // "format": "int64",
  4931. // "location": "query",
  4932. // "type": "string"
  4933. // },
  4934. // "userProject": {
  4935. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  4936. // "location": "query",
  4937. // "type": "string"
  4938. // }
  4939. // },
  4940. // "path": "b/{bucket}/defaultObjectAcl",
  4941. // "response": {
  4942. // "$ref": "ObjectAccessControls"
  4943. // },
  4944. // "scopes": [
  4945. // "https://www.googleapis.com/auth/cloud-platform",
  4946. // "https://www.googleapis.com/auth/devstorage.full_control"
  4947. // ]
  4948. // }
  4949. }
  4950. // method id "storage.defaultObjectAccessControls.patch":
  4951. type DefaultObjectAccessControlsPatchCall struct {
  4952. s *Service
  4953. bucket string
  4954. entity string
  4955. objectaccesscontrol *ObjectAccessControl
  4956. urlParams_ gensupport.URLParams
  4957. ctx_ context.Context
  4958. header_ http.Header
  4959. }
  4960. // Patch: Patches a default object ACL entry on the specified bucket.
  4961. func (r *DefaultObjectAccessControlsService) Patch(bucket string, entity string, objectaccesscontrol *ObjectAccessControl) *DefaultObjectAccessControlsPatchCall {
  4962. c := &DefaultObjectAccessControlsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4963. c.bucket = bucket
  4964. c.entity = entity
  4965. c.objectaccesscontrol = objectaccesscontrol
  4966. return c
  4967. }
  4968. // UserProject sets the optional parameter "userProject": The project to
  4969. // be billed for this request. Required for Requester Pays buckets.
  4970. func (c *DefaultObjectAccessControlsPatchCall) UserProject(userProject string) *DefaultObjectAccessControlsPatchCall {
  4971. c.urlParams_.Set("userProject", userProject)
  4972. return c
  4973. }
  4974. // Fields allows partial responses to be retrieved. See
  4975. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4976. // for more information.
  4977. func (c *DefaultObjectAccessControlsPatchCall) Fields(s ...googleapi.Field) *DefaultObjectAccessControlsPatchCall {
  4978. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4979. return c
  4980. }
  4981. // Context sets the context to be used in this call's Do method. Any
  4982. // pending HTTP request will be aborted if the provided context is
  4983. // canceled.
  4984. func (c *DefaultObjectAccessControlsPatchCall) Context(ctx context.Context) *DefaultObjectAccessControlsPatchCall {
  4985. c.ctx_ = ctx
  4986. return c
  4987. }
  4988. // Header returns an http.Header that can be modified by the caller to
  4989. // add HTTP headers to the request.
  4990. func (c *DefaultObjectAccessControlsPatchCall) Header() http.Header {
  4991. if c.header_ == nil {
  4992. c.header_ = make(http.Header)
  4993. }
  4994. return c.header_
  4995. }
  4996. func (c *DefaultObjectAccessControlsPatchCall) doRequest(alt string) (*http.Response, error) {
  4997. reqHeaders := make(http.Header)
  4998. for k, v := range c.header_ {
  4999. reqHeaders[k] = v
  5000. }
  5001. reqHeaders.Set("User-Agent", c.s.userAgent())
  5002. var body io.Reader = nil
  5003. body, err := googleapi.WithoutDataWrapper.JSONReader(c.objectaccesscontrol)
  5004. if err != nil {
  5005. return nil, err
  5006. }
  5007. reqHeaders.Set("Content-Type", "application/json")
  5008. c.urlParams_.Set("alt", alt)
  5009. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/defaultObjectAcl/{entity}")
  5010. urls += "?" + c.urlParams_.Encode()
  5011. req, _ := http.NewRequest("PATCH", urls, body)
  5012. req.Header = reqHeaders
  5013. googleapi.Expand(req.URL, map[string]string{
  5014. "bucket": c.bucket,
  5015. "entity": c.entity,
  5016. })
  5017. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5018. }
  5019. // Do executes the "storage.defaultObjectAccessControls.patch" call.
  5020. // Exactly one of *ObjectAccessControl or error will be non-nil. Any
  5021. // non-2xx status code is an error. Response headers are in either
  5022. // *ObjectAccessControl.ServerResponse.Header or (if a response was
  5023. // returned at all) in error.(*googleapi.Error).Header. Use
  5024. // googleapi.IsNotModified to check whether the returned error was
  5025. // because http.StatusNotModified was returned.
  5026. func (c *DefaultObjectAccessControlsPatchCall) Do(opts ...googleapi.CallOption) (*ObjectAccessControl, error) {
  5027. gensupport.SetOptions(c.urlParams_, opts...)
  5028. res, err := c.doRequest("json")
  5029. if res != nil && res.StatusCode == http.StatusNotModified {
  5030. if res.Body != nil {
  5031. res.Body.Close()
  5032. }
  5033. return nil, &googleapi.Error{
  5034. Code: res.StatusCode,
  5035. Header: res.Header,
  5036. }
  5037. }
  5038. if err != nil {
  5039. return nil, err
  5040. }
  5041. defer googleapi.CloseBody(res)
  5042. if err := googleapi.CheckResponse(res); err != nil {
  5043. return nil, err
  5044. }
  5045. ret := &ObjectAccessControl{
  5046. ServerResponse: googleapi.ServerResponse{
  5047. Header: res.Header,
  5048. HTTPStatusCode: res.StatusCode,
  5049. },
  5050. }
  5051. target := &ret
  5052. if err := gensupport.DecodeResponse(target, res); err != nil {
  5053. return nil, err
  5054. }
  5055. return ret, nil
  5056. // {
  5057. // "description": "Patches a default object ACL entry on the specified bucket.",
  5058. // "httpMethod": "PATCH",
  5059. // "id": "storage.defaultObjectAccessControls.patch",
  5060. // "parameterOrder": [
  5061. // "bucket",
  5062. // "entity"
  5063. // ],
  5064. // "parameters": {
  5065. // "bucket": {
  5066. // "description": "Name of a bucket.",
  5067. // "location": "path",
  5068. // "required": true,
  5069. // "type": "string"
  5070. // },
  5071. // "entity": {
  5072. // "description": "The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.",
  5073. // "location": "path",
  5074. // "required": true,
  5075. // "type": "string"
  5076. // },
  5077. // "userProject": {
  5078. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  5079. // "location": "query",
  5080. // "type": "string"
  5081. // }
  5082. // },
  5083. // "path": "b/{bucket}/defaultObjectAcl/{entity}",
  5084. // "request": {
  5085. // "$ref": "ObjectAccessControl"
  5086. // },
  5087. // "response": {
  5088. // "$ref": "ObjectAccessControl"
  5089. // },
  5090. // "scopes": [
  5091. // "https://www.googleapis.com/auth/cloud-platform",
  5092. // "https://www.googleapis.com/auth/devstorage.full_control"
  5093. // ]
  5094. // }
  5095. }
  5096. // method id "storage.defaultObjectAccessControls.update":
  5097. type DefaultObjectAccessControlsUpdateCall struct {
  5098. s *Service
  5099. bucket string
  5100. entity string
  5101. objectaccesscontrol *ObjectAccessControl
  5102. urlParams_ gensupport.URLParams
  5103. ctx_ context.Context
  5104. header_ http.Header
  5105. }
  5106. // Update: Updates a default object ACL entry on the specified bucket.
  5107. func (r *DefaultObjectAccessControlsService) Update(bucket string, entity string, objectaccesscontrol *ObjectAccessControl) *DefaultObjectAccessControlsUpdateCall {
  5108. c := &DefaultObjectAccessControlsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5109. c.bucket = bucket
  5110. c.entity = entity
  5111. c.objectaccesscontrol = objectaccesscontrol
  5112. return c
  5113. }
  5114. // UserProject sets the optional parameter "userProject": The project to
  5115. // be billed for this request. Required for Requester Pays buckets.
  5116. func (c *DefaultObjectAccessControlsUpdateCall) UserProject(userProject string) *DefaultObjectAccessControlsUpdateCall {
  5117. c.urlParams_.Set("userProject", userProject)
  5118. return c
  5119. }
  5120. // Fields allows partial responses to be retrieved. See
  5121. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5122. // for more information.
  5123. func (c *DefaultObjectAccessControlsUpdateCall) Fields(s ...googleapi.Field) *DefaultObjectAccessControlsUpdateCall {
  5124. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5125. return c
  5126. }
  5127. // Context sets the context to be used in this call's Do method. Any
  5128. // pending HTTP request will be aborted if the provided context is
  5129. // canceled.
  5130. func (c *DefaultObjectAccessControlsUpdateCall) Context(ctx context.Context) *DefaultObjectAccessControlsUpdateCall {
  5131. c.ctx_ = ctx
  5132. return c
  5133. }
  5134. // Header returns an http.Header that can be modified by the caller to
  5135. // add HTTP headers to the request.
  5136. func (c *DefaultObjectAccessControlsUpdateCall) Header() http.Header {
  5137. if c.header_ == nil {
  5138. c.header_ = make(http.Header)
  5139. }
  5140. return c.header_
  5141. }
  5142. func (c *DefaultObjectAccessControlsUpdateCall) doRequest(alt string) (*http.Response, error) {
  5143. reqHeaders := make(http.Header)
  5144. for k, v := range c.header_ {
  5145. reqHeaders[k] = v
  5146. }
  5147. reqHeaders.Set("User-Agent", c.s.userAgent())
  5148. var body io.Reader = nil
  5149. body, err := googleapi.WithoutDataWrapper.JSONReader(c.objectaccesscontrol)
  5150. if err != nil {
  5151. return nil, err
  5152. }
  5153. reqHeaders.Set("Content-Type", "application/json")
  5154. c.urlParams_.Set("alt", alt)
  5155. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/defaultObjectAcl/{entity}")
  5156. urls += "?" + c.urlParams_.Encode()
  5157. req, _ := http.NewRequest("PUT", urls, body)
  5158. req.Header = reqHeaders
  5159. googleapi.Expand(req.URL, map[string]string{
  5160. "bucket": c.bucket,
  5161. "entity": c.entity,
  5162. })
  5163. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5164. }
  5165. // Do executes the "storage.defaultObjectAccessControls.update" call.
  5166. // Exactly one of *ObjectAccessControl or error will be non-nil. Any
  5167. // non-2xx status code is an error. Response headers are in either
  5168. // *ObjectAccessControl.ServerResponse.Header or (if a response was
  5169. // returned at all) in error.(*googleapi.Error).Header. Use
  5170. // googleapi.IsNotModified to check whether the returned error was
  5171. // because http.StatusNotModified was returned.
  5172. func (c *DefaultObjectAccessControlsUpdateCall) Do(opts ...googleapi.CallOption) (*ObjectAccessControl, error) {
  5173. gensupport.SetOptions(c.urlParams_, opts...)
  5174. res, err := c.doRequest("json")
  5175. if res != nil && res.StatusCode == http.StatusNotModified {
  5176. if res.Body != nil {
  5177. res.Body.Close()
  5178. }
  5179. return nil, &googleapi.Error{
  5180. Code: res.StatusCode,
  5181. Header: res.Header,
  5182. }
  5183. }
  5184. if err != nil {
  5185. return nil, err
  5186. }
  5187. defer googleapi.CloseBody(res)
  5188. if err := googleapi.CheckResponse(res); err != nil {
  5189. return nil, err
  5190. }
  5191. ret := &ObjectAccessControl{
  5192. ServerResponse: googleapi.ServerResponse{
  5193. Header: res.Header,
  5194. HTTPStatusCode: res.StatusCode,
  5195. },
  5196. }
  5197. target := &ret
  5198. if err := gensupport.DecodeResponse(target, res); err != nil {
  5199. return nil, err
  5200. }
  5201. return ret, nil
  5202. // {
  5203. // "description": "Updates a default object ACL entry on the specified bucket.",
  5204. // "httpMethod": "PUT",
  5205. // "id": "storage.defaultObjectAccessControls.update",
  5206. // "parameterOrder": [
  5207. // "bucket",
  5208. // "entity"
  5209. // ],
  5210. // "parameters": {
  5211. // "bucket": {
  5212. // "description": "Name of a bucket.",
  5213. // "location": "path",
  5214. // "required": true,
  5215. // "type": "string"
  5216. // },
  5217. // "entity": {
  5218. // "description": "The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.",
  5219. // "location": "path",
  5220. // "required": true,
  5221. // "type": "string"
  5222. // },
  5223. // "userProject": {
  5224. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  5225. // "location": "query",
  5226. // "type": "string"
  5227. // }
  5228. // },
  5229. // "path": "b/{bucket}/defaultObjectAcl/{entity}",
  5230. // "request": {
  5231. // "$ref": "ObjectAccessControl"
  5232. // },
  5233. // "response": {
  5234. // "$ref": "ObjectAccessControl"
  5235. // },
  5236. // "scopes": [
  5237. // "https://www.googleapis.com/auth/cloud-platform",
  5238. // "https://www.googleapis.com/auth/devstorage.full_control"
  5239. // ]
  5240. // }
  5241. }
  5242. // method id "storage.notifications.delete":
  5243. type NotificationsDeleteCall struct {
  5244. s *Service
  5245. bucket string
  5246. notification string
  5247. urlParams_ gensupport.URLParams
  5248. ctx_ context.Context
  5249. header_ http.Header
  5250. }
  5251. // Delete: Permanently deletes a notification subscription.
  5252. func (r *NotificationsService) Delete(bucket string, notification string) *NotificationsDeleteCall {
  5253. c := &NotificationsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5254. c.bucket = bucket
  5255. c.notification = notification
  5256. return c
  5257. }
  5258. // UserProject sets the optional parameter "userProject": The project to
  5259. // be billed for this request. Required for Requester Pays buckets.
  5260. func (c *NotificationsDeleteCall) UserProject(userProject string) *NotificationsDeleteCall {
  5261. c.urlParams_.Set("userProject", userProject)
  5262. return c
  5263. }
  5264. // Fields allows partial responses to be retrieved. See
  5265. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5266. // for more information.
  5267. func (c *NotificationsDeleteCall) Fields(s ...googleapi.Field) *NotificationsDeleteCall {
  5268. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5269. return c
  5270. }
  5271. // Context sets the context to be used in this call's Do method. Any
  5272. // pending HTTP request will be aborted if the provided context is
  5273. // canceled.
  5274. func (c *NotificationsDeleteCall) Context(ctx context.Context) *NotificationsDeleteCall {
  5275. c.ctx_ = ctx
  5276. return c
  5277. }
  5278. // Header returns an http.Header that can be modified by the caller to
  5279. // add HTTP headers to the request.
  5280. func (c *NotificationsDeleteCall) Header() http.Header {
  5281. if c.header_ == nil {
  5282. c.header_ = make(http.Header)
  5283. }
  5284. return c.header_
  5285. }
  5286. func (c *NotificationsDeleteCall) doRequest(alt string) (*http.Response, error) {
  5287. reqHeaders := make(http.Header)
  5288. for k, v := range c.header_ {
  5289. reqHeaders[k] = v
  5290. }
  5291. reqHeaders.Set("User-Agent", c.s.userAgent())
  5292. var body io.Reader = nil
  5293. c.urlParams_.Set("alt", alt)
  5294. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/notificationConfigs/{notification}")
  5295. urls += "?" + c.urlParams_.Encode()
  5296. req, _ := http.NewRequest("DELETE", urls, body)
  5297. req.Header = reqHeaders
  5298. googleapi.Expand(req.URL, map[string]string{
  5299. "bucket": c.bucket,
  5300. "notification": c.notification,
  5301. })
  5302. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5303. }
  5304. // Do executes the "storage.notifications.delete" call.
  5305. func (c *NotificationsDeleteCall) Do(opts ...googleapi.CallOption) error {
  5306. gensupport.SetOptions(c.urlParams_, opts...)
  5307. res, err := c.doRequest("json")
  5308. if err != nil {
  5309. return err
  5310. }
  5311. defer googleapi.CloseBody(res)
  5312. if err := googleapi.CheckResponse(res); err != nil {
  5313. return err
  5314. }
  5315. return nil
  5316. // {
  5317. // "description": "Permanently deletes a notification subscription.",
  5318. // "httpMethod": "DELETE",
  5319. // "id": "storage.notifications.delete",
  5320. // "parameterOrder": [
  5321. // "bucket",
  5322. // "notification"
  5323. // ],
  5324. // "parameters": {
  5325. // "bucket": {
  5326. // "description": "The parent bucket of the notification.",
  5327. // "location": "path",
  5328. // "required": true,
  5329. // "type": "string"
  5330. // },
  5331. // "notification": {
  5332. // "description": "ID of the notification to delete.",
  5333. // "location": "path",
  5334. // "required": true,
  5335. // "type": "string"
  5336. // },
  5337. // "userProject": {
  5338. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  5339. // "location": "query",
  5340. // "type": "string"
  5341. // }
  5342. // },
  5343. // "path": "b/{bucket}/notificationConfigs/{notification}",
  5344. // "scopes": [
  5345. // "https://www.googleapis.com/auth/cloud-platform",
  5346. // "https://www.googleapis.com/auth/devstorage.full_control",
  5347. // "https://www.googleapis.com/auth/devstorage.read_write"
  5348. // ]
  5349. // }
  5350. }
  5351. // method id "storage.notifications.get":
  5352. type NotificationsGetCall struct {
  5353. s *Service
  5354. bucket string
  5355. notification string
  5356. urlParams_ gensupport.URLParams
  5357. ifNoneMatch_ string
  5358. ctx_ context.Context
  5359. header_ http.Header
  5360. }
  5361. // Get: View a notification configuration.
  5362. func (r *NotificationsService) Get(bucket string, notification string) *NotificationsGetCall {
  5363. c := &NotificationsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5364. c.bucket = bucket
  5365. c.notification = notification
  5366. return c
  5367. }
  5368. // UserProject sets the optional parameter "userProject": The project to
  5369. // be billed for this request. Required for Requester Pays buckets.
  5370. func (c *NotificationsGetCall) UserProject(userProject string) *NotificationsGetCall {
  5371. c.urlParams_.Set("userProject", userProject)
  5372. return c
  5373. }
  5374. // Fields allows partial responses to be retrieved. See
  5375. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5376. // for more information.
  5377. func (c *NotificationsGetCall) Fields(s ...googleapi.Field) *NotificationsGetCall {
  5378. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5379. return c
  5380. }
  5381. // IfNoneMatch sets the optional parameter which makes the operation
  5382. // fail if the object's ETag matches the given value. This is useful for
  5383. // getting updates only after the object has changed since the last
  5384. // request. Use googleapi.IsNotModified to check whether the response
  5385. // error from Do is the result of In-None-Match.
  5386. func (c *NotificationsGetCall) IfNoneMatch(entityTag string) *NotificationsGetCall {
  5387. c.ifNoneMatch_ = entityTag
  5388. return c
  5389. }
  5390. // Context sets the context to be used in this call's Do method. Any
  5391. // pending HTTP request will be aborted if the provided context is
  5392. // canceled.
  5393. func (c *NotificationsGetCall) Context(ctx context.Context) *NotificationsGetCall {
  5394. c.ctx_ = ctx
  5395. return c
  5396. }
  5397. // Header returns an http.Header that can be modified by the caller to
  5398. // add HTTP headers to the request.
  5399. func (c *NotificationsGetCall) Header() http.Header {
  5400. if c.header_ == nil {
  5401. c.header_ = make(http.Header)
  5402. }
  5403. return c.header_
  5404. }
  5405. func (c *NotificationsGetCall) doRequest(alt string) (*http.Response, error) {
  5406. reqHeaders := make(http.Header)
  5407. for k, v := range c.header_ {
  5408. reqHeaders[k] = v
  5409. }
  5410. reqHeaders.Set("User-Agent", c.s.userAgent())
  5411. if c.ifNoneMatch_ != "" {
  5412. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  5413. }
  5414. var body io.Reader = nil
  5415. c.urlParams_.Set("alt", alt)
  5416. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/notificationConfigs/{notification}")
  5417. urls += "?" + c.urlParams_.Encode()
  5418. req, _ := http.NewRequest("GET", urls, body)
  5419. req.Header = reqHeaders
  5420. googleapi.Expand(req.URL, map[string]string{
  5421. "bucket": c.bucket,
  5422. "notification": c.notification,
  5423. })
  5424. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5425. }
  5426. // Do executes the "storage.notifications.get" call.
  5427. // Exactly one of *Notification or error will be non-nil. Any non-2xx
  5428. // status code is an error. Response headers are in either
  5429. // *Notification.ServerResponse.Header or (if a response was returned at
  5430. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  5431. // to check whether the returned error was because
  5432. // http.StatusNotModified was returned.
  5433. func (c *NotificationsGetCall) Do(opts ...googleapi.CallOption) (*Notification, error) {
  5434. gensupport.SetOptions(c.urlParams_, opts...)
  5435. res, err := c.doRequest("json")
  5436. if res != nil && res.StatusCode == http.StatusNotModified {
  5437. if res.Body != nil {
  5438. res.Body.Close()
  5439. }
  5440. return nil, &googleapi.Error{
  5441. Code: res.StatusCode,
  5442. Header: res.Header,
  5443. }
  5444. }
  5445. if err != nil {
  5446. return nil, err
  5447. }
  5448. defer googleapi.CloseBody(res)
  5449. if err := googleapi.CheckResponse(res); err != nil {
  5450. return nil, err
  5451. }
  5452. ret := &Notification{
  5453. ServerResponse: googleapi.ServerResponse{
  5454. Header: res.Header,
  5455. HTTPStatusCode: res.StatusCode,
  5456. },
  5457. }
  5458. target := &ret
  5459. if err := gensupport.DecodeResponse(target, res); err != nil {
  5460. return nil, err
  5461. }
  5462. return ret, nil
  5463. // {
  5464. // "description": "View a notification configuration.",
  5465. // "httpMethod": "GET",
  5466. // "id": "storage.notifications.get",
  5467. // "parameterOrder": [
  5468. // "bucket",
  5469. // "notification"
  5470. // ],
  5471. // "parameters": {
  5472. // "bucket": {
  5473. // "description": "The parent bucket of the notification.",
  5474. // "location": "path",
  5475. // "required": true,
  5476. // "type": "string"
  5477. // },
  5478. // "notification": {
  5479. // "description": "Notification ID",
  5480. // "location": "path",
  5481. // "required": true,
  5482. // "type": "string"
  5483. // },
  5484. // "userProject": {
  5485. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  5486. // "location": "query",
  5487. // "type": "string"
  5488. // }
  5489. // },
  5490. // "path": "b/{bucket}/notificationConfigs/{notification}",
  5491. // "response": {
  5492. // "$ref": "Notification"
  5493. // },
  5494. // "scopes": [
  5495. // "https://www.googleapis.com/auth/cloud-platform",
  5496. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  5497. // "https://www.googleapis.com/auth/devstorage.full_control",
  5498. // "https://www.googleapis.com/auth/devstorage.read_only",
  5499. // "https://www.googleapis.com/auth/devstorage.read_write"
  5500. // ]
  5501. // }
  5502. }
  5503. // method id "storage.notifications.insert":
  5504. type NotificationsInsertCall struct {
  5505. s *Service
  5506. bucket string
  5507. notification *Notification
  5508. urlParams_ gensupport.URLParams
  5509. ctx_ context.Context
  5510. header_ http.Header
  5511. }
  5512. // Insert: Creates a notification subscription for a given bucket.
  5513. func (r *NotificationsService) Insert(bucket string, notification *Notification) *NotificationsInsertCall {
  5514. c := &NotificationsInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5515. c.bucket = bucket
  5516. c.notification = notification
  5517. return c
  5518. }
  5519. // UserProject sets the optional parameter "userProject": The project to
  5520. // be billed for this request. Required for Requester Pays buckets.
  5521. func (c *NotificationsInsertCall) UserProject(userProject string) *NotificationsInsertCall {
  5522. c.urlParams_.Set("userProject", userProject)
  5523. return c
  5524. }
  5525. // Fields allows partial responses to be retrieved. See
  5526. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5527. // for more information.
  5528. func (c *NotificationsInsertCall) Fields(s ...googleapi.Field) *NotificationsInsertCall {
  5529. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5530. return c
  5531. }
  5532. // Context sets the context to be used in this call's Do method. Any
  5533. // pending HTTP request will be aborted if the provided context is
  5534. // canceled.
  5535. func (c *NotificationsInsertCall) Context(ctx context.Context) *NotificationsInsertCall {
  5536. c.ctx_ = ctx
  5537. return c
  5538. }
  5539. // Header returns an http.Header that can be modified by the caller to
  5540. // add HTTP headers to the request.
  5541. func (c *NotificationsInsertCall) Header() http.Header {
  5542. if c.header_ == nil {
  5543. c.header_ = make(http.Header)
  5544. }
  5545. return c.header_
  5546. }
  5547. func (c *NotificationsInsertCall) doRequest(alt string) (*http.Response, error) {
  5548. reqHeaders := make(http.Header)
  5549. for k, v := range c.header_ {
  5550. reqHeaders[k] = v
  5551. }
  5552. reqHeaders.Set("User-Agent", c.s.userAgent())
  5553. var body io.Reader = nil
  5554. body, err := googleapi.WithoutDataWrapper.JSONReader(c.notification)
  5555. if err != nil {
  5556. return nil, err
  5557. }
  5558. reqHeaders.Set("Content-Type", "application/json")
  5559. c.urlParams_.Set("alt", alt)
  5560. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/notificationConfigs")
  5561. urls += "?" + c.urlParams_.Encode()
  5562. req, _ := http.NewRequest("POST", urls, body)
  5563. req.Header = reqHeaders
  5564. googleapi.Expand(req.URL, map[string]string{
  5565. "bucket": c.bucket,
  5566. })
  5567. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5568. }
  5569. // Do executes the "storage.notifications.insert" call.
  5570. // Exactly one of *Notification or error will be non-nil. Any non-2xx
  5571. // status code is an error. Response headers are in either
  5572. // *Notification.ServerResponse.Header or (if a response was returned at
  5573. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  5574. // to check whether the returned error was because
  5575. // http.StatusNotModified was returned.
  5576. func (c *NotificationsInsertCall) Do(opts ...googleapi.CallOption) (*Notification, error) {
  5577. gensupport.SetOptions(c.urlParams_, opts...)
  5578. res, err := c.doRequest("json")
  5579. if res != nil && res.StatusCode == http.StatusNotModified {
  5580. if res.Body != nil {
  5581. res.Body.Close()
  5582. }
  5583. return nil, &googleapi.Error{
  5584. Code: res.StatusCode,
  5585. Header: res.Header,
  5586. }
  5587. }
  5588. if err != nil {
  5589. return nil, err
  5590. }
  5591. defer googleapi.CloseBody(res)
  5592. if err := googleapi.CheckResponse(res); err != nil {
  5593. return nil, err
  5594. }
  5595. ret := &Notification{
  5596. ServerResponse: googleapi.ServerResponse{
  5597. Header: res.Header,
  5598. HTTPStatusCode: res.StatusCode,
  5599. },
  5600. }
  5601. target := &ret
  5602. if err := gensupport.DecodeResponse(target, res); err != nil {
  5603. return nil, err
  5604. }
  5605. return ret, nil
  5606. // {
  5607. // "description": "Creates a notification subscription for a given bucket.",
  5608. // "httpMethod": "POST",
  5609. // "id": "storage.notifications.insert",
  5610. // "parameterOrder": [
  5611. // "bucket"
  5612. // ],
  5613. // "parameters": {
  5614. // "bucket": {
  5615. // "description": "The parent bucket of the notification.",
  5616. // "location": "path",
  5617. // "required": true,
  5618. // "type": "string"
  5619. // },
  5620. // "userProject": {
  5621. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  5622. // "location": "query",
  5623. // "type": "string"
  5624. // }
  5625. // },
  5626. // "path": "b/{bucket}/notificationConfigs",
  5627. // "request": {
  5628. // "$ref": "Notification"
  5629. // },
  5630. // "response": {
  5631. // "$ref": "Notification"
  5632. // },
  5633. // "scopes": [
  5634. // "https://www.googleapis.com/auth/cloud-platform",
  5635. // "https://www.googleapis.com/auth/devstorage.full_control",
  5636. // "https://www.googleapis.com/auth/devstorage.read_write"
  5637. // ]
  5638. // }
  5639. }
  5640. // method id "storage.notifications.list":
  5641. type NotificationsListCall struct {
  5642. s *Service
  5643. bucket string
  5644. urlParams_ gensupport.URLParams
  5645. ifNoneMatch_ string
  5646. ctx_ context.Context
  5647. header_ http.Header
  5648. }
  5649. // List: Retrieves a list of notification subscriptions for a given
  5650. // bucket.
  5651. func (r *NotificationsService) List(bucket string) *NotificationsListCall {
  5652. c := &NotificationsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5653. c.bucket = bucket
  5654. return c
  5655. }
  5656. // UserProject sets the optional parameter "userProject": The project to
  5657. // be billed for this request. Required for Requester Pays buckets.
  5658. func (c *NotificationsListCall) UserProject(userProject string) *NotificationsListCall {
  5659. c.urlParams_.Set("userProject", userProject)
  5660. return c
  5661. }
  5662. // Fields allows partial responses to be retrieved. See
  5663. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5664. // for more information.
  5665. func (c *NotificationsListCall) Fields(s ...googleapi.Field) *NotificationsListCall {
  5666. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5667. return c
  5668. }
  5669. // IfNoneMatch sets the optional parameter which makes the operation
  5670. // fail if the object's ETag matches the given value. This is useful for
  5671. // getting updates only after the object has changed since the last
  5672. // request. Use googleapi.IsNotModified to check whether the response
  5673. // error from Do is the result of In-None-Match.
  5674. func (c *NotificationsListCall) IfNoneMatch(entityTag string) *NotificationsListCall {
  5675. c.ifNoneMatch_ = entityTag
  5676. return c
  5677. }
  5678. // Context sets the context to be used in this call's Do method. Any
  5679. // pending HTTP request will be aborted if the provided context is
  5680. // canceled.
  5681. func (c *NotificationsListCall) Context(ctx context.Context) *NotificationsListCall {
  5682. c.ctx_ = ctx
  5683. return c
  5684. }
  5685. // Header returns an http.Header that can be modified by the caller to
  5686. // add HTTP headers to the request.
  5687. func (c *NotificationsListCall) Header() http.Header {
  5688. if c.header_ == nil {
  5689. c.header_ = make(http.Header)
  5690. }
  5691. return c.header_
  5692. }
  5693. func (c *NotificationsListCall) doRequest(alt string) (*http.Response, error) {
  5694. reqHeaders := make(http.Header)
  5695. for k, v := range c.header_ {
  5696. reqHeaders[k] = v
  5697. }
  5698. reqHeaders.Set("User-Agent", c.s.userAgent())
  5699. if c.ifNoneMatch_ != "" {
  5700. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  5701. }
  5702. var body io.Reader = nil
  5703. c.urlParams_.Set("alt", alt)
  5704. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/notificationConfigs")
  5705. urls += "?" + c.urlParams_.Encode()
  5706. req, _ := http.NewRequest("GET", urls, body)
  5707. req.Header = reqHeaders
  5708. googleapi.Expand(req.URL, map[string]string{
  5709. "bucket": c.bucket,
  5710. })
  5711. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5712. }
  5713. // Do executes the "storage.notifications.list" call.
  5714. // Exactly one of *Notifications or error will be non-nil. Any non-2xx
  5715. // status code is an error. Response headers are in either
  5716. // *Notifications.ServerResponse.Header or (if a response was returned
  5717. // at all) in error.(*googleapi.Error).Header. Use
  5718. // googleapi.IsNotModified to check whether the returned error was
  5719. // because http.StatusNotModified was returned.
  5720. func (c *NotificationsListCall) Do(opts ...googleapi.CallOption) (*Notifications, error) {
  5721. gensupport.SetOptions(c.urlParams_, opts...)
  5722. res, err := c.doRequest("json")
  5723. if res != nil && res.StatusCode == http.StatusNotModified {
  5724. if res.Body != nil {
  5725. res.Body.Close()
  5726. }
  5727. return nil, &googleapi.Error{
  5728. Code: res.StatusCode,
  5729. Header: res.Header,
  5730. }
  5731. }
  5732. if err != nil {
  5733. return nil, err
  5734. }
  5735. defer googleapi.CloseBody(res)
  5736. if err := googleapi.CheckResponse(res); err != nil {
  5737. return nil, err
  5738. }
  5739. ret := &Notifications{
  5740. ServerResponse: googleapi.ServerResponse{
  5741. Header: res.Header,
  5742. HTTPStatusCode: res.StatusCode,
  5743. },
  5744. }
  5745. target := &ret
  5746. if err := gensupport.DecodeResponse(target, res); err != nil {
  5747. return nil, err
  5748. }
  5749. return ret, nil
  5750. // {
  5751. // "description": "Retrieves a list of notification subscriptions for a given bucket.",
  5752. // "httpMethod": "GET",
  5753. // "id": "storage.notifications.list",
  5754. // "parameterOrder": [
  5755. // "bucket"
  5756. // ],
  5757. // "parameters": {
  5758. // "bucket": {
  5759. // "description": "Name of a Google Cloud Storage bucket.",
  5760. // "location": "path",
  5761. // "required": true,
  5762. // "type": "string"
  5763. // },
  5764. // "userProject": {
  5765. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  5766. // "location": "query",
  5767. // "type": "string"
  5768. // }
  5769. // },
  5770. // "path": "b/{bucket}/notificationConfigs",
  5771. // "response": {
  5772. // "$ref": "Notifications"
  5773. // },
  5774. // "scopes": [
  5775. // "https://www.googleapis.com/auth/cloud-platform",
  5776. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  5777. // "https://www.googleapis.com/auth/devstorage.full_control",
  5778. // "https://www.googleapis.com/auth/devstorage.read_only",
  5779. // "https://www.googleapis.com/auth/devstorage.read_write"
  5780. // ]
  5781. // }
  5782. }
  5783. // method id "storage.objectAccessControls.delete":
  5784. type ObjectAccessControlsDeleteCall struct {
  5785. s *Service
  5786. bucket string
  5787. object string
  5788. entity string
  5789. urlParams_ gensupport.URLParams
  5790. ctx_ context.Context
  5791. header_ http.Header
  5792. }
  5793. // Delete: Permanently deletes the ACL entry for the specified entity on
  5794. // the specified object.
  5795. func (r *ObjectAccessControlsService) Delete(bucket string, object string, entity string) *ObjectAccessControlsDeleteCall {
  5796. c := &ObjectAccessControlsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5797. c.bucket = bucket
  5798. c.object = object
  5799. c.entity = entity
  5800. return c
  5801. }
  5802. // Generation sets the optional parameter "generation": If present,
  5803. // selects a specific revision of this object (as opposed to the latest
  5804. // version, the default).
  5805. func (c *ObjectAccessControlsDeleteCall) Generation(generation int64) *ObjectAccessControlsDeleteCall {
  5806. c.urlParams_.Set("generation", fmt.Sprint(generation))
  5807. return c
  5808. }
  5809. // UserProject sets the optional parameter "userProject": The project to
  5810. // be billed for this request. Required for Requester Pays buckets.
  5811. func (c *ObjectAccessControlsDeleteCall) UserProject(userProject string) *ObjectAccessControlsDeleteCall {
  5812. c.urlParams_.Set("userProject", userProject)
  5813. return c
  5814. }
  5815. // Fields allows partial responses to be retrieved. See
  5816. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5817. // for more information.
  5818. func (c *ObjectAccessControlsDeleteCall) Fields(s ...googleapi.Field) *ObjectAccessControlsDeleteCall {
  5819. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5820. return c
  5821. }
  5822. // Context sets the context to be used in this call's Do method. Any
  5823. // pending HTTP request will be aborted if the provided context is
  5824. // canceled.
  5825. func (c *ObjectAccessControlsDeleteCall) Context(ctx context.Context) *ObjectAccessControlsDeleteCall {
  5826. c.ctx_ = ctx
  5827. return c
  5828. }
  5829. // Header returns an http.Header that can be modified by the caller to
  5830. // add HTTP headers to the request.
  5831. func (c *ObjectAccessControlsDeleteCall) Header() http.Header {
  5832. if c.header_ == nil {
  5833. c.header_ = make(http.Header)
  5834. }
  5835. return c.header_
  5836. }
  5837. func (c *ObjectAccessControlsDeleteCall) doRequest(alt string) (*http.Response, error) {
  5838. reqHeaders := make(http.Header)
  5839. for k, v := range c.header_ {
  5840. reqHeaders[k] = v
  5841. }
  5842. reqHeaders.Set("User-Agent", c.s.userAgent())
  5843. var body io.Reader = nil
  5844. c.urlParams_.Set("alt", alt)
  5845. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o/{object}/acl/{entity}")
  5846. urls += "?" + c.urlParams_.Encode()
  5847. req, _ := http.NewRequest("DELETE", urls, body)
  5848. req.Header = reqHeaders
  5849. googleapi.Expand(req.URL, map[string]string{
  5850. "bucket": c.bucket,
  5851. "object": c.object,
  5852. "entity": c.entity,
  5853. })
  5854. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5855. }
  5856. // Do executes the "storage.objectAccessControls.delete" call.
  5857. func (c *ObjectAccessControlsDeleteCall) Do(opts ...googleapi.CallOption) error {
  5858. gensupport.SetOptions(c.urlParams_, opts...)
  5859. res, err := c.doRequest("json")
  5860. if err != nil {
  5861. return err
  5862. }
  5863. defer googleapi.CloseBody(res)
  5864. if err := googleapi.CheckResponse(res); err != nil {
  5865. return err
  5866. }
  5867. return nil
  5868. // {
  5869. // "description": "Permanently deletes the ACL entry for the specified entity on the specified object.",
  5870. // "httpMethod": "DELETE",
  5871. // "id": "storage.objectAccessControls.delete",
  5872. // "parameterOrder": [
  5873. // "bucket",
  5874. // "object",
  5875. // "entity"
  5876. // ],
  5877. // "parameters": {
  5878. // "bucket": {
  5879. // "description": "Name of a bucket.",
  5880. // "location": "path",
  5881. // "required": true,
  5882. // "type": "string"
  5883. // },
  5884. // "entity": {
  5885. // "description": "The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.",
  5886. // "location": "path",
  5887. // "required": true,
  5888. // "type": "string"
  5889. // },
  5890. // "generation": {
  5891. // "description": "If present, selects a specific revision of this object (as opposed to the latest version, the default).",
  5892. // "format": "int64",
  5893. // "location": "query",
  5894. // "type": "string"
  5895. // },
  5896. // "object": {
  5897. // "description": "Name of the object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.",
  5898. // "location": "path",
  5899. // "required": true,
  5900. // "type": "string"
  5901. // },
  5902. // "userProject": {
  5903. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  5904. // "location": "query",
  5905. // "type": "string"
  5906. // }
  5907. // },
  5908. // "path": "b/{bucket}/o/{object}/acl/{entity}",
  5909. // "scopes": [
  5910. // "https://www.googleapis.com/auth/cloud-platform",
  5911. // "https://www.googleapis.com/auth/devstorage.full_control"
  5912. // ]
  5913. // }
  5914. }
  5915. // method id "storage.objectAccessControls.get":
  5916. type ObjectAccessControlsGetCall struct {
  5917. s *Service
  5918. bucket string
  5919. object string
  5920. entity string
  5921. urlParams_ gensupport.URLParams
  5922. ifNoneMatch_ string
  5923. ctx_ context.Context
  5924. header_ http.Header
  5925. }
  5926. // Get: Returns the ACL entry for the specified entity on the specified
  5927. // object.
  5928. func (r *ObjectAccessControlsService) Get(bucket string, object string, entity string) *ObjectAccessControlsGetCall {
  5929. c := &ObjectAccessControlsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5930. c.bucket = bucket
  5931. c.object = object
  5932. c.entity = entity
  5933. return c
  5934. }
  5935. // Generation sets the optional parameter "generation": If present,
  5936. // selects a specific revision of this object (as opposed to the latest
  5937. // version, the default).
  5938. func (c *ObjectAccessControlsGetCall) Generation(generation int64) *ObjectAccessControlsGetCall {
  5939. c.urlParams_.Set("generation", fmt.Sprint(generation))
  5940. return c
  5941. }
  5942. // UserProject sets the optional parameter "userProject": The project to
  5943. // be billed for this request. Required for Requester Pays buckets.
  5944. func (c *ObjectAccessControlsGetCall) UserProject(userProject string) *ObjectAccessControlsGetCall {
  5945. c.urlParams_.Set("userProject", userProject)
  5946. return c
  5947. }
  5948. // Fields allows partial responses to be retrieved. See
  5949. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5950. // for more information.
  5951. func (c *ObjectAccessControlsGetCall) Fields(s ...googleapi.Field) *ObjectAccessControlsGetCall {
  5952. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5953. return c
  5954. }
  5955. // IfNoneMatch sets the optional parameter which makes the operation
  5956. // fail if the object's ETag matches the given value. This is useful for
  5957. // getting updates only after the object has changed since the last
  5958. // request. Use googleapi.IsNotModified to check whether the response
  5959. // error from Do is the result of In-None-Match.
  5960. func (c *ObjectAccessControlsGetCall) IfNoneMatch(entityTag string) *ObjectAccessControlsGetCall {
  5961. c.ifNoneMatch_ = entityTag
  5962. return c
  5963. }
  5964. // Context sets the context to be used in this call's Do method. Any
  5965. // pending HTTP request will be aborted if the provided context is
  5966. // canceled.
  5967. func (c *ObjectAccessControlsGetCall) Context(ctx context.Context) *ObjectAccessControlsGetCall {
  5968. c.ctx_ = ctx
  5969. return c
  5970. }
  5971. // Header returns an http.Header that can be modified by the caller to
  5972. // add HTTP headers to the request.
  5973. func (c *ObjectAccessControlsGetCall) Header() http.Header {
  5974. if c.header_ == nil {
  5975. c.header_ = make(http.Header)
  5976. }
  5977. return c.header_
  5978. }
  5979. func (c *ObjectAccessControlsGetCall) doRequest(alt string) (*http.Response, error) {
  5980. reqHeaders := make(http.Header)
  5981. for k, v := range c.header_ {
  5982. reqHeaders[k] = v
  5983. }
  5984. reqHeaders.Set("User-Agent", c.s.userAgent())
  5985. if c.ifNoneMatch_ != "" {
  5986. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  5987. }
  5988. var body io.Reader = nil
  5989. c.urlParams_.Set("alt", alt)
  5990. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o/{object}/acl/{entity}")
  5991. urls += "?" + c.urlParams_.Encode()
  5992. req, _ := http.NewRequest("GET", urls, body)
  5993. req.Header = reqHeaders
  5994. googleapi.Expand(req.URL, map[string]string{
  5995. "bucket": c.bucket,
  5996. "object": c.object,
  5997. "entity": c.entity,
  5998. })
  5999. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6000. }
  6001. // Do executes the "storage.objectAccessControls.get" call.
  6002. // Exactly one of *ObjectAccessControl or error will be non-nil. Any
  6003. // non-2xx status code is an error. Response headers are in either
  6004. // *ObjectAccessControl.ServerResponse.Header or (if a response was
  6005. // returned at all) in error.(*googleapi.Error).Header. Use
  6006. // googleapi.IsNotModified to check whether the returned error was
  6007. // because http.StatusNotModified was returned.
  6008. func (c *ObjectAccessControlsGetCall) Do(opts ...googleapi.CallOption) (*ObjectAccessControl, error) {
  6009. gensupport.SetOptions(c.urlParams_, opts...)
  6010. res, err := c.doRequest("json")
  6011. if res != nil && res.StatusCode == http.StatusNotModified {
  6012. if res.Body != nil {
  6013. res.Body.Close()
  6014. }
  6015. return nil, &googleapi.Error{
  6016. Code: res.StatusCode,
  6017. Header: res.Header,
  6018. }
  6019. }
  6020. if err != nil {
  6021. return nil, err
  6022. }
  6023. defer googleapi.CloseBody(res)
  6024. if err := googleapi.CheckResponse(res); err != nil {
  6025. return nil, err
  6026. }
  6027. ret := &ObjectAccessControl{
  6028. ServerResponse: googleapi.ServerResponse{
  6029. Header: res.Header,
  6030. HTTPStatusCode: res.StatusCode,
  6031. },
  6032. }
  6033. target := &ret
  6034. if err := gensupport.DecodeResponse(target, res); err != nil {
  6035. return nil, err
  6036. }
  6037. return ret, nil
  6038. // {
  6039. // "description": "Returns the ACL entry for the specified entity on the specified object.",
  6040. // "httpMethod": "GET",
  6041. // "id": "storage.objectAccessControls.get",
  6042. // "parameterOrder": [
  6043. // "bucket",
  6044. // "object",
  6045. // "entity"
  6046. // ],
  6047. // "parameters": {
  6048. // "bucket": {
  6049. // "description": "Name of a bucket.",
  6050. // "location": "path",
  6051. // "required": true,
  6052. // "type": "string"
  6053. // },
  6054. // "entity": {
  6055. // "description": "The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.",
  6056. // "location": "path",
  6057. // "required": true,
  6058. // "type": "string"
  6059. // },
  6060. // "generation": {
  6061. // "description": "If present, selects a specific revision of this object (as opposed to the latest version, the default).",
  6062. // "format": "int64",
  6063. // "location": "query",
  6064. // "type": "string"
  6065. // },
  6066. // "object": {
  6067. // "description": "Name of the object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.",
  6068. // "location": "path",
  6069. // "required": true,
  6070. // "type": "string"
  6071. // },
  6072. // "userProject": {
  6073. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  6074. // "location": "query",
  6075. // "type": "string"
  6076. // }
  6077. // },
  6078. // "path": "b/{bucket}/o/{object}/acl/{entity}",
  6079. // "response": {
  6080. // "$ref": "ObjectAccessControl"
  6081. // },
  6082. // "scopes": [
  6083. // "https://www.googleapis.com/auth/cloud-platform",
  6084. // "https://www.googleapis.com/auth/devstorage.full_control"
  6085. // ]
  6086. // }
  6087. }
  6088. // method id "storage.objectAccessControls.insert":
  6089. type ObjectAccessControlsInsertCall struct {
  6090. s *Service
  6091. bucket string
  6092. object string
  6093. objectaccesscontrol *ObjectAccessControl
  6094. urlParams_ gensupport.URLParams
  6095. ctx_ context.Context
  6096. header_ http.Header
  6097. }
  6098. // Insert: Creates a new ACL entry on the specified object.
  6099. func (r *ObjectAccessControlsService) Insert(bucket string, object string, objectaccesscontrol *ObjectAccessControl) *ObjectAccessControlsInsertCall {
  6100. c := &ObjectAccessControlsInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6101. c.bucket = bucket
  6102. c.object = object
  6103. c.objectaccesscontrol = objectaccesscontrol
  6104. return c
  6105. }
  6106. // Generation sets the optional parameter "generation": If present,
  6107. // selects a specific revision of this object (as opposed to the latest
  6108. // version, the default).
  6109. func (c *ObjectAccessControlsInsertCall) Generation(generation int64) *ObjectAccessControlsInsertCall {
  6110. c.urlParams_.Set("generation", fmt.Sprint(generation))
  6111. return c
  6112. }
  6113. // UserProject sets the optional parameter "userProject": The project to
  6114. // be billed for this request. Required for Requester Pays buckets.
  6115. func (c *ObjectAccessControlsInsertCall) UserProject(userProject string) *ObjectAccessControlsInsertCall {
  6116. c.urlParams_.Set("userProject", userProject)
  6117. return c
  6118. }
  6119. // Fields allows partial responses to be retrieved. See
  6120. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6121. // for more information.
  6122. func (c *ObjectAccessControlsInsertCall) Fields(s ...googleapi.Field) *ObjectAccessControlsInsertCall {
  6123. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6124. return c
  6125. }
  6126. // Context sets the context to be used in this call's Do method. Any
  6127. // pending HTTP request will be aborted if the provided context is
  6128. // canceled.
  6129. func (c *ObjectAccessControlsInsertCall) Context(ctx context.Context) *ObjectAccessControlsInsertCall {
  6130. c.ctx_ = ctx
  6131. return c
  6132. }
  6133. // Header returns an http.Header that can be modified by the caller to
  6134. // add HTTP headers to the request.
  6135. func (c *ObjectAccessControlsInsertCall) Header() http.Header {
  6136. if c.header_ == nil {
  6137. c.header_ = make(http.Header)
  6138. }
  6139. return c.header_
  6140. }
  6141. func (c *ObjectAccessControlsInsertCall) doRequest(alt string) (*http.Response, error) {
  6142. reqHeaders := make(http.Header)
  6143. for k, v := range c.header_ {
  6144. reqHeaders[k] = v
  6145. }
  6146. reqHeaders.Set("User-Agent", c.s.userAgent())
  6147. var body io.Reader = nil
  6148. body, err := googleapi.WithoutDataWrapper.JSONReader(c.objectaccesscontrol)
  6149. if err != nil {
  6150. return nil, err
  6151. }
  6152. reqHeaders.Set("Content-Type", "application/json")
  6153. c.urlParams_.Set("alt", alt)
  6154. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o/{object}/acl")
  6155. urls += "?" + c.urlParams_.Encode()
  6156. req, _ := http.NewRequest("POST", urls, body)
  6157. req.Header = reqHeaders
  6158. googleapi.Expand(req.URL, map[string]string{
  6159. "bucket": c.bucket,
  6160. "object": c.object,
  6161. })
  6162. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6163. }
  6164. // Do executes the "storage.objectAccessControls.insert" call.
  6165. // Exactly one of *ObjectAccessControl or error will be non-nil. Any
  6166. // non-2xx status code is an error. Response headers are in either
  6167. // *ObjectAccessControl.ServerResponse.Header or (if a response was
  6168. // returned at all) in error.(*googleapi.Error).Header. Use
  6169. // googleapi.IsNotModified to check whether the returned error was
  6170. // because http.StatusNotModified was returned.
  6171. func (c *ObjectAccessControlsInsertCall) Do(opts ...googleapi.CallOption) (*ObjectAccessControl, error) {
  6172. gensupport.SetOptions(c.urlParams_, opts...)
  6173. res, err := c.doRequest("json")
  6174. if res != nil && res.StatusCode == http.StatusNotModified {
  6175. if res.Body != nil {
  6176. res.Body.Close()
  6177. }
  6178. return nil, &googleapi.Error{
  6179. Code: res.StatusCode,
  6180. Header: res.Header,
  6181. }
  6182. }
  6183. if err != nil {
  6184. return nil, err
  6185. }
  6186. defer googleapi.CloseBody(res)
  6187. if err := googleapi.CheckResponse(res); err != nil {
  6188. return nil, err
  6189. }
  6190. ret := &ObjectAccessControl{
  6191. ServerResponse: googleapi.ServerResponse{
  6192. Header: res.Header,
  6193. HTTPStatusCode: res.StatusCode,
  6194. },
  6195. }
  6196. target := &ret
  6197. if err := gensupport.DecodeResponse(target, res); err != nil {
  6198. return nil, err
  6199. }
  6200. return ret, nil
  6201. // {
  6202. // "description": "Creates a new ACL entry on the specified object.",
  6203. // "httpMethod": "POST",
  6204. // "id": "storage.objectAccessControls.insert",
  6205. // "parameterOrder": [
  6206. // "bucket",
  6207. // "object"
  6208. // ],
  6209. // "parameters": {
  6210. // "bucket": {
  6211. // "description": "Name of a bucket.",
  6212. // "location": "path",
  6213. // "required": true,
  6214. // "type": "string"
  6215. // },
  6216. // "generation": {
  6217. // "description": "If present, selects a specific revision of this object (as opposed to the latest version, the default).",
  6218. // "format": "int64",
  6219. // "location": "query",
  6220. // "type": "string"
  6221. // },
  6222. // "object": {
  6223. // "description": "Name of the object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.",
  6224. // "location": "path",
  6225. // "required": true,
  6226. // "type": "string"
  6227. // },
  6228. // "userProject": {
  6229. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  6230. // "location": "query",
  6231. // "type": "string"
  6232. // }
  6233. // },
  6234. // "path": "b/{bucket}/o/{object}/acl",
  6235. // "request": {
  6236. // "$ref": "ObjectAccessControl"
  6237. // },
  6238. // "response": {
  6239. // "$ref": "ObjectAccessControl"
  6240. // },
  6241. // "scopes": [
  6242. // "https://www.googleapis.com/auth/cloud-platform",
  6243. // "https://www.googleapis.com/auth/devstorage.full_control"
  6244. // ]
  6245. // }
  6246. }
  6247. // method id "storage.objectAccessControls.list":
  6248. type ObjectAccessControlsListCall struct {
  6249. s *Service
  6250. bucket string
  6251. object string
  6252. urlParams_ gensupport.URLParams
  6253. ifNoneMatch_ string
  6254. ctx_ context.Context
  6255. header_ http.Header
  6256. }
  6257. // List: Retrieves ACL entries on the specified object.
  6258. func (r *ObjectAccessControlsService) List(bucket string, object string) *ObjectAccessControlsListCall {
  6259. c := &ObjectAccessControlsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6260. c.bucket = bucket
  6261. c.object = object
  6262. return c
  6263. }
  6264. // Generation sets the optional parameter "generation": If present,
  6265. // selects a specific revision of this object (as opposed to the latest
  6266. // version, the default).
  6267. func (c *ObjectAccessControlsListCall) Generation(generation int64) *ObjectAccessControlsListCall {
  6268. c.urlParams_.Set("generation", fmt.Sprint(generation))
  6269. return c
  6270. }
  6271. // UserProject sets the optional parameter "userProject": The project to
  6272. // be billed for this request. Required for Requester Pays buckets.
  6273. func (c *ObjectAccessControlsListCall) UserProject(userProject string) *ObjectAccessControlsListCall {
  6274. c.urlParams_.Set("userProject", userProject)
  6275. return c
  6276. }
  6277. // Fields allows partial responses to be retrieved. See
  6278. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6279. // for more information.
  6280. func (c *ObjectAccessControlsListCall) Fields(s ...googleapi.Field) *ObjectAccessControlsListCall {
  6281. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6282. return c
  6283. }
  6284. // IfNoneMatch sets the optional parameter which makes the operation
  6285. // fail if the object's ETag matches the given value. This is useful for
  6286. // getting updates only after the object has changed since the last
  6287. // request. Use googleapi.IsNotModified to check whether the response
  6288. // error from Do is the result of In-None-Match.
  6289. func (c *ObjectAccessControlsListCall) IfNoneMatch(entityTag string) *ObjectAccessControlsListCall {
  6290. c.ifNoneMatch_ = entityTag
  6291. return c
  6292. }
  6293. // Context sets the context to be used in this call's Do method. Any
  6294. // pending HTTP request will be aborted if the provided context is
  6295. // canceled.
  6296. func (c *ObjectAccessControlsListCall) Context(ctx context.Context) *ObjectAccessControlsListCall {
  6297. c.ctx_ = ctx
  6298. return c
  6299. }
  6300. // Header returns an http.Header that can be modified by the caller to
  6301. // add HTTP headers to the request.
  6302. func (c *ObjectAccessControlsListCall) Header() http.Header {
  6303. if c.header_ == nil {
  6304. c.header_ = make(http.Header)
  6305. }
  6306. return c.header_
  6307. }
  6308. func (c *ObjectAccessControlsListCall) doRequest(alt string) (*http.Response, error) {
  6309. reqHeaders := make(http.Header)
  6310. for k, v := range c.header_ {
  6311. reqHeaders[k] = v
  6312. }
  6313. reqHeaders.Set("User-Agent", c.s.userAgent())
  6314. if c.ifNoneMatch_ != "" {
  6315. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  6316. }
  6317. var body io.Reader = nil
  6318. c.urlParams_.Set("alt", alt)
  6319. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o/{object}/acl")
  6320. urls += "?" + c.urlParams_.Encode()
  6321. req, _ := http.NewRequest("GET", urls, body)
  6322. req.Header = reqHeaders
  6323. googleapi.Expand(req.URL, map[string]string{
  6324. "bucket": c.bucket,
  6325. "object": c.object,
  6326. })
  6327. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6328. }
  6329. // Do executes the "storage.objectAccessControls.list" call.
  6330. // Exactly one of *ObjectAccessControls or error will be non-nil. Any
  6331. // non-2xx status code is an error. Response headers are in either
  6332. // *ObjectAccessControls.ServerResponse.Header or (if a response was
  6333. // returned at all) in error.(*googleapi.Error).Header. Use
  6334. // googleapi.IsNotModified to check whether the returned error was
  6335. // because http.StatusNotModified was returned.
  6336. func (c *ObjectAccessControlsListCall) Do(opts ...googleapi.CallOption) (*ObjectAccessControls, error) {
  6337. gensupport.SetOptions(c.urlParams_, opts...)
  6338. res, err := c.doRequest("json")
  6339. if res != nil && res.StatusCode == http.StatusNotModified {
  6340. if res.Body != nil {
  6341. res.Body.Close()
  6342. }
  6343. return nil, &googleapi.Error{
  6344. Code: res.StatusCode,
  6345. Header: res.Header,
  6346. }
  6347. }
  6348. if err != nil {
  6349. return nil, err
  6350. }
  6351. defer googleapi.CloseBody(res)
  6352. if err := googleapi.CheckResponse(res); err != nil {
  6353. return nil, err
  6354. }
  6355. ret := &ObjectAccessControls{
  6356. ServerResponse: googleapi.ServerResponse{
  6357. Header: res.Header,
  6358. HTTPStatusCode: res.StatusCode,
  6359. },
  6360. }
  6361. target := &ret
  6362. if err := gensupport.DecodeResponse(target, res); err != nil {
  6363. return nil, err
  6364. }
  6365. return ret, nil
  6366. // {
  6367. // "description": "Retrieves ACL entries on the specified object.",
  6368. // "httpMethod": "GET",
  6369. // "id": "storage.objectAccessControls.list",
  6370. // "parameterOrder": [
  6371. // "bucket",
  6372. // "object"
  6373. // ],
  6374. // "parameters": {
  6375. // "bucket": {
  6376. // "description": "Name of a bucket.",
  6377. // "location": "path",
  6378. // "required": true,
  6379. // "type": "string"
  6380. // },
  6381. // "generation": {
  6382. // "description": "If present, selects a specific revision of this object (as opposed to the latest version, the default).",
  6383. // "format": "int64",
  6384. // "location": "query",
  6385. // "type": "string"
  6386. // },
  6387. // "object": {
  6388. // "description": "Name of the object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.",
  6389. // "location": "path",
  6390. // "required": true,
  6391. // "type": "string"
  6392. // },
  6393. // "userProject": {
  6394. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  6395. // "location": "query",
  6396. // "type": "string"
  6397. // }
  6398. // },
  6399. // "path": "b/{bucket}/o/{object}/acl",
  6400. // "response": {
  6401. // "$ref": "ObjectAccessControls"
  6402. // },
  6403. // "scopes": [
  6404. // "https://www.googleapis.com/auth/cloud-platform",
  6405. // "https://www.googleapis.com/auth/devstorage.full_control"
  6406. // ]
  6407. // }
  6408. }
  6409. // method id "storage.objectAccessControls.patch":
  6410. type ObjectAccessControlsPatchCall struct {
  6411. s *Service
  6412. bucket string
  6413. object string
  6414. entity string
  6415. objectaccesscontrol *ObjectAccessControl
  6416. urlParams_ gensupport.URLParams
  6417. ctx_ context.Context
  6418. header_ http.Header
  6419. }
  6420. // Patch: Patches an ACL entry on the specified object.
  6421. func (r *ObjectAccessControlsService) Patch(bucket string, object string, entity string, objectaccesscontrol *ObjectAccessControl) *ObjectAccessControlsPatchCall {
  6422. c := &ObjectAccessControlsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6423. c.bucket = bucket
  6424. c.object = object
  6425. c.entity = entity
  6426. c.objectaccesscontrol = objectaccesscontrol
  6427. return c
  6428. }
  6429. // Generation sets the optional parameter "generation": If present,
  6430. // selects a specific revision of this object (as opposed to the latest
  6431. // version, the default).
  6432. func (c *ObjectAccessControlsPatchCall) Generation(generation int64) *ObjectAccessControlsPatchCall {
  6433. c.urlParams_.Set("generation", fmt.Sprint(generation))
  6434. return c
  6435. }
  6436. // UserProject sets the optional parameter "userProject": The project to
  6437. // be billed for this request. Required for Requester Pays buckets.
  6438. func (c *ObjectAccessControlsPatchCall) UserProject(userProject string) *ObjectAccessControlsPatchCall {
  6439. c.urlParams_.Set("userProject", userProject)
  6440. return c
  6441. }
  6442. // Fields allows partial responses to be retrieved. See
  6443. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6444. // for more information.
  6445. func (c *ObjectAccessControlsPatchCall) Fields(s ...googleapi.Field) *ObjectAccessControlsPatchCall {
  6446. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6447. return c
  6448. }
  6449. // Context sets the context to be used in this call's Do method. Any
  6450. // pending HTTP request will be aborted if the provided context is
  6451. // canceled.
  6452. func (c *ObjectAccessControlsPatchCall) Context(ctx context.Context) *ObjectAccessControlsPatchCall {
  6453. c.ctx_ = ctx
  6454. return c
  6455. }
  6456. // Header returns an http.Header that can be modified by the caller to
  6457. // add HTTP headers to the request.
  6458. func (c *ObjectAccessControlsPatchCall) Header() http.Header {
  6459. if c.header_ == nil {
  6460. c.header_ = make(http.Header)
  6461. }
  6462. return c.header_
  6463. }
  6464. func (c *ObjectAccessControlsPatchCall) doRequest(alt string) (*http.Response, error) {
  6465. reqHeaders := make(http.Header)
  6466. for k, v := range c.header_ {
  6467. reqHeaders[k] = v
  6468. }
  6469. reqHeaders.Set("User-Agent", c.s.userAgent())
  6470. var body io.Reader = nil
  6471. body, err := googleapi.WithoutDataWrapper.JSONReader(c.objectaccesscontrol)
  6472. if err != nil {
  6473. return nil, err
  6474. }
  6475. reqHeaders.Set("Content-Type", "application/json")
  6476. c.urlParams_.Set("alt", alt)
  6477. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o/{object}/acl/{entity}")
  6478. urls += "?" + c.urlParams_.Encode()
  6479. req, _ := http.NewRequest("PATCH", urls, body)
  6480. req.Header = reqHeaders
  6481. googleapi.Expand(req.URL, map[string]string{
  6482. "bucket": c.bucket,
  6483. "object": c.object,
  6484. "entity": c.entity,
  6485. })
  6486. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6487. }
  6488. // Do executes the "storage.objectAccessControls.patch" call.
  6489. // Exactly one of *ObjectAccessControl or error will be non-nil. Any
  6490. // non-2xx status code is an error. Response headers are in either
  6491. // *ObjectAccessControl.ServerResponse.Header or (if a response was
  6492. // returned at all) in error.(*googleapi.Error).Header. Use
  6493. // googleapi.IsNotModified to check whether the returned error was
  6494. // because http.StatusNotModified was returned.
  6495. func (c *ObjectAccessControlsPatchCall) Do(opts ...googleapi.CallOption) (*ObjectAccessControl, error) {
  6496. gensupport.SetOptions(c.urlParams_, opts...)
  6497. res, err := c.doRequest("json")
  6498. if res != nil && res.StatusCode == http.StatusNotModified {
  6499. if res.Body != nil {
  6500. res.Body.Close()
  6501. }
  6502. return nil, &googleapi.Error{
  6503. Code: res.StatusCode,
  6504. Header: res.Header,
  6505. }
  6506. }
  6507. if err != nil {
  6508. return nil, err
  6509. }
  6510. defer googleapi.CloseBody(res)
  6511. if err := googleapi.CheckResponse(res); err != nil {
  6512. return nil, err
  6513. }
  6514. ret := &ObjectAccessControl{
  6515. ServerResponse: googleapi.ServerResponse{
  6516. Header: res.Header,
  6517. HTTPStatusCode: res.StatusCode,
  6518. },
  6519. }
  6520. target := &ret
  6521. if err := gensupport.DecodeResponse(target, res); err != nil {
  6522. return nil, err
  6523. }
  6524. return ret, nil
  6525. // {
  6526. // "description": "Patches an ACL entry on the specified object.",
  6527. // "httpMethod": "PATCH",
  6528. // "id": "storage.objectAccessControls.patch",
  6529. // "parameterOrder": [
  6530. // "bucket",
  6531. // "object",
  6532. // "entity"
  6533. // ],
  6534. // "parameters": {
  6535. // "bucket": {
  6536. // "description": "Name of a bucket.",
  6537. // "location": "path",
  6538. // "required": true,
  6539. // "type": "string"
  6540. // },
  6541. // "entity": {
  6542. // "description": "The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.",
  6543. // "location": "path",
  6544. // "required": true,
  6545. // "type": "string"
  6546. // },
  6547. // "generation": {
  6548. // "description": "If present, selects a specific revision of this object (as opposed to the latest version, the default).",
  6549. // "format": "int64",
  6550. // "location": "query",
  6551. // "type": "string"
  6552. // },
  6553. // "object": {
  6554. // "description": "Name of the object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.",
  6555. // "location": "path",
  6556. // "required": true,
  6557. // "type": "string"
  6558. // },
  6559. // "userProject": {
  6560. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  6561. // "location": "query",
  6562. // "type": "string"
  6563. // }
  6564. // },
  6565. // "path": "b/{bucket}/o/{object}/acl/{entity}",
  6566. // "request": {
  6567. // "$ref": "ObjectAccessControl"
  6568. // },
  6569. // "response": {
  6570. // "$ref": "ObjectAccessControl"
  6571. // },
  6572. // "scopes": [
  6573. // "https://www.googleapis.com/auth/cloud-platform",
  6574. // "https://www.googleapis.com/auth/devstorage.full_control"
  6575. // ]
  6576. // }
  6577. }
  6578. // method id "storage.objectAccessControls.update":
  6579. type ObjectAccessControlsUpdateCall struct {
  6580. s *Service
  6581. bucket string
  6582. object string
  6583. entity string
  6584. objectaccesscontrol *ObjectAccessControl
  6585. urlParams_ gensupport.URLParams
  6586. ctx_ context.Context
  6587. header_ http.Header
  6588. }
  6589. // Update: Updates an ACL entry on the specified object.
  6590. func (r *ObjectAccessControlsService) Update(bucket string, object string, entity string, objectaccesscontrol *ObjectAccessControl) *ObjectAccessControlsUpdateCall {
  6591. c := &ObjectAccessControlsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6592. c.bucket = bucket
  6593. c.object = object
  6594. c.entity = entity
  6595. c.objectaccesscontrol = objectaccesscontrol
  6596. return c
  6597. }
  6598. // Generation sets the optional parameter "generation": If present,
  6599. // selects a specific revision of this object (as opposed to the latest
  6600. // version, the default).
  6601. func (c *ObjectAccessControlsUpdateCall) Generation(generation int64) *ObjectAccessControlsUpdateCall {
  6602. c.urlParams_.Set("generation", fmt.Sprint(generation))
  6603. return c
  6604. }
  6605. // UserProject sets the optional parameter "userProject": The project to
  6606. // be billed for this request. Required for Requester Pays buckets.
  6607. func (c *ObjectAccessControlsUpdateCall) UserProject(userProject string) *ObjectAccessControlsUpdateCall {
  6608. c.urlParams_.Set("userProject", userProject)
  6609. return c
  6610. }
  6611. // Fields allows partial responses to be retrieved. See
  6612. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6613. // for more information.
  6614. func (c *ObjectAccessControlsUpdateCall) Fields(s ...googleapi.Field) *ObjectAccessControlsUpdateCall {
  6615. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6616. return c
  6617. }
  6618. // Context sets the context to be used in this call's Do method. Any
  6619. // pending HTTP request will be aborted if the provided context is
  6620. // canceled.
  6621. func (c *ObjectAccessControlsUpdateCall) Context(ctx context.Context) *ObjectAccessControlsUpdateCall {
  6622. c.ctx_ = ctx
  6623. return c
  6624. }
  6625. // Header returns an http.Header that can be modified by the caller to
  6626. // add HTTP headers to the request.
  6627. func (c *ObjectAccessControlsUpdateCall) Header() http.Header {
  6628. if c.header_ == nil {
  6629. c.header_ = make(http.Header)
  6630. }
  6631. return c.header_
  6632. }
  6633. func (c *ObjectAccessControlsUpdateCall) doRequest(alt string) (*http.Response, error) {
  6634. reqHeaders := make(http.Header)
  6635. for k, v := range c.header_ {
  6636. reqHeaders[k] = v
  6637. }
  6638. reqHeaders.Set("User-Agent", c.s.userAgent())
  6639. var body io.Reader = nil
  6640. body, err := googleapi.WithoutDataWrapper.JSONReader(c.objectaccesscontrol)
  6641. if err != nil {
  6642. return nil, err
  6643. }
  6644. reqHeaders.Set("Content-Type", "application/json")
  6645. c.urlParams_.Set("alt", alt)
  6646. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o/{object}/acl/{entity}")
  6647. urls += "?" + c.urlParams_.Encode()
  6648. req, _ := http.NewRequest("PUT", urls, body)
  6649. req.Header = reqHeaders
  6650. googleapi.Expand(req.URL, map[string]string{
  6651. "bucket": c.bucket,
  6652. "object": c.object,
  6653. "entity": c.entity,
  6654. })
  6655. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6656. }
  6657. // Do executes the "storage.objectAccessControls.update" call.
  6658. // Exactly one of *ObjectAccessControl or error will be non-nil. Any
  6659. // non-2xx status code is an error. Response headers are in either
  6660. // *ObjectAccessControl.ServerResponse.Header or (if a response was
  6661. // returned at all) in error.(*googleapi.Error).Header. Use
  6662. // googleapi.IsNotModified to check whether the returned error was
  6663. // because http.StatusNotModified was returned.
  6664. func (c *ObjectAccessControlsUpdateCall) Do(opts ...googleapi.CallOption) (*ObjectAccessControl, error) {
  6665. gensupport.SetOptions(c.urlParams_, opts...)
  6666. res, err := c.doRequest("json")
  6667. if res != nil && res.StatusCode == http.StatusNotModified {
  6668. if res.Body != nil {
  6669. res.Body.Close()
  6670. }
  6671. return nil, &googleapi.Error{
  6672. Code: res.StatusCode,
  6673. Header: res.Header,
  6674. }
  6675. }
  6676. if err != nil {
  6677. return nil, err
  6678. }
  6679. defer googleapi.CloseBody(res)
  6680. if err := googleapi.CheckResponse(res); err != nil {
  6681. return nil, err
  6682. }
  6683. ret := &ObjectAccessControl{
  6684. ServerResponse: googleapi.ServerResponse{
  6685. Header: res.Header,
  6686. HTTPStatusCode: res.StatusCode,
  6687. },
  6688. }
  6689. target := &ret
  6690. if err := gensupport.DecodeResponse(target, res); err != nil {
  6691. return nil, err
  6692. }
  6693. return ret, nil
  6694. // {
  6695. // "description": "Updates an ACL entry on the specified object.",
  6696. // "httpMethod": "PUT",
  6697. // "id": "storage.objectAccessControls.update",
  6698. // "parameterOrder": [
  6699. // "bucket",
  6700. // "object",
  6701. // "entity"
  6702. // ],
  6703. // "parameters": {
  6704. // "bucket": {
  6705. // "description": "Name of a bucket.",
  6706. // "location": "path",
  6707. // "required": true,
  6708. // "type": "string"
  6709. // },
  6710. // "entity": {
  6711. // "description": "The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.",
  6712. // "location": "path",
  6713. // "required": true,
  6714. // "type": "string"
  6715. // },
  6716. // "generation": {
  6717. // "description": "If present, selects a specific revision of this object (as opposed to the latest version, the default).",
  6718. // "format": "int64",
  6719. // "location": "query",
  6720. // "type": "string"
  6721. // },
  6722. // "object": {
  6723. // "description": "Name of the object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.",
  6724. // "location": "path",
  6725. // "required": true,
  6726. // "type": "string"
  6727. // },
  6728. // "userProject": {
  6729. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  6730. // "location": "query",
  6731. // "type": "string"
  6732. // }
  6733. // },
  6734. // "path": "b/{bucket}/o/{object}/acl/{entity}",
  6735. // "request": {
  6736. // "$ref": "ObjectAccessControl"
  6737. // },
  6738. // "response": {
  6739. // "$ref": "ObjectAccessControl"
  6740. // },
  6741. // "scopes": [
  6742. // "https://www.googleapis.com/auth/cloud-platform",
  6743. // "https://www.googleapis.com/auth/devstorage.full_control"
  6744. // ]
  6745. // }
  6746. }
  6747. // method id "storage.objects.compose":
  6748. type ObjectsComposeCall struct {
  6749. s *Service
  6750. destinationBucket string
  6751. destinationObject string
  6752. composerequest *ComposeRequest
  6753. urlParams_ gensupport.URLParams
  6754. ctx_ context.Context
  6755. header_ http.Header
  6756. }
  6757. // Compose: Concatenates a list of existing objects into a new object in
  6758. // the same bucket.
  6759. func (r *ObjectsService) Compose(destinationBucket string, destinationObject string, composerequest *ComposeRequest) *ObjectsComposeCall {
  6760. c := &ObjectsComposeCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6761. c.destinationBucket = destinationBucket
  6762. c.destinationObject = destinationObject
  6763. c.composerequest = composerequest
  6764. return c
  6765. }
  6766. // DestinationPredefinedAcl sets the optional parameter
  6767. // "destinationPredefinedAcl": Apply a predefined set of access controls
  6768. // to the destination object.
  6769. //
  6770. // Possible values:
  6771. // "authenticatedRead" - Object owner gets OWNER access, and
  6772. // allAuthenticatedUsers get READER access.
  6773. // "bucketOwnerFullControl" - Object owner gets OWNER access, and
  6774. // project team owners get OWNER access.
  6775. // "bucketOwnerRead" - Object owner gets OWNER access, and project
  6776. // team owners get READER access.
  6777. // "private" - Object owner gets OWNER access.
  6778. // "projectPrivate" - Object owner gets OWNER access, and project team
  6779. // members get access according to their roles.
  6780. // "publicRead" - Object owner gets OWNER access, and allUsers get
  6781. // READER access.
  6782. func (c *ObjectsComposeCall) DestinationPredefinedAcl(destinationPredefinedAcl string) *ObjectsComposeCall {
  6783. c.urlParams_.Set("destinationPredefinedAcl", destinationPredefinedAcl)
  6784. return c
  6785. }
  6786. // IfGenerationMatch sets the optional parameter "ifGenerationMatch":
  6787. // Makes the operation conditional on whether the object's current
  6788. // generation matches the given value. Setting to 0 makes the operation
  6789. // succeed only if there are no live versions of the object.
  6790. func (c *ObjectsComposeCall) IfGenerationMatch(ifGenerationMatch int64) *ObjectsComposeCall {
  6791. c.urlParams_.Set("ifGenerationMatch", fmt.Sprint(ifGenerationMatch))
  6792. return c
  6793. }
  6794. // IfMetagenerationMatch sets the optional parameter
  6795. // "ifMetagenerationMatch": Makes the operation conditional on whether
  6796. // the object's current metageneration matches the given value.
  6797. func (c *ObjectsComposeCall) IfMetagenerationMatch(ifMetagenerationMatch int64) *ObjectsComposeCall {
  6798. c.urlParams_.Set("ifMetagenerationMatch", fmt.Sprint(ifMetagenerationMatch))
  6799. return c
  6800. }
  6801. // KmsKeyName sets the optional parameter "kmsKeyName": Resource name of
  6802. // the Cloud KMS key, of the form
  6803. // projects/my-project/locations/global/keyRings/my-kr/cryptoKeys/my-key,
  6804. // that will be used to encrypt the object. Overrides the object
  6805. // metadata's kms_key_name value, if any.
  6806. func (c *ObjectsComposeCall) KmsKeyName(kmsKeyName string) *ObjectsComposeCall {
  6807. c.urlParams_.Set("kmsKeyName", kmsKeyName)
  6808. return c
  6809. }
  6810. // UserProject sets the optional parameter "userProject": The project to
  6811. // be billed for this request. Required for Requester Pays buckets.
  6812. func (c *ObjectsComposeCall) UserProject(userProject string) *ObjectsComposeCall {
  6813. c.urlParams_.Set("userProject", userProject)
  6814. return c
  6815. }
  6816. // Fields allows partial responses to be retrieved. See
  6817. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6818. // for more information.
  6819. func (c *ObjectsComposeCall) Fields(s ...googleapi.Field) *ObjectsComposeCall {
  6820. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6821. return c
  6822. }
  6823. // Context sets the context to be used in this call's Do method. Any
  6824. // pending HTTP request will be aborted if the provided context is
  6825. // canceled.
  6826. func (c *ObjectsComposeCall) Context(ctx context.Context) *ObjectsComposeCall {
  6827. c.ctx_ = ctx
  6828. return c
  6829. }
  6830. // Header returns an http.Header that can be modified by the caller to
  6831. // add HTTP headers to the request.
  6832. func (c *ObjectsComposeCall) Header() http.Header {
  6833. if c.header_ == nil {
  6834. c.header_ = make(http.Header)
  6835. }
  6836. return c.header_
  6837. }
  6838. func (c *ObjectsComposeCall) doRequest(alt string) (*http.Response, error) {
  6839. reqHeaders := make(http.Header)
  6840. for k, v := range c.header_ {
  6841. reqHeaders[k] = v
  6842. }
  6843. reqHeaders.Set("User-Agent", c.s.userAgent())
  6844. var body io.Reader = nil
  6845. body, err := googleapi.WithoutDataWrapper.JSONReader(c.composerequest)
  6846. if err != nil {
  6847. return nil, err
  6848. }
  6849. reqHeaders.Set("Content-Type", "application/json")
  6850. c.urlParams_.Set("alt", alt)
  6851. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{destinationBucket}/o/{destinationObject}/compose")
  6852. urls += "?" + c.urlParams_.Encode()
  6853. req, _ := http.NewRequest("POST", urls, body)
  6854. req.Header = reqHeaders
  6855. googleapi.Expand(req.URL, map[string]string{
  6856. "destinationBucket": c.destinationBucket,
  6857. "destinationObject": c.destinationObject,
  6858. })
  6859. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6860. }
  6861. // Do executes the "storage.objects.compose" call.
  6862. // Exactly one of *Object or error will be non-nil. Any non-2xx status
  6863. // code is an error. Response headers are in either
  6864. // *Object.ServerResponse.Header or (if a response was returned at all)
  6865. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  6866. // check whether the returned error was because http.StatusNotModified
  6867. // was returned.
  6868. func (c *ObjectsComposeCall) Do(opts ...googleapi.CallOption) (*Object, error) {
  6869. gensupport.SetOptions(c.urlParams_, opts...)
  6870. res, err := c.doRequest("json")
  6871. if res != nil && res.StatusCode == http.StatusNotModified {
  6872. if res.Body != nil {
  6873. res.Body.Close()
  6874. }
  6875. return nil, &googleapi.Error{
  6876. Code: res.StatusCode,
  6877. Header: res.Header,
  6878. }
  6879. }
  6880. if err != nil {
  6881. return nil, err
  6882. }
  6883. defer googleapi.CloseBody(res)
  6884. if err := googleapi.CheckResponse(res); err != nil {
  6885. return nil, err
  6886. }
  6887. ret := &Object{
  6888. ServerResponse: googleapi.ServerResponse{
  6889. Header: res.Header,
  6890. HTTPStatusCode: res.StatusCode,
  6891. },
  6892. }
  6893. target := &ret
  6894. if err := gensupport.DecodeResponse(target, res); err != nil {
  6895. return nil, err
  6896. }
  6897. return ret, nil
  6898. // {
  6899. // "description": "Concatenates a list of existing objects into a new object in the same bucket.",
  6900. // "httpMethod": "POST",
  6901. // "id": "storage.objects.compose",
  6902. // "parameterOrder": [
  6903. // "destinationBucket",
  6904. // "destinationObject"
  6905. // ],
  6906. // "parameters": {
  6907. // "destinationBucket": {
  6908. // "description": "Name of the bucket in which to store the new object.",
  6909. // "location": "path",
  6910. // "required": true,
  6911. // "type": "string"
  6912. // },
  6913. // "destinationObject": {
  6914. // "description": "Name of the new object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.",
  6915. // "location": "path",
  6916. // "required": true,
  6917. // "type": "string"
  6918. // },
  6919. // "destinationPredefinedAcl": {
  6920. // "description": "Apply a predefined set of access controls to the destination object.",
  6921. // "enum": [
  6922. // "authenticatedRead",
  6923. // "bucketOwnerFullControl",
  6924. // "bucketOwnerRead",
  6925. // "private",
  6926. // "projectPrivate",
  6927. // "publicRead"
  6928. // ],
  6929. // "enumDescriptions": [
  6930. // "Object owner gets OWNER access, and allAuthenticatedUsers get READER access.",
  6931. // "Object owner gets OWNER access, and project team owners get OWNER access.",
  6932. // "Object owner gets OWNER access, and project team owners get READER access.",
  6933. // "Object owner gets OWNER access.",
  6934. // "Object owner gets OWNER access, and project team members get access according to their roles.",
  6935. // "Object owner gets OWNER access, and allUsers get READER access."
  6936. // ],
  6937. // "location": "query",
  6938. // "type": "string"
  6939. // },
  6940. // "ifGenerationMatch": {
  6941. // "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.",
  6942. // "format": "int64",
  6943. // "location": "query",
  6944. // "type": "string"
  6945. // },
  6946. // "ifMetagenerationMatch": {
  6947. // "description": "Makes the operation conditional on whether the object's current metageneration matches the given value.",
  6948. // "format": "int64",
  6949. // "location": "query",
  6950. // "type": "string"
  6951. // },
  6952. // "kmsKeyName": {
  6953. // "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.",
  6954. // "location": "query",
  6955. // "type": "string"
  6956. // },
  6957. // "userProject": {
  6958. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  6959. // "location": "query",
  6960. // "type": "string"
  6961. // }
  6962. // },
  6963. // "path": "b/{destinationBucket}/o/{destinationObject}/compose",
  6964. // "request": {
  6965. // "$ref": "ComposeRequest"
  6966. // },
  6967. // "response": {
  6968. // "$ref": "Object"
  6969. // },
  6970. // "scopes": [
  6971. // "https://www.googleapis.com/auth/cloud-platform",
  6972. // "https://www.googleapis.com/auth/devstorage.full_control",
  6973. // "https://www.googleapis.com/auth/devstorage.read_write"
  6974. // ]
  6975. // }
  6976. }
  6977. // method id "storage.objects.copy":
  6978. type ObjectsCopyCall struct {
  6979. s *Service
  6980. sourceBucket string
  6981. sourceObject string
  6982. destinationBucket string
  6983. destinationObject string
  6984. object *Object
  6985. urlParams_ gensupport.URLParams
  6986. ctx_ context.Context
  6987. header_ http.Header
  6988. }
  6989. // Copy: Copies a source object to a destination object. Optionally
  6990. // overrides metadata.
  6991. func (r *ObjectsService) Copy(sourceBucket string, sourceObject string, destinationBucket string, destinationObject string, object *Object) *ObjectsCopyCall {
  6992. c := &ObjectsCopyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6993. c.sourceBucket = sourceBucket
  6994. c.sourceObject = sourceObject
  6995. c.destinationBucket = destinationBucket
  6996. c.destinationObject = destinationObject
  6997. c.object = object
  6998. return c
  6999. }
  7000. // DestinationPredefinedAcl sets the optional parameter
  7001. // "destinationPredefinedAcl": Apply a predefined set of access controls
  7002. // to the destination object.
  7003. //
  7004. // Possible values:
  7005. // "authenticatedRead" - Object owner gets OWNER access, and
  7006. // allAuthenticatedUsers get READER access.
  7007. // "bucketOwnerFullControl" - Object owner gets OWNER access, and
  7008. // project team owners get OWNER access.
  7009. // "bucketOwnerRead" - Object owner gets OWNER access, and project
  7010. // team owners get READER access.
  7011. // "private" - Object owner gets OWNER access.
  7012. // "projectPrivate" - Object owner gets OWNER access, and project team
  7013. // members get access according to their roles.
  7014. // "publicRead" - Object owner gets OWNER access, and allUsers get
  7015. // READER access.
  7016. func (c *ObjectsCopyCall) DestinationPredefinedAcl(destinationPredefinedAcl string) *ObjectsCopyCall {
  7017. c.urlParams_.Set("destinationPredefinedAcl", destinationPredefinedAcl)
  7018. return c
  7019. }
  7020. // IfGenerationMatch sets the optional parameter "ifGenerationMatch":
  7021. // Makes the operation conditional on whether the destination object's
  7022. // current generation matches the given value. Setting to 0 makes the
  7023. // operation succeed only if there are no live versions of the object.
  7024. func (c *ObjectsCopyCall) IfGenerationMatch(ifGenerationMatch int64) *ObjectsCopyCall {
  7025. c.urlParams_.Set("ifGenerationMatch", fmt.Sprint(ifGenerationMatch))
  7026. return c
  7027. }
  7028. // IfGenerationNotMatch sets the optional parameter
  7029. // "ifGenerationNotMatch": Makes the operation conditional on whether
  7030. // the destination object's current generation does not match the given
  7031. // value. If no live object exists, the precondition fails. Setting to 0
  7032. // makes the operation succeed only if there is a live version of the
  7033. // object.
  7034. func (c *ObjectsCopyCall) IfGenerationNotMatch(ifGenerationNotMatch int64) *ObjectsCopyCall {
  7035. c.urlParams_.Set("ifGenerationNotMatch", fmt.Sprint(ifGenerationNotMatch))
  7036. return c
  7037. }
  7038. // IfMetagenerationMatch sets the optional parameter
  7039. // "ifMetagenerationMatch": Makes the operation conditional on whether
  7040. // the destination object's current metageneration matches the given
  7041. // value.
  7042. func (c *ObjectsCopyCall) IfMetagenerationMatch(ifMetagenerationMatch int64) *ObjectsCopyCall {
  7043. c.urlParams_.Set("ifMetagenerationMatch", fmt.Sprint(ifMetagenerationMatch))
  7044. return c
  7045. }
  7046. // IfMetagenerationNotMatch sets the optional parameter
  7047. // "ifMetagenerationNotMatch": Makes the operation conditional on
  7048. // whether the destination object's current metageneration does not
  7049. // match the given value.
  7050. func (c *ObjectsCopyCall) IfMetagenerationNotMatch(ifMetagenerationNotMatch int64) *ObjectsCopyCall {
  7051. c.urlParams_.Set("ifMetagenerationNotMatch", fmt.Sprint(ifMetagenerationNotMatch))
  7052. return c
  7053. }
  7054. // IfSourceGenerationMatch sets the optional parameter
  7055. // "ifSourceGenerationMatch": Makes the operation conditional on whether
  7056. // the source object's current generation matches the given value.
  7057. func (c *ObjectsCopyCall) IfSourceGenerationMatch(ifSourceGenerationMatch int64) *ObjectsCopyCall {
  7058. c.urlParams_.Set("ifSourceGenerationMatch", fmt.Sprint(ifSourceGenerationMatch))
  7059. return c
  7060. }
  7061. // IfSourceGenerationNotMatch sets the optional parameter
  7062. // "ifSourceGenerationNotMatch": Makes the operation conditional on
  7063. // whether the source object's current generation does not match the
  7064. // given value.
  7065. func (c *ObjectsCopyCall) IfSourceGenerationNotMatch(ifSourceGenerationNotMatch int64) *ObjectsCopyCall {
  7066. c.urlParams_.Set("ifSourceGenerationNotMatch", fmt.Sprint(ifSourceGenerationNotMatch))
  7067. return c
  7068. }
  7069. // IfSourceMetagenerationMatch sets the optional parameter
  7070. // "ifSourceMetagenerationMatch": Makes the operation conditional on
  7071. // whether the source object's current metageneration matches the given
  7072. // value.
  7073. func (c *ObjectsCopyCall) IfSourceMetagenerationMatch(ifSourceMetagenerationMatch int64) *ObjectsCopyCall {
  7074. c.urlParams_.Set("ifSourceMetagenerationMatch", fmt.Sprint(ifSourceMetagenerationMatch))
  7075. return c
  7076. }
  7077. // IfSourceMetagenerationNotMatch sets the optional parameter
  7078. // "ifSourceMetagenerationNotMatch": Makes the operation conditional on
  7079. // whether the source object's current metageneration does not match the
  7080. // given value.
  7081. func (c *ObjectsCopyCall) IfSourceMetagenerationNotMatch(ifSourceMetagenerationNotMatch int64) *ObjectsCopyCall {
  7082. c.urlParams_.Set("ifSourceMetagenerationNotMatch", fmt.Sprint(ifSourceMetagenerationNotMatch))
  7083. return c
  7084. }
  7085. // Projection sets the optional parameter "projection": Set of
  7086. // properties to return. Defaults to noAcl, unless the object resource
  7087. // specifies the acl property, when it defaults to full.
  7088. //
  7089. // Possible values:
  7090. // "full" - Include all properties.
  7091. // "noAcl" - Omit the owner, acl property.
  7092. func (c *ObjectsCopyCall) Projection(projection string) *ObjectsCopyCall {
  7093. c.urlParams_.Set("projection", projection)
  7094. return c
  7095. }
  7096. // SourceGeneration sets the optional parameter "sourceGeneration": If
  7097. // present, selects a specific revision of the source object (as opposed
  7098. // to the latest version, the default).
  7099. func (c *ObjectsCopyCall) SourceGeneration(sourceGeneration int64) *ObjectsCopyCall {
  7100. c.urlParams_.Set("sourceGeneration", fmt.Sprint(sourceGeneration))
  7101. return c
  7102. }
  7103. // UserProject sets the optional parameter "userProject": The project to
  7104. // be billed for this request. Required for Requester Pays buckets.
  7105. func (c *ObjectsCopyCall) UserProject(userProject string) *ObjectsCopyCall {
  7106. c.urlParams_.Set("userProject", userProject)
  7107. return c
  7108. }
  7109. // Fields allows partial responses to be retrieved. See
  7110. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  7111. // for more information.
  7112. func (c *ObjectsCopyCall) Fields(s ...googleapi.Field) *ObjectsCopyCall {
  7113. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  7114. return c
  7115. }
  7116. // Context sets the context to be used in this call's Do method. Any
  7117. // pending HTTP request will be aborted if the provided context is
  7118. // canceled.
  7119. func (c *ObjectsCopyCall) Context(ctx context.Context) *ObjectsCopyCall {
  7120. c.ctx_ = ctx
  7121. return c
  7122. }
  7123. // Header returns an http.Header that can be modified by the caller to
  7124. // add HTTP headers to the request.
  7125. func (c *ObjectsCopyCall) Header() http.Header {
  7126. if c.header_ == nil {
  7127. c.header_ = make(http.Header)
  7128. }
  7129. return c.header_
  7130. }
  7131. func (c *ObjectsCopyCall) doRequest(alt string) (*http.Response, error) {
  7132. reqHeaders := make(http.Header)
  7133. for k, v := range c.header_ {
  7134. reqHeaders[k] = v
  7135. }
  7136. reqHeaders.Set("User-Agent", c.s.userAgent())
  7137. var body io.Reader = nil
  7138. body, err := googleapi.WithoutDataWrapper.JSONReader(c.object)
  7139. if err != nil {
  7140. return nil, err
  7141. }
  7142. reqHeaders.Set("Content-Type", "application/json")
  7143. c.urlParams_.Set("alt", alt)
  7144. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{sourceBucket}/o/{sourceObject}/copyTo/b/{destinationBucket}/o/{destinationObject}")
  7145. urls += "?" + c.urlParams_.Encode()
  7146. req, _ := http.NewRequest("POST", urls, body)
  7147. req.Header = reqHeaders
  7148. googleapi.Expand(req.URL, map[string]string{
  7149. "sourceBucket": c.sourceBucket,
  7150. "sourceObject": c.sourceObject,
  7151. "destinationBucket": c.destinationBucket,
  7152. "destinationObject": c.destinationObject,
  7153. })
  7154. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  7155. }
  7156. // Do executes the "storage.objects.copy" call.
  7157. // Exactly one of *Object or error will be non-nil. Any non-2xx status
  7158. // code is an error. Response headers are in either
  7159. // *Object.ServerResponse.Header or (if a response was returned at all)
  7160. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  7161. // check whether the returned error was because http.StatusNotModified
  7162. // was returned.
  7163. func (c *ObjectsCopyCall) Do(opts ...googleapi.CallOption) (*Object, error) {
  7164. gensupport.SetOptions(c.urlParams_, opts...)
  7165. res, err := c.doRequest("json")
  7166. if res != nil && res.StatusCode == http.StatusNotModified {
  7167. if res.Body != nil {
  7168. res.Body.Close()
  7169. }
  7170. return nil, &googleapi.Error{
  7171. Code: res.StatusCode,
  7172. Header: res.Header,
  7173. }
  7174. }
  7175. if err != nil {
  7176. return nil, err
  7177. }
  7178. defer googleapi.CloseBody(res)
  7179. if err := googleapi.CheckResponse(res); err != nil {
  7180. return nil, err
  7181. }
  7182. ret := &Object{
  7183. ServerResponse: googleapi.ServerResponse{
  7184. Header: res.Header,
  7185. HTTPStatusCode: res.StatusCode,
  7186. },
  7187. }
  7188. target := &ret
  7189. if err := gensupport.DecodeResponse(target, res); err != nil {
  7190. return nil, err
  7191. }
  7192. return ret, nil
  7193. // {
  7194. // "description": "Copies a source object to a destination object. Optionally overrides metadata.",
  7195. // "httpMethod": "POST",
  7196. // "id": "storage.objects.copy",
  7197. // "parameterOrder": [
  7198. // "sourceBucket",
  7199. // "sourceObject",
  7200. // "destinationBucket",
  7201. // "destinationObject"
  7202. // ],
  7203. // "parameters": {
  7204. // "destinationBucket": {
  7205. // "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.",
  7206. // "location": "path",
  7207. // "required": true,
  7208. // "type": "string"
  7209. // },
  7210. // "destinationObject": {
  7211. // "description": "Name of the new object. Required when the object metadata is not otherwise provided. Overrides the object metadata's name value, if any.",
  7212. // "location": "path",
  7213. // "required": true,
  7214. // "type": "string"
  7215. // },
  7216. // "destinationPredefinedAcl": {
  7217. // "description": "Apply a predefined set of access controls to the destination object.",
  7218. // "enum": [
  7219. // "authenticatedRead",
  7220. // "bucketOwnerFullControl",
  7221. // "bucketOwnerRead",
  7222. // "private",
  7223. // "projectPrivate",
  7224. // "publicRead"
  7225. // ],
  7226. // "enumDescriptions": [
  7227. // "Object owner gets OWNER access, and allAuthenticatedUsers get READER access.",
  7228. // "Object owner gets OWNER access, and project team owners get OWNER access.",
  7229. // "Object owner gets OWNER access, and project team owners get READER access.",
  7230. // "Object owner gets OWNER access.",
  7231. // "Object owner gets OWNER access, and project team members get access according to their roles.",
  7232. // "Object owner gets OWNER access, and allUsers get READER access."
  7233. // ],
  7234. // "location": "query",
  7235. // "type": "string"
  7236. // },
  7237. // "ifGenerationMatch": {
  7238. // "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.",
  7239. // "format": "int64",
  7240. // "location": "query",
  7241. // "type": "string"
  7242. // },
  7243. // "ifGenerationNotMatch": {
  7244. // "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.",
  7245. // "format": "int64",
  7246. // "location": "query",
  7247. // "type": "string"
  7248. // },
  7249. // "ifMetagenerationMatch": {
  7250. // "description": "Makes the operation conditional on whether the destination object's current metageneration matches the given value.",
  7251. // "format": "int64",
  7252. // "location": "query",
  7253. // "type": "string"
  7254. // },
  7255. // "ifMetagenerationNotMatch": {
  7256. // "description": "Makes the operation conditional on whether the destination object's current metageneration does not match the given value.",
  7257. // "format": "int64",
  7258. // "location": "query",
  7259. // "type": "string"
  7260. // },
  7261. // "ifSourceGenerationMatch": {
  7262. // "description": "Makes the operation conditional on whether the source object's current generation matches the given value.",
  7263. // "format": "int64",
  7264. // "location": "query",
  7265. // "type": "string"
  7266. // },
  7267. // "ifSourceGenerationNotMatch": {
  7268. // "description": "Makes the operation conditional on whether the source object's current generation does not match the given value.",
  7269. // "format": "int64",
  7270. // "location": "query",
  7271. // "type": "string"
  7272. // },
  7273. // "ifSourceMetagenerationMatch": {
  7274. // "description": "Makes the operation conditional on whether the source object's current metageneration matches the given value.",
  7275. // "format": "int64",
  7276. // "location": "query",
  7277. // "type": "string"
  7278. // },
  7279. // "ifSourceMetagenerationNotMatch": {
  7280. // "description": "Makes the operation conditional on whether the source object's current metageneration does not match the given value.",
  7281. // "format": "int64",
  7282. // "location": "query",
  7283. // "type": "string"
  7284. // },
  7285. // "projection": {
  7286. // "description": "Set of properties to return. Defaults to noAcl, unless the object resource specifies the acl property, when it defaults to full.",
  7287. // "enum": [
  7288. // "full",
  7289. // "noAcl"
  7290. // ],
  7291. // "enumDescriptions": [
  7292. // "Include all properties.",
  7293. // "Omit the owner, acl property."
  7294. // ],
  7295. // "location": "query",
  7296. // "type": "string"
  7297. // },
  7298. // "sourceBucket": {
  7299. // "description": "Name of the bucket in which to find the source object.",
  7300. // "location": "path",
  7301. // "required": true,
  7302. // "type": "string"
  7303. // },
  7304. // "sourceGeneration": {
  7305. // "description": "If present, selects a specific revision of the source object (as opposed to the latest version, the default).",
  7306. // "format": "int64",
  7307. // "location": "query",
  7308. // "type": "string"
  7309. // },
  7310. // "sourceObject": {
  7311. // "description": "Name of the source object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.",
  7312. // "location": "path",
  7313. // "required": true,
  7314. // "type": "string"
  7315. // },
  7316. // "userProject": {
  7317. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  7318. // "location": "query",
  7319. // "type": "string"
  7320. // }
  7321. // },
  7322. // "path": "b/{sourceBucket}/o/{sourceObject}/copyTo/b/{destinationBucket}/o/{destinationObject}",
  7323. // "request": {
  7324. // "$ref": "Object"
  7325. // },
  7326. // "response": {
  7327. // "$ref": "Object"
  7328. // },
  7329. // "scopes": [
  7330. // "https://www.googleapis.com/auth/cloud-platform",
  7331. // "https://www.googleapis.com/auth/devstorage.full_control",
  7332. // "https://www.googleapis.com/auth/devstorage.read_write"
  7333. // ]
  7334. // }
  7335. }
  7336. // method id "storage.objects.delete":
  7337. type ObjectsDeleteCall struct {
  7338. s *Service
  7339. bucket string
  7340. object string
  7341. urlParams_ gensupport.URLParams
  7342. ctx_ context.Context
  7343. header_ http.Header
  7344. }
  7345. // Delete: Deletes an object and its metadata. Deletions are permanent
  7346. // if versioning is not enabled for the bucket, or if the generation
  7347. // parameter is used.
  7348. func (r *ObjectsService) Delete(bucket string, object string) *ObjectsDeleteCall {
  7349. c := &ObjectsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  7350. c.bucket = bucket
  7351. c.object = object
  7352. return c
  7353. }
  7354. // Generation sets the optional parameter "generation": If present,
  7355. // permanently deletes a specific revision of this object (as opposed to
  7356. // the latest version, the default).
  7357. func (c *ObjectsDeleteCall) Generation(generation int64) *ObjectsDeleteCall {
  7358. c.urlParams_.Set("generation", fmt.Sprint(generation))
  7359. return c
  7360. }
  7361. // IfGenerationMatch sets the optional parameter "ifGenerationMatch":
  7362. // Makes the operation conditional on whether the object's current
  7363. // generation matches the given value. Setting to 0 makes the operation
  7364. // succeed only if there are no live versions of the object.
  7365. func (c *ObjectsDeleteCall) IfGenerationMatch(ifGenerationMatch int64) *ObjectsDeleteCall {
  7366. c.urlParams_.Set("ifGenerationMatch", fmt.Sprint(ifGenerationMatch))
  7367. return c
  7368. }
  7369. // IfGenerationNotMatch sets the optional parameter
  7370. // "ifGenerationNotMatch": Makes the operation conditional on whether
  7371. // the object's current generation does not match the given value. If no
  7372. // live object exists, the precondition fails. Setting to 0 makes the
  7373. // operation succeed only if there is a live version of the object.
  7374. func (c *ObjectsDeleteCall) IfGenerationNotMatch(ifGenerationNotMatch int64) *ObjectsDeleteCall {
  7375. c.urlParams_.Set("ifGenerationNotMatch", fmt.Sprint(ifGenerationNotMatch))
  7376. return c
  7377. }
  7378. // IfMetagenerationMatch sets the optional parameter
  7379. // "ifMetagenerationMatch": Makes the operation conditional on whether
  7380. // the object's current metageneration matches the given value.
  7381. func (c *ObjectsDeleteCall) IfMetagenerationMatch(ifMetagenerationMatch int64) *ObjectsDeleteCall {
  7382. c.urlParams_.Set("ifMetagenerationMatch", fmt.Sprint(ifMetagenerationMatch))
  7383. return c
  7384. }
  7385. // IfMetagenerationNotMatch sets the optional parameter
  7386. // "ifMetagenerationNotMatch": Makes the operation conditional on
  7387. // whether the object's current metageneration does not match the given
  7388. // value.
  7389. func (c *ObjectsDeleteCall) IfMetagenerationNotMatch(ifMetagenerationNotMatch int64) *ObjectsDeleteCall {
  7390. c.urlParams_.Set("ifMetagenerationNotMatch", fmt.Sprint(ifMetagenerationNotMatch))
  7391. return c
  7392. }
  7393. // UserProject sets the optional parameter "userProject": The project to
  7394. // be billed for this request. Required for Requester Pays buckets.
  7395. func (c *ObjectsDeleteCall) UserProject(userProject string) *ObjectsDeleteCall {
  7396. c.urlParams_.Set("userProject", userProject)
  7397. return c
  7398. }
  7399. // Fields allows partial responses to be retrieved. See
  7400. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  7401. // for more information.
  7402. func (c *ObjectsDeleteCall) Fields(s ...googleapi.Field) *ObjectsDeleteCall {
  7403. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  7404. return c
  7405. }
  7406. // Context sets the context to be used in this call's Do method. Any
  7407. // pending HTTP request will be aborted if the provided context is
  7408. // canceled.
  7409. func (c *ObjectsDeleteCall) Context(ctx context.Context) *ObjectsDeleteCall {
  7410. c.ctx_ = ctx
  7411. return c
  7412. }
  7413. // Header returns an http.Header that can be modified by the caller to
  7414. // add HTTP headers to the request.
  7415. func (c *ObjectsDeleteCall) Header() http.Header {
  7416. if c.header_ == nil {
  7417. c.header_ = make(http.Header)
  7418. }
  7419. return c.header_
  7420. }
  7421. func (c *ObjectsDeleteCall) doRequest(alt string) (*http.Response, error) {
  7422. reqHeaders := make(http.Header)
  7423. for k, v := range c.header_ {
  7424. reqHeaders[k] = v
  7425. }
  7426. reqHeaders.Set("User-Agent", c.s.userAgent())
  7427. var body io.Reader = nil
  7428. c.urlParams_.Set("alt", alt)
  7429. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o/{object}")
  7430. urls += "?" + c.urlParams_.Encode()
  7431. req, _ := http.NewRequest("DELETE", urls, body)
  7432. req.Header = reqHeaders
  7433. googleapi.Expand(req.URL, map[string]string{
  7434. "bucket": c.bucket,
  7435. "object": c.object,
  7436. })
  7437. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  7438. }
  7439. // Do executes the "storage.objects.delete" call.
  7440. func (c *ObjectsDeleteCall) Do(opts ...googleapi.CallOption) error {
  7441. gensupport.SetOptions(c.urlParams_, opts...)
  7442. res, err := c.doRequest("json")
  7443. if err != nil {
  7444. return err
  7445. }
  7446. defer googleapi.CloseBody(res)
  7447. if err := googleapi.CheckResponse(res); err != nil {
  7448. return err
  7449. }
  7450. return nil
  7451. // {
  7452. // "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.",
  7453. // "httpMethod": "DELETE",
  7454. // "id": "storage.objects.delete",
  7455. // "parameterOrder": [
  7456. // "bucket",
  7457. // "object"
  7458. // ],
  7459. // "parameters": {
  7460. // "bucket": {
  7461. // "description": "Name of the bucket in which the object resides.",
  7462. // "location": "path",
  7463. // "required": true,
  7464. // "type": "string"
  7465. // },
  7466. // "generation": {
  7467. // "description": "If present, permanently deletes a specific revision of this object (as opposed to the latest version, the default).",
  7468. // "format": "int64",
  7469. // "location": "query",
  7470. // "type": "string"
  7471. // },
  7472. // "ifGenerationMatch": {
  7473. // "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.",
  7474. // "format": "int64",
  7475. // "location": "query",
  7476. // "type": "string"
  7477. // },
  7478. // "ifGenerationNotMatch": {
  7479. // "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.",
  7480. // "format": "int64",
  7481. // "location": "query",
  7482. // "type": "string"
  7483. // },
  7484. // "ifMetagenerationMatch": {
  7485. // "description": "Makes the operation conditional on whether the object's current metageneration matches the given value.",
  7486. // "format": "int64",
  7487. // "location": "query",
  7488. // "type": "string"
  7489. // },
  7490. // "ifMetagenerationNotMatch": {
  7491. // "description": "Makes the operation conditional on whether the object's current metageneration does not match the given value.",
  7492. // "format": "int64",
  7493. // "location": "query",
  7494. // "type": "string"
  7495. // },
  7496. // "object": {
  7497. // "description": "Name of the object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.",
  7498. // "location": "path",
  7499. // "required": true,
  7500. // "type": "string"
  7501. // },
  7502. // "userProject": {
  7503. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  7504. // "location": "query",
  7505. // "type": "string"
  7506. // }
  7507. // },
  7508. // "path": "b/{bucket}/o/{object}",
  7509. // "scopes": [
  7510. // "https://www.googleapis.com/auth/cloud-platform",
  7511. // "https://www.googleapis.com/auth/devstorage.full_control",
  7512. // "https://www.googleapis.com/auth/devstorage.read_write"
  7513. // ]
  7514. // }
  7515. }
  7516. // method id "storage.objects.get":
  7517. type ObjectsGetCall struct {
  7518. s *Service
  7519. bucket string
  7520. object string
  7521. urlParams_ gensupport.URLParams
  7522. ifNoneMatch_ string
  7523. ctx_ context.Context
  7524. header_ http.Header
  7525. }
  7526. // Get: Retrieves an object or its metadata.
  7527. func (r *ObjectsService) Get(bucket string, object string) *ObjectsGetCall {
  7528. c := &ObjectsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  7529. c.bucket = bucket
  7530. c.object = object
  7531. return c
  7532. }
  7533. // Generation sets the optional parameter "generation": If present,
  7534. // selects a specific revision of this object (as opposed to the latest
  7535. // version, the default).
  7536. func (c *ObjectsGetCall) Generation(generation int64) *ObjectsGetCall {
  7537. c.urlParams_.Set("generation", fmt.Sprint(generation))
  7538. return c
  7539. }
  7540. // IfGenerationMatch sets the optional parameter "ifGenerationMatch":
  7541. // Makes the operation conditional on whether the object's current
  7542. // generation matches the given value. Setting to 0 makes the operation
  7543. // succeed only if there are no live versions of the object.
  7544. func (c *ObjectsGetCall) IfGenerationMatch(ifGenerationMatch int64) *ObjectsGetCall {
  7545. c.urlParams_.Set("ifGenerationMatch", fmt.Sprint(ifGenerationMatch))
  7546. return c
  7547. }
  7548. // IfGenerationNotMatch sets the optional parameter
  7549. // "ifGenerationNotMatch": Makes the operation conditional on whether
  7550. // the object's current generation does not match the given value. If no
  7551. // live object exists, the precondition fails. Setting to 0 makes the
  7552. // operation succeed only if there is a live version of the object.
  7553. func (c *ObjectsGetCall) IfGenerationNotMatch(ifGenerationNotMatch int64) *ObjectsGetCall {
  7554. c.urlParams_.Set("ifGenerationNotMatch", fmt.Sprint(ifGenerationNotMatch))
  7555. return c
  7556. }
  7557. // IfMetagenerationMatch sets the optional parameter
  7558. // "ifMetagenerationMatch": Makes the operation conditional on whether
  7559. // the object's current metageneration matches the given value.
  7560. func (c *ObjectsGetCall) IfMetagenerationMatch(ifMetagenerationMatch int64) *ObjectsGetCall {
  7561. c.urlParams_.Set("ifMetagenerationMatch", fmt.Sprint(ifMetagenerationMatch))
  7562. return c
  7563. }
  7564. // IfMetagenerationNotMatch sets the optional parameter
  7565. // "ifMetagenerationNotMatch": Makes the operation conditional on
  7566. // whether the object's current metageneration does not match the given
  7567. // value.
  7568. func (c *ObjectsGetCall) IfMetagenerationNotMatch(ifMetagenerationNotMatch int64) *ObjectsGetCall {
  7569. c.urlParams_.Set("ifMetagenerationNotMatch", fmt.Sprint(ifMetagenerationNotMatch))
  7570. return c
  7571. }
  7572. // Projection sets the optional parameter "projection": Set of
  7573. // properties to return. Defaults to noAcl.
  7574. //
  7575. // Possible values:
  7576. // "full" - Include all properties.
  7577. // "noAcl" - Omit the owner, acl property.
  7578. func (c *ObjectsGetCall) Projection(projection string) *ObjectsGetCall {
  7579. c.urlParams_.Set("projection", projection)
  7580. return c
  7581. }
  7582. // UserProject sets the optional parameter "userProject": The project to
  7583. // be billed for this request. Required for Requester Pays buckets.
  7584. func (c *ObjectsGetCall) UserProject(userProject string) *ObjectsGetCall {
  7585. c.urlParams_.Set("userProject", userProject)
  7586. return c
  7587. }
  7588. // Fields allows partial responses to be retrieved. See
  7589. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  7590. // for more information.
  7591. func (c *ObjectsGetCall) Fields(s ...googleapi.Field) *ObjectsGetCall {
  7592. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  7593. return c
  7594. }
  7595. // IfNoneMatch sets the optional parameter which makes the operation
  7596. // fail if the object's ETag matches the given value. This is useful for
  7597. // getting updates only after the object has changed since the last
  7598. // request. Use googleapi.IsNotModified to check whether the response
  7599. // error from Do is the result of In-None-Match.
  7600. func (c *ObjectsGetCall) IfNoneMatch(entityTag string) *ObjectsGetCall {
  7601. c.ifNoneMatch_ = entityTag
  7602. return c
  7603. }
  7604. // Context sets the context to be used in this call's Do and Download
  7605. // methods. Any pending HTTP request will be aborted if the provided
  7606. // context is canceled.
  7607. func (c *ObjectsGetCall) Context(ctx context.Context) *ObjectsGetCall {
  7608. c.ctx_ = ctx
  7609. return c
  7610. }
  7611. // Header returns an http.Header that can be modified by the caller to
  7612. // add HTTP headers to the request.
  7613. func (c *ObjectsGetCall) Header() http.Header {
  7614. if c.header_ == nil {
  7615. c.header_ = make(http.Header)
  7616. }
  7617. return c.header_
  7618. }
  7619. func (c *ObjectsGetCall) doRequest(alt string) (*http.Response, error) {
  7620. reqHeaders := make(http.Header)
  7621. for k, v := range c.header_ {
  7622. reqHeaders[k] = v
  7623. }
  7624. reqHeaders.Set("User-Agent", c.s.userAgent())
  7625. if c.ifNoneMatch_ != "" {
  7626. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  7627. }
  7628. var body io.Reader = nil
  7629. c.urlParams_.Set("alt", alt)
  7630. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o/{object}")
  7631. urls += "?" + c.urlParams_.Encode()
  7632. req, _ := http.NewRequest("GET", urls, body)
  7633. req.Header = reqHeaders
  7634. googleapi.Expand(req.URL, map[string]string{
  7635. "bucket": c.bucket,
  7636. "object": c.object,
  7637. })
  7638. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  7639. }
  7640. // Download fetches the API endpoint's "media" value, instead of the normal
  7641. // API response value. If the returned error is nil, the Response is guaranteed to
  7642. // have a 2xx status code. Callers must close the Response.Body as usual.
  7643. func (c *ObjectsGetCall) Download(opts ...googleapi.CallOption) (*http.Response, error) {
  7644. gensupport.SetOptions(c.urlParams_, opts...)
  7645. res, err := c.doRequest("media")
  7646. if err != nil {
  7647. return nil, err
  7648. }
  7649. if err := googleapi.CheckMediaResponse(res); err != nil {
  7650. res.Body.Close()
  7651. return nil, err
  7652. }
  7653. return res, nil
  7654. }
  7655. // Do executes the "storage.objects.get" call.
  7656. // Exactly one of *Object or error will be non-nil. Any non-2xx status
  7657. // code is an error. Response headers are in either
  7658. // *Object.ServerResponse.Header or (if a response was returned at all)
  7659. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  7660. // check whether the returned error was because http.StatusNotModified
  7661. // was returned.
  7662. func (c *ObjectsGetCall) Do(opts ...googleapi.CallOption) (*Object, error) {
  7663. gensupport.SetOptions(c.urlParams_, opts...)
  7664. res, err := c.doRequest("json")
  7665. if res != nil && res.StatusCode == http.StatusNotModified {
  7666. if res.Body != nil {
  7667. res.Body.Close()
  7668. }
  7669. return nil, &googleapi.Error{
  7670. Code: res.StatusCode,
  7671. Header: res.Header,
  7672. }
  7673. }
  7674. if err != nil {
  7675. return nil, err
  7676. }
  7677. defer googleapi.CloseBody(res)
  7678. if err := googleapi.CheckResponse(res); err != nil {
  7679. return nil, err
  7680. }
  7681. ret := &Object{
  7682. ServerResponse: googleapi.ServerResponse{
  7683. Header: res.Header,
  7684. HTTPStatusCode: res.StatusCode,
  7685. },
  7686. }
  7687. target := &ret
  7688. if err := gensupport.DecodeResponse(target, res); err != nil {
  7689. return nil, err
  7690. }
  7691. return ret, nil
  7692. // {
  7693. // "description": "Retrieves an object or its metadata.",
  7694. // "httpMethod": "GET",
  7695. // "id": "storage.objects.get",
  7696. // "parameterOrder": [
  7697. // "bucket",
  7698. // "object"
  7699. // ],
  7700. // "parameters": {
  7701. // "bucket": {
  7702. // "description": "Name of the bucket in which the object resides.",
  7703. // "location": "path",
  7704. // "required": true,
  7705. // "type": "string"
  7706. // },
  7707. // "generation": {
  7708. // "description": "If present, selects a specific revision of this object (as opposed to the latest version, the default).",
  7709. // "format": "int64",
  7710. // "location": "query",
  7711. // "type": "string"
  7712. // },
  7713. // "ifGenerationMatch": {
  7714. // "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.",
  7715. // "format": "int64",
  7716. // "location": "query",
  7717. // "type": "string"
  7718. // },
  7719. // "ifGenerationNotMatch": {
  7720. // "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.",
  7721. // "format": "int64",
  7722. // "location": "query",
  7723. // "type": "string"
  7724. // },
  7725. // "ifMetagenerationMatch": {
  7726. // "description": "Makes the operation conditional on whether the object's current metageneration matches the given value.",
  7727. // "format": "int64",
  7728. // "location": "query",
  7729. // "type": "string"
  7730. // },
  7731. // "ifMetagenerationNotMatch": {
  7732. // "description": "Makes the operation conditional on whether the object's current metageneration does not match the given value.",
  7733. // "format": "int64",
  7734. // "location": "query",
  7735. // "type": "string"
  7736. // },
  7737. // "object": {
  7738. // "description": "Name of the object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.",
  7739. // "location": "path",
  7740. // "required": true,
  7741. // "type": "string"
  7742. // },
  7743. // "projection": {
  7744. // "description": "Set of properties to return. Defaults to noAcl.",
  7745. // "enum": [
  7746. // "full",
  7747. // "noAcl"
  7748. // ],
  7749. // "enumDescriptions": [
  7750. // "Include all properties.",
  7751. // "Omit the owner, acl property."
  7752. // ],
  7753. // "location": "query",
  7754. // "type": "string"
  7755. // },
  7756. // "userProject": {
  7757. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  7758. // "location": "query",
  7759. // "type": "string"
  7760. // }
  7761. // },
  7762. // "path": "b/{bucket}/o/{object}",
  7763. // "response": {
  7764. // "$ref": "Object"
  7765. // },
  7766. // "scopes": [
  7767. // "https://www.googleapis.com/auth/cloud-platform",
  7768. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  7769. // "https://www.googleapis.com/auth/devstorage.full_control",
  7770. // "https://www.googleapis.com/auth/devstorage.read_only",
  7771. // "https://www.googleapis.com/auth/devstorage.read_write"
  7772. // ],
  7773. // "supportsMediaDownload": true,
  7774. // "useMediaDownloadService": true
  7775. // }
  7776. }
  7777. // method id "storage.objects.getIamPolicy":
  7778. type ObjectsGetIamPolicyCall struct {
  7779. s *Service
  7780. bucket string
  7781. object string
  7782. urlParams_ gensupport.URLParams
  7783. ifNoneMatch_ string
  7784. ctx_ context.Context
  7785. header_ http.Header
  7786. }
  7787. // GetIamPolicy: Returns an IAM policy for the specified object.
  7788. func (r *ObjectsService) GetIamPolicy(bucket string, object string) *ObjectsGetIamPolicyCall {
  7789. c := &ObjectsGetIamPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  7790. c.bucket = bucket
  7791. c.object = object
  7792. return c
  7793. }
  7794. // Generation sets the optional parameter "generation": If present,
  7795. // selects a specific revision of this object (as opposed to the latest
  7796. // version, the default).
  7797. func (c *ObjectsGetIamPolicyCall) Generation(generation int64) *ObjectsGetIamPolicyCall {
  7798. c.urlParams_.Set("generation", fmt.Sprint(generation))
  7799. return c
  7800. }
  7801. // UserProject sets the optional parameter "userProject": The project to
  7802. // be billed for this request. Required for Requester Pays buckets.
  7803. func (c *ObjectsGetIamPolicyCall) UserProject(userProject string) *ObjectsGetIamPolicyCall {
  7804. c.urlParams_.Set("userProject", userProject)
  7805. return c
  7806. }
  7807. // Fields allows partial responses to be retrieved. See
  7808. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  7809. // for more information.
  7810. func (c *ObjectsGetIamPolicyCall) Fields(s ...googleapi.Field) *ObjectsGetIamPolicyCall {
  7811. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  7812. return c
  7813. }
  7814. // IfNoneMatch sets the optional parameter which makes the operation
  7815. // fail if the object's ETag matches the given value. This is useful for
  7816. // getting updates only after the object has changed since the last
  7817. // request. Use googleapi.IsNotModified to check whether the response
  7818. // error from Do is the result of In-None-Match.
  7819. func (c *ObjectsGetIamPolicyCall) IfNoneMatch(entityTag string) *ObjectsGetIamPolicyCall {
  7820. c.ifNoneMatch_ = entityTag
  7821. return c
  7822. }
  7823. // Context sets the context to be used in this call's Do method. Any
  7824. // pending HTTP request will be aborted if the provided context is
  7825. // canceled.
  7826. func (c *ObjectsGetIamPolicyCall) Context(ctx context.Context) *ObjectsGetIamPolicyCall {
  7827. c.ctx_ = ctx
  7828. return c
  7829. }
  7830. // Header returns an http.Header that can be modified by the caller to
  7831. // add HTTP headers to the request.
  7832. func (c *ObjectsGetIamPolicyCall) Header() http.Header {
  7833. if c.header_ == nil {
  7834. c.header_ = make(http.Header)
  7835. }
  7836. return c.header_
  7837. }
  7838. func (c *ObjectsGetIamPolicyCall) doRequest(alt string) (*http.Response, error) {
  7839. reqHeaders := make(http.Header)
  7840. for k, v := range c.header_ {
  7841. reqHeaders[k] = v
  7842. }
  7843. reqHeaders.Set("User-Agent", c.s.userAgent())
  7844. if c.ifNoneMatch_ != "" {
  7845. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  7846. }
  7847. var body io.Reader = nil
  7848. c.urlParams_.Set("alt", alt)
  7849. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o/{object}/iam")
  7850. urls += "?" + c.urlParams_.Encode()
  7851. req, _ := http.NewRequest("GET", urls, body)
  7852. req.Header = reqHeaders
  7853. googleapi.Expand(req.URL, map[string]string{
  7854. "bucket": c.bucket,
  7855. "object": c.object,
  7856. })
  7857. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  7858. }
  7859. // Do executes the "storage.objects.getIamPolicy" call.
  7860. // Exactly one of *Policy or error will be non-nil. Any non-2xx status
  7861. // code is an error. Response headers are in either
  7862. // *Policy.ServerResponse.Header or (if a response was returned at all)
  7863. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  7864. // check whether the returned error was because http.StatusNotModified
  7865. // was returned.
  7866. func (c *ObjectsGetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Policy, error) {
  7867. gensupport.SetOptions(c.urlParams_, opts...)
  7868. res, err := c.doRequest("json")
  7869. if res != nil && res.StatusCode == http.StatusNotModified {
  7870. if res.Body != nil {
  7871. res.Body.Close()
  7872. }
  7873. return nil, &googleapi.Error{
  7874. Code: res.StatusCode,
  7875. Header: res.Header,
  7876. }
  7877. }
  7878. if err != nil {
  7879. return nil, err
  7880. }
  7881. defer googleapi.CloseBody(res)
  7882. if err := googleapi.CheckResponse(res); err != nil {
  7883. return nil, err
  7884. }
  7885. ret := &Policy{
  7886. ServerResponse: googleapi.ServerResponse{
  7887. Header: res.Header,
  7888. HTTPStatusCode: res.StatusCode,
  7889. },
  7890. }
  7891. target := &ret
  7892. if err := gensupport.DecodeResponse(target, res); err != nil {
  7893. return nil, err
  7894. }
  7895. return ret, nil
  7896. // {
  7897. // "description": "Returns an IAM policy for the specified object.",
  7898. // "httpMethod": "GET",
  7899. // "id": "storage.objects.getIamPolicy",
  7900. // "parameterOrder": [
  7901. // "bucket",
  7902. // "object"
  7903. // ],
  7904. // "parameters": {
  7905. // "bucket": {
  7906. // "description": "Name of the bucket in which the object resides.",
  7907. // "location": "path",
  7908. // "required": true,
  7909. // "type": "string"
  7910. // },
  7911. // "generation": {
  7912. // "description": "If present, selects a specific revision of this object (as opposed to the latest version, the default).",
  7913. // "format": "int64",
  7914. // "location": "query",
  7915. // "type": "string"
  7916. // },
  7917. // "object": {
  7918. // "description": "Name of the object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.",
  7919. // "location": "path",
  7920. // "required": true,
  7921. // "type": "string"
  7922. // },
  7923. // "userProject": {
  7924. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  7925. // "location": "query",
  7926. // "type": "string"
  7927. // }
  7928. // },
  7929. // "path": "b/{bucket}/o/{object}/iam",
  7930. // "response": {
  7931. // "$ref": "Policy"
  7932. // },
  7933. // "scopes": [
  7934. // "https://www.googleapis.com/auth/cloud-platform",
  7935. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  7936. // "https://www.googleapis.com/auth/devstorage.full_control",
  7937. // "https://www.googleapis.com/auth/devstorage.read_only",
  7938. // "https://www.googleapis.com/auth/devstorage.read_write"
  7939. // ]
  7940. // }
  7941. }
  7942. // method id "storage.objects.insert":
  7943. type ObjectsInsertCall struct {
  7944. s *Service
  7945. bucket string
  7946. object *Object
  7947. urlParams_ gensupport.URLParams
  7948. mediaInfo_ *gensupport.MediaInfo
  7949. ctx_ context.Context
  7950. header_ http.Header
  7951. }
  7952. // Insert: Stores a new object and metadata.
  7953. func (r *ObjectsService) Insert(bucket string, object *Object) *ObjectsInsertCall {
  7954. c := &ObjectsInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  7955. c.bucket = bucket
  7956. c.object = object
  7957. return c
  7958. }
  7959. // ContentEncoding sets the optional parameter "contentEncoding": If
  7960. // set, sets the contentEncoding property of the final object to this
  7961. // value. Setting this parameter is equivalent to setting the
  7962. // contentEncoding metadata property. This can be useful when uploading
  7963. // an object with uploadType=media to indicate the encoding of the
  7964. // content being uploaded.
  7965. func (c *ObjectsInsertCall) ContentEncoding(contentEncoding string) *ObjectsInsertCall {
  7966. c.urlParams_.Set("contentEncoding", contentEncoding)
  7967. return c
  7968. }
  7969. // IfGenerationMatch sets the optional parameter "ifGenerationMatch":
  7970. // Makes the operation conditional on whether the object's current
  7971. // generation matches the given value. Setting to 0 makes the operation
  7972. // succeed only if there are no live versions of the object.
  7973. func (c *ObjectsInsertCall) IfGenerationMatch(ifGenerationMatch int64) *ObjectsInsertCall {
  7974. c.urlParams_.Set("ifGenerationMatch", fmt.Sprint(ifGenerationMatch))
  7975. return c
  7976. }
  7977. // IfGenerationNotMatch sets the optional parameter
  7978. // "ifGenerationNotMatch": Makes the operation conditional on whether
  7979. // the object's current generation does not match the given value. If no
  7980. // live object exists, the precondition fails. Setting to 0 makes the
  7981. // operation succeed only if there is a live version of the object.
  7982. func (c *ObjectsInsertCall) IfGenerationNotMatch(ifGenerationNotMatch int64) *ObjectsInsertCall {
  7983. c.urlParams_.Set("ifGenerationNotMatch", fmt.Sprint(ifGenerationNotMatch))
  7984. return c
  7985. }
  7986. // IfMetagenerationMatch sets the optional parameter
  7987. // "ifMetagenerationMatch": Makes the operation conditional on whether
  7988. // the object's current metageneration matches the given value.
  7989. func (c *ObjectsInsertCall) IfMetagenerationMatch(ifMetagenerationMatch int64) *ObjectsInsertCall {
  7990. c.urlParams_.Set("ifMetagenerationMatch", fmt.Sprint(ifMetagenerationMatch))
  7991. return c
  7992. }
  7993. // IfMetagenerationNotMatch sets the optional parameter
  7994. // "ifMetagenerationNotMatch": Makes the operation conditional on
  7995. // whether the object's current metageneration does not match the given
  7996. // value.
  7997. func (c *ObjectsInsertCall) IfMetagenerationNotMatch(ifMetagenerationNotMatch int64) *ObjectsInsertCall {
  7998. c.urlParams_.Set("ifMetagenerationNotMatch", fmt.Sprint(ifMetagenerationNotMatch))
  7999. return c
  8000. }
  8001. // KmsKeyName sets the optional parameter "kmsKeyName": Resource name of
  8002. // the Cloud KMS key, of the form
  8003. // projects/my-project/locations/global/keyRings/my-kr/cryptoKeys/my-key,
  8004. // that will be used to encrypt the object. Overrides the object
  8005. // metadata's kms_key_name value, if any. Limited availability; usable
  8006. // only by enabled projects.
  8007. func (c *ObjectsInsertCall) KmsKeyName(kmsKeyName string) *ObjectsInsertCall {
  8008. c.urlParams_.Set("kmsKeyName", kmsKeyName)
  8009. return c
  8010. }
  8011. // Name sets the optional parameter "name": Name of the object. Required
  8012. // when the object metadata is not otherwise provided. Overrides the
  8013. // object metadata's name value, if any. For information about how to
  8014. // URL encode object names to be path safe, see Encoding URI Path Parts.
  8015. func (c *ObjectsInsertCall) Name(name string) *ObjectsInsertCall {
  8016. c.urlParams_.Set("name", name)
  8017. return c
  8018. }
  8019. // PredefinedAcl sets the optional parameter "predefinedAcl": Apply a
  8020. // predefined set of access controls to this object.
  8021. //
  8022. // Possible values:
  8023. // "authenticatedRead" - Object owner gets OWNER access, and
  8024. // allAuthenticatedUsers get READER access.
  8025. // "bucketOwnerFullControl" - Object owner gets OWNER access, and
  8026. // project team owners get OWNER access.
  8027. // "bucketOwnerRead" - Object owner gets OWNER access, and project
  8028. // team owners get READER access.
  8029. // "private" - Object owner gets OWNER access.
  8030. // "projectPrivate" - Object owner gets OWNER access, and project team
  8031. // members get access according to their roles.
  8032. // "publicRead" - Object owner gets OWNER access, and allUsers get
  8033. // READER access.
  8034. func (c *ObjectsInsertCall) PredefinedAcl(predefinedAcl string) *ObjectsInsertCall {
  8035. c.urlParams_.Set("predefinedAcl", predefinedAcl)
  8036. return c
  8037. }
  8038. // Projection sets the optional parameter "projection": Set of
  8039. // properties to return. Defaults to noAcl, unless the object resource
  8040. // specifies the acl property, when it defaults to full.
  8041. //
  8042. // Possible values:
  8043. // "full" - Include all properties.
  8044. // "noAcl" - Omit the owner, acl property.
  8045. func (c *ObjectsInsertCall) Projection(projection string) *ObjectsInsertCall {
  8046. c.urlParams_.Set("projection", projection)
  8047. return c
  8048. }
  8049. // UserProject sets the optional parameter "userProject": The project to
  8050. // be billed for this request. Required for Requester Pays buckets.
  8051. func (c *ObjectsInsertCall) UserProject(userProject string) *ObjectsInsertCall {
  8052. c.urlParams_.Set("userProject", userProject)
  8053. return c
  8054. }
  8055. // Media specifies the media to upload in one or more chunks. The chunk
  8056. // size may be controlled by supplying a MediaOption generated by
  8057. // googleapi.ChunkSize. The chunk size defaults to
  8058. // googleapi.DefaultUploadChunkSize.The Content-Type header used in the
  8059. // upload request will be determined by sniffing the contents of r,
  8060. // unless a MediaOption generated by googleapi.ContentType is
  8061. // supplied.
  8062. // At most one of Media and ResumableMedia may be set.
  8063. func (c *ObjectsInsertCall) Media(r io.Reader, options ...googleapi.MediaOption) *ObjectsInsertCall {
  8064. if ct := c.object.ContentType; ct != "" {
  8065. options = append([]googleapi.MediaOption{googleapi.ContentType(ct)}, options...)
  8066. }
  8067. c.mediaInfo_ = gensupport.NewInfoFromMedia(r, options)
  8068. return c
  8069. }
  8070. // ResumableMedia specifies the media to upload in chunks and can be
  8071. // canceled with ctx.
  8072. //
  8073. // Deprecated: use Media instead.
  8074. //
  8075. // At most one of Media and ResumableMedia may be set. mediaType
  8076. // identifies the MIME media type of the upload, such as "image/png". If
  8077. // mediaType is "", it will be auto-detected. The provided ctx will
  8078. // supersede any context previously provided to the Context method.
  8079. func (c *ObjectsInsertCall) ResumableMedia(ctx context.Context, r io.ReaderAt, size int64, mediaType string) *ObjectsInsertCall {
  8080. c.ctx_ = ctx
  8081. c.mediaInfo_ = gensupport.NewInfoFromResumableMedia(r, size, mediaType)
  8082. return c
  8083. }
  8084. // ProgressUpdater provides a callback function that will be called
  8085. // after every chunk. It should be a low-latency function in order to
  8086. // not slow down the upload operation. This should only be called when
  8087. // using ResumableMedia (as opposed to Media).
  8088. func (c *ObjectsInsertCall) ProgressUpdater(pu googleapi.ProgressUpdater) *ObjectsInsertCall {
  8089. c.mediaInfo_.SetProgressUpdater(pu)
  8090. return c
  8091. }
  8092. // Fields allows partial responses to be retrieved. See
  8093. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  8094. // for more information.
  8095. func (c *ObjectsInsertCall) Fields(s ...googleapi.Field) *ObjectsInsertCall {
  8096. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  8097. return c
  8098. }
  8099. // Context sets the context to be used in this call's Do method. Any
  8100. // pending HTTP request will be aborted if the provided context is
  8101. // canceled.
  8102. // This context will supersede any context previously provided to the
  8103. // ResumableMedia method.
  8104. func (c *ObjectsInsertCall) Context(ctx context.Context) *ObjectsInsertCall {
  8105. c.ctx_ = ctx
  8106. return c
  8107. }
  8108. // Header returns an http.Header that can be modified by the caller to
  8109. // add HTTP headers to the request.
  8110. func (c *ObjectsInsertCall) Header() http.Header {
  8111. if c.header_ == nil {
  8112. c.header_ = make(http.Header)
  8113. }
  8114. return c.header_
  8115. }
  8116. func (c *ObjectsInsertCall) doRequest(alt string) (*http.Response, error) {
  8117. reqHeaders := make(http.Header)
  8118. for k, v := range c.header_ {
  8119. reqHeaders[k] = v
  8120. }
  8121. reqHeaders.Set("User-Agent", c.s.userAgent())
  8122. var body io.Reader = nil
  8123. body, err := googleapi.WithoutDataWrapper.JSONReader(c.object)
  8124. if err != nil {
  8125. return nil, err
  8126. }
  8127. reqHeaders.Set("Content-Type", "application/json")
  8128. c.urlParams_.Set("alt", alt)
  8129. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o")
  8130. if c.mediaInfo_ != nil {
  8131. urls = strings.Replace(urls, "https://www.googleapis.com/", "https://www.googleapis.com/upload/", 1)
  8132. c.urlParams_.Set("uploadType", c.mediaInfo_.UploadType())
  8133. }
  8134. if body == nil {
  8135. body = new(bytes.Buffer)
  8136. reqHeaders.Set("Content-Type", "application/json")
  8137. }
  8138. body, getBody, cleanup := c.mediaInfo_.UploadRequest(reqHeaders, body)
  8139. defer cleanup()
  8140. urls += "?" + c.urlParams_.Encode()
  8141. req, _ := http.NewRequest("POST", urls, body)
  8142. req.Header = reqHeaders
  8143. gensupport.SetGetBody(req, getBody)
  8144. googleapi.Expand(req.URL, map[string]string{
  8145. "bucket": c.bucket,
  8146. })
  8147. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  8148. }
  8149. // Do executes the "storage.objects.insert" call.
  8150. // Exactly one of *Object or error will be non-nil. Any non-2xx status
  8151. // code is an error. Response headers are in either
  8152. // *Object.ServerResponse.Header or (if a response was returned at all)
  8153. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  8154. // check whether the returned error was because http.StatusNotModified
  8155. // was returned.
  8156. func (c *ObjectsInsertCall) Do(opts ...googleapi.CallOption) (*Object, error) {
  8157. gensupport.SetOptions(c.urlParams_, opts...)
  8158. res, err := c.doRequest("json")
  8159. if res != nil && res.StatusCode == http.StatusNotModified {
  8160. if res.Body != nil {
  8161. res.Body.Close()
  8162. }
  8163. return nil, &googleapi.Error{
  8164. Code: res.StatusCode,
  8165. Header: res.Header,
  8166. }
  8167. }
  8168. if err != nil {
  8169. return nil, err
  8170. }
  8171. defer googleapi.CloseBody(res)
  8172. if err := googleapi.CheckResponse(res); err != nil {
  8173. return nil, err
  8174. }
  8175. rx := c.mediaInfo_.ResumableUpload(res.Header.Get("Location"))
  8176. if rx != nil {
  8177. rx.Client = c.s.client
  8178. rx.UserAgent = c.s.userAgent()
  8179. ctx := c.ctx_
  8180. if ctx == nil {
  8181. ctx = context.TODO()
  8182. }
  8183. res, err = rx.Upload(ctx)
  8184. if err != nil {
  8185. return nil, err
  8186. }
  8187. defer res.Body.Close()
  8188. if err := googleapi.CheckResponse(res); err != nil {
  8189. return nil, err
  8190. }
  8191. }
  8192. ret := &Object{
  8193. ServerResponse: googleapi.ServerResponse{
  8194. Header: res.Header,
  8195. HTTPStatusCode: res.StatusCode,
  8196. },
  8197. }
  8198. target := &ret
  8199. if err := gensupport.DecodeResponse(target, res); err != nil {
  8200. return nil, err
  8201. }
  8202. return ret, nil
  8203. // {
  8204. // "description": "Stores a new object and metadata.",
  8205. // "httpMethod": "POST",
  8206. // "id": "storage.objects.insert",
  8207. // "mediaUpload": {
  8208. // "accept": [
  8209. // "*/*"
  8210. // ],
  8211. // "protocols": {
  8212. // "resumable": {
  8213. // "multipart": true,
  8214. // "path": "/resumable/upload/storage/v1/b/{bucket}/o"
  8215. // },
  8216. // "simple": {
  8217. // "multipart": true,
  8218. // "path": "/upload/storage/v1/b/{bucket}/o"
  8219. // }
  8220. // }
  8221. // },
  8222. // "parameterOrder": [
  8223. // "bucket"
  8224. // ],
  8225. // "parameters": {
  8226. // "bucket": {
  8227. // "description": "Name of the bucket in which to store the new object. Overrides the provided object metadata's bucket value, if any.",
  8228. // "location": "path",
  8229. // "required": true,
  8230. // "type": "string"
  8231. // },
  8232. // "contentEncoding": {
  8233. // "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.",
  8234. // "location": "query",
  8235. // "type": "string"
  8236. // },
  8237. // "ifGenerationMatch": {
  8238. // "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.",
  8239. // "format": "int64",
  8240. // "location": "query",
  8241. // "type": "string"
  8242. // },
  8243. // "ifGenerationNotMatch": {
  8244. // "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.",
  8245. // "format": "int64",
  8246. // "location": "query",
  8247. // "type": "string"
  8248. // },
  8249. // "ifMetagenerationMatch": {
  8250. // "description": "Makes the operation conditional on whether the object's current metageneration matches the given value.",
  8251. // "format": "int64",
  8252. // "location": "query",
  8253. // "type": "string"
  8254. // },
  8255. // "ifMetagenerationNotMatch": {
  8256. // "description": "Makes the operation conditional on whether the object's current metageneration does not match the given value.",
  8257. // "format": "int64",
  8258. // "location": "query",
  8259. // "type": "string"
  8260. // },
  8261. // "kmsKeyName": {
  8262. // "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. Limited availability; usable only by enabled projects.",
  8263. // "location": "query",
  8264. // "type": "string"
  8265. // },
  8266. // "name": {
  8267. // "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.",
  8268. // "location": "query",
  8269. // "type": "string"
  8270. // },
  8271. // "predefinedAcl": {
  8272. // "description": "Apply a predefined set of access controls to this object.",
  8273. // "enum": [
  8274. // "authenticatedRead",
  8275. // "bucketOwnerFullControl",
  8276. // "bucketOwnerRead",
  8277. // "private",
  8278. // "projectPrivate",
  8279. // "publicRead"
  8280. // ],
  8281. // "enumDescriptions": [
  8282. // "Object owner gets OWNER access, and allAuthenticatedUsers get READER access.",
  8283. // "Object owner gets OWNER access, and project team owners get OWNER access.",
  8284. // "Object owner gets OWNER access, and project team owners get READER access.",
  8285. // "Object owner gets OWNER access.",
  8286. // "Object owner gets OWNER access, and project team members get access according to their roles.",
  8287. // "Object owner gets OWNER access, and allUsers get READER access."
  8288. // ],
  8289. // "location": "query",
  8290. // "type": "string"
  8291. // },
  8292. // "projection": {
  8293. // "description": "Set of properties to return. Defaults to noAcl, unless the object resource specifies the acl property, when it defaults to full.",
  8294. // "enum": [
  8295. // "full",
  8296. // "noAcl"
  8297. // ],
  8298. // "enumDescriptions": [
  8299. // "Include all properties.",
  8300. // "Omit the owner, acl property."
  8301. // ],
  8302. // "location": "query",
  8303. // "type": "string"
  8304. // },
  8305. // "userProject": {
  8306. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  8307. // "location": "query",
  8308. // "type": "string"
  8309. // }
  8310. // },
  8311. // "path": "b/{bucket}/o",
  8312. // "request": {
  8313. // "$ref": "Object"
  8314. // },
  8315. // "response": {
  8316. // "$ref": "Object"
  8317. // },
  8318. // "scopes": [
  8319. // "https://www.googleapis.com/auth/cloud-platform",
  8320. // "https://www.googleapis.com/auth/devstorage.full_control",
  8321. // "https://www.googleapis.com/auth/devstorage.read_write"
  8322. // ],
  8323. // "supportsMediaUpload": true
  8324. // }
  8325. }
  8326. // method id "storage.objects.list":
  8327. type ObjectsListCall struct {
  8328. s *Service
  8329. bucket string
  8330. urlParams_ gensupport.URLParams
  8331. ifNoneMatch_ string
  8332. ctx_ context.Context
  8333. header_ http.Header
  8334. }
  8335. // List: Retrieves a list of objects matching the criteria.
  8336. func (r *ObjectsService) List(bucket string) *ObjectsListCall {
  8337. c := &ObjectsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  8338. c.bucket = bucket
  8339. return c
  8340. }
  8341. // Delimiter sets the optional parameter "delimiter": Returns results in
  8342. // a directory-like mode. items will contain only objects whose names,
  8343. // aside from the prefix, do not contain delimiter. Objects whose names,
  8344. // aside from the prefix, contain delimiter will have their name,
  8345. // truncated after the delimiter, returned in prefixes. Duplicate
  8346. // prefixes are omitted.
  8347. func (c *ObjectsListCall) Delimiter(delimiter string) *ObjectsListCall {
  8348. c.urlParams_.Set("delimiter", delimiter)
  8349. return c
  8350. }
  8351. // IncludeTrailingDelimiter sets the optional parameter
  8352. // "includeTrailingDelimiter": If true, objects that end in exactly one
  8353. // instance of delimiter will have their metadata included in items in
  8354. // addition to prefixes.
  8355. func (c *ObjectsListCall) IncludeTrailingDelimiter(includeTrailingDelimiter bool) *ObjectsListCall {
  8356. c.urlParams_.Set("includeTrailingDelimiter", fmt.Sprint(includeTrailingDelimiter))
  8357. return c
  8358. }
  8359. // MaxResults sets the optional parameter "maxResults": Maximum number
  8360. // of items plus prefixes to return in a single page of responses. As
  8361. // duplicate prefixes are omitted, fewer total results may be returned
  8362. // than requested. The service will use this parameter or 1,000 items,
  8363. // whichever is smaller.
  8364. func (c *ObjectsListCall) MaxResults(maxResults int64) *ObjectsListCall {
  8365. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  8366. return c
  8367. }
  8368. // PageToken sets the optional parameter "pageToken": A
  8369. // previously-returned page token representing part of the larger set of
  8370. // results to view.
  8371. func (c *ObjectsListCall) PageToken(pageToken string) *ObjectsListCall {
  8372. c.urlParams_.Set("pageToken", pageToken)
  8373. return c
  8374. }
  8375. // Prefix sets the optional parameter "prefix": Filter results to
  8376. // objects whose names begin with this prefix.
  8377. func (c *ObjectsListCall) Prefix(prefix string) *ObjectsListCall {
  8378. c.urlParams_.Set("prefix", prefix)
  8379. return c
  8380. }
  8381. // Projection sets the optional parameter "projection": Set of
  8382. // properties to return. Defaults to noAcl.
  8383. //
  8384. // Possible values:
  8385. // "full" - Include all properties.
  8386. // "noAcl" - Omit the owner, acl property.
  8387. func (c *ObjectsListCall) Projection(projection string) *ObjectsListCall {
  8388. c.urlParams_.Set("projection", projection)
  8389. return c
  8390. }
  8391. // UserProject sets the optional parameter "userProject": The project to
  8392. // be billed for this request. Required for Requester Pays buckets.
  8393. func (c *ObjectsListCall) UserProject(userProject string) *ObjectsListCall {
  8394. c.urlParams_.Set("userProject", userProject)
  8395. return c
  8396. }
  8397. // Versions sets the optional parameter "versions": If true, lists all
  8398. // versions of an object as distinct results. The default is false. For
  8399. // more information, see Object Versioning.
  8400. func (c *ObjectsListCall) Versions(versions bool) *ObjectsListCall {
  8401. c.urlParams_.Set("versions", fmt.Sprint(versions))
  8402. return c
  8403. }
  8404. // Fields allows partial responses to be retrieved. See
  8405. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  8406. // for more information.
  8407. func (c *ObjectsListCall) Fields(s ...googleapi.Field) *ObjectsListCall {
  8408. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  8409. return c
  8410. }
  8411. // IfNoneMatch sets the optional parameter which makes the operation
  8412. // fail if the object's ETag matches the given value. This is useful for
  8413. // getting updates only after the object has changed since the last
  8414. // request. Use googleapi.IsNotModified to check whether the response
  8415. // error from Do is the result of In-None-Match.
  8416. func (c *ObjectsListCall) IfNoneMatch(entityTag string) *ObjectsListCall {
  8417. c.ifNoneMatch_ = entityTag
  8418. return c
  8419. }
  8420. // Context sets the context to be used in this call's Do method. Any
  8421. // pending HTTP request will be aborted if the provided context is
  8422. // canceled.
  8423. func (c *ObjectsListCall) Context(ctx context.Context) *ObjectsListCall {
  8424. c.ctx_ = ctx
  8425. return c
  8426. }
  8427. // Header returns an http.Header that can be modified by the caller to
  8428. // add HTTP headers to the request.
  8429. func (c *ObjectsListCall) Header() http.Header {
  8430. if c.header_ == nil {
  8431. c.header_ = make(http.Header)
  8432. }
  8433. return c.header_
  8434. }
  8435. func (c *ObjectsListCall) doRequest(alt string) (*http.Response, error) {
  8436. reqHeaders := make(http.Header)
  8437. for k, v := range c.header_ {
  8438. reqHeaders[k] = v
  8439. }
  8440. reqHeaders.Set("User-Agent", c.s.userAgent())
  8441. if c.ifNoneMatch_ != "" {
  8442. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  8443. }
  8444. var body io.Reader = nil
  8445. c.urlParams_.Set("alt", alt)
  8446. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o")
  8447. urls += "?" + c.urlParams_.Encode()
  8448. req, _ := http.NewRequest("GET", urls, body)
  8449. req.Header = reqHeaders
  8450. googleapi.Expand(req.URL, map[string]string{
  8451. "bucket": c.bucket,
  8452. })
  8453. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  8454. }
  8455. // Do executes the "storage.objects.list" call.
  8456. // Exactly one of *Objects or error will be non-nil. Any non-2xx status
  8457. // code is an error. Response headers are in either
  8458. // *Objects.ServerResponse.Header or (if a response was returned at all)
  8459. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  8460. // check whether the returned error was because http.StatusNotModified
  8461. // was returned.
  8462. func (c *ObjectsListCall) Do(opts ...googleapi.CallOption) (*Objects, error) {
  8463. gensupport.SetOptions(c.urlParams_, opts...)
  8464. res, err := c.doRequest("json")
  8465. if res != nil && res.StatusCode == http.StatusNotModified {
  8466. if res.Body != nil {
  8467. res.Body.Close()
  8468. }
  8469. return nil, &googleapi.Error{
  8470. Code: res.StatusCode,
  8471. Header: res.Header,
  8472. }
  8473. }
  8474. if err != nil {
  8475. return nil, err
  8476. }
  8477. defer googleapi.CloseBody(res)
  8478. if err := googleapi.CheckResponse(res); err != nil {
  8479. return nil, err
  8480. }
  8481. ret := &Objects{
  8482. ServerResponse: googleapi.ServerResponse{
  8483. Header: res.Header,
  8484. HTTPStatusCode: res.StatusCode,
  8485. },
  8486. }
  8487. target := &ret
  8488. if err := gensupport.DecodeResponse(target, res); err != nil {
  8489. return nil, err
  8490. }
  8491. return ret, nil
  8492. // {
  8493. // "description": "Retrieves a list of objects matching the criteria.",
  8494. // "httpMethod": "GET",
  8495. // "id": "storage.objects.list",
  8496. // "parameterOrder": [
  8497. // "bucket"
  8498. // ],
  8499. // "parameters": {
  8500. // "bucket": {
  8501. // "description": "Name of the bucket in which to look for objects.",
  8502. // "location": "path",
  8503. // "required": true,
  8504. // "type": "string"
  8505. // },
  8506. // "delimiter": {
  8507. // "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.",
  8508. // "location": "query",
  8509. // "type": "string"
  8510. // },
  8511. // "includeTrailingDelimiter": {
  8512. // "description": "If true, objects that end in exactly one instance of delimiter will have their metadata included in items in addition to prefixes.",
  8513. // "location": "query",
  8514. // "type": "boolean"
  8515. // },
  8516. // "maxResults": {
  8517. // "default": "1000",
  8518. // "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.",
  8519. // "format": "uint32",
  8520. // "location": "query",
  8521. // "minimum": "0",
  8522. // "type": "integer"
  8523. // },
  8524. // "pageToken": {
  8525. // "description": "A previously-returned page token representing part of the larger set of results to view.",
  8526. // "location": "query",
  8527. // "type": "string"
  8528. // },
  8529. // "prefix": {
  8530. // "description": "Filter results to objects whose names begin with this prefix.",
  8531. // "location": "query",
  8532. // "type": "string"
  8533. // },
  8534. // "projection": {
  8535. // "description": "Set of properties to return. Defaults to noAcl.",
  8536. // "enum": [
  8537. // "full",
  8538. // "noAcl"
  8539. // ],
  8540. // "enumDescriptions": [
  8541. // "Include all properties.",
  8542. // "Omit the owner, acl property."
  8543. // ],
  8544. // "location": "query",
  8545. // "type": "string"
  8546. // },
  8547. // "userProject": {
  8548. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  8549. // "location": "query",
  8550. // "type": "string"
  8551. // },
  8552. // "versions": {
  8553. // "description": "If true, lists all versions of an object as distinct results. The default is false. For more information, see Object Versioning.",
  8554. // "location": "query",
  8555. // "type": "boolean"
  8556. // }
  8557. // },
  8558. // "path": "b/{bucket}/o",
  8559. // "response": {
  8560. // "$ref": "Objects"
  8561. // },
  8562. // "scopes": [
  8563. // "https://www.googleapis.com/auth/cloud-platform",
  8564. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  8565. // "https://www.googleapis.com/auth/devstorage.full_control",
  8566. // "https://www.googleapis.com/auth/devstorage.read_only",
  8567. // "https://www.googleapis.com/auth/devstorage.read_write"
  8568. // ],
  8569. // "supportsSubscription": true
  8570. // }
  8571. }
  8572. // Pages invokes f for each page of results.
  8573. // A non-nil error returned from f will halt the iteration.
  8574. // The provided context supersedes any context provided to the Context method.
  8575. func (c *ObjectsListCall) Pages(ctx context.Context, f func(*Objects) error) error {
  8576. c.ctx_ = ctx
  8577. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  8578. for {
  8579. x, err := c.Do()
  8580. if err != nil {
  8581. return err
  8582. }
  8583. if err := f(x); err != nil {
  8584. return err
  8585. }
  8586. if x.NextPageToken == "" {
  8587. return nil
  8588. }
  8589. c.PageToken(x.NextPageToken)
  8590. }
  8591. }
  8592. // method id "storage.objects.patch":
  8593. type ObjectsPatchCall struct {
  8594. s *Service
  8595. bucket string
  8596. object string
  8597. object2 *Object
  8598. urlParams_ gensupport.URLParams
  8599. ctx_ context.Context
  8600. header_ http.Header
  8601. }
  8602. // Patch: Patches an object's metadata.
  8603. func (r *ObjectsService) Patch(bucket string, object string, object2 *Object) *ObjectsPatchCall {
  8604. c := &ObjectsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  8605. c.bucket = bucket
  8606. c.object = object
  8607. c.object2 = object2
  8608. return c
  8609. }
  8610. // Generation sets the optional parameter "generation": If present,
  8611. // selects a specific revision of this object (as opposed to the latest
  8612. // version, the default).
  8613. func (c *ObjectsPatchCall) Generation(generation int64) *ObjectsPatchCall {
  8614. c.urlParams_.Set("generation", fmt.Sprint(generation))
  8615. return c
  8616. }
  8617. // IfGenerationMatch sets the optional parameter "ifGenerationMatch":
  8618. // Makes the operation conditional on whether the object's current
  8619. // generation matches the given value. Setting to 0 makes the operation
  8620. // succeed only if there are no live versions of the object.
  8621. func (c *ObjectsPatchCall) IfGenerationMatch(ifGenerationMatch int64) *ObjectsPatchCall {
  8622. c.urlParams_.Set("ifGenerationMatch", fmt.Sprint(ifGenerationMatch))
  8623. return c
  8624. }
  8625. // IfGenerationNotMatch sets the optional parameter
  8626. // "ifGenerationNotMatch": Makes the operation conditional on whether
  8627. // the object's current generation does not match the given value. If no
  8628. // live object exists, the precondition fails. Setting to 0 makes the
  8629. // operation succeed only if there is a live version of the object.
  8630. func (c *ObjectsPatchCall) IfGenerationNotMatch(ifGenerationNotMatch int64) *ObjectsPatchCall {
  8631. c.urlParams_.Set("ifGenerationNotMatch", fmt.Sprint(ifGenerationNotMatch))
  8632. return c
  8633. }
  8634. // IfMetagenerationMatch sets the optional parameter
  8635. // "ifMetagenerationMatch": Makes the operation conditional on whether
  8636. // the object's current metageneration matches the given value.
  8637. func (c *ObjectsPatchCall) IfMetagenerationMatch(ifMetagenerationMatch int64) *ObjectsPatchCall {
  8638. c.urlParams_.Set("ifMetagenerationMatch", fmt.Sprint(ifMetagenerationMatch))
  8639. return c
  8640. }
  8641. // IfMetagenerationNotMatch sets the optional parameter
  8642. // "ifMetagenerationNotMatch": Makes the operation conditional on
  8643. // whether the object's current metageneration does not match the given
  8644. // value.
  8645. func (c *ObjectsPatchCall) IfMetagenerationNotMatch(ifMetagenerationNotMatch int64) *ObjectsPatchCall {
  8646. c.urlParams_.Set("ifMetagenerationNotMatch", fmt.Sprint(ifMetagenerationNotMatch))
  8647. return c
  8648. }
  8649. // PredefinedAcl sets the optional parameter "predefinedAcl": Apply a
  8650. // predefined set of access controls to this object.
  8651. //
  8652. // Possible values:
  8653. // "authenticatedRead" - Object owner gets OWNER access, and
  8654. // allAuthenticatedUsers get READER access.
  8655. // "bucketOwnerFullControl" - Object owner gets OWNER access, and
  8656. // project team owners get OWNER access.
  8657. // "bucketOwnerRead" - Object owner gets OWNER access, and project
  8658. // team owners get READER access.
  8659. // "private" - Object owner gets OWNER access.
  8660. // "projectPrivate" - Object owner gets OWNER access, and project team
  8661. // members get access according to their roles.
  8662. // "publicRead" - Object owner gets OWNER access, and allUsers get
  8663. // READER access.
  8664. func (c *ObjectsPatchCall) PredefinedAcl(predefinedAcl string) *ObjectsPatchCall {
  8665. c.urlParams_.Set("predefinedAcl", predefinedAcl)
  8666. return c
  8667. }
  8668. // Projection sets the optional parameter "projection": Set of
  8669. // properties to return. Defaults to full.
  8670. //
  8671. // Possible values:
  8672. // "full" - Include all properties.
  8673. // "noAcl" - Omit the owner, acl property.
  8674. func (c *ObjectsPatchCall) Projection(projection string) *ObjectsPatchCall {
  8675. c.urlParams_.Set("projection", projection)
  8676. return c
  8677. }
  8678. // UserProject sets the optional parameter "userProject": The project to
  8679. // be billed for this request, for Requester Pays buckets.
  8680. func (c *ObjectsPatchCall) UserProject(userProject string) *ObjectsPatchCall {
  8681. c.urlParams_.Set("userProject", userProject)
  8682. return c
  8683. }
  8684. // Fields allows partial responses to be retrieved. See
  8685. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  8686. // for more information.
  8687. func (c *ObjectsPatchCall) Fields(s ...googleapi.Field) *ObjectsPatchCall {
  8688. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  8689. return c
  8690. }
  8691. // Context sets the context to be used in this call's Do method. Any
  8692. // pending HTTP request will be aborted if the provided context is
  8693. // canceled.
  8694. func (c *ObjectsPatchCall) Context(ctx context.Context) *ObjectsPatchCall {
  8695. c.ctx_ = ctx
  8696. return c
  8697. }
  8698. // Header returns an http.Header that can be modified by the caller to
  8699. // add HTTP headers to the request.
  8700. func (c *ObjectsPatchCall) Header() http.Header {
  8701. if c.header_ == nil {
  8702. c.header_ = make(http.Header)
  8703. }
  8704. return c.header_
  8705. }
  8706. func (c *ObjectsPatchCall) doRequest(alt string) (*http.Response, error) {
  8707. reqHeaders := make(http.Header)
  8708. for k, v := range c.header_ {
  8709. reqHeaders[k] = v
  8710. }
  8711. reqHeaders.Set("User-Agent", c.s.userAgent())
  8712. var body io.Reader = nil
  8713. body, err := googleapi.WithoutDataWrapper.JSONReader(c.object2)
  8714. if err != nil {
  8715. return nil, err
  8716. }
  8717. reqHeaders.Set("Content-Type", "application/json")
  8718. c.urlParams_.Set("alt", alt)
  8719. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o/{object}")
  8720. urls += "?" + c.urlParams_.Encode()
  8721. req, _ := http.NewRequest("PATCH", urls, body)
  8722. req.Header = reqHeaders
  8723. googleapi.Expand(req.URL, map[string]string{
  8724. "bucket": c.bucket,
  8725. "object": c.object,
  8726. })
  8727. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  8728. }
  8729. // Do executes the "storage.objects.patch" call.
  8730. // Exactly one of *Object or error will be non-nil. Any non-2xx status
  8731. // code is an error. Response headers are in either
  8732. // *Object.ServerResponse.Header or (if a response was returned at all)
  8733. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  8734. // check whether the returned error was because http.StatusNotModified
  8735. // was returned.
  8736. func (c *ObjectsPatchCall) Do(opts ...googleapi.CallOption) (*Object, error) {
  8737. gensupport.SetOptions(c.urlParams_, opts...)
  8738. res, err := c.doRequest("json")
  8739. if res != nil && res.StatusCode == http.StatusNotModified {
  8740. if res.Body != nil {
  8741. res.Body.Close()
  8742. }
  8743. return nil, &googleapi.Error{
  8744. Code: res.StatusCode,
  8745. Header: res.Header,
  8746. }
  8747. }
  8748. if err != nil {
  8749. return nil, err
  8750. }
  8751. defer googleapi.CloseBody(res)
  8752. if err := googleapi.CheckResponse(res); err != nil {
  8753. return nil, err
  8754. }
  8755. ret := &Object{
  8756. ServerResponse: googleapi.ServerResponse{
  8757. Header: res.Header,
  8758. HTTPStatusCode: res.StatusCode,
  8759. },
  8760. }
  8761. target := &ret
  8762. if err := gensupport.DecodeResponse(target, res); err != nil {
  8763. return nil, err
  8764. }
  8765. return ret, nil
  8766. // {
  8767. // "description": "Patches an object's metadata.",
  8768. // "httpMethod": "PATCH",
  8769. // "id": "storage.objects.patch",
  8770. // "parameterOrder": [
  8771. // "bucket",
  8772. // "object"
  8773. // ],
  8774. // "parameters": {
  8775. // "bucket": {
  8776. // "description": "Name of the bucket in which the object resides.",
  8777. // "location": "path",
  8778. // "required": true,
  8779. // "type": "string"
  8780. // },
  8781. // "generation": {
  8782. // "description": "If present, selects a specific revision of this object (as opposed to the latest version, the default).",
  8783. // "format": "int64",
  8784. // "location": "query",
  8785. // "type": "string"
  8786. // },
  8787. // "ifGenerationMatch": {
  8788. // "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.",
  8789. // "format": "int64",
  8790. // "location": "query",
  8791. // "type": "string"
  8792. // },
  8793. // "ifGenerationNotMatch": {
  8794. // "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.",
  8795. // "format": "int64",
  8796. // "location": "query",
  8797. // "type": "string"
  8798. // },
  8799. // "ifMetagenerationMatch": {
  8800. // "description": "Makes the operation conditional on whether the object's current metageneration matches the given value.",
  8801. // "format": "int64",
  8802. // "location": "query",
  8803. // "type": "string"
  8804. // },
  8805. // "ifMetagenerationNotMatch": {
  8806. // "description": "Makes the operation conditional on whether the object's current metageneration does not match the given value.",
  8807. // "format": "int64",
  8808. // "location": "query",
  8809. // "type": "string"
  8810. // },
  8811. // "object": {
  8812. // "description": "Name of the object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.",
  8813. // "location": "path",
  8814. // "required": true,
  8815. // "type": "string"
  8816. // },
  8817. // "predefinedAcl": {
  8818. // "description": "Apply a predefined set of access controls to this object.",
  8819. // "enum": [
  8820. // "authenticatedRead",
  8821. // "bucketOwnerFullControl",
  8822. // "bucketOwnerRead",
  8823. // "private",
  8824. // "projectPrivate",
  8825. // "publicRead"
  8826. // ],
  8827. // "enumDescriptions": [
  8828. // "Object owner gets OWNER access, and allAuthenticatedUsers get READER access.",
  8829. // "Object owner gets OWNER access, and project team owners get OWNER access.",
  8830. // "Object owner gets OWNER access, and project team owners get READER access.",
  8831. // "Object owner gets OWNER access.",
  8832. // "Object owner gets OWNER access, and project team members get access according to their roles.",
  8833. // "Object owner gets OWNER access, and allUsers get READER access."
  8834. // ],
  8835. // "location": "query",
  8836. // "type": "string"
  8837. // },
  8838. // "projection": {
  8839. // "description": "Set of properties to return. Defaults to full.",
  8840. // "enum": [
  8841. // "full",
  8842. // "noAcl"
  8843. // ],
  8844. // "enumDescriptions": [
  8845. // "Include all properties.",
  8846. // "Omit the owner, acl property."
  8847. // ],
  8848. // "location": "query",
  8849. // "type": "string"
  8850. // },
  8851. // "userProject": {
  8852. // "description": "The project to be billed for this request, for Requester Pays buckets.",
  8853. // "location": "query",
  8854. // "type": "string"
  8855. // }
  8856. // },
  8857. // "path": "b/{bucket}/o/{object}",
  8858. // "request": {
  8859. // "$ref": "Object"
  8860. // },
  8861. // "response": {
  8862. // "$ref": "Object"
  8863. // },
  8864. // "scopes": [
  8865. // "https://www.googleapis.com/auth/cloud-platform",
  8866. // "https://www.googleapis.com/auth/devstorage.full_control"
  8867. // ]
  8868. // }
  8869. }
  8870. // method id "storage.objects.rewrite":
  8871. type ObjectsRewriteCall struct {
  8872. s *Service
  8873. sourceBucket string
  8874. sourceObject string
  8875. destinationBucket string
  8876. destinationObject string
  8877. object *Object
  8878. urlParams_ gensupport.URLParams
  8879. ctx_ context.Context
  8880. header_ http.Header
  8881. }
  8882. // Rewrite: Rewrites a source object to a destination object. Optionally
  8883. // overrides metadata.
  8884. func (r *ObjectsService) Rewrite(sourceBucket string, sourceObject string, destinationBucket string, destinationObject string, object *Object) *ObjectsRewriteCall {
  8885. c := &ObjectsRewriteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  8886. c.sourceBucket = sourceBucket
  8887. c.sourceObject = sourceObject
  8888. c.destinationBucket = destinationBucket
  8889. c.destinationObject = destinationObject
  8890. c.object = object
  8891. return c
  8892. }
  8893. // DestinationKmsKeyName sets the optional parameter
  8894. // "destinationKmsKeyName": Resource name of the Cloud KMS key, of the
  8895. // form
  8896. // projects/my-project/locations/global/keyRings/my-kr/cryptoKeys/my-key,
  8897. // that will be used to encrypt the object. Overrides the object
  8898. // metadata's kms_key_name value, if any.
  8899. func (c *ObjectsRewriteCall) DestinationKmsKeyName(destinationKmsKeyName string) *ObjectsRewriteCall {
  8900. c.urlParams_.Set("destinationKmsKeyName", destinationKmsKeyName)
  8901. return c
  8902. }
  8903. // DestinationPredefinedAcl sets the optional parameter
  8904. // "destinationPredefinedAcl": Apply a predefined set of access controls
  8905. // to the destination object.
  8906. //
  8907. // Possible values:
  8908. // "authenticatedRead" - Object owner gets OWNER access, and
  8909. // allAuthenticatedUsers get READER access.
  8910. // "bucketOwnerFullControl" - Object owner gets OWNER access, and
  8911. // project team owners get OWNER access.
  8912. // "bucketOwnerRead" - Object owner gets OWNER access, and project
  8913. // team owners get READER access.
  8914. // "private" - Object owner gets OWNER access.
  8915. // "projectPrivate" - Object owner gets OWNER access, and project team
  8916. // members get access according to their roles.
  8917. // "publicRead" - Object owner gets OWNER access, and allUsers get
  8918. // READER access.
  8919. func (c *ObjectsRewriteCall) DestinationPredefinedAcl(destinationPredefinedAcl string) *ObjectsRewriteCall {
  8920. c.urlParams_.Set("destinationPredefinedAcl", destinationPredefinedAcl)
  8921. return c
  8922. }
  8923. // IfGenerationMatch sets the optional parameter "ifGenerationMatch":
  8924. // Makes the operation conditional on whether the object's current
  8925. // generation matches the given value. Setting to 0 makes the operation
  8926. // succeed only if there are no live versions of the object.
  8927. func (c *ObjectsRewriteCall) IfGenerationMatch(ifGenerationMatch int64) *ObjectsRewriteCall {
  8928. c.urlParams_.Set("ifGenerationMatch", fmt.Sprint(ifGenerationMatch))
  8929. return c
  8930. }
  8931. // IfGenerationNotMatch sets the optional parameter
  8932. // "ifGenerationNotMatch": Makes the operation conditional on whether
  8933. // the object's current generation does not match the given value. If no
  8934. // live object exists, the precondition fails. Setting to 0 makes the
  8935. // operation succeed only if there is a live version of the object.
  8936. func (c *ObjectsRewriteCall) IfGenerationNotMatch(ifGenerationNotMatch int64) *ObjectsRewriteCall {
  8937. c.urlParams_.Set("ifGenerationNotMatch", fmt.Sprint(ifGenerationNotMatch))
  8938. return c
  8939. }
  8940. // IfMetagenerationMatch sets the optional parameter
  8941. // "ifMetagenerationMatch": Makes the operation conditional on whether
  8942. // the destination object's current metageneration matches the given
  8943. // value.
  8944. func (c *ObjectsRewriteCall) IfMetagenerationMatch(ifMetagenerationMatch int64) *ObjectsRewriteCall {
  8945. c.urlParams_.Set("ifMetagenerationMatch", fmt.Sprint(ifMetagenerationMatch))
  8946. return c
  8947. }
  8948. // IfMetagenerationNotMatch sets the optional parameter
  8949. // "ifMetagenerationNotMatch": Makes the operation conditional on
  8950. // whether the destination object's current metageneration does not
  8951. // match the given value.
  8952. func (c *ObjectsRewriteCall) IfMetagenerationNotMatch(ifMetagenerationNotMatch int64) *ObjectsRewriteCall {
  8953. c.urlParams_.Set("ifMetagenerationNotMatch", fmt.Sprint(ifMetagenerationNotMatch))
  8954. return c
  8955. }
  8956. // IfSourceGenerationMatch sets the optional parameter
  8957. // "ifSourceGenerationMatch": Makes the operation conditional on whether
  8958. // the source object's current generation matches the given value.
  8959. func (c *ObjectsRewriteCall) IfSourceGenerationMatch(ifSourceGenerationMatch int64) *ObjectsRewriteCall {
  8960. c.urlParams_.Set("ifSourceGenerationMatch", fmt.Sprint(ifSourceGenerationMatch))
  8961. return c
  8962. }
  8963. // IfSourceGenerationNotMatch sets the optional parameter
  8964. // "ifSourceGenerationNotMatch": Makes the operation conditional on
  8965. // whether the source object's current generation does not match the
  8966. // given value.
  8967. func (c *ObjectsRewriteCall) IfSourceGenerationNotMatch(ifSourceGenerationNotMatch int64) *ObjectsRewriteCall {
  8968. c.urlParams_.Set("ifSourceGenerationNotMatch", fmt.Sprint(ifSourceGenerationNotMatch))
  8969. return c
  8970. }
  8971. // IfSourceMetagenerationMatch sets the optional parameter
  8972. // "ifSourceMetagenerationMatch": Makes the operation conditional on
  8973. // whether the source object's current metageneration matches the given
  8974. // value.
  8975. func (c *ObjectsRewriteCall) IfSourceMetagenerationMatch(ifSourceMetagenerationMatch int64) *ObjectsRewriteCall {
  8976. c.urlParams_.Set("ifSourceMetagenerationMatch", fmt.Sprint(ifSourceMetagenerationMatch))
  8977. return c
  8978. }
  8979. // IfSourceMetagenerationNotMatch sets the optional parameter
  8980. // "ifSourceMetagenerationNotMatch": Makes the operation conditional on
  8981. // whether the source object's current metageneration does not match the
  8982. // given value.
  8983. func (c *ObjectsRewriteCall) IfSourceMetagenerationNotMatch(ifSourceMetagenerationNotMatch int64) *ObjectsRewriteCall {
  8984. c.urlParams_.Set("ifSourceMetagenerationNotMatch", fmt.Sprint(ifSourceMetagenerationNotMatch))
  8985. return c
  8986. }
  8987. // MaxBytesRewrittenPerCall sets the optional parameter
  8988. // "maxBytesRewrittenPerCall": The maximum number of bytes that will be
  8989. // rewritten per rewrite request. Most callers shouldn't need to specify
  8990. // this parameter - it is primarily in place to support testing. If
  8991. // specified the value must be an integral multiple of 1 MiB (1048576).
  8992. // Also, this only applies to requests where the source and destination
  8993. // span locations and/or storage classes. Finally, this value must not
  8994. // change across rewrite calls else you'll get an error that the
  8995. // rewriteToken is invalid.
  8996. func (c *ObjectsRewriteCall) MaxBytesRewrittenPerCall(maxBytesRewrittenPerCall int64) *ObjectsRewriteCall {
  8997. c.urlParams_.Set("maxBytesRewrittenPerCall", fmt.Sprint(maxBytesRewrittenPerCall))
  8998. return c
  8999. }
  9000. // Projection sets the optional parameter "projection": Set of
  9001. // properties to return. Defaults to noAcl, unless the object resource
  9002. // specifies the acl property, when it defaults to full.
  9003. //
  9004. // Possible values:
  9005. // "full" - Include all properties.
  9006. // "noAcl" - Omit the owner, acl property.
  9007. func (c *ObjectsRewriteCall) Projection(projection string) *ObjectsRewriteCall {
  9008. c.urlParams_.Set("projection", projection)
  9009. return c
  9010. }
  9011. // RewriteToken sets the optional parameter "rewriteToken": Include this
  9012. // field (from the previous rewrite response) on each rewrite request
  9013. // after the first one, until the rewrite response 'done' flag is true.
  9014. // Calls that provide a rewriteToken can omit all other request fields,
  9015. // but if included those fields must match the values provided in the
  9016. // first rewrite request.
  9017. func (c *ObjectsRewriteCall) RewriteToken(rewriteToken string) *ObjectsRewriteCall {
  9018. c.urlParams_.Set("rewriteToken", rewriteToken)
  9019. return c
  9020. }
  9021. // SourceGeneration sets the optional parameter "sourceGeneration": If
  9022. // present, selects a specific revision of the source object (as opposed
  9023. // to the latest version, the default).
  9024. func (c *ObjectsRewriteCall) SourceGeneration(sourceGeneration int64) *ObjectsRewriteCall {
  9025. c.urlParams_.Set("sourceGeneration", fmt.Sprint(sourceGeneration))
  9026. return c
  9027. }
  9028. // UserProject sets the optional parameter "userProject": The project to
  9029. // be billed for this request. Required for Requester Pays buckets.
  9030. func (c *ObjectsRewriteCall) UserProject(userProject string) *ObjectsRewriteCall {
  9031. c.urlParams_.Set("userProject", userProject)
  9032. return c
  9033. }
  9034. // Fields allows partial responses to be retrieved. See
  9035. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  9036. // for more information.
  9037. func (c *ObjectsRewriteCall) Fields(s ...googleapi.Field) *ObjectsRewriteCall {
  9038. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  9039. return c
  9040. }
  9041. // Context sets the context to be used in this call's Do method. Any
  9042. // pending HTTP request will be aborted if the provided context is
  9043. // canceled.
  9044. func (c *ObjectsRewriteCall) Context(ctx context.Context) *ObjectsRewriteCall {
  9045. c.ctx_ = ctx
  9046. return c
  9047. }
  9048. // Header returns an http.Header that can be modified by the caller to
  9049. // add HTTP headers to the request.
  9050. func (c *ObjectsRewriteCall) Header() http.Header {
  9051. if c.header_ == nil {
  9052. c.header_ = make(http.Header)
  9053. }
  9054. return c.header_
  9055. }
  9056. func (c *ObjectsRewriteCall) doRequest(alt string) (*http.Response, error) {
  9057. reqHeaders := make(http.Header)
  9058. for k, v := range c.header_ {
  9059. reqHeaders[k] = v
  9060. }
  9061. reqHeaders.Set("User-Agent", c.s.userAgent())
  9062. var body io.Reader = nil
  9063. body, err := googleapi.WithoutDataWrapper.JSONReader(c.object)
  9064. if err != nil {
  9065. return nil, err
  9066. }
  9067. reqHeaders.Set("Content-Type", "application/json")
  9068. c.urlParams_.Set("alt", alt)
  9069. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{sourceBucket}/o/{sourceObject}/rewriteTo/b/{destinationBucket}/o/{destinationObject}")
  9070. urls += "?" + c.urlParams_.Encode()
  9071. req, _ := http.NewRequest("POST", urls, body)
  9072. req.Header = reqHeaders
  9073. googleapi.Expand(req.URL, map[string]string{
  9074. "sourceBucket": c.sourceBucket,
  9075. "sourceObject": c.sourceObject,
  9076. "destinationBucket": c.destinationBucket,
  9077. "destinationObject": c.destinationObject,
  9078. })
  9079. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  9080. }
  9081. // Do executes the "storage.objects.rewrite" call.
  9082. // Exactly one of *RewriteResponse or error will be non-nil. Any non-2xx
  9083. // status code is an error. Response headers are in either
  9084. // *RewriteResponse.ServerResponse.Header or (if a response was returned
  9085. // at all) in error.(*googleapi.Error).Header. Use
  9086. // googleapi.IsNotModified to check whether the returned error was
  9087. // because http.StatusNotModified was returned.
  9088. func (c *ObjectsRewriteCall) Do(opts ...googleapi.CallOption) (*RewriteResponse, error) {
  9089. gensupport.SetOptions(c.urlParams_, opts...)
  9090. res, err := c.doRequest("json")
  9091. if res != nil && res.StatusCode == http.StatusNotModified {
  9092. if res.Body != nil {
  9093. res.Body.Close()
  9094. }
  9095. return nil, &googleapi.Error{
  9096. Code: res.StatusCode,
  9097. Header: res.Header,
  9098. }
  9099. }
  9100. if err != nil {
  9101. return nil, err
  9102. }
  9103. defer googleapi.CloseBody(res)
  9104. if err := googleapi.CheckResponse(res); err != nil {
  9105. return nil, err
  9106. }
  9107. ret := &RewriteResponse{
  9108. ServerResponse: googleapi.ServerResponse{
  9109. Header: res.Header,
  9110. HTTPStatusCode: res.StatusCode,
  9111. },
  9112. }
  9113. target := &ret
  9114. if err := gensupport.DecodeResponse(target, res); err != nil {
  9115. return nil, err
  9116. }
  9117. return ret, nil
  9118. // {
  9119. // "description": "Rewrites a source object to a destination object. Optionally overrides metadata.",
  9120. // "httpMethod": "POST",
  9121. // "id": "storage.objects.rewrite",
  9122. // "parameterOrder": [
  9123. // "sourceBucket",
  9124. // "sourceObject",
  9125. // "destinationBucket",
  9126. // "destinationObject"
  9127. // ],
  9128. // "parameters": {
  9129. // "destinationBucket": {
  9130. // "description": "Name of the bucket in which to store the new object. Overrides the provided object metadata's bucket value, if any.",
  9131. // "location": "path",
  9132. // "required": true,
  9133. // "type": "string"
  9134. // },
  9135. // "destinationKmsKeyName": {
  9136. // "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.",
  9137. // "location": "query",
  9138. // "type": "string"
  9139. // },
  9140. // "destinationObject": {
  9141. // "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.",
  9142. // "location": "path",
  9143. // "required": true,
  9144. // "type": "string"
  9145. // },
  9146. // "destinationPredefinedAcl": {
  9147. // "description": "Apply a predefined set of access controls to the destination object.",
  9148. // "enum": [
  9149. // "authenticatedRead",
  9150. // "bucketOwnerFullControl",
  9151. // "bucketOwnerRead",
  9152. // "private",
  9153. // "projectPrivate",
  9154. // "publicRead"
  9155. // ],
  9156. // "enumDescriptions": [
  9157. // "Object owner gets OWNER access, and allAuthenticatedUsers get READER access.",
  9158. // "Object owner gets OWNER access, and project team owners get OWNER access.",
  9159. // "Object owner gets OWNER access, and project team owners get READER access.",
  9160. // "Object owner gets OWNER access.",
  9161. // "Object owner gets OWNER access, and project team members get access according to their roles.",
  9162. // "Object owner gets OWNER access, and allUsers get READER access."
  9163. // ],
  9164. // "location": "query",
  9165. // "type": "string"
  9166. // },
  9167. // "ifGenerationMatch": {
  9168. // "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.",
  9169. // "format": "int64",
  9170. // "location": "query",
  9171. // "type": "string"
  9172. // },
  9173. // "ifGenerationNotMatch": {
  9174. // "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.",
  9175. // "format": "int64",
  9176. // "location": "query",
  9177. // "type": "string"
  9178. // },
  9179. // "ifMetagenerationMatch": {
  9180. // "description": "Makes the operation conditional on whether the destination object's current metageneration matches the given value.",
  9181. // "format": "int64",
  9182. // "location": "query",
  9183. // "type": "string"
  9184. // },
  9185. // "ifMetagenerationNotMatch": {
  9186. // "description": "Makes the operation conditional on whether the destination object's current metageneration does not match the given value.",
  9187. // "format": "int64",
  9188. // "location": "query",
  9189. // "type": "string"
  9190. // },
  9191. // "ifSourceGenerationMatch": {
  9192. // "description": "Makes the operation conditional on whether the source object's current generation matches the given value.",
  9193. // "format": "int64",
  9194. // "location": "query",
  9195. // "type": "string"
  9196. // },
  9197. // "ifSourceGenerationNotMatch": {
  9198. // "description": "Makes the operation conditional on whether the source object's current generation does not match the given value.",
  9199. // "format": "int64",
  9200. // "location": "query",
  9201. // "type": "string"
  9202. // },
  9203. // "ifSourceMetagenerationMatch": {
  9204. // "description": "Makes the operation conditional on whether the source object's current metageneration matches the given value.",
  9205. // "format": "int64",
  9206. // "location": "query",
  9207. // "type": "string"
  9208. // },
  9209. // "ifSourceMetagenerationNotMatch": {
  9210. // "description": "Makes the operation conditional on whether the source object's current metageneration does not match the given value.",
  9211. // "format": "int64",
  9212. // "location": "query",
  9213. // "type": "string"
  9214. // },
  9215. // "maxBytesRewrittenPerCall": {
  9216. // "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.",
  9217. // "format": "int64",
  9218. // "location": "query",
  9219. // "type": "string"
  9220. // },
  9221. // "projection": {
  9222. // "description": "Set of properties to return. Defaults to noAcl, unless the object resource specifies the acl property, when it defaults to full.",
  9223. // "enum": [
  9224. // "full",
  9225. // "noAcl"
  9226. // ],
  9227. // "enumDescriptions": [
  9228. // "Include all properties.",
  9229. // "Omit the owner, acl property."
  9230. // ],
  9231. // "location": "query",
  9232. // "type": "string"
  9233. // },
  9234. // "rewriteToken": {
  9235. // "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.",
  9236. // "location": "query",
  9237. // "type": "string"
  9238. // },
  9239. // "sourceBucket": {
  9240. // "description": "Name of the bucket in which to find the source object.",
  9241. // "location": "path",
  9242. // "required": true,
  9243. // "type": "string"
  9244. // },
  9245. // "sourceGeneration": {
  9246. // "description": "If present, selects a specific revision of the source object (as opposed to the latest version, the default).",
  9247. // "format": "int64",
  9248. // "location": "query",
  9249. // "type": "string"
  9250. // },
  9251. // "sourceObject": {
  9252. // "description": "Name of the source object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.",
  9253. // "location": "path",
  9254. // "required": true,
  9255. // "type": "string"
  9256. // },
  9257. // "userProject": {
  9258. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  9259. // "location": "query",
  9260. // "type": "string"
  9261. // }
  9262. // },
  9263. // "path": "b/{sourceBucket}/o/{sourceObject}/rewriteTo/b/{destinationBucket}/o/{destinationObject}",
  9264. // "request": {
  9265. // "$ref": "Object"
  9266. // },
  9267. // "response": {
  9268. // "$ref": "RewriteResponse"
  9269. // },
  9270. // "scopes": [
  9271. // "https://www.googleapis.com/auth/cloud-platform",
  9272. // "https://www.googleapis.com/auth/devstorage.full_control",
  9273. // "https://www.googleapis.com/auth/devstorage.read_write"
  9274. // ]
  9275. // }
  9276. }
  9277. // method id "storage.objects.setIamPolicy":
  9278. type ObjectsSetIamPolicyCall struct {
  9279. s *Service
  9280. bucket string
  9281. object string
  9282. policy *Policy
  9283. urlParams_ gensupport.URLParams
  9284. ctx_ context.Context
  9285. header_ http.Header
  9286. }
  9287. // SetIamPolicy: Updates an IAM policy for the specified object.
  9288. func (r *ObjectsService) SetIamPolicy(bucket string, object string, policy *Policy) *ObjectsSetIamPolicyCall {
  9289. c := &ObjectsSetIamPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  9290. c.bucket = bucket
  9291. c.object = object
  9292. c.policy = policy
  9293. return c
  9294. }
  9295. // Generation sets the optional parameter "generation": If present,
  9296. // selects a specific revision of this object (as opposed to the latest
  9297. // version, the default).
  9298. func (c *ObjectsSetIamPolicyCall) Generation(generation int64) *ObjectsSetIamPolicyCall {
  9299. c.urlParams_.Set("generation", fmt.Sprint(generation))
  9300. return c
  9301. }
  9302. // UserProject sets the optional parameter "userProject": The project to
  9303. // be billed for this request. Required for Requester Pays buckets.
  9304. func (c *ObjectsSetIamPolicyCall) UserProject(userProject string) *ObjectsSetIamPolicyCall {
  9305. c.urlParams_.Set("userProject", userProject)
  9306. return c
  9307. }
  9308. // Fields allows partial responses to be retrieved. See
  9309. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  9310. // for more information.
  9311. func (c *ObjectsSetIamPolicyCall) Fields(s ...googleapi.Field) *ObjectsSetIamPolicyCall {
  9312. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  9313. return c
  9314. }
  9315. // Context sets the context to be used in this call's Do method. Any
  9316. // pending HTTP request will be aborted if the provided context is
  9317. // canceled.
  9318. func (c *ObjectsSetIamPolicyCall) Context(ctx context.Context) *ObjectsSetIamPolicyCall {
  9319. c.ctx_ = ctx
  9320. return c
  9321. }
  9322. // Header returns an http.Header that can be modified by the caller to
  9323. // add HTTP headers to the request.
  9324. func (c *ObjectsSetIamPolicyCall) Header() http.Header {
  9325. if c.header_ == nil {
  9326. c.header_ = make(http.Header)
  9327. }
  9328. return c.header_
  9329. }
  9330. func (c *ObjectsSetIamPolicyCall) doRequest(alt string) (*http.Response, error) {
  9331. reqHeaders := make(http.Header)
  9332. for k, v := range c.header_ {
  9333. reqHeaders[k] = v
  9334. }
  9335. reqHeaders.Set("User-Agent", c.s.userAgent())
  9336. var body io.Reader = nil
  9337. body, err := googleapi.WithoutDataWrapper.JSONReader(c.policy)
  9338. if err != nil {
  9339. return nil, err
  9340. }
  9341. reqHeaders.Set("Content-Type", "application/json")
  9342. c.urlParams_.Set("alt", alt)
  9343. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o/{object}/iam")
  9344. urls += "?" + c.urlParams_.Encode()
  9345. req, _ := http.NewRequest("PUT", urls, body)
  9346. req.Header = reqHeaders
  9347. googleapi.Expand(req.URL, map[string]string{
  9348. "bucket": c.bucket,
  9349. "object": c.object,
  9350. })
  9351. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  9352. }
  9353. // Do executes the "storage.objects.setIamPolicy" call.
  9354. // Exactly one of *Policy or error will be non-nil. Any non-2xx status
  9355. // code is an error. Response headers are in either
  9356. // *Policy.ServerResponse.Header or (if a response was returned at all)
  9357. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  9358. // check whether the returned error was because http.StatusNotModified
  9359. // was returned.
  9360. func (c *ObjectsSetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Policy, error) {
  9361. gensupport.SetOptions(c.urlParams_, opts...)
  9362. res, err := c.doRequest("json")
  9363. if res != nil && res.StatusCode == http.StatusNotModified {
  9364. if res.Body != nil {
  9365. res.Body.Close()
  9366. }
  9367. return nil, &googleapi.Error{
  9368. Code: res.StatusCode,
  9369. Header: res.Header,
  9370. }
  9371. }
  9372. if err != nil {
  9373. return nil, err
  9374. }
  9375. defer googleapi.CloseBody(res)
  9376. if err := googleapi.CheckResponse(res); err != nil {
  9377. return nil, err
  9378. }
  9379. ret := &Policy{
  9380. ServerResponse: googleapi.ServerResponse{
  9381. Header: res.Header,
  9382. HTTPStatusCode: res.StatusCode,
  9383. },
  9384. }
  9385. target := &ret
  9386. if err := gensupport.DecodeResponse(target, res); err != nil {
  9387. return nil, err
  9388. }
  9389. return ret, nil
  9390. // {
  9391. // "description": "Updates an IAM policy for the specified object.",
  9392. // "httpMethod": "PUT",
  9393. // "id": "storage.objects.setIamPolicy",
  9394. // "parameterOrder": [
  9395. // "bucket",
  9396. // "object"
  9397. // ],
  9398. // "parameters": {
  9399. // "bucket": {
  9400. // "description": "Name of the bucket in which the object resides.",
  9401. // "location": "path",
  9402. // "required": true,
  9403. // "type": "string"
  9404. // },
  9405. // "generation": {
  9406. // "description": "If present, selects a specific revision of this object (as opposed to the latest version, the default).",
  9407. // "format": "int64",
  9408. // "location": "query",
  9409. // "type": "string"
  9410. // },
  9411. // "object": {
  9412. // "description": "Name of the object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.",
  9413. // "location": "path",
  9414. // "required": true,
  9415. // "type": "string"
  9416. // },
  9417. // "userProject": {
  9418. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  9419. // "location": "query",
  9420. // "type": "string"
  9421. // }
  9422. // },
  9423. // "path": "b/{bucket}/o/{object}/iam",
  9424. // "request": {
  9425. // "$ref": "Policy"
  9426. // },
  9427. // "response": {
  9428. // "$ref": "Policy"
  9429. // },
  9430. // "scopes": [
  9431. // "https://www.googleapis.com/auth/cloud-platform",
  9432. // "https://www.googleapis.com/auth/devstorage.full_control",
  9433. // "https://www.googleapis.com/auth/devstorage.read_write"
  9434. // ]
  9435. // }
  9436. }
  9437. // method id "storage.objects.testIamPermissions":
  9438. type ObjectsTestIamPermissionsCall struct {
  9439. s *Service
  9440. bucket string
  9441. object string
  9442. urlParams_ gensupport.URLParams
  9443. ifNoneMatch_ string
  9444. ctx_ context.Context
  9445. header_ http.Header
  9446. }
  9447. // TestIamPermissions: Tests a set of permissions on the given object to
  9448. // see which, if any, are held by the caller.
  9449. func (r *ObjectsService) TestIamPermissions(bucket string, object string, permissions []string) *ObjectsTestIamPermissionsCall {
  9450. c := &ObjectsTestIamPermissionsCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  9451. c.bucket = bucket
  9452. c.object = object
  9453. c.urlParams_.SetMulti("permissions", append([]string{}, permissions...))
  9454. return c
  9455. }
  9456. // Generation sets the optional parameter "generation": If present,
  9457. // selects a specific revision of this object (as opposed to the latest
  9458. // version, the default).
  9459. func (c *ObjectsTestIamPermissionsCall) Generation(generation int64) *ObjectsTestIamPermissionsCall {
  9460. c.urlParams_.Set("generation", fmt.Sprint(generation))
  9461. return c
  9462. }
  9463. // UserProject sets the optional parameter "userProject": The project to
  9464. // be billed for this request. Required for Requester Pays buckets.
  9465. func (c *ObjectsTestIamPermissionsCall) UserProject(userProject string) *ObjectsTestIamPermissionsCall {
  9466. c.urlParams_.Set("userProject", userProject)
  9467. return c
  9468. }
  9469. // Fields allows partial responses to be retrieved. See
  9470. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  9471. // for more information.
  9472. func (c *ObjectsTestIamPermissionsCall) Fields(s ...googleapi.Field) *ObjectsTestIamPermissionsCall {
  9473. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  9474. return c
  9475. }
  9476. // IfNoneMatch sets the optional parameter which makes the operation
  9477. // fail if the object's ETag matches the given value. This is useful for
  9478. // getting updates only after the object has changed since the last
  9479. // request. Use googleapi.IsNotModified to check whether the response
  9480. // error from Do is the result of In-None-Match.
  9481. func (c *ObjectsTestIamPermissionsCall) IfNoneMatch(entityTag string) *ObjectsTestIamPermissionsCall {
  9482. c.ifNoneMatch_ = entityTag
  9483. return c
  9484. }
  9485. // Context sets the context to be used in this call's Do method. Any
  9486. // pending HTTP request will be aborted if the provided context is
  9487. // canceled.
  9488. func (c *ObjectsTestIamPermissionsCall) Context(ctx context.Context) *ObjectsTestIamPermissionsCall {
  9489. c.ctx_ = ctx
  9490. return c
  9491. }
  9492. // Header returns an http.Header that can be modified by the caller to
  9493. // add HTTP headers to the request.
  9494. func (c *ObjectsTestIamPermissionsCall) Header() http.Header {
  9495. if c.header_ == nil {
  9496. c.header_ = make(http.Header)
  9497. }
  9498. return c.header_
  9499. }
  9500. func (c *ObjectsTestIamPermissionsCall) doRequest(alt string) (*http.Response, error) {
  9501. reqHeaders := make(http.Header)
  9502. for k, v := range c.header_ {
  9503. reqHeaders[k] = v
  9504. }
  9505. reqHeaders.Set("User-Agent", c.s.userAgent())
  9506. if c.ifNoneMatch_ != "" {
  9507. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  9508. }
  9509. var body io.Reader = nil
  9510. c.urlParams_.Set("alt", alt)
  9511. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o/{object}/iam/testPermissions")
  9512. urls += "?" + c.urlParams_.Encode()
  9513. req, _ := http.NewRequest("GET", urls, body)
  9514. req.Header = reqHeaders
  9515. googleapi.Expand(req.URL, map[string]string{
  9516. "bucket": c.bucket,
  9517. "object": c.object,
  9518. })
  9519. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  9520. }
  9521. // Do executes the "storage.objects.testIamPermissions" call.
  9522. // Exactly one of *TestIamPermissionsResponse or error will be non-nil.
  9523. // Any non-2xx status code is an error. Response headers are in either
  9524. // *TestIamPermissionsResponse.ServerResponse.Header or (if a response
  9525. // was returned at all) in error.(*googleapi.Error).Header. Use
  9526. // googleapi.IsNotModified to check whether the returned error was
  9527. // because http.StatusNotModified was returned.
  9528. func (c *ObjectsTestIamPermissionsCall) Do(opts ...googleapi.CallOption) (*TestIamPermissionsResponse, error) {
  9529. gensupport.SetOptions(c.urlParams_, opts...)
  9530. res, err := c.doRequest("json")
  9531. if res != nil && res.StatusCode == http.StatusNotModified {
  9532. if res.Body != nil {
  9533. res.Body.Close()
  9534. }
  9535. return nil, &googleapi.Error{
  9536. Code: res.StatusCode,
  9537. Header: res.Header,
  9538. }
  9539. }
  9540. if err != nil {
  9541. return nil, err
  9542. }
  9543. defer googleapi.CloseBody(res)
  9544. if err := googleapi.CheckResponse(res); err != nil {
  9545. return nil, err
  9546. }
  9547. ret := &TestIamPermissionsResponse{
  9548. ServerResponse: googleapi.ServerResponse{
  9549. Header: res.Header,
  9550. HTTPStatusCode: res.StatusCode,
  9551. },
  9552. }
  9553. target := &ret
  9554. if err := gensupport.DecodeResponse(target, res); err != nil {
  9555. return nil, err
  9556. }
  9557. return ret, nil
  9558. // {
  9559. // "description": "Tests a set of permissions on the given object to see which, if any, are held by the caller.",
  9560. // "httpMethod": "GET",
  9561. // "id": "storage.objects.testIamPermissions",
  9562. // "parameterOrder": [
  9563. // "bucket",
  9564. // "object",
  9565. // "permissions"
  9566. // ],
  9567. // "parameters": {
  9568. // "bucket": {
  9569. // "description": "Name of the bucket in which the object resides.",
  9570. // "location": "path",
  9571. // "required": true,
  9572. // "type": "string"
  9573. // },
  9574. // "generation": {
  9575. // "description": "If present, selects a specific revision of this object (as opposed to the latest version, the default).",
  9576. // "format": "int64",
  9577. // "location": "query",
  9578. // "type": "string"
  9579. // },
  9580. // "object": {
  9581. // "description": "Name of the object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.",
  9582. // "location": "path",
  9583. // "required": true,
  9584. // "type": "string"
  9585. // },
  9586. // "permissions": {
  9587. // "description": "Permissions to test.",
  9588. // "location": "query",
  9589. // "repeated": true,
  9590. // "required": true,
  9591. // "type": "string"
  9592. // },
  9593. // "userProject": {
  9594. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  9595. // "location": "query",
  9596. // "type": "string"
  9597. // }
  9598. // },
  9599. // "path": "b/{bucket}/o/{object}/iam/testPermissions",
  9600. // "response": {
  9601. // "$ref": "TestIamPermissionsResponse"
  9602. // },
  9603. // "scopes": [
  9604. // "https://www.googleapis.com/auth/cloud-platform",
  9605. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  9606. // "https://www.googleapis.com/auth/devstorage.full_control",
  9607. // "https://www.googleapis.com/auth/devstorage.read_only",
  9608. // "https://www.googleapis.com/auth/devstorage.read_write"
  9609. // ]
  9610. // }
  9611. }
  9612. // method id "storage.objects.update":
  9613. type ObjectsUpdateCall struct {
  9614. s *Service
  9615. bucket string
  9616. object string
  9617. object2 *Object
  9618. urlParams_ gensupport.URLParams
  9619. ctx_ context.Context
  9620. header_ http.Header
  9621. }
  9622. // Update: Updates an object's metadata.
  9623. func (r *ObjectsService) Update(bucket string, object string, object2 *Object) *ObjectsUpdateCall {
  9624. c := &ObjectsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  9625. c.bucket = bucket
  9626. c.object = object
  9627. c.object2 = object2
  9628. return c
  9629. }
  9630. // Generation sets the optional parameter "generation": If present,
  9631. // selects a specific revision of this object (as opposed to the latest
  9632. // version, the default).
  9633. func (c *ObjectsUpdateCall) Generation(generation int64) *ObjectsUpdateCall {
  9634. c.urlParams_.Set("generation", fmt.Sprint(generation))
  9635. return c
  9636. }
  9637. // IfGenerationMatch sets the optional parameter "ifGenerationMatch":
  9638. // Makes the operation conditional on whether the object's current
  9639. // generation matches the given value. Setting to 0 makes the operation
  9640. // succeed only if there are no live versions of the object.
  9641. func (c *ObjectsUpdateCall) IfGenerationMatch(ifGenerationMatch int64) *ObjectsUpdateCall {
  9642. c.urlParams_.Set("ifGenerationMatch", fmt.Sprint(ifGenerationMatch))
  9643. return c
  9644. }
  9645. // IfGenerationNotMatch sets the optional parameter
  9646. // "ifGenerationNotMatch": Makes the operation conditional on whether
  9647. // the object's current generation does not match the given value. If no
  9648. // live object exists, the precondition fails. Setting to 0 makes the
  9649. // operation succeed only if there is a live version of the object.
  9650. func (c *ObjectsUpdateCall) IfGenerationNotMatch(ifGenerationNotMatch int64) *ObjectsUpdateCall {
  9651. c.urlParams_.Set("ifGenerationNotMatch", fmt.Sprint(ifGenerationNotMatch))
  9652. return c
  9653. }
  9654. // IfMetagenerationMatch sets the optional parameter
  9655. // "ifMetagenerationMatch": Makes the operation conditional on whether
  9656. // the object's current metageneration matches the given value.
  9657. func (c *ObjectsUpdateCall) IfMetagenerationMatch(ifMetagenerationMatch int64) *ObjectsUpdateCall {
  9658. c.urlParams_.Set("ifMetagenerationMatch", fmt.Sprint(ifMetagenerationMatch))
  9659. return c
  9660. }
  9661. // IfMetagenerationNotMatch sets the optional parameter
  9662. // "ifMetagenerationNotMatch": Makes the operation conditional on
  9663. // whether the object's current metageneration does not match the given
  9664. // value.
  9665. func (c *ObjectsUpdateCall) IfMetagenerationNotMatch(ifMetagenerationNotMatch int64) *ObjectsUpdateCall {
  9666. c.urlParams_.Set("ifMetagenerationNotMatch", fmt.Sprint(ifMetagenerationNotMatch))
  9667. return c
  9668. }
  9669. // PredefinedAcl sets the optional parameter "predefinedAcl": Apply a
  9670. // predefined set of access controls to this object.
  9671. //
  9672. // Possible values:
  9673. // "authenticatedRead" - Object owner gets OWNER access, and
  9674. // allAuthenticatedUsers get READER access.
  9675. // "bucketOwnerFullControl" - Object owner gets OWNER access, and
  9676. // project team owners get OWNER access.
  9677. // "bucketOwnerRead" - Object owner gets OWNER access, and project
  9678. // team owners get READER access.
  9679. // "private" - Object owner gets OWNER access.
  9680. // "projectPrivate" - Object owner gets OWNER access, and project team
  9681. // members get access according to their roles.
  9682. // "publicRead" - Object owner gets OWNER access, and allUsers get
  9683. // READER access.
  9684. func (c *ObjectsUpdateCall) PredefinedAcl(predefinedAcl string) *ObjectsUpdateCall {
  9685. c.urlParams_.Set("predefinedAcl", predefinedAcl)
  9686. return c
  9687. }
  9688. // Projection sets the optional parameter "projection": Set of
  9689. // properties to return. Defaults to full.
  9690. //
  9691. // Possible values:
  9692. // "full" - Include all properties.
  9693. // "noAcl" - Omit the owner, acl property.
  9694. func (c *ObjectsUpdateCall) Projection(projection string) *ObjectsUpdateCall {
  9695. c.urlParams_.Set("projection", projection)
  9696. return c
  9697. }
  9698. // UserProject sets the optional parameter "userProject": The project to
  9699. // be billed for this request. Required for Requester Pays buckets.
  9700. func (c *ObjectsUpdateCall) UserProject(userProject string) *ObjectsUpdateCall {
  9701. c.urlParams_.Set("userProject", userProject)
  9702. return c
  9703. }
  9704. // Fields allows partial responses to be retrieved. See
  9705. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  9706. // for more information.
  9707. func (c *ObjectsUpdateCall) Fields(s ...googleapi.Field) *ObjectsUpdateCall {
  9708. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  9709. return c
  9710. }
  9711. // Context sets the context to be used in this call's Do method. Any
  9712. // pending HTTP request will be aborted if the provided context is
  9713. // canceled.
  9714. func (c *ObjectsUpdateCall) Context(ctx context.Context) *ObjectsUpdateCall {
  9715. c.ctx_ = ctx
  9716. return c
  9717. }
  9718. // Header returns an http.Header that can be modified by the caller to
  9719. // add HTTP headers to the request.
  9720. func (c *ObjectsUpdateCall) Header() http.Header {
  9721. if c.header_ == nil {
  9722. c.header_ = make(http.Header)
  9723. }
  9724. return c.header_
  9725. }
  9726. func (c *ObjectsUpdateCall) doRequest(alt string) (*http.Response, error) {
  9727. reqHeaders := make(http.Header)
  9728. for k, v := range c.header_ {
  9729. reqHeaders[k] = v
  9730. }
  9731. reqHeaders.Set("User-Agent", c.s.userAgent())
  9732. var body io.Reader = nil
  9733. body, err := googleapi.WithoutDataWrapper.JSONReader(c.object2)
  9734. if err != nil {
  9735. return nil, err
  9736. }
  9737. reqHeaders.Set("Content-Type", "application/json")
  9738. c.urlParams_.Set("alt", alt)
  9739. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o/{object}")
  9740. urls += "?" + c.urlParams_.Encode()
  9741. req, _ := http.NewRequest("PUT", urls, body)
  9742. req.Header = reqHeaders
  9743. googleapi.Expand(req.URL, map[string]string{
  9744. "bucket": c.bucket,
  9745. "object": c.object,
  9746. })
  9747. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  9748. }
  9749. // Do executes the "storage.objects.update" call.
  9750. // Exactly one of *Object or error will be non-nil. Any non-2xx status
  9751. // code is an error. Response headers are in either
  9752. // *Object.ServerResponse.Header or (if a response was returned at all)
  9753. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  9754. // check whether the returned error was because http.StatusNotModified
  9755. // was returned.
  9756. func (c *ObjectsUpdateCall) Do(opts ...googleapi.CallOption) (*Object, error) {
  9757. gensupport.SetOptions(c.urlParams_, opts...)
  9758. res, err := c.doRequest("json")
  9759. if res != nil && res.StatusCode == http.StatusNotModified {
  9760. if res.Body != nil {
  9761. res.Body.Close()
  9762. }
  9763. return nil, &googleapi.Error{
  9764. Code: res.StatusCode,
  9765. Header: res.Header,
  9766. }
  9767. }
  9768. if err != nil {
  9769. return nil, err
  9770. }
  9771. defer googleapi.CloseBody(res)
  9772. if err := googleapi.CheckResponse(res); err != nil {
  9773. return nil, err
  9774. }
  9775. ret := &Object{
  9776. ServerResponse: googleapi.ServerResponse{
  9777. Header: res.Header,
  9778. HTTPStatusCode: res.StatusCode,
  9779. },
  9780. }
  9781. target := &ret
  9782. if err := gensupport.DecodeResponse(target, res); err != nil {
  9783. return nil, err
  9784. }
  9785. return ret, nil
  9786. // {
  9787. // "description": "Updates an object's metadata.",
  9788. // "httpMethod": "PUT",
  9789. // "id": "storage.objects.update",
  9790. // "parameterOrder": [
  9791. // "bucket",
  9792. // "object"
  9793. // ],
  9794. // "parameters": {
  9795. // "bucket": {
  9796. // "description": "Name of the bucket in which the object resides.",
  9797. // "location": "path",
  9798. // "required": true,
  9799. // "type": "string"
  9800. // },
  9801. // "generation": {
  9802. // "description": "If present, selects a specific revision of this object (as opposed to the latest version, the default).",
  9803. // "format": "int64",
  9804. // "location": "query",
  9805. // "type": "string"
  9806. // },
  9807. // "ifGenerationMatch": {
  9808. // "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.",
  9809. // "format": "int64",
  9810. // "location": "query",
  9811. // "type": "string"
  9812. // },
  9813. // "ifGenerationNotMatch": {
  9814. // "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.",
  9815. // "format": "int64",
  9816. // "location": "query",
  9817. // "type": "string"
  9818. // },
  9819. // "ifMetagenerationMatch": {
  9820. // "description": "Makes the operation conditional on whether the object's current metageneration matches the given value.",
  9821. // "format": "int64",
  9822. // "location": "query",
  9823. // "type": "string"
  9824. // },
  9825. // "ifMetagenerationNotMatch": {
  9826. // "description": "Makes the operation conditional on whether the object's current metageneration does not match the given value.",
  9827. // "format": "int64",
  9828. // "location": "query",
  9829. // "type": "string"
  9830. // },
  9831. // "object": {
  9832. // "description": "Name of the object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.",
  9833. // "location": "path",
  9834. // "required": true,
  9835. // "type": "string"
  9836. // },
  9837. // "predefinedAcl": {
  9838. // "description": "Apply a predefined set of access controls to this object.",
  9839. // "enum": [
  9840. // "authenticatedRead",
  9841. // "bucketOwnerFullControl",
  9842. // "bucketOwnerRead",
  9843. // "private",
  9844. // "projectPrivate",
  9845. // "publicRead"
  9846. // ],
  9847. // "enumDescriptions": [
  9848. // "Object owner gets OWNER access, and allAuthenticatedUsers get READER access.",
  9849. // "Object owner gets OWNER access, and project team owners get OWNER access.",
  9850. // "Object owner gets OWNER access, and project team owners get READER access.",
  9851. // "Object owner gets OWNER access.",
  9852. // "Object owner gets OWNER access, and project team members get access according to their roles.",
  9853. // "Object owner gets OWNER access, and allUsers get READER access."
  9854. // ],
  9855. // "location": "query",
  9856. // "type": "string"
  9857. // },
  9858. // "projection": {
  9859. // "description": "Set of properties to return. Defaults to full.",
  9860. // "enum": [
  9861. // "full",
  9862. // "noAcl"
  9863. // ],
  9864. // "enumDescriptions": [
  9865. // "Include all properties.",
  9866. // "Omit the owner, acl property."
  9867. // ],
  9868. // "location": "query",
  9869. // "type": "string"
  9870. // },
  9871. // "userProject": {
  9872. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  9873. // "location": "query",
  9874. // "type": "string"
  9875. // }
  9876. // },
  9877. // "path": "b/{bucket}/o/{object}",
  9878. // "request": {
  9879. // "$ref": "Object"
  9880. // },
  9881. // "response": {
  9882. // "$ref": "Object"
  9883. // },
  9884. // "scopes": [
  9885. // "https://www.googleapis.com/auth/cloud-platform",
  9886. // "https://www.googleapis.com/auth/devstorage.full_control"
  9887. // ]
  9888. // }
  9889. }
  9890. // method id "storage.objects.watchAll":
  9891. type ObjectsWatchAllCall struct {
  9892. s *Service
  9893. bucket string
  9894. channel *Channel
  9895. urlParams_ gensupport.URLParams
  9896. ctx_ context.Context
  9897. header_ http.Header
  9898. }
  9899. // WatchAll: Watch for changes on all objects in a bucket.
  9900. func (r *ObjectsService) WatchAll(bucket string, channel *Channel) *ObjectsWatchAllCall {
  9901. c := &ObjectsWatchAllCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  9902. c.bucket = bucket
  9903. c.channel = channel
  9904. return c
  9905. }
  9906. // Delimiter sets the optional parameter "delimiter": Returns results in
  9907. // a directory-like mode. items will contain only objects whose names,
  9908. // aside from the prefix, do not contain delimiter. Objects whose names,
  9909. // aside from the prefix, contain delimiter will have their name,
  9910. // truncated after the delimiter, returned in prefixes. Duplicate
  9911. // prefixes are omitted.
  9912. func (c *ObjectsWatchAllCall) Delimiter(delimiter string) *ObjectsWatchAllCall {
  9913. c.urlParams_.Set("delimiter", delimiter)
  9914. return c
  9915. }
  9916. // IncludeTrailingDelimiter sets the optional parameter
  9917. // "includeTrailingDelimiter": If true, objects that end in exactly one
  9918. // instance of delimiter will have their metadata included in items in
  9919. // addition to prefixes.
  9920. func (c *ObjectsWatchAllCall) IncludeTrailingDelimiter(includeTrailingDelimiter bool) *ObjectsWatchAllCall {
  9921. c.urlParams_.Set("includeTrailingDelimiter", fmt.Sprint(includeTrailingDelimiter))
  9922. return c
  9923. }
  9924. // MaxResults sets the optional parameter "maxResults": Maximum number
  9925. // of items plus prefixes to return in a single page of responses. As
  9926. // duplicate prefixes are omitted, fewer total results may be returned
  9927. // than requested. The service will use this parameter or 1,000 items,
  9928. // whichever is smaller.
  9929. func (c *ObjectsWatchAllCall) MaxResults(maxResults int64) *ObjectsWatchAllCall {
  9930. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  9931. return c
  9932. }
  9933. // PageToken sets the optional parameter "pageToken": A
  9934. // previously-returned page token representing part of the larger set of
  9935. // results to view.
  9936. func (c *ObjectsWatchAllCall) PageToken(pageToken string) *ObjectsWatchAllCall {
  9937. c.urlParams_.Set("pageToken", pageToken)
  9938. return c
  9939. }
  9940. // Prefix sets the optional parameter "prefix": Filter results to
  9941. // objects whose names begin with this prefix.
  9942. func (c *ObjectsWatchAllCall) Prefix(prefix string) *ObjectsWatchAllCall {
  9943. c.urlParams_.Set("prefix", prefix)
  9944. return c
  9945. }
  9946. // Projection sets the optional parameter "projection": Set of
  9947. // properties to return. Defaults to noAcl.
  9948. //
  9949. // Possible values:
  9950. // "full" - Include all properties.
  9951. // "noAcl" - Omit the owner, acl property.
  9952. func (c *ObjectsWatchAllCall) Projection(projection string) *ObjectsWatchAllCall {
  9953. c.urlParams_.Set("projection", projection)
  9954. return c
  9955. }
  9956. // UserProject sets the optional parameter "userProject": The project to
  9957. // be billed for this request. Required for Requester Pays buckets.
  9958. func (c *ObjectsWatchAllCall) UserProject(userProject string) *ObjectsWatchAllCall {
  9959. c.urlParams_.Set("userProject", userProject)
  9960. return c
  9961. }
  9962. // Versions sets the optional parameter "versions": If true, lists all
  9963. // versions of an object as distinct results. The default is false. For
  9964. // more information, see Object Versioning.
  9965. func (c *ObjectsWatchAllCall) Versions(versions bool) *ObjectsWatchAllCall {
  9966. c.urlParams_.Set("versions", fmt.Sprint(versions))
  9967. return c
  9968. }
  9969. // Fields allows partial responses to be retrieved. See
  9970. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  9971. // for more information.
  9972. func (c *ObjectsWatchAllCall) Fields(s ...googleapi.Field) *ObjectsWatchAllCall {
  9973. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  9974. return c
  9975. }
  9976. // Context sets the context to be used in this call's Do method. Any
  9977. // pending HTTP request will be aborted if the provided context is
  9978. // canceled.
  9979. func (c *ObjectsWatchAllCall) Context(ctx context.Context) *ObjectsWatchAllCall {
  9980. c.ctx_ = ctx
  9981. return c
  9982. }
  9983. // Header returns an http.Header that can be modified by the caller to
  9984. // add HTTP headers to the request.
  9985. func (c *ObjectsWatchAllCall) Header() http.Header {
  9986. if c.header_ == nil {
  9987. c.header_ = make(http.Header)
  9988. }
  9989. return c.header_
  9990. }
  9991. func (c *ObjectsWatchAllCall) doRequest(alt string) (*http.Response, error) {
  9992. reqHeaders := make(http.Header)
  9993. for k, v := range c.header_ {
  9994. reqHeaders[k] = v
  9995. }
  9996. reqHeaders.Set("User-Agent", c.s.userAgent())
  9997. var body io.Reader = nil
  9998. body, err := googleapi.WithoutDataWrapper.JSONReader(c.channel)
  9999. if err != nil {
  10000. return nil, err
  10001. }
  10002. reqHeaders.Set("Content-Type", "application/json")
  10003. c.urlParams_.Set("alt", alt)
  10004. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o/watch")
  10005. urls += "?" + c.urlParams_.Encode()
  10006. req, _ := http.NewRequest("POST", urls, body)
  10007. req.Header = reqHeaders
  10008. googleapi.Expand(req.URL, map[string]string{
  10009. "bucket": c.bucket,
  10010. })
  10011. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  10012. }
  10013. // Do executes the "storage.objects.watchAll" call.
  10014. // Exactly one of *Channel or error will be non-nil. Any non-2xx status
  10015. // code is an error. Response headers are in either
  10016. // *Channel.ServerResponse.Header or (if a response was returned at all)
  10017. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  10018. // check whether the returned error was because http.StatusNotModified
  10019. // was returned.
  10020. func (c *ObjectsWatchAllCall) Do(opts ...googleapi.CallOption) (*Channel, error) {
  10021. gensupport.SetOptions(c.urlParams_, opts...)
  10022. res, err := c.doRequest("json")
  10023. if res != nil && res.StatusCode == http.StatusNotModified {
  10024. if res.Body != nil {
  10025. res.Body.Close()
  10026. }
  10027. return nil, &googleapi.Error{
  10028. Code: res.StatusCode,
  10029. Header: res.Header,
  10030. }
  10031. }
  10032. if err != nil {
  10033. return nil, err
  10034. }
  10035. defer googleapi.CloseBody(res)
  10036. if err := googleapi.CheckResponse(res); err != nil {
  10037. return nil, err
  10038. }
  10039. ret := &Channel{
  10040. ServerResponse: googleapi.ServerResponse{
  10041. Header: res.Header,
  10042. HTTPStatusCode: res.StatusCode,
  10043. },
  10044. }
  10045. target := &ret
  10046. if err := gensupport.DecodeResponse(target, res); err != nil {
  10047. return nil, err
  10048. }
  10049. return ret, nil
  10050. // {
  10051. // "description": "Watch for changes on all objects in a bucket.",
  10052. // "httpMethod": "POST",
  10053. // "id": "storage.objects.watchAll",
  10054. // "parameterOrder": [
  10055. // "bucket"
  10056. // ],
  10057. // "parameters": {
  10058. // "bucket": {
  10059. // "description": "Name of the bucket in which to look for objects.",
  10060. // "location": "path",
  10061. // "required": true,
  10062. // "type": "string"
  10063. // },
  10064. // "delimiter": {
  10065. // "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.",
  10066. // "location": "query",
  10067. // "type": "string"
  10068. // },
  10069. // "includeTrailingDelimiter": {
  10070. // "description": "If true, objects that end in exactly one instance of delimiter will have their metadata included in items in addition to prefixes.",
  10071. // "location": "query",
  10072. // "type": "boolean"
  10073. // },
  10074. // "maxResults": {
  10075. // "default": "1000",
  10076. // "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.",
  10077. // "format": "uint32",
  10078. // "location": "query",
  10079. // "minimum": "0",
  10080. // "type": "integer"
  10081. // },
  10082. // "pageToken": {
  10083. // "description": "A previously-returned page token representing part of the larger set of results to view.",
  10084. // "location": "query",
  10085. // "type": "string"
  10086. // },
  10087. // "prefix": {
  10088. // "description": "Filter results to objects whose names begin with this prefix.",
  10089. // "location": "query",
  10090. // "type": "string"
  10091. // },
  10092. // "projection": {
  10093. // "description": "Set of properties to return. Defaults to noAcl.",
  10094. // "enum": [
  10095. // "full",
  10096. // "noAcl"
  10097. // ],
  10098. // "enumDescriptions": [
  10099. // "Include all properties.",
  10100. // "Omit the owner, acl property."
  10101. // ],
  10102. // "location": "query",
  10103. // "type": "string"
  10104. // },
  10105. // "userProject": {
  10106. // "description": "The project to be billed for this request. Required for Requester Pays buckets.",
  10107. // "location": "query",
  10108. // "type": "string"
  10109. // },
  10110. // "versions": {
  10111. // "description": "If true, lists all versions of an object as distinct results. The default is false. For more information, see Object Versioning.",
  10112. // "location": "query",
  10113. // "type": "boolean"
  10114. // }
  10115. // },
  10116. // "path": "b/{bucket}/o/watch",
  10117. // "request": {
  10118. // "$ref": "Channel",
  10119. // "parameterName": "resource"
  10120. // },
  10121. // "response": {
  10122. // "$ref": "Channel"
  10123. // },
  10124. // "scopes": [
  10125. // "https://www.googleapis.com/auth/cloud-platform",
  10126. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  10127. // "https://www.googleapis.com/auth/devstorage.full_control",
  10128. // "https://www.googleapis.com/auth/devstorage.read_only",
  10129. // "https://www.googleapis.com/auth/devstorage.read_write"
  10130. // ],
  10131. // "supportsSubscription": true
  10132. // }
  10133. }
  10134. // method id "storage.projects.serviceAccount.get":
  10135. type ProjectsServiceAccountGetCall struct {
  10136. s *Service
  10137. projectId string
  10138. urlParams_ gensupport.URLParams
  10139. ifNoneMatch_ string
  10140. ctx_ context.Context
  10141. header_ http.Header
  10142. }
  10143. // Get: Get the email address of this project's Google Cloud Storage
  10144. // service account.
  10145. func (r *ProjectsServiceAccountService) Get(projectId string) *ProjectsServiceAccountGetCall {
  10146. c := &ProjectsServiceAccountGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  10147. c.projectId = projectId
  10148. return c
  10149. }
  10150. // UserProject sets the optional parameter "userProject": The project to
  10151. // be billed for this request.
  10152. func (c *ProjectsServiceAccountGetCall) UserProject(userProject string) *ProjectsServiceAccountGetCall {
  10153. c.urlParams_.Set("userProject", userProject)
  10154. return c
  10155. }
  10156. // Fields allows partial responses to be retrieved. See
  10157. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  10158. // for more information.
  10159. func (c *ProjectsServiceAccountGetCall) Fields(s ...googleapi.Field) *ProjectsServiceAccountGetCall {
  10160. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  10161. return c
  10162. }
  10163. // IfNoneMatch sets the optional parameter which makes the operation
  10164. // fail if the object's ETag matches the given value. This is useful for
  10165. // getting updates only after the object has changed since the last
  10166. // request. Use googleapi.IsNotModified to check whether the response
  10167. // error from Do is the result of In-None-Match.
  10168. func (c *ProjectsServiceAccountGetCall) IfNoneMatch(entityTag string) *ProjectsServiceAccountGetCall {
  10169. c.ifNoneMatch_ = entityTag
  10170. return c
  10171. }
  10172. // Context sets the context to be used in this call's Do method. Any
  10173. // pending HTTP request will be aborted if the provided context is
  10174. // canceled.
  10175. func (c *ProjectsServiceAccountGetCall) Context(ctx context.Context) *ProjectsServiceAccountGetCall {
  10176. c.ctx_ = ctx
  10177. return c
  10178. }
  10179. // Header returns an http.Header that can be modified by the caller to
  10180. // add HTTP headers to the request.
  10181. func (c *ProjectsServiceAccountGetCall) Header() http.Header {
  10182. if c.header_ == nil {
  10183. c.header_ = make(http.Header)
  10184. }
  10185. return c.header_
  10186. }
  10187. func (c *ProjectsServiceAccountGetCall) doRequest(alt string) (*http.Response, error) {
  10188. reqHeaders := make(http.Header)
  10189. for k, v := range c.header_ {
  10190. reqHeaders[k] = v
  10191. }
  10192. reqHeaders.Set("User-Agent", c.s.userAgent())
  10193. if c.ifNoneMatch_ != "" {
  10194. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  10195. }
  10196. var body io.Reader = nil
  10197. c.urlParams_.Set("alt", alt)
  10198. urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{projectId}/serviceAccount")
  10199. urls += "?" + c.urlParams_.Encode()
  10200. req, _ := http.NewRequest("GET", urls, body)
  10201. req.Header = reqHeaders
  10202. googleapi.Expand(req.URL, map[string]string{
  10203. "projectId": c.projectId,
  10204. })
  10205. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  10206. }
  10207. // Do executes the "storage.projects.serviceAccount.get" call.
  10208. // Exactly one of *ServiceAccount or error will be non-nil. Any non-2xx
  10209. // status code is an error. Response headers are in either
  10210. // *ServiceAccount.ServerResponse.Header or (if a response was returned
  10211. // at all) in error.(*googleapi.Error).Header. Use
  10212. // googleapi.IsNotModified to check whether the returned error was
  10213. // because http.StatusNotModified was returned.
  10214. func (c *ProjectsServiceAccountGetCall) Do(opts ...googleapi.CallOption) (*ServiceAccount, error) {
  10215. gensupport.SetOptions(c.urlParams_, opts...)
  10216. res, err := c.doRequest("json")
  10217. if res != nil && res.StatusCode == http.StatusNotModified {
  10218. if res.Body != nil {
  10219. res.Body.Close()
  10220. }
  10221. return nil, &googleapi.Error{
  10222. Code: res.StatusCode,
  10223. Header: res.Header,
  10224. }
  10225. }
  10226. if err != nil {
  10227. return nil, err
  10228. }
  10229. defer googleapi.CloseBody(res)
  10230. if err := googleapi.CheckResponse(res); err != nil {
  10231. return nil, err
  10232. }
  10233. ret := &ServiceAccount{
  10234. ServerResponse: googleapi.ServerResponse{
  10235. Header: res.Header,
  10236. HTTPStatusCode: res.StatusCode,
  10237. },
  10238. }
  10239. target := &ret
  10240. if err := gensupport.DecodeResponse(target, res); err != nil {
  10241. return nil, err
  10242. }
  10243. return ret, nil
  10244. // {
  10245. // "description": "Get the email address of this project's Google Cloud Storage service account.",
  10246. // "httpMethod": "GET",
  10247. // "id": "storage.projects.serviceAccount.get",
  10248. // "parameterOrder": [
  10249. // "projectId"
  10250. // ],
  10251. // "parameters": {
  10252. // "projectId": {
  10253. // "description": "Project ID",
  10254. // "location": "path",
  10255. // "required": true,
  10256. // "type": "string"
  10257. // },
  10258. // "userProject": {
  10259. // "description": "The project to be billed for this request.",
  10260. // "location": "query",
  10261. // "type": "string"
  10262. // }
  10263. // },
  10264. // "path": "projects/{projectId}/serviceAccount",
  10265. // "response": {
  10266. // "$ref": "ServiceAccount"
  10267. // },
  10268. // "scopes": [
  10269. // "https://www.googleapis.com/auth/cloud-platform",
  10270. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  10271. // "https://www.googleapis.com/auth/devstorage.full_control",
  10272. // "https://www.googleapis.com/auth/devstorage.read_only",
  10273. // "https://www.googleapis.com/auth/devstorage.read_write"
  10274. // ]
  10275. // }
  10276. }