Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.
 
 
 

4634 rader
144 KiB

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