Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.
 
 
 

4475 rindas
140 KiB

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