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

7394 regels
245 KiB

  1. // Copyright 2019 Google LLC.
  2. // Use of this source code is governed by a BSD-style
  3. // license that can be found in the LICENSE file.
  4. // Code generated file. DO NOT EDIT.
  5. // Package storage provides access to the Cloud Storage JSON API.
  6. //
  7. // This package is DEPRECATED. Use package cloud.google.com/go/storage instead.
  8. //
  9. // For product documentation, see: https://developers.google.com/storage/docs/json_api/
  10. //
  11. // Creating a client
  12. //
  13. // Usage example:
  14. //
  15. // import "google.golang.org/api/storage/v1beta2"
  16. // ...
  17. // ctx := context.Background()
  18. // storageService, err := storage.NewService(ctx)
  19. //
  20. // In this example, Google Application Default Credentials are used for authentication.
  21. //
  22. // For information on how to create and obtain Application Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials.
  23. //
  24. // Other authentication options
  25. //
  26. // By default, all available scopes (see "Constants") are used to authenticate. To restrict scopes, use option.WithScopes:
  27. //
  28. // storageService, err := storage.NewService(ctx, option.WithScopes(storage.DevstorageReadWriteScope))
  29. //
  30. // To use an API key for authentication (note: some APIs do not support API keys), use option.WithAPIKey:
  31. //
  32. // storageService, err := storage.NewService(ctx, option.WithAPIKey("AIza..."))
  33. //
  34. // To use an OAuth token (e.g., a user token obtained via a three-legged OAuth flow), use option.WithTokenSource:
  35. //
  36. // config := &oauth2.Config{...}
  37. // // ...
  38. // token, err := config.Exchange(ctx, ...)
  39. // storageService, err := storage.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token)))
  40. //
  41. // See https://godoc.org/google.golang.org/api/option/ for details on options.
  42. package storage // import "google.golang.org/api/storage/v1beta2"
  43. import (
  44. "bytes"
  45. "context"
  46. "encoding/json"
  47. "errors"
  48. "fmt"
  49. "io"
  50. "net/http"
  51. "net/url"
  52. "strconv"
  53. "strings"
  54. gensupport "google.golang.org/api/gensupport"
  55. googleapi "google.golang.org/api/googleapi"
  56. option "google.golang.org/api/option"
  57. htransport "google.golang.org/api/transport/http"
  58. )
  59. // Always reference these packages, just in case the auto-generated code
  60. // below doesn't.
  61. var _ = bytes.NewBuffer
  62. var _ = strconv.Itoa
  63. var _ = fmt.Sprintf
  64. var _ = json.NewDecoder
  65. var _ = io.Copy
  66. var _ = url.Parse
  67. var _ = gensupport.MarshalJSON
  68. var _ = googleapi.Version
  69. var _ = errors.New
  70. var _ = strings.Replace
  71. var _ = context.Canceled
  72. const apiId = "storage:v1beta2"
  73. const apiName = "storage"
  74. const apiVersion = "v1beta2"
  75. const basePath = "https://www.googleapis.com/storage/v1beta2/"
  76. // OAuth2 scopes used by this API.
  77. const (
  78. // Manage your data and permissions in Google Cloud Storage
  79. DevstorageFullControlScope = "https://www.googleapis.com/auth/devstorage.full_control"
  80. // View your data in Google Cloud Storage
  81. DevstorageReadOnlyScope = "https://www.googleapis.com/auth/devstorage.read_only"
  82. // Manage your data in Google Cloud Storage
  83. DevstorageReadWriteScope = "https://www.googleapis.com/auth/devstorage.read_write"
  84. )
  85. // NewService creates a new Service.
  86. func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {
  87. scopesOption := option.WithScopes(
  88. "https://www.googleapis.com/auth/devstorage.full_control",
  89. "https://www.googleapis.com/auth/devstorage.read_only",
  90. "https://www.googleapis.com/auth/devstorage.read_write",
  91. )
  92. // NOTE: prepend, so we don't override user-specified scopes.
  93. opts = append([]option.ClientOption{scopesOption}, opts...)
  94. client, endpoint, err := htransport.NewClient(ctx, opts...)
  95. if err != nil {
  96. return nil, err
  97. }
  98. s, err := New(client)
  99. if err != nil {
  100. return nil, err
  101. }
  102. if endpoint != "" {
  103. s.BasePath = endpoint
  104. }
  105. return s, nil
  106. }
  107. // New creates a new Service. It uses the provided http.Client for requests.
  108. //
  109. // Deprecated: please use NewService instead.
  110. // To provide a custom HTTP client, use option.WithHTTPClient.
  111. // If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead.
  112. func New(client *http.Client) (*Service, error) {
  113. if client == nil {
  114. return nil, errors.New("client is nil")
  115. }
  116. s := &Service{client: client, BasePath: basePath}
  117. s.BucketAccessControls = NewBucketAccessControlsService(s)
  118. s.Buckets = NewBucketsService(s)
  119. s.Channels = NewChannelsService(s)
  120. s.DefaultObjectAccessControls = NewDefaultObjectAccessControlsService(s)
  121. s.ObjectAccessControls = NewObjectAccessControlsService(s)
  122. s.Objects = NewObjectsService(s)
  123. return s, nil
  124. }
  125. type Service struct {
  126. client *http.Client
  127. BasePath string // API endpoint base URL
  128. UserAgent string // optional additional User-Agent fragment
  129. BucketAccessControls *BucketAccessControlsService
  130. Buckets *BucketsService
  131. Channels *ChannelsService
  132. DefaultObjectAccessControls *DefaultObjectAccessControlsService
  133. ObjectAccessControls *ObjectAccessControlsService
  134. Objects *ObjectsService
  135. }
  136. func (s *Service) userAgent() string {
  137. if s.UserAgent == "" {
  138. return googleapi.UserAgent
  139. }
  140. return googleapi.UserAgent + " " + s.UserAgent
  141. }
  142. func NewBucketAccessControlsService(s *Service) *BucketAccessControlsService {
  143. rs := &BucketAccessControlsService{s: s}
  144. return rs
  145. }
  146. type BucketAccessControlsService struct {
  147. s *Service
  148. }
  149. func NewBucketsService(s *Service) *BucketsService {
  150. rs := &BucketsService{s: s}
  151. return rs
  152. }
  153. type BucketsService struct {
  154. s *Service
  155. }
  156. func NewChannelsService(s *Service) *ChannelsService {
  157. rs := &ChannelsService{s: s}
  158. return rs
  159. }
  160. type ChannelsService struct {
  161. s *Service
  162. }
  163. func NewDefaultObjectAccessControlsService(s *Service) *DefaultObjectAccessControlsService {
  164. rs := &DefaultObjectAccessControlsService{s: s}
  165. return rs
  166. }
  167. type DefaultObjectAccessControlsService struct {
  168. s *Service
  169. }
  170. func NewObjectAccessControlsService(s *Service) *ObjectAccessControlsService {
  171. rs := &ObjectAccessControlsService{s: s}
  172. return rs
  173. }
  174. type ObjectAccessControlsService struct {
  175. s *Service
  176. }
  177. func NewObjectsService(s *Service) *ObjectsService {
  178. rs := &ObjectsService{s: s}
  179. return rs
  180. }
  181. type ObjectsService struct {
  182. s *Service
  183. }
  184. // Bucket: A bucket.
  185. type Bucket struct {
  186. // Acl: Access controls on the bucket.
  187. Acl []*BucketAccessControl `json:"acl,omitempty"`
  188. // Cors: The bucket's Cross-Origin Resource Sharing (CORS)
  189. // configuration.
  190. Cors []*BucketCors `json:"cors,omitempty"`
  191. // DefaultObjectAcl: Default access controls to apply to new objects
  192. // when no ACL is provided.
  193. DefaultObjectAcl []*ObjectAccessControl `json:"defaultObjectAcl,omitempty"`
  194. // Etag: HTTP 1.1 Entity tag for the bucket.
  195. Etag string `json:"etag,omitempty"`
  196. // Id: The ID of the bucket.
  197. Id string `json:"id,omitempty"`
  198. // Kind: The kind of item this is. For buckets, this is always
  199. // storage#bucket.
  200. Kind string `json:"kind,omitempty"`
  201. // Lifecycle: The bucket's lifecycle configuration. See object lifecycle
  202. // management for more information.
  203. Lifecycle *BucketLifecycle `json:"lifecycle,omitempty"`
  204. // Location: The location of the bucket. Object data for objects in the
  205. // bucket resides in physical storage within this region. Typical values
  206. // are US and EU. Defaults to US. See the developer's guide for the
  207. // authoritative list.
  208. Location string `json:"location,omitempty"`
  209. // Logging: The bucket's logging configuration, which defines the
  210. // destination bucket and optional name prefix for the current bucket's
  211. // logs.
  212. Logging *BucketLogging `json:"logging,omitempty"`
  213. // Metageneration: The metadata generation of this bucket.
  214. Metageneration int64 `json:"metageneration,omitempty,string"`
  215. // Name: The name of the bucket.
  216. Name string `json:"name,omitempty"`
  217. // Owner: The owner of the bucket. This is always the project team's
  218. // owner group.
  219. Owner *BucketOwner `json:"owner,omitempty"`
  220. // SelfLink: The URI of this bucket.
  221. SelfLink string `json:"selfLink,omitempty"`
  222. // StorageClass: The bucket's storage class. This defines how objects in
  223. // the bucket are stored and determines the SLA and the cost of storage.
  224. // Typical values are STANDARD and DURABLE_REDUCED_AVAILABILITY.
  225. // Defaults to STANDARD. See the developer's guide for the authoritative
  226. // list.
  227. StorageClass string `json:"storageClass,omitempty"`
  228. // TimeCreated: Creation time of the bucket in RFC 3339 format.
  229. TimeCreated string `json:"timeCreated,omitempty"`
  230. // Versioning: The bucket's versioning configuration.
  231. Versioning *BucketVersioning `json:"versioning,omitempty"`
  232. // Website: The bucket's website configuration.
  233. Website *BucketWebsite `json:"website,omitempty"`
  234. // ServerResponse contains the HTTP response code and headers from the
  235. // server.
  236. googleapi.ServerResponse `json:"-"`
  237. // ForceSendFields is a list of field names (e.g. "Acl") to
  238. // unconditionally include in API requests. By default, fields with
  239. // empty values are omitted from API requests. However, any non-pointer,
  240. // non-interface field appearing in ForceSendFields will be sent to the
  241. // server regardless of whether the field is empty or not. This may be
  242. // used to include empty fields in Patch requests.
  243. ForceSendFields []string `json:"-"`
  244. // NullFields is a list of field names (e.g. "Acl") to include in API
  245. // requests with the JSON null value. By default, fields with empty
  246. // values are omitted from API requests. However, any field with an
  247. // empty value appearing in NullFields will be sent to the server as
  248. // null. It is an error if a field in this list has a non-empty value.
  249. // This may be used to include null fields in Patch requests.
  250. NullFields []string `json:"-"`
  251. }
  252. func (s *Bucket) MarshalJSON() ([]byte, error) {
  253. type NoMethod Bucket
  254. raw := NoMethod(*s)
  255. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  256. }
  257. type BucketCors struct {
  258. // MaxAgeSeconds: The value, in seconds, to return in the
  259. // Access-Control-Max-Age header used in preflight responses.
  260. MaxAgeSeconds int64 `json:"maxAgeSeconds,omitempty"`
  261. // Method: The list of HTTP methods on which to include CORS response
  262. // headers: GET, OPTIONS, POST, etc. Note, "*" is permitted in the list
  263. // of methods, and means "any method".
  264. Method []string `json:"method,omitempty"`
  265. // Origin: The list of Origins eligible to receive CORS response
  266. // headers. Note: "*" is permitted in the list of origins, and means
  267. // "any Origin".
  268. Origin []string `json:"origin,omitempty"`
  269. // ResponseHeader: The list of HTTP headers other than the simple
  270. // response headers to give permission for the user-agent to share
  271. // across domains.
  272. ResponseHeader []string `json:"responseHeader,omitempty"`
  273. // ForceSendFields is a list of field names (e.g. "MaxAgeSeconds") to
  274. // unconditionally include in API requests. By default, fields with
  275. // empty values are omitted from API requests. However, any non-pointer,
  276. // non-interface field appearing in ForceSendFields will be sent to the
  277. // server regardless of whether the field is empty or not. This may be
  278. // used to include empty fields in Patch requests.
  279. ForceSendFields []string `json:"-"`
  280. // NullFields is a list of field names (e.g. "MaxAgeSeconds") to include
  281. // in API requests with the JSON null value. By default, fields with
  282. // empty values are omitted from API requests. However, any field with
  283. // an empty value appearing in NullFields will be sent to the server as
  284. // null. It is an error if a field in this list has a non-empty value.
  285. // This may be used to include null fields in Patch requests.
  286. NullFields []string `json:"-"`
  287. }
  288. func (s *BucketCors) MarshalJSON() ([]byte, error) {
  289. type NoMethod BucketCors
  290. raw := NoMethod(*s)
  291. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  292. }
  293. // BucketLifecycle: The bucket's lifecycle configuration. See object
  294. // lifecycle management for more information.
  295. type BucketLifecycle struct {
  296. // Rule: A lifecycle management rule, which is made of an action to take
  297. // and the condition(s) under which the action will be taken.
  298. Rule []*BucketLifecycleRule `json:"rule,omitempty"`
  299. // ForceSendFields is a list of field names (e.g. "Rule") to
  300. // unconditionally include in API requests. By default, fields with
  301. // empty values are omitted from API requests. However, any non-pointer,
  302. // non-interface field appearing in ForceSendFields will be sent to the
  303. // server regardless of whether the field is empty or not. This may be
  304. // used to include empty fields in Patch requests.
  305. ForceSendFields []string `json:"-"`
  306. // NullFields is a list of field names (e.g. "Rule") to include in API
  307. // requests with the JSON null value. By default, fields with empty
  308. // values are omitted from API requests. However, any field with an
  309. // empty value appearing in NullFields will be sent to the server as
  310. // null. It is an error if a field in this list has a non-empty value.
  311. // This may be used to include null fields in Patch requests.
  312. NullFields []string `json:"-"`
  313. }
  314. func (s *BucketLifecycle) MarshalJSON() ([]byte, error) {
  315. type NoMethod BucketLifecycle
  316. raw := NoMethod(*s)
  317. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  318. }
  319. type BucketLifecycleRule struct {
  320. // Action: The action to take.
  321. Action *BucketLifecycleRuleAction `json:"action,omitempty"`
  322. // Condition: The condition(s) under which the action will be taken.
  323. Condition *BucketLifecycleRuleCondition `json:"condition,omitempty"`
  324. // ForceSendFields is a list of field names (e.g. "Action") to
  325. // unconditionally include in API requests. By default, fields with
  326. // empty values are omitted from API requests. However, any non-pointer,
  327. // non-interface field appearing in ForceSendFields will be sent to the
  328. // server regardless of whether the field is empty or not. This may be
  329. // used to include empty fields in Patch requests.
  330. ForceSendFields []string `json:"-"`
  331. // NullFields is a list of field names (e.g. "Action") to include in API
  332. // requests with the JSON null value. By default, fields with empty
  333. // values are omitted from API requests. However, any field with an
  334. // empty value appearing in NullFields will be sent to the server as
  335. // null. It is an error if a field in this list has a non-empty value.
  336. // This may be used to include null fields in Patch requests.
  337. NullFields []string `json:"-"`
  338. }
  339. func (s *BucketLifecycleRule) MarshalJSON() ([]byte, error) {
  340. type NoMethod BucketLifecycleRule
  341. raw := NoMethod(*s)
  342. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  343. }
  344. // BucketLifecycleRuleAction: The action to take.
  345. type BucketLifecycleRuleAction struct {
  346. // Type: Type of the action. Currently only Delete is supported.
  347. Type string `json:"type,omitempty"`
  348. // ForceSendFields is a list of field names (e.g. "Type") to
  349. // unconditionally include in API requests. By default, fields with
  350. // empty values are omitted from API requests. However, any non-pointer,
  351. // non-interface field appearing in ForceSendFields will be sent to the
  352. // server regardless of whether the field is empty or not. This may be
  353. // used to include empty fields in Patch requests.
  354. ForceSendFields []string `json:"-"`
  355. // NullFields is a list of field names (e.g. "Type") to include in API
  356. // requests with the JSON null value. By default, fields with empty
  357. // values are omitted from API requests. However, any field with an
  358. // empty value appearing in NullFields will be sent to the server as
  359. // null. It is an error if a field in this list has a non-empty value.
  360. // This may be used to include null fields in Patch requests.
  361. NullFields []string `json:"-"`
  362. }
  363. func (s *BucketLifecycleRuleAction) MarshalJSON() ([]byte, error) {
  364. type NoMethod BucketLifecycleRuleAction
  365. raw := NoMethod(*s)
  366. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  367. }
  368. // BucketLifecycleRuleCondition: The condition(s) under which the action
  369. // will be taken.
  370. type BucketLifecycleRuleCondition struct {
  371. // Age: Age of an object (in days). This condition is satisfied when an
  372. // object reaches the specified age.
  373. Age int64 `json:"age,omitempty"`
  374. // CreatedBefore: A date in RFC 3339 format with only the date part,
  375. // e.g. "2013-01-15". This condition is satisfied when an object is
  376. // created before midnight of the specified date in UTC.
  377. CreatedBefore string `json:"createdBefore,omitempty"`
  378. // IsLive: Relevant only for versioned objects. If the value is true,
  379. // this condition matches live objects; if the value is false, it
  380. // matches archived objects.
  381. IsLive *bool `json:"isLive,omitempty"`
  382. // NumNewerVersions: Relevant only for versioned objects. If the value
  383. // is N, this condition is satisfied when there are at least N versions
  384. // (including the live version) newer than this version of the object.
  385. NumNewerVersions int64 `json:"numNewerVersions,omitempty"`
  386. // ForceSendFields is a list of field names (e.g. "Age") to
  387. // unconditionally include in API requests. By default, fields with
  388. // empty values are omitted from API requests. However, any non-pointer,
  389. // non-interface field appearing in ForceSendFields will be sent to the
  390. // server regardless of whether the field is empty or not. This may be
  391. // used to include empty fields in Patch requests.
  392. ForceSendFields []string `json:"-"`
  393. // NullFields is a list of field names (e.g. "Age") to include in API
  394. // requests with the JSON null value. By default, fields with empty
  395. // values are omitted from API requests. However, any field with an
  396. // empty value appearing in NullFields will be sent to the server as
  397. // null. It is an error if a field in this list has a non-empty value.
  398. // This may be used to include null fields in Patch requests.
  399. NullFields []string `json:"-"`
  400. }
  401. func (s *BucketLifecycleRuleCondition) MarshalJSON() ([]byte, error) {
  402. type NoMethod BucketLifecycleRuleCondition
  403. raw := NoMethod(*s)
  404. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  405. }
  406. // BucketLogging: The bucket's logging configuration, which defines the
  407. // destination bucket and optional name prefix for the current bucket's
  408. // logs.
  409. type BucketLogging struct {
  410. // LogBucket: The destination bucket where the current bucket's logs
  411. // should be placed.
  412. LogBucket string `json:"logBucket,omitempty"`
  413. // LogObjectPrefix: A prefix for log object names.
  414. LogObjectPrefix string `json:"logObjectPrefix,omitempty"`
  415. // ForceSendFields is a list of field names (e.g. "LogBucket") to
  416. // unconditionally include in API requests. By default, fields with
  417. // empty values are omitted from API requests. However, any non-pointer,
  418. // non-interface field appearing in ForceSendFields will be sent to the
  419. // server regardless of whether the field is empty or not. This may be
  420. // used to include empty fields in Patch requests.
  421. ForceSendFields []string `json:"-"`
  422. // NullFields is a list of field names (e.g. "LogBucket") to include in
  423. // API requests with the JSON null value. By default, fields with empty
  424. // values are omitted from API requests. However, any field with an
  425. // empty value appearing in NullFields will be sent to the server as
  426. // null. It is an error if a field in this list has a non-empty value.
  427. // This may be used to include null fields in Patch requests.
  428. NullFields []string `json:"-"`
  429. }
  430. func (s *BucketLogging) MarshalJSON() ([]byte, error) {
  431. type NoMethod BucketLogging
  432. raw := NoMethod(*s)
  433. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  434. }
  435. // BucketOwner: The owner of the bucket. This is always the project
  436. // team's owner group.
  437. type BucketOwner struct {
  438. // Entity: The entity, in the form group-groupId.
  439. Entity string `json:"entity,omitempty"`
  440. // EntityId: The ID for the entity.
  441. EntityId string `json:"entityId,omitempty"`
  442. // ForceSendFields is a list of field names (e.g. "Entity") to
  443. // unconditionally include in API requests. By default, fields with
  444. // empty values are omitted from API requests. However, any non-pointer,
  445. // non-interface field appearing in ForceSendFields will be sent to the
  446. // server regardless of whether the field is empty or not. This may be
  447. // used to include empty fields in Patch requests.
  448. ForceSendFields []string `json:"-"`
  449. // NullFields is a list of field names (e.g. "Entity") to include in API
  450. // requests with the JSON null value. By default, fields with empty
  451. // values are omitted from API requests. However, any field with an
  452. // empty value appearing in NullFields will be sent to the server as
  453. // null. It is an error if a field in this list has a non-empty value.
  454. // This may be used to include null fields in Patch requests.
  455. NullFields []string `json:"-"`
  456. }
  457. func (s *BucketOwner) MarshalJSON() ([]byte, error) {
  458. type NoMethod BucketOwner
  459. raw := NoMethod(*s)
  460. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  461. }
  462. // BucketVersioning: The bucket's versioning configuration.
  463. type BucketVersioning struct {
  464. // Enabled: While set to true, versioning is fully enabled for this
  465. // bucket.
  466. Enabled bool `json:"enabled,omitempty"`
  467. // ForceSendFields is a list of field names (e.g. "Enabled") to
  468. // unconditionally include in API requests. By default, fields with
  469. // empty values are omitted from API requests. However, any non-pointer,
  470. // non-interface field appearing in ForceSendFields will be sent to the
  471. // server regardless of whether the field is empty or not. This may be
  472. // used to include empty fields in Patch requests.
  473. ForceSendFields []string `json:"-"`
  474. // NullFields is a list of field names (e.g. "Enabled") to include in
  475. // API requests with the JSON null value. By default, fields with empty
  476. // values are omitted from API requests. However, any field with an
  477. // empty value appearing in NullFields will be sent to the server as
  478. // null. It is an error if a field in this list has a non-empty value.
  479. // This may be used to include null fields in Patch requests.
  480. NullFields []string `json:"-"`
  481. }
  482. func (s *BucketVersioning) MarshalJSON() ([]byte, error) {
  483. type NoMethod BucketVersioning
  484. raw := NoMethod(*s)
  485. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  486. }
  487. // BucketWebsite: The bucket's website configuration.
  488. type BucketWebsite struct {
  489. // MainPageSuffix: Behaves as the bucket's directory index where missing
  490. // objects are treated as potential directories.
  491. MainPageSuffix string `json:"mainPageSuffix,omitempty"`
  492. // NotFoundPage: The custom object to return when a requested resource
  493. // is not found.
  494. NotFoundPage string `json:"notFoundPage,omitempty"`
  495. // ForceSendFields is a list of field names (e.g. "MainPageSuffix") to
  496. // unconditionally include in API requests. By default, fields with
  497. // empty values are omitted from API requests. However, any non-pointer,
  498. // non-interface field appearing in ForceSendFields will be sent to the
  499. // server regardless of whether the field is empty or not. This may be
  500. // used to include empty fields in Patch requests.
  501. ForceSendFields []string `json:"-"`
  502. // NullFields is a list of field names (e.g. "MainPageSuffix") to
  503. // include in API requests with the JSON null value. By default, fields
  504. // with empty values are omitted from API requests. However, any field
  505. // with an empty value appearing in NullFields will be sent to the
  506. // server as null. It is an error if a field in this list has a
  507. // non-empty value. This may be used to include null fields in Patch
  508. // requests.
  509. NullFields []string `json:"-"`
  510. }
  511. func (s *BucketWebsite) MarshalJSON() ([]byte, error) {
  512. type NoMethod BucketWebsite
  513. raw := NoMethod(*s)
  514. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  515. }
  516. // BucketAccessControl: An access-control entry.
  517. type BucketAccessControl struct {
  518. // Bucket: The name of the bucket.
  519. Bucket string `json:"bucket,omitempty"`
  520. // Domain: The domain associated with the entity, if any.
  521. Domain string `json:"domain,omitempty"`
  522. // Email: The email address associated with the entity, if any.
  523. Email string `json:"email,omitempty"`
  524. // Entity: The entity holding the permission, in one of the following
  525. // forms:
  526. // - user-userId
  527. // - user-email
  528. // - group-groupId
  529. // - group-email
  530. // - domain-domain
  531. // - allUsers
  532. // - allAuthenticatedUsers Examples:
  533. // - The user liz@example.com would be user-liz@example.com.
  534. // - The group example@googlegroups.com would be
  535. // group-example@googlegroups.com.
  536. // - To refer to all members of the Google Apps for Business domain
  537. // example.com, the entity would be domain-example.com.
  538. Entity string `json:"entity,omitempty"`
  539. // EntityId: The ID for the entity, if any.
  540. EntityId string `json:"entityId,omitempty"`
  541. // Etag: HTTP 1.1 Entity tag for the access-control entry.
  542. Etag string `json:"etag,omitempty"`
  543. // Id: The ID of the access-control entry.
  544. Id string `json:"id,omitempty"`
  545. // Kind: The kind of item this is. For bucket access control entries,
  546. // this is always storage#bucketAccessControl.
  547. Kind string `json:"kind,omitempty"`
  548. // Role: The access permission for the entity. Can be READER, WRITER, or
  549. // OWNER.
  550. Role string `json:"role,omitempty"`
  551. // SelfLink: The link to this access-control entry.
  552. SelfLink string `json:"selfLink,omitempty"`
  553. // ServerResponse contains the HTTP response code and headers from the
  554. // server.
  555. googleapi.ServerResponse `json:"-"`
  556. // ForceSendFields is a list of field names (e.g. "Bucket") to
  557. // unconditionally include in API requests. By default, fields with
  558. // empty values are omitted from API requests. However, any non-pointer,
  559. // non-interface field appearing in ForceSendFields will be sent to the
  560. // server regardless of whether the field is empty or not. This may be
  561. // used to include empty fields in Patch requests.
  562. ForceSendFields []string `json:"-"`
  563. // NullFields is a list of field names (e.g. "Bucket") to include in API
  564. // requests with the JSON null value. By default, fields with empty
  565. // values are omitted from API requests. However, any field with an
  566. // empty value appearing in NullFields will be sent to the server as
  567. // null. It is an error if a field in this list has a non-empty value.
  568. // This may be used to include null fields in Patch requests.
  569. NullFields []string `json:"-"`
  570. }
  571. func (s *BucketAccessControl) MarshalJSON() ([]byte, error) {
  572. type NoMethod BucketAccessControl
  573. raw := NoMethod(*s)
  574. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  575. }
  576. // BucketAccessControls: An access-control list.
  577. type BucketAccessControls struct {
  578. // Items: The list of items.
  579. Items []*BucketAccessControl `json:"items,omitempty"`
  580. // Kind: The kind of item this is. For lists of bucket access control
  581. // entries, this is always storage#bucketAccessControls.
  582. Kind string `json:"kind,omitempty"`
  583. // ServerResponse contains the HTTP response code and headers from the
  584. // server.
  585. googleapi.ServerResponse `json:"-"`
  586. // ForceSendFields is a list of field names (e.g. "Items") to
  587. // unconditionally include in API requests. By default, fields with
  588. // empty values are omitted from API requests. However, any non-pointer,
  589. // non-interface field appearing in ForceSendFields will be sent to the
  590. // server regardless of whether the field is empty or not. This may be
  591. // used to include empty fields in Patch requests.
  592. ForceSendFields []string `json:"-"`
  593. // NullFields is a list of field names (e.g. "Items") to include in API
  594. // requests with the JSON null value. By default, fields with empty
  595. // values are omitted from API requests. However, any field with an
  596. // empty value appearing in NullFields will be sent to the server as
  597. // null. It is an error if a field in this list has a non-empty value.
  598. // This may be used to include null fields in Patch requests.
  599. NullFields []string `json:"-"`
  600. }
  601. func (s *BucketAccessControls) MarshalJSON() ([]byte, error) {
  602. type NoMethod BucketAccessControls
  603. raw := NoMethod(*s)
  604. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  605. }
  606. // Buckets: A list of buckets.
  607. type Buckets struct {
  608. // Items: The list of items.
  609. Items []*Bucket `json:"items,omitempty"`
  610. // Kind: The kind of item this is. For lists of buckets, this is always
  611. // storage#buckets.
  612. Kind string `json:"kind,omitempty"`
  613. // NextPageToken: The continuation token, used to page through large
  614. // result sets. Provide this value in a subsequent request to return the
  615. // next page of results.
  616. NextPageToken string `json:"nextPageToken,omitempty"`
  617. // ServerResponse contains the HTTP response code and headers from the
  618. // server.
  619. googleapi.ServerResponse `json:"-"`
  620. // ForceSendFields is a list of field names (e.g. "Items") to
  621. // unconditionally include in API requests. By default, fields with
  622. // empty values are omitted from API requests. However, any non-pointer,
  623. // non-interface field appearing in ForceSendFields will be sent to the
  624. // server regardless of whether the field is empty or not. This may be
  625. // used to include empty fields in Patch requests.
  626. ForceSendFields []string `json:"-"`
  627. // NullFields is a list of field names (e.g. "Items") to include in API
  628. // requests with the JSON null value. By default, fields with empty
  629. // values are omitted from API requests. However, any field with an
  630. // empty value appearing in NullFields will be sent to the server as
  631. // null. It is an error if a field in this list has a non-empty value.
  632. // This may be used to include null fields in Patch requests.
  633. NullFields []string `json:"-"`
  634. }
  635. func (s *Buckets) MarshalJSON() ([]byte, error) {
  636. type NoMethod Buckets
  637. raw := NoMethod(*s)
  638. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  639. }
  640. // Channel: An notification channel used to watch for resource changes.
  641. type Channel struct {
  642. // Address: The address where notifications are delivered for this
  643. // channel.
  644. Address string `json:"address,omitempty"`
  645. // Expiration: Date and time of notification channel expiration,
  646. // expressed as a Unix timestamp, in milliseconds. Optional.
  647. Expiration int64 `json:"expiration,omitempty,string"`
  648. // Id: A UUID or similar unique string that identifies this channel.
  649. Id string `json:"id,omitempty"`
  650. // Kind: Identifies this as a notification channel used to watch for
  651. // changes to a resource. Value: the fixed string "api#channel".
  652. Kind string `json:"kind,omitempty"`
  653. // Params: Additional parameters controlling delivery channel behavior.
  654. // Optional.
  655. Params map[string]string `json:"params,omitempty"`
  656. // Payload: A Boolean value to indicate whether payload is wanted.
  657. // Optional.
  658. Payload bool `json:"payload,omitempty"`
  659. // ResourceId: An opaque ID that identifies the resource being watched
  660. // on this channel. Stable across different API versions.
  661. ResourceId string `json:"resourceId,omitempty"`
  662. // ResourceUri: A version-specific identifier for the watched resource.
  663. ResourceUri string `json:"resourceUri,omitempty"`
  664. // Token: An arbitrary string delivered to the target address with each
  665. // notification delivered over this channel. Optional.
  666. Token string `json:"token,omitempty"`
  667. // Type: The type of delivery mechanism used for this channel.
  668. Type string `json:"type,omitempty"`
  669. // ServerResponse contains the HTTP response code and headers from the
  670. // server.
  671. googleapi.ServerResponse `json:"-"`
  672. // ForceSendFields is a list of field names (e.g. "Address") to
  673. // unconditionally include in API requests. By default, fields with
  674. // empty values are omitted from API requests. However, any non-pointer,
  675. // non-interface field appearing in ForceSendFields will be sent to the
  676. // server regardless of whether the field is empty or not. This may be
  677. // used to include empty fields in Patch requests.
  678. ForceSendFields []string `json:"-"`
  679. // NullFields is a list of field names (e.g. "Address") to include in
  680. // API requests with the JSON null value. By default, fields with empty
  681. // values are omitted from API requests. However, any field with an
  682. // empty value appearing in NullFields will be sent to the server as
  683. // null. It is an error if a field in this list has a non-empty value.
  684. // This may be used to include null fields in Patch requests.
  685. NullFields []string `json:"-"`
  686. }
  687. func (s *Channel) MarshalJSON() ([]byte, error) {
  688. type NoMethod Channel
  689. raw := NoMethod(*s)
  690. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  691. }
  692. // ComposeRequest: A Compose request.
  693. type ComposeRequest struct {
  694. // Destination: Properties of the resulting object
  695. Destination *Object `json:"destination,omitempty"`
  696. // Kind: The kind of item this is.
  697. Kind string `json:"kind,omitempty"`
  698. // SourceObjects: The list of source objects that will be concatenated
  699. // into a single object.
  700. SourceObjects []*ComposeRequestSourceObjects `json:"sourceObjects,omitempty"`
  701. // ForceSendFields is a list of field names (e.g. "Destination") to
  702. // unconditionally include in API requests. By default, fields with
  703. // empty values are omitted from API requests. However, any non-pointer,
  704. // non-interface field appearing in ForceSendFields will be sent to the
  705. // server regardless of whether the field is empty or not. This may be
  706. // used to include empty fields in Patch requests.
  707. ForceSendFields []string `json:"-"`
  708. // NullFields is a list of field names (e.g. "Destination") to include
  709. // in API requests with the JSON null value. By default, fields with
  710. // empty values are omitted from API requests. However, any field with
  711. // an empty value appearing in NullFields will be sent to the server as
  712. // null. It is an error if a field in this list has a non-empty value.
  713. // This may be used to include null fields in Patch requests.
  714. NullFields []string `json:"-"`
  715. }
  716. func (s *ComposeRequest) MarshalJSON() ([]byte, error) {
  717. type NoMethod ComposeRequest
  718. raw := NoMethod(*s)
  719. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  720. }
  721. type ComposeRequestSourceObjects struct {
  722. // Generation: The generation of this object to use as the source.
  723. Generation int64 `json:"generation,omitempty,string"`
  724. // Name: The source object's name. All source objects must reside in the
  725. // same bucket.
  726. Name string `json:"name,omitempty"`
  727. // ObjectPreconditions: Conditions that must be met for this operation
  728. // to execute.
  729. ObjectPreconditions *ComposeRequestSourceObjectsObjectPreconditions `json:"objectPreconditions,omitempty"`
  730. // ForceSendFields is a list of field names (e.g. "Generation") to
  731. // unconditionally include in API requests. By default, fields with
  732. // empty values are omitted from API requests. However, any non-pointer,
  733. // non-interface field appearing in ForceSendFields will be sent to the
  734. // server regardless of whether the field is empty or not. This may be
  735. // used to include empty fields in Patch requests.
  736. ForceSendFields []string `json:"-"`
  737. // NullFields is a list of field names (e.g. "Generation") to include in
  738. // API requests with the JSON null value. By default, fields with empty
  739. // values are omitted from API requests. However, any field with an
  740. // empty value appearing in NullFields will be sent to the server as
  741. // null. It is an error if a field in this list has a non-empty value.
  742. // This may be used to include null fields in Patch requests.
  743. NullFields []string `json:"-"`
  744. }
  745. func (s *ComposeRequestSourceObjects) MarshalJSON() ([]byte, error) {
  746. type NoMethod ComposeRequestSourceObjects
  747. raw := NoMethod(*s)
  748. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  749. }
  750. // ComposeRequestSourceObjectsObjectPreconditions: Conditions that must
  751. // be met for this operation to execute.
  752. type ComposeRequestSourceObjectsObjectPreconditions struct {
  753. // IfGenerationMatch: Only perform the composition if the generation of
  754. // the source object that would be used matches this value. If this
  755. // value and a generation are both specified, they must be the same
  756. // value or the call will fail.
  757. IfGenerationMatch int64 `json:"ifGenerationMatch,omitempty,string"`
  758. // ForceSendFields is a list of field names (e.g. "IfGenerationMatch")
  759. // to unconditionally include in API requests. By default, fields with
  760. // empty values are omitted from API requests. However, any non-pointer,
  761. // non-interface field appearing in ForceSendFields will be sent to the
  762. // server regardless of whether the field is empty or not. This may be
  763. // used to include empty fields in Patch requests.
  764. ForceSendFields []string `json:"-"`
  765. // NullFields is a list of field names (e.g. "IfGenerationMatch") to
  766. // include in API requests with the JSON null value. By default, fields
  767. // with empty values are omitted from API requests. However, any field
  768. // with an empty value appearing in NullFields will be sent to the
  769. // server as null. It is an error if a field in this list has a
  770. // non-empty value. This may be used to include null fields in Patch
  771. // requests.
  772. NullFields []string `json:"-"`
  773. }
  774. func (s *ComposeRequestSourceObjectsObjectPreconditions) MarshalJSON() ([]byte, error) {
  775. type NoMethod ComposeRequestSourceObjectsObjectPreconditions
  776. raw := NoMethod(*s)
  777. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  778. }
  779. // Object: An object.
  780. type Object struct {
  781. // Acl: Access controls on the object.
  782. Acl []*ObjectAccessControl `json:"acl,omitempty"`
  783. // Bucket: The bucket containing this object.
  784. Bucket string `json:"bucket,omitempty"`
  785. // CacheControl: Cache-Control directive for the object data.
  786. CacheControl string `json:"cacheControl,omitempty"`
  787. // ComponentCount: Number of underlying components that make up this
  788. // object. Components are accumulated by compose operations and are
  789. // limited to a count of 32.
  790. ComponentCount int64 `json:"componentCount,omitempty"`
  791. // ContentDisposition: Content-Disposition of the object data.
  792. ContentDisposition string `json:"contentDisposition,omitempty"`
  793. // ContentEncoding: Content-Encoding of the object data.
  794. ContentEncoding string `json:"contentEncoding,omitempty"`
  795. // ContentLanguage: Content-Language of the object data.
  796. ContentLanguage string `json:"contentLanguage,omitempty"`
  797. // ContentType: Content-Type of the object data.
  798. ContentType string `json:"contentType,omitempty"`
  799. // Crc32c: CRC32c checksum, as described in RFC 4960, Appendix B;
  800. // encoded using base64.
  801. Crc32c string `json:"crc32c,omitempty"`
  802. // Etag: HTTP 1.1 Entity tag for the object.
  803. Etag string `json:"etag,omitempty"`
  804. // Generation: The content generation of this object. Used for object
  805. // versioning.
  806. Generation int64 `json:"generation,omitempty,string"`
  807. // Id: The ID of the object.
  808. Id string `json:"id,omitempty"`
  809. // Kind: The kind of item this is. For objects, this is always
  810. // storage#object.
  811. Kind string `json:"kind,omitempty"`
  812. // Md5Hash: MD5 hash of the data; encoded using base64.
  813. Md5Hash string `json:"md5Hash,omitempty"`
  814. // MediaLink: Media download link.
  815. MediaLink string `json:"mediaLink,omitempty"`
  816. // Metadata: User-provided metadata, in key/value pairs.
  817. Metadata map[string]string `json:"metadata,omitempty"`
  818. // Metageneration: The generation of the metadata for this object at
  819. // this generation. Used for metadata versioning. Has no meaning outside
  820. // of the context of this generation.
  821. Metageneration int64 `json:"metageneration,omitempty,string"`
  822. // Name: The name of this object. Required if not specified by URL
  823. // parameter.
  824. Name string `json:"name,omitempty"`
  825. // Owner: The owner of the object. This will always be the uploader of
  826. // the object.
  827. Owner *ObjectOwner `json:"owner,omitempty"`
  828. // SelfLink: The link to this object.
  829. SelfLink string `json:"selfLink,omitempty"`
  830. // Size: Content-Length of the data in bytes.
  831. Size uint64 `json:"size,omitempty,string"`
  832. // StorageClass: Storage class of the object.
  833. StorageClass string `json:"storageClass,omitempty"`
  834. // TimeDeleted: Deletion time of the object in RFC 3339 format. Will be
  835. // returned if and only if this version of the object has been deleted.
  836. TimeDeleted string `json:"timeDeleted,omitempty"`
  837. // Updated: Modification time of the object metadata in RFC 3339 format.
  838. Updated string `json:"updated,omitempty"`
  839. // ServerResponse contains the HTTP response code and headers from the
  840. // server.
  841. googleapi.ServerResponse `json:"-"`
  842. // ForceSendFields is a list of field names (e.g. "Acl") to
  843. // unconditionally include in API requests. By default, fields with
  844. // empty values are omitted from API requests. However, any non-pointer,
  845. // non-interface field appearing in ForceSendFields will be sent to the
  846. // server regardless of whether the field is empty or not. This may be
  847. // used to include empty fields in Patch requests.
  848. ForceSendFields []string `json:"-"`
  849. // NullFields is a list of field names (e.g. "Acl") to include in API
  850. // requests with the JSON null value. By default, fields with empty
  851. // values are omitted from API requests. However, any field with an
  852. // empty value appearing in NullFields will be sent to the server as
  853. // null. It is an error if a field in this list has a non-empty value.
  854. // This may be used to include null fields in Patch requests.
  855. NullFields []string `json:"-"`
  856. }
  857. func (s *Object) MarshalJSON() ([]byte, error) {
  858. type NoMethod Object
  859. raw := NoMethod(*s)
  860. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  861. }
  862. // ObjectOwner: The owner of the object. This will always be the
  863. // uploader of the object.
  864. type ObjectOwner struct {
  865. // Entity: The entity, in the form user-userId.
  866. Entity string `json:"entity,omitempty"`
  867. // EntityId: The ID for the entity.
  868. EntityId string `json:"entityId,omitempty"`
  869. // ForceSendFields is a list of field names (e.g. "Entity") to
  870. // unconditionally include in API requests. By default, fields with
  871. // empty values are omitted from API requests. However, any non-pointer,
  872. // non-interface field appearing in ForceSendFields will be sent to the
  873. // server regardless of whether the field is empty or not. This may be
  874. // used to include empty fields in Patch requests.
  875. ForceSendFields []string `json:"-"`
  876. // NullFields is a list of field names (e.g. "Entity") to include in API
  877. // requests with the JSON null value. By default, fields with empty
  878. // values are omitted from API requests. However, any field with an
  879. // empty value appearing in NullFields will be sent to the server as
  880. // null. It is an error if a field in this list has a non-empty value.
  881. // This may be used to include null fields in Patch requests.
  882. NullFields []string `json:"-"`
  883. }
  884. func (s *ObjectOwner) MarshalJSON() ([]byte, error) {
  885. type NoMethod ObjectOwner
  886. raw := NoMethod(*s)
  887. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  888. }
  889. // ObjectAccessControl: An access-control entry.
  890. type ObjectAccessControl struct {
  891. // Bucket: The name of the bucket.
  892. Bucket string `json:"bucket,omitempty"`
  893. // Domain: The domain associated with the entity, if any.
  894. Domain string `json:"domain,omitempty"`
  895. // Email: The email address associated with the entity, if any.
  896. Email string `json:"email,omitempty"`
  897. // Entity: The entity holding the permission, in one of the following
  898. // forms:
  899. // - user-userId
  900. // - user-email
  901. // - group-groupId
  902. // - group-email
  903. // - domain-domain
  904. // - allUsers
  905. // - allAuthenticatedUsers Examples:
  906. // - The user liz@example.com would be user-liz@example.com.
  907. // - The group example@googlegroups.com would be
  908. // group-example@googlegroups.com.
  909. // - To refer to all members of the Google Apps for Business domain
  910. // example.com, the entity would be domain-example.com.
  911. Entity string `json:"entity,omitempty"`
  912. // EntityId: The ID for the entity, if any.
  913. EntityId string `json:"entityId,omitempty"`
  914. // Etag: HTTP 1.1 Entity tag for the access-control entry.
  915. Etag string `json:"etag,omitempty"`
  916. // Generation: The content generation of the object.
  917. Generation int64 `json:"generation,omitempty,string"`
  918. // Id: The ID of the access-control entry.
  919. Id string `json:"id,omitempty"`
  920. // Kind: The kind of item this is. For object access control entries,
  921. // this is always storage#objectAccessControl.
  922. Kind string `json:"kind,omitempty"`
  923. // Object: The name of the object.
  924. Object string `json:"object,omitempty"`
  925. // Role: The access permission for the entity. Can be READER or OWNER.
  926. Role string `json:"role,omitempty"`
  927. // SelfLink: The link to this access-control entry.
  928. SelfLink string `json:"selfLink,omitempty"`
  929. // ServerResponse contains the HTTP response code and headers from the
  930. // server.
  931. googleapi.ServerResponse `json:"-"`
  932. // ForceSendFields is a list of field names (e.g. "Bucket") to
  933. // unconditionally include in API requests. By default, fields with
  934. // empty values are omitted from API requests. However, any non-pointer,
  935. // non-interface field appearing in ForceSendFields will be sent to the
  936. // server regardless of whether the field is empty or not. This may be
  937. // used to include empty fields in Patch requests.
  938. ForceSendFields []string `json:"-"`
  939. // NullFields is a list of field names (e.g. "Bucket") to include in API
  940. // requests with the JSON null value. By default, fields with empty
  941. // values are omitted from API requests. However, any field with an
  942. // empty value appearing in NullFields will be sent to the server as
  943. // null. It is an error if a field in this list has a non-empty value.
  944. // This may be used to include null fields in Patch requests.
  945. NullFields []string `json:"-"`
  946. }
  947. func (s *ObjectAccessControl) MarshalJSON() ([]byte, error) {
  948. type NoMethod ObjectAccessControl
  949. raw := NoMethod(*s)
  950. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  951. }
  952. // ObjectAccessControls: An access-control list.
  953. type ObjectAccessControls struct {
  954. // Items: The list of items.
  955. Items []interface{} `json:"items,omitempty"`
  956. // Kind: The kind of item this is. For lists of object access control
  957. // entries, this is always storage#objectAccessControls.
  958. Kind string `json:"kind,omitempty"`
  959. // ServerResponse contains the HTTP response code and headers from the
  960. // server.
  961. googleapi.ServerResponse `json:"-"`
  962. // ForceSendFields is a list of field names (e.g. "Items") to
  963. // unconditionally include in API requests. By default, fields with
  964. // empty values are omitted from API requests. However, any non-pointer,
  965. // non-interface field appearing in ForceSendFields will be sent to the
  966. // server regardless of whether the field is empty or not. This may be
  967. // used to include empty fields in Patch requests.
  968. ForceSendFields []string `json:"-"`
  969. // NullFields is a list of field names (e.g. "Items") to include in API
  970. // requests with the JSON null value. By default, fields with empty
  971. // values are omitted from API requests. However, any field with an
  972. // empty value appearing in NullFields will be sent to the server as
  973. // null. It is an error if a field in this list has a non-empty value.
  974. // This may be used to include null fields in Patch requests.
  975. NullFields []string `json:"-"`
  976. }
  977. func (s *ObjectAccessControls) MarshalJSON() ([]byte, error) {
  978. type NoMethod ObjectAccessControls
  979. raw := NoMethod(*s)
  980. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  981. }
  982. // Objects: A list of objects.
  983. type Objects struct {
  984. // Items: The list of items.
  985. Items []*Object `json:"items,omitempty"`
  986. // Kind: The kind of item this is. For lists of objects, this is always
  987. // storage#objects.
  988. Kind string `json:"kind,omitempty"`
  989. // NextPageToken: The continuation token, used to page through large
  990. // result sets. Provide this value in a subsequent request to return the
  991. // next page of results.
  992. NextPageToken string `json:"nextPageToken,omitempty"`
  993. // Prefixes: The list of prefixes of objects matching-but-not-listed up
  994. // to and including the requested delimiter.
  995. Prefixes []string `json:"prefixes,omitempty"`
  996. // ServerResponse contains the HTTP response code and headers from the
  997. // server.
  998. googleapi.ServerResponse `json:"-"`
  999. // ForceSendFields is a list of field names (e.g. "Items") to
  1000. // unconditionally include in API requests. By default, fields with
  1001. // empty values are omitted from API requests. However, any non-pointer,
  1002. // non-interface field appearing in ForceSendFields will be sent to the
  1003. // server regardless of whether the field is empty or not. This may be
  1004. // used to include empty fields in Patch requests.
  1005. ForceSendFields []string `json:"-"`
  1006. // NullFields is a list of field names (e.g. "Items") to include in API
  1007. // requests with the JSON null value. By default, fields with empty
  1008. // values are omitted from API requests. However, any field with an
  1009. // empty value appearing in NullFields will be sent to the server as
  1010. // null. It is an error if a field in this list has a non-empty value.
  1011. // This may be used to include null fields in Patch requests.
  1012. NullFields []string `json:"-"`
  1013. }
  1014. func (s *Objects) MarshalJSON() ([]byte, error) {
  1015. type NoMethod Objects
  1016. raw := NoMethod(*s)
  1017. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1018. }
  1019. // method id "storage.bucketAccessControls.delete":
  1020. type BucketAccessControlsDeleteCall struct {
  1021. s *Service
  1022. bucket string
  1023. entity string
  1024. urlParams_ gensupport.URLParams
  1025. ctx_ context.Context
  1026. header_ http.Header
  1027. }
  1028. // Delete: Permanently deletes the ACL entry for the specified entity on
  1029. // the specified bucket.
  1030. func (r *BucketAccessControlsService) Delete(bucket string, entity string) *BucketAccessControlsDeleteCall {
  1031. c := &BucketAccessControlsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1032. c.bucket = bucket
  1033. c.entity = entity
  1034. return c
  1035. }
  1036. // Fields allows partial responses to be retrieved. See
  1037. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1038. // for more information.
  1039. func (c *BucketAccessControlsDeleteCall) Fields(s ...googleapi.Field) *BucketAccessControlsDeleteCall {
  1040. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1041. return c
  1042. }
  1043. // Context sets the context to be used in this call's Do method. Any
  1044. // pending HTTP request will be aborted if the provided context is
  1045. // canceled.
  1046. func (c *BucketAccessControlsDeleteCall) Context(ctx context.Context) *BucketAccessControlsDeleteCall {
  1047. c.ctx_ = ctx
  1048. return c
  1049. }
  1050. // Header returns an http.Header that can be modified by the caller to
  1051. // add HTTP headers to the request.
  1052. func (c *BucketAccessControlsDeleteCall) Header() http.Header {
  1053. if c.header_ == nil {
  1054. c.header_ = make(http.Header)
  1055. }
  1056. return c.header_
  1057. }
  1058. func (c *BucketAccessControlsDeleteCall) doRequest(alt string) (*http.Response, error) {
  1059. reqHeaders := make(http.Header)
  1060. for k, v := range c.header_ {
  1061. reqHeaders[k] = v
  1062. }
  1063. reqHeaders.Set("User-Agent", c.s.userAgent())
  1064. var body io.Reader = nil
  1065. c.urlParams_.Set("alt", alt)
  1066. c.urlParams_.Set("prettyPrint", "false")
  1067. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/acl/{entity}")
  1068. urls += "?" + c.urlParams_.Encode()
  1069. req, err := http.NewRequest("DELETE", urls, body)
  1070. if err != nil {
  1071. return nil, err
  1072. }
  1073. req.Header = reqHeaders
  1074. googleapi.Expand(req.URL, map[string]string{
  1075. "bucket": c.bucket,
  1076. "entity": c.entity,
  1077. })
  1078. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1079. }
  1080. // Do executes the "storage.bucketAccessControls.delete" call.
  1081. func (c *BucketAccessControlsDeleteCall) Do(opts ...googleapi.CallOption) error {
  1082. gensupport.SetOptions(c.urlParams_, opts...)
  1083. res, err := c.doRequest("json")
  1084. if err != nil {
  1085. return err
  1086. }
  1087. defer googleapi.CloseBody(res)
  1088. if err := googleapi.CheckResponse(res); err != nil {
  1089. return err
  1090. }
  1091. return nil
  1092. // {
  1093. // "description": "Permanently deletes the ACL entry for the specified entity on the specified bucket.",
  1094. // "httpMethod": "DELETE",
  1095. // "id": "storage.bucketAccessControls.delete",
  1096. // "parameterOrder": [
  1097. // "bucket",
  1098. // "entity"
  1099. // ],
  1100. // "parameters": {
  1101. // "bucket": {
  1102. // "description": "Name of a bucket.",
  1103. // "location": "path",
  1104. // "required": true,
  1105. // "type": "string"
  1106. // },
  1107. // "entity": {
  1108. // "description": "The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.",
  1109. // "location": "path",
  1110. // "required": true,
  1111. // "type": "string"
  1112. // }
  1113. // },
  1114. // "path": "b/{bucket}/acl/{entity}",
  1115. // "scopes": [
  1116. // "https://www.googleapis.com/auth/devstorage.full_control"
  1117. // ]
  1118. // }
  1119. }
  1120. // method id "storage.bucketAccessControls.get":
  1121. type BucketAccessControlsGetCall struct {
  1122. s *Service
  1123. bucket string
  1124. entity string
  1125. urlParams_ gensupport.URLParams
  1126. ifNoneMatch_ string
  1127. ctx_ context.Context
  1128. header_ http.Header
  1129. }
  1130. // Get: Returns the ACL entry for the specified entity on the specified
  1131. // bucket.
  1132. func (r *BucketAccessControlsService) Get(bucket string, entity string) *BucketAccessControlsGetCall {
  1133. c := &BucketAccessControlsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1134. c.bucket = bucket
  1135. c.entity = entity
  1136. return c
  1137. }
  1138. // Fields allows partial responses to be retrieved. See
  1139. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1140. // for more information.
  1141. func (c *BucketAccessControlsGetCall) Fields(s ...googleapi.Field) *BucketAccessControlsGetCall {
  1142. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1143. return c
  1144. }
  1145. // IfNoneMatch sets the optional parameter which makes the operation
  1146. // fail if the object's ETag matches the given value. This is useful for
  1147. // getting updates only after the object has changed since the last
  1148. // request. Use googleapi.IsNotModified to check whether the response
  1149. // error from Do is the result of In-None-Match.
  1150. func (c *BucketAccessControlsGetCall) IfNoneMatch(entityTag string) *BucketAccessControlsGetCall {
  1151. c.ifNoneMatch_ = entityTag
  1152. return c
  1153. }
  1154. // Context sets the context to be used in this call's Do method. Any
  1155. // pending HTTP request will be aborted if the provided context is
  1156. // canceled.
  1157. func (c *BucketAccessControlsGetCall) Context(ctx context.Context) *BucketAccessControlsGetCall {
  1158. c.ctx_ = ctx
  1159. return c
  1160. }
  1161. // Header returns an http.Header that can be modified by the caller to
  1162. // add HTTP headers to the request.
  1163. func (c *BucketAccessControlsGetCall) Header() http.Header {
  1164. if c.header_ == nil {
  1165. c.header_ = make(http.Header)
  1166. }
  1167. return c.header_
  1168. }
  1169. func (c *BucketAccessControlsGetCall) doRequest(alt string) (*http.Response, error) {
  1170. reqHeaders := make(http.Header)
  1171. for k, v := range c.header_ {
  1172. reqHeaders[k] = v
  1173. }
  1174. reqHeaders.Set("User-Agent", c.s.userAgent())
  1175. if c.ifNoneMatch_ != "" {
  1176. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1177. }
  1178. var body io.Reader = nil
  1179. c.urlParams_.Set("alt", alt)
  1180. c.urlParams_.Set("prettyPrint", "false")
  1181. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/acl/{entity}")
  1182. urls += "?" + c.urlParams_.Encode()
  1183. req, err := http.NewRequest("GET", urls, body)
  1184. if err != nil {
  1185. return nil, err
  1186. }
  1187. req.Header = reqHeaders
  1188. googleapi.Expand(req.URL, map[string]string{
  1189. "bucket": c.bucket,
  1190. "entity": c.entity,
  1191. })
  1192. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1193. }
  1194. // Do executes the "storage.bucketAccessControls.get" call.
  1195. // Exactly one of *BucketAccessControl or error will be non-nil. Any
  1196. // non-2xx status code is an error. Response headers are in either
  1197. // *BucketAccessControl.ServerResponse.Header or (if a response was
  1198. // returned at all) in error.(*googleapi.Error).Header. Use
  1199. // googleapi.IsNotModified to check whether the returned error was
  1200. // because http.StatusNotModified was returned.
  1201. func (c *BucketAccessControlsGetCall) Do(opts ...googleapi.CallOption) (*BucketAccessControl, error) {
  1202. gensupport.SetOptions(c.urlParams_, opts...)
  1203. res, err := c.doRequest("json")
  1204. if res != nil && res.StatusCode == http.StatusNotModified {
  1205. if res.Body != nil {
  1206. res.Body.Close()
  1207. }
  1208. return nil, &googleapi.Error{
  1209. Code: res.StatusCode,
  1210. Header: res.Header,
  1211. }
  1212. }
  1213. if err != nil {
  1214. return nil, err
  1215. }
  1216. defer googleapi.CloseBody(res)
  1217. if err := googleapi.CheckResponse(res); err != nil {
  1218. return nil, err
  1219. }
  1220. ret := &BucketAccessControl{
  1221. ServerResponse: googleapi.ServerResponse{
  1222. Header: res.Header,
  1223. HTTPStatusCode: res.StatusCode,
  1224. },
  1225. }
  1226. target := &ret
  1227. if err := gensupport.DecodeResponse(target, res); err != nil {
  1228. return nil, err
  1229. }
  1230. return ret, nil
  1231. // {
  1232. // "description": "Returns the ACL entry for the specified entity on the specified bucket.",
  1233. // "httpMethod": "GET",
  1234. // "id": "storage.bucketAccessControls.get",
  1235. // "parameterOrder": [
  1236. // "bucket",
  1237. // "entity"
  1238. // ],
  1239. // "parameters": {
  1240. // "bucket": {
  1241. // "description": "Name of a bucket.",
  1242. // "location": "path",
  1243. // "required": true,
  1244. // "type": "string"
  1245. // },
  1246. // "entity": {
  1247. // "description": "The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.",
  1248. // "location": "path",
  1249. // "required": true,
  1250. // "type": "string"
  1251. // }
  1252. // },
  1253. // "path": "b/{bucket}/acl/{entity}",
  1254. // "response": {
  1255. // "$ref": "BucketAccessControl"
  1256. // },
  1257. // "scopes": [
  1258. // "https://www.googleapis.com/auth/devstorage.full_control"
  1259. // ]
  1260. // }
  1261. }
  1262. // method id "storage.bucketAccessControls.insert":
  1263. type BucketAccessControlsInsertCall struct {
  1264. s *Service
  1265. bucket string
  1266. bucketaccesscontrol *BucketAccessControl
  1267. urlParams_ gensupport.URLParams
  1268. ctx_ context.Context
  1269. header_ http.Header
  1270. }
  1271. // Insert: Creates a new ACL entry on the specified bucket.
  1272. func (r *BucketAccessControlsService) Insert(bucket string, bucketaccesscontrol *BucketAccessControl) *BucketAccessControlsInsertCall {
  1273. c := &BucketAccessControlsInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1274. c.bucket = bucket
  1275. c.bucketaccesscontrol = bucketaccesscontrol
  1276. return c
  1277. }
  1278. // Fields allows partial responses to be retrieved. See
  1279. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1280. // for more information.
  1281. func (c *BucketAccessControlsInsertCall) Fields(s ...googleapi.Field) *BucketAccessControlsInsertCall {
  1282. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1283. return c
  1284. }
  1285. // Context sets the context to be used in this call's Do method. Any
  1286. // pending HTTP request will be aborted if the provided context is
  1287. // canceled.
  1288. func (c *BucketAccessControlsInsertCall) Context(ctx context.Context) *BucketAccessControlsInsertCall {
  1289. c.ctx_ = ctx
  1290. return c
  1291. }
  1292. // Header returns an http.Header that can be modified by the caller to
  1293. // add HTTP headers to the request.
  1294. func (c *BucketAccessControlsInsertCall) Header() http.Header {
  1295. if c.header_ == nil {
  1296. c.header_ = make(http.Header)
  1297. }
  1298. return c.header_
  1299. }
  1300. func (c *BucketAccessControlsInsertCall) doRequest(alt string) (*http.Response, error) {
  1301. reqHeaders := make(http.Header)
  1302. for k, v := range c.header_ {
  1303. reqHeaders[k] = v
  1304. }
  1305. reqHeaders.Set("User-Agent", c.s.userAgent())
  1306. var body io.Reader = nil
  1307. body, err := googleapi.WithoutDataWrapper.JSONReader(c.bucketaccesscontrol)
  1308. if err != nil {
  1309. return nil, err
  1310. }
  1311. reqHeaders.Set("Content-Type", "application/json")
  1312. c.urlParams_.Set("alt", alt)
  1313. c.urlParams_.Set("prettyPrint", "false")
  1314. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/acl")
  1315. urls += "?" + c.urlParams_.Encode()
  1316. req, err := http.NewRequest("POST", urls, body)
  1317. if err != nil {
  1318. return nil, err
  1319. }
  1320. req.Header = reqHeaders
  1321. googleapi.Expand(req.URL, map[string]string{
  1322. "bucket": c.bucket,
  1323. })
  1324. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1325. }
  1326. // Do executes the "storage.bucketAccessControls.insert" call.
  1327. // Exactly one of *BucketAccessControl or error will be non-nil. Any
  1328. // non-2xx status code is an error. Response headers are in either
  1329. // *BucketAccessControl.ServerResponse.Header or (if a response was
  1330. // returned at all) in error.(*googleapi.Error).Header. Use
  1331. // googleapi.IsNotModified to check whether the returned error was
  1332. // because http.StatusNotModified was returned.
  1333. func (c *BucketAccessControlsInsertCall) Do(opts ...googleapi.CallOption) (*BucketAccessControl, error) {
  1334. gensupport.SetOptions(c.urlParams_, opts...)
  1335. res, err := c.doRequest("json")
  1336. if res != nil && res.StatusCode == http.StatusNotModified {
  1337. if res.Body != nil {
  1338. res.Body.Close()
  1339. }
  1340. return nil, &googleapi.Error{
  1341. Code: res.StatusCode,
  1342. Header: res.Header,
  1343. }
  1344. }
  1345. if err != nil {
  1346. return nil, err
  1347. }
  1348. defer googleapi.CloseBody(res)
  1349. if err := googleapi.CheckResponse(res); err != nil {
  1350. return nil, err
  1351. }
  1352. ret := &BucketAccessControl{
  1353. ServerResponse: googleapi.ServerResponse{
  1354. Header: res.Header,
  1355. HTTPStatusCode: res.StatusCode,
  1356. },
  1357. }
  1358. target := &ret
  1359. if err := gensupport.DecodeResponse(target, res); err != nil {
  1360. return nil, err
  1361. }
  1362. return ret, nil
  1363. // {
  1364. // "description": "Creates a new ACL entry on the specified bucket.",
  1365. // "httpMethod": "POST",
  1366. // "id": "storage.bucketAccessControls.insert",
  1367. // "parameterOrder": [
  1368. // "bucket"
  1369. // ],
  1370. // "parameters": {
  1371. // "bucket": {
  1372. // "description": "Name of a bucket.",
  1373. // "location": "path",
  1374. // "required": true,
  1375. // "type": "string"
  1376. // }
  1377. // },
  1378. // "path": "b/{bucket}/acl",
  1379. // "request": {
  1380. // "$ref": "BucketAccessControl"
  1381. // },
  1382. // "response": {
  1383. // "$ref": "BucketAccessControl"
  1384. // },
  1385. // "scopes": [
  1386. // "https://www.googleapis.com/auth/devstorage.full_control"
  1387. // ]
  1388. // }
  1389. }
  1390. // method id "storage.bucketAccessControls.list":
  1391. type BucketAccessControlsListCall struct {
  1392. s *Service
  1393. bucket string
  1394. urlParams_ gensupport.URLParams
  1395. ifNoneMatch_ string
  1396. ctx_ context.Context
  1397. header_ http.Header
  1398. }
  1399. // List: Retrieves ACL entries on the specified bucket.
  1400. func (r *BucketAccessControlsService) List(bucket string) *BucketAccessControlsListCall {
  1401. c := &BucketAccessControlsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1402. c.bucket = bucket
  1403. return c
  1404. }
  1405. // Fields allows partial responses to be retrieved. See
  1406. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1407. // for more information.
  1408. func (c *BucketAccessControlsListCall) Fields(s ...googleapi.Field) *BucketAccessControlsListCall {
  1409. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1410. return c
  1411. }
  1412. // IfNoneMatch sets the optional parameter which makes the operation
  1413. // fail if the object's ETag matches the given value. This is useful for
  1414. // getting updates only after the object has changed since the last
  1415. // request. Use googleapi.IsNotModified to check whether the response
  1416. // error from Do is the result of In-None-Match.
  1417. func (c *BucketAccessControlsListCall) IfNoneMatch(entityTag string) *BucketAccessControlsListCall {
  1418. c.ifNoneMatch_ = entityTag
  1419. return c
  1420. }
  1421. // Context sets the context to be used in this call's Do method. Any
  1422. // pending HTTP request will be aborted if the provided context is
  1423. // canceled.
  1424. func (c *BucketAccessControlsListCall) Context(ctx context.Context) *BucketAccessControlsListCall {
  1425. c.ctx_ = ctx
  1426. return c
  1427. }
  1428. // Header returns an http.Header that can be modified by the caller to
  1429. // add HTTP headers to the request.
  1430. func (c *BucketAccessControlsListCall) Header() http.Header {
  1431. if c.header_ == nil {
  1432. c.header_ = make(http.Header)
  1433. }
  1434. return c.header_
  1435. }
  1436. func (c *BucketAccessControlsListCall) doRequest(alt string) (*http.Response, error) {
  1437. reqHeaders := make(http.Header)
  1438. for k, v := range c.header_ {
  1439. reqHeaders[k] = v
  1440. }
  1441. reqHeaders.Set("User-Agent", c.s.userAgent())
  1442. if c.ifNoneMatch_ != "" {
  1443. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1444. }
  1445. var body io.Reader = nil
  1446. c.urlParams_.Set("alt", alt)
  1447. c.urlParams_.Set("prettyPrint", "false")
  1448. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/acl")
  1449. urls += "?" + c.urlParams_.Encode()
  1450. req, err := http.NewRequest("GET", urls, body)
  1451. if err != nil {
  1452. return nil, err
  1453. }
  1454. req.Header = reqHeaders
  1455. googleapi.Expand(req.URL, map[string]string{
  1456. "bucket": c.bucket,
  1457. })
  1458. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1459. }
  1460. // Do executes the "storage.bucketAccessControls.list" call.
  1461. // Exactly one of *BucketAccessControls or error will be non-nil. Any
  1462. // non-2xx status code is an error. Response headers are in either
  1463. // *BucketAccessControls.ServerResponse.Header or (if a response was
  1464. // returned at all) in error.(*googleapi.Error).Header. Use
  1465. // googleapi.IsNotModified to check whether the returned error was
  1466. // because http.StatusNotModified was returned.
  1467. func (c *BucketAccessControlsListCall) Do(opts ...googleapi.CallOption) (*BucketAccessControls, error) {
  1468. gensupport.SetOptions(c.urlParams_, opts...)
  1469. res, err := c.doRequest("json")
  1470. if res != nil && res.StatusCode == http.StatusNotModified {
  1471. if res.Body != nil {
  1472. res.Body.Close()
  1473. }
  1474. return nil, &googleapi.Error{
  1475. Code: res.StatusCode,
  1476. Header: res.Header,
  1477. }
  1478. }
  1479. if err != nil {
  1480. return nil, err
  1481. }
  1482. defer googleapi.CloseBody(res)
  1483. if err := googleapi.CheckResponse(res); err != nil {
  1484. return nil, err
  1485. }
  1486. ret := &BucketAccessControls{
  1487. ServerResponse: googleapi.ServerResponse{
  1488. Header: res.Header,
  1489. HTTPStatusCode: res.StatusCode,
  1490. },
  1491. }
  1492. target := &ret
  1493. if err := gensupport.DecodeResponse(target, res); err != nil {
  1494. return nil, err
  1495. }
  1496. return ret, nil
  1497. // {
  1498. // "description": "Retrieves ACL entries on the specified bucket.",
  1499. // "httpMethod": "GET",
  1500. // "id": "storage.bucketAccessControls.list",
  1501. // "parameterOrder": [
  1502. // "bucket"
  1503. // ],
  1504. // "parameters": {
  1505. // "bucket": {
  1506. // "description": "Name of a bucket.",
  1507. // "location": "path",
  1508. // "required": true,
  1509. // "type": "string"
  1510. // }
  1511. // },
  1512. // "path": "b/{bucket}/acl",
  1513. // "response": {
  1514. // "$ref": "BucketAccessControls"
  1515. // },
  1516. // "scopes": [
  1517. // "https://www.googleapis.com/auth/devstorage.full_control"
  1518. // ]
  1519. // }
  1520. }
  1521. // method id "storage.bucketAccessControls.patch":
  1522. type BucketAccessControlsPatchCall struct {
  1523. s *Service
  1524. bucket string
  1525. entity string
  1526. bucketaccesscontrol *BucketAccessControl
  1527. urlParams_ gensupport.URLParams
  1528. ctx_ context.Context
  1529. header_ http.Header
  1530. }
  1531. // Patch: Updates an ACL entry on the specified bucket. This method
  1532. // supports patch semantics.
  1533. func (r *BucketAccessControlsService) Patch(bucket string, entity string, bucketaccesscontrol *BucketAccessControl) *BucketAccessControlsPatchCall {
  1534. c := &BucketAccessControlsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1535. c.bucket = bucket
  1536. c.entity = entity
  1537. c.bucketaccesscontrol = bucketaccesscontrol
  1538. return c
  1539. }
  1540. // Fields allows partial responses to be retrieved. See
  1541. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1542. // for more information.
  1543. func (c *BucketAccessControlsPatchCall) Fields(s ...googleapi.Field) *BucketAccessControlsPatchCall {
  1544. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1545. return c
  1546. }
  1547. // Context sets the context to be used in this call's Do method. Any
  1548. // pending HTTP request will be aborted if the provided context is
  1549. // canceled.
  1550. func (c *BucketAccessControlsPatchCall) Context(ctx context.Context) *BucketAccessControlsPatchCall {
  1551. c.ctx_ = ctx
  1552. return c
  1553. }
  1554. // Header returns an http.Header that can be modified by the caller to
  1555. // add HTTP headers to the request.
  1556. func (c *BucketAccessControlsPatchCall) Header() http.Header {
  1557. if c.header_ == nil {
  1558. c.header_ = make(http.Header)
  1559. }
  1560. return c.header_
  1561. }
  1562. func (c *BucketAccessControlsPatchCall) doRequest(alt string) (*http.Response, error) {
  1563. reqHeaders := make(http.Header)
  1564. for k, v := range c.header_ {
  1565. reqHeaders[k] = v
  1566. }
  1567. reqHeaders.Set("User-Agent", c.s.userAgent())
  1568. var body io.Reader = nil
  1569. body, err := googleapi.WithoutDataWrapper.JSONReader(c.bucketaccesscontrol)
  1570. if err != nil {
  1571. return nil, err
  1572. }
  1573. reqHeaders.Set("Content-Type", "application/json")
  1574. c.urlParams_.Set("alt", alt)
  1575. c.urlParams_.Set("prettyPrint", "false")
  1576. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/acl/{entity}")
  1577. urls += "?" + c.urlParams_.Encode()
  1578. req, err := http.NewRequest("PATCH", urls, body)
  1579. if err != nil {
  1580. return nil, err
  1581. }
  1582. req.Header = reqHeaders
  1583. googleapi.Expand(req.URL, map[string]string{
  1584. "bucket": c.bucket,
  1585. "entity": c.entity,
  1586. })
  1587. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1588. }
  1589. // Do executes the "storage.bucketAccessControls.patch" call.
  1590. // Exactly one of *BucketAccessControl or error will be non-nil. Any
  1591. // non-2xx status code is an error. Response headers are in either
  1592. // *BucketAccessControl.ServerResponse.Header or (if a response was
  1593. // returned at all) in error.(*googleapi.Error).Header. Use
  1594. // googleapi.IsNotModified to check whether the returned error was
  1595. // because http.StatusNotModified was returned.
  1596. func (c *BucketAccessControlsPatchCall) Do(opts ...googleapi.CallOption) (*BucketAccessControl, error) {
  1597. gensupport.SetOptions(c.urlParams_, opts...)
  1598. res, err := c.doRequest("json")
  1599. if res != nil && res.StatusCode == http.StatusNotModified {
  1600. if res.Body != nil {
  1601. res.Body.Close()
  1602. }
  1603. return nil, &googleapi.Error{
  1604. Code: res.StatusCode,
  1605. Header: res.Header,
  1606. }
  1607. }
  1608. if err != nil {
  1609. return nil, err
  1610. }
  1611. defer googleapi.CloseBody(res)
  1612. if err := googleapi.CheckResponse(res); err != nil {
  1613. return nil, err
  1614. }
  1615. ret := &BucketAccessControl{
  1616. ServerResponse: googleapi.ServerResponse{
  1617. Header: res.Header,
  1618. HTTPStatusCode: res.StatusCode,
  1619. },
  1620. }
  1621. target := &ret
  1622. if err := gensupport.DecodeResponse(target, res); err != nil {
  1623. return nil, err
  1624. }
  1625. return ret, nil
  1626. // {
  1627. // "description": "Updates an ACL entry on the specified bucket. This method supports patch semantics.",
  1628. // "httpMethod": "PATCH",
  1629. // "id": "storage.bucketAccessControls.patch",
  1630. // "parameterOrder": [
  1631. // "bucket",
  1632. // "entity"
  1633. // ],
  1634. // "parameters": {
  1635. // "bucket": {
  1636. // "description": "Name of a bucket.",
  1637. // "location": "path",
  1638. // "required": true,
  1639. // "type": "string"
  1640. // },
  1641. // "entity": {
  1642. // "description": "The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.",
  1643. // "location": "path",
  1644. // "required": true,
  1645. // "type": "string"
  1646. // }
  1647. // },
  1648. // "path": "b/{bucket}/acl/{entity}",
  1649. // "request": {
  1650. // "$ref": "BucketAccessControl"
  1651. // },
  1652. // "response": {
  1653. // "$ref": "BucketAccessControl"
  1654. // },
  1655. // "scopes": [
  1656. // "https://www.googleapis.com/auth/devstorage.full_control"
  1657. // ]
  1658. // }
  1659. }
  1660. // method id "storage.bucketAccessControls.update":
  1661. type BucketAccessControlsUpdateCall struct {
  1662. s *Service
  1663. bucket string
  1664. entity string
  1665. bucketaccesscontrol *BucketAccessControl
  1666. urlParams_ gensupport.URLParams
  1667. ctx_ context.Context
  1668. header_ http.Header
  1669. }
  1670. // Update: Updates an ACL entry on the specified bucket.
  1671. func (r *BucketAccessControlsService) Update(bucket string, entity string, bucketaccesscontrol *BucketAccessControl) *BucketAccessControlsUpdateCall {
  1672. c := &BucketAccessControlsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1673. c.bucket = bucket
  1674. c.entity = entity
  1675. c.bucketaccesscontrol = bucketaccesscontrol
  1676. return c
  1677. }
  1678. // Fields allows partial responses to be retrieved. See
  1679. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1680. // for more information.
  1681. func (c *BucketAccessControlsUpdateCall) Fields(s ...googleapi.Field) *BucketAccessControlsUpdateCall {
  1682. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1683. return c
  1684. }
  1685. // Context sets the context to be used in this call's Do method. Any
  1686. // pending HTTP request will be aborted if the provided context is
  1687. // canceled.
  1688. func (c *BucketAccessControlsUpdateCall) Context(ctx context.Context) *BucketAccessControlsUpdateCall {
  1689. c.ctx_ = ctx
  1690. return c
  1691. }
  1692. // Header returns an http.Header that can be modified by the caller to
  1693. // add HTTP headers to the request.
  1694. func (c *BucketAccessControlsUpdateCall) Header() http.Header {
  1695. if c.header_ == nil {
  1696. c.header_ = make(http.Header)
  1697. }
  1698. return c.header_
  1699. }
  1700. func (c *BucketAccessControlsUpdateCall) doRequest(alt string) (*http.Response, error) {
  1701. reqHeaders := make(http.Header)
  1702. for k, v := range c.header_ {
  1703. reqHeaders[k] = v
  1704. }
  1705. reqHeaders.Set("User-Agent", c.s.userAgent())
  1706. var body io.Reader = nil
  1707. body, err := googleapi.WithoutDataWrapper.JSONReader(c.bucketaccesscontrol)
  1708. if err != nil {
  1709. return nil, err
  1710. }
  1711. reqHeaders.Set("Content-Type", "application/json")
  1712. c.urlParams_.Set("alt", alt)
  1713. c.urlParams_.Set("prettyPrint", "false")
  1714. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/acl/{entity}")
  1715. urls += "?" + c.urlParams_.Encode()
  1716. req, err := http.NewRequest("PUT", urls, body)
  1717. if err != nil {
  1718. return nil, err
  1719. }
  1720. req.Header = reqHeaders
  1721. googleapi.Expand(req.URL, map[string]string{
  1722. "bucket": c.bucket,
  1723. "entity": c.entity,
  1724. })
  1725. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1726. }
  1727. // Do executes the "storage.bucketAccessControls.update" call.
  1728. // Exactly one of *BucketAccessControl or error will be non-nil. Any
  1729. // non-2xx status code is an error. Response headers are in either
  1730. // *BucketAccessControl.ServerResponse.Header or (if a response was
  1731. // returned at all) in error.(*googleapi.Error).Header. Use
  1732. // googleapi.IsNotModified to check whether the returned error was
  1733. // because http.StatusNotModified was returned.
  1734. func (c *BucketAccessControlsUpdateCall) Do(opts ...googleapi.CallOption) (*BucketAccessControl, error) {
  1735. gensupport.SetOptions(c.urlParams_, opts...)
  1736. res, err := c.doRequest("json")
  1737. if res != nil && res.StatusCode == http.StatusNotModified {
  1738. if res.Body != nil {
  1739. res.Body.Close()
  1740. }
  1741. return nil, &googleapi.Error{
  1742. Code: res.StatusCode,
  1743. Header: res.Header,
  1744. }
  1745. }
  1746. if err != nil {
  1747. return nil, err
  1748. }
  1749. defer googleapi.CloseBody(res)
  1750. if err := googleapi.CheckResponse(res); err != nil {
  1751. return nil, err
  1752. }
  1753. ret := &BucketAccessControl{
  1754. ServerResponse: googleapi.ServerResponse{
  1755. Header: res.Header,
  1756. HTTPStatusCode: res.StatusCode,
  1757. },
  1758. }
  1759. target := &ret
  1760. if err := gensupport.DecodeResponse(target, res); err != nil {
  1761. return nil, err
  1762. }
  1763. return ret, nil
  1764. // {
  1765. // "description": "Updates an ACL entry on the specified bucket.",
  1766. // "httpMethod": "PUT",
  1767. // "id": "storage.bucketAccessControls.update",
  1768. // "parameterOrder": [
  1769. // "bucket",
  1770. // "entity"
  1771. // ],
  1772. // "parameters": {
  1773. // "bucket": {
  1774. // "description": "Name of a bucket.",
  1775. // "location": "path",
  1776. // "required": true,
  1777. // "type": "string"
  1778. // },
  1779. // "entity": {
  1780. // "description": "The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.",
  1781. // "location": "path",
  1782. // "required": true,
  1783. // "type": "string"
  1784. // }
  1785. // },
  1786. // "path": "b/{bucket}/acl/{entity}",
  1787. // "request": {
  1788. // "$ref": "BucketAccessControl"
  1789. // },
  1790. // "response": {
  1791. // "$ref": "BucketAccessControl"
  1792. // },
  1793. // "scopes": [
  1794. // "https://www.googleapis.com/auth/devstorage.full_control"
  1795. // ]
  1796. // }
  1797. }
  1798. // method id "storage.buckets.delete":
  1799. type BucketsDeleteCall struct {
  1800. s *Service
  1801. bucket string
  1802. urlParams_ gensupport.URLParams
  1803. ctx_ context.Context
  1804. header_ http.Header
  1805. }
  1806. // Delete: Permanently deletes an empty bucket.
  1807. func (r *BucketsService) Delete(bucket string) *BucketsDeleteCall {
  1808. c := &BucketsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1809. c.bucket = bucket
  1810. return c
  1811. }
  1812. // IfMetagenerationMatch sets the optional parameter
  1813. // "ifMetagenerationMatch": Makes the return of the bucket metadata
  1814. // conditional on whether the bucket's current metageneration matches
  1815. // the given value.
  1816. func (c *BucketsDeleteCall) IfMetagenerationMatch(ifMetagenerationMatch uint64) *BucketsDeleteCall {
  1817. c.urlParams_.Set("ifMetagenerationMatch", fmt.Sprint(ifMetagenerationMatch))
  1818. return c
  1819. }
  1820. // IfMetagenerationNotMatch sets the optional parameter
  1821. // "ifMetagenerationNotMatch": Makes the return of the bucket metadata
  1822. // conditional on whether the bucket's current metageneration does not
  1823. // match the given value.
  1824. func (c *BucketsDeleteCall) IfMetagenerationNotMatch(ifMetagenerationNotMatch uint64) *BucketsDeleteCall {
  1825. c.urlParams_.Set("ifMetagenerationNotMatch", fmt.Sprint(ifMetagenerationNotMatch))
  1826. return c
  1827. }
  1828. // Fields allows partial responses to be retrieved. See
  1829. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1830. // for more information.
  1831. func (c *BucketsDeleteCall) Fields(s ...googleapi.Field) *BucketsDeleteCall {
  1832. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1833. return c
  1834. }
  1835. // Context sets the context to be used in this call's Do method. Any
  1836. // pending HTTP request will be aborted if the provided context is
  1837. // canceled.
  1838. func (c *BucketsDeleteCall) Context(ctx context.Context) *BucketsDeleteCall {
  1839. c.ctx_ = ctx
  1840. return c
  1841. }
  1842. // Header returns an http.Header that can be modified by the caller to
  1843. // add HTTP headers to the request.
  1844. func (c *BucketsDeleteCall) Header() http.Header {
  1845. if c.header_ == nil {
  1846. c.header_ = make(http.Header)
  1847. }
  1848. return c.header_
  1849. }
  1850. func (c *BucketsDeleteCall) doRequest(alt string) (*http.Response, error) {
  1851. reqHeaders := make(http.Header)
  1852. for k, v := range c.header_ {
  1853. reqHeaders[k] = v
  1854. }
  1855. reqHeaders.Set("User-Agent", c.s.userAgent())
  1856. var body io.Reader = nil
  1857. c.urlParams_.Set("alt", alt)
  1858. c.urlParams_.Set("prettyPrint", "false")
  1859. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}")
  1860. urls += "?" + c.urlParams_.Encode()
  1861. req, err := http.NewRequest("DELETE", urls, body)
  1862. if err != nil {
  1863. return nil, err
  1864. }
  1865. req.Header = reqHeaders
  1866. googleapi.Expand(req.URL, map[string]string{
  1867. "bucket": c.bucket,
  1868. })
  1869. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1870. }
  1871. // Do executes the "storage.buckets.delete" call.
  1872. func (c *BucketsDeleteCall) Do(opts ...googleapi.CallOption) error {
  1873. gensupport.SetOptions(c.urlParams_, opts...)
  1874. res, err := c.doRequest("json")
  1875. if err != nil {
  1876. return err
  1877. }
  1878. defer googleapi.CloseBody(res)
  1879. if err := googleapi.CheckResponse(res); err != nil {
  1880. return err
  1881. }
  1882. return nil
  1883. // {
  1884. // "description": "Permanently deletes an empty bucket.",
  1885. // "httpMethod": "DELETE",
  1886. // "id": "storage.buckets.delete",
  1887. // "parameterOrder": [
  1888. // "bucket"
  1889. // ],
  1890. // "parameters": {
  1891. // "bucket": {
  1892. // "description": "Name of a bucket.",
  1893. // "location": "path",
  1894. // "required": true,
  1895. // "type": "string"
  1896. // },
  1897. // "ifMetagenerationMatch": {
  1898. // "description": "Makes the return of the bucket metadata conditional on whether the bucket's current metageneration matches the given value.",
  1899. // "format": "uint64",
  1900. // "location": "query",
  1901. // "type": "string"
  1902. // },
  1903. // "ifMetagenerationNotMatch": {
  1904. // "description": "Makes the return of the bucket metadata conditional on whether the bucket's current metageneration does not match the given value.",
  1905. // "format": "uint64",
  1906. // "location": "query",
  1907. // "type": "string"
  1908. // }
  1909. // },
  1910. // "path": "b/{bucket}",
  1911. // "scopes": [
  1912. // "https://www.googleapis.com/auth/devstorage.full_control",
  1913. // "https://www.googleapis.com/auth/devstorage.read_write"
  1914. // ]
  1915. // }
  1916. }
  1917. // method id "storage.buckets.get":
  1918. type BucketsGetCall struct {
  1919. s *Service
  1920. bucket string
  1921. urlParams_ gensupport.URLParams
  1922. ifNoneMatch_ string
  1923. ctx_ context.Context
  1924. header_ http.Header
  1925. }
  1926. // Get: Returns metadata for the specified bucket.
  1927. func (r *BucketsService) Get(bucket string) *BucketsGetCall {
  1928. c := &BucketsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1929. c.bucket = bucket
  1930. return c
  1931. }
  1932. // IfMetagenerationMatch sets the optional parameter
  1933. // "ifMetagenerationMatch": Makes the return of the bucket metadata
  1934. // conditional on whether the bucket's current metageneration matches
  1935. // the given value.
  1936. func (c *BucketsGetCall) IfMetagenerationMatch(ifMetagenerationMatch uint64) *BucketsGetCall {
  1937. c.urlParams_.Set("ifMetagenerationMatch", fmt.Sprint(ifMetagenerationMatch))
  1938. return c
  1939. }
  1940. // IfMetagenerationNotMatch sets the optional parameter
  1941. // "ifMetagenerationNotMatch": Makes the return of the bucket metadata
  1942. // conditional on whether the bucket's current metageneration does not
  1943. // match the given value.
  1944. func (c *BucketsGetCall) IfMetagenerationNotMatch(ifMetagenerationNotMatch uint64) *BucketsGetCall {
  1945. c.urlParams_.Set("ifMetagenerationNotMatch", fmt.Sprint(ifMetagenerationNotMatch))
  1946. return c
  1947. }
  1948. // Projection sets the optional parameter "projection": Set of
  1949. // properties to return. Defaults to noAcl.
  1950. //
  1951. // Possible values:
  1952. // "full" - Include all properties.
  1953. // "noAcl" - Omit acl and defaultObjectAcl properties.
  1954. func (c *BucketsGetCall) Projection(projection string) *BucketsGetCall {
  1955. c.urlParams_.Set("projection", projection)
  1956. return c
  1957. }
  1958. // Fields allows partial responses to be retrieved. See
  1959. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1960. // for more information.
  1961. func (c *BucketsGetCall) Fields(s ...googleapi.Field) *BucketsGetCall {
  1962. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1963. return c
  1964. }
  1965. // IfNoneMatch sets the optional parameter which makes the operation
  1966. // fail if the object's ETag matches the given value. This is useful for
  1967. // getting updates only after the object has changed since the last
  1968. // request. Use googleapi.IsNotModified to check whether the response
  1969. // error from Do is the result of In-None-Match.
  1970. func (c *BucketsGetCall) IfNoneMatch(entityTag string) *BucketsGetCall {
  1971. c.ifNoneMatch_ = entityTag
  1972. return c
  1973. }
  1974. // Context sets the context to be used in this call's Do method. Any
  1975. // pending HTTP request will be aborted if the provided context is
  1976. // canceled.
  1977. func (c *BucketsGetCall) Context(ctx context.Context) *BucketsGetCall {
  1978. c.ctx_ = ctx
  1979. return c
  1980. }
  1981. // Header returns an http.Header that can be modified by the caller to
  1982. // add HTTP headers to the request.
  1983. func (c *BucketsGetCall) Header() http.Header {
  1984. if c.header_ == nil {
  1985. c.header_ = make(http.Header)
  1986. }
  1987. return c.header_
  1988. }
  1989. func (c *BucketsGetCall) doRequest(alt string) (*http.Response, error) {
  1990. reqHeaders := make(http.Header)
  1991. for k, v := range c.header_ {
  1992. reqHeaders[k] = v
  1993. }
  1994. reqHeaders.Set("User-Agent", c.s.userAgent())
  1995. if c.ifNoneMatch_ != "" {
  1996. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1997. }
  1998. var body io.Reader = nil
  1999. c.urlParams_.Set("alt", alt)
  2000. c.urlParams_.Set("prettyPrint", "false")
  2001. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}")
  2002. urls += "?" + c.urlParams_.Encode()
  2003. req, err := http.NewRequest("GET", urls, body)
  2004. if err != nil {
  2005. return nil, err
  2006. }
  2007. req.Header = reqHeaders
  2008. googleapi.Expand(req.URL, map[string]string{
  2009. "bucket": c.bucket,
  2010. })
  2011. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2012. }
  2013. // Do executes the "storage.buckets.get" call.
  2014. // Exactly one of *Bucket or error will be non-nil. Any non-2xx status
  2015. // code is an error. Response headers are in either
  2016. // *Bucket.ServerResponse.Header or (if a response was returned at all)
  2017. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2018. // check whether the returned error was because http.StatusNotModified
  2019. // was returned.
  2020. func (c *BucketsGetCall) Do(opts ...googleapi.CallOption) (*Bucket, error) {
  2021. gensupport.SetOptions(c.urlParams_, opts...)
  2022. res, err := c.doRequest("json")
  2023. if res != nil && res.StatusCode == http.StatusNotModified {
  2024. if res.Body != nil {
  2025. res.Body.Close()
  2026. }
  2027. return nil, &googleapi.Error{
  2028. Code: res.StatusCode,
  2029. Header: res.Header,
  2030. }
  2031. }
  2032. if err != nil {
  2033. return nil, err
  2034. }
  2035. defer googleapi.CloseBody(res)
  2036. if err := googleapi.CheckResponse(res); err != nil {
  2037. return nil, err
  2038. }
  2039. ret := &Bucket{
  2040. ServerResponse: googleapi.ServerResponse{
  2041. Header: res.Header,
  2042. HTTPStatusCode: res.StatusCode,
  2043. },
  2044. }
  2045. target := &ret
  2046. if err := gensupport.DecodeResponse(target, res); err != nil {
  2047. return nil, err
  2048. }
  2049. return ret, nil
  2050. // {
  2051. // "description": "Returns metadata for the specified bucket.",
  2052. // "httpMethod": "GET",
  2053. // "id": "storage.buckets.get",
  2054. // "parameterOrder": [
  2055. // "bucket"
  2056. // ],
  2057. // "parameters": {
  2058. // "bucket": {
  2059. // "description": "Name of a bucket.",
  2060. // "location": "path",
  2061. // "required": true,
  2062. // "type": "string"
  2063. // },
  2064. // "ifMetagenerationMatch": {
  2065. // "description": "Makes the return of the bucket metadata conditional on whether the bucket's current metageneration matches the given value.",
  2066. // "format": "uint64",
  2067. // "location": "query",
  2068. // "type": "string"
  2069. // },
  2070. // "ifMetagenerationNotMatch": {
  2071. // "description": "Makes the return of the bucket metadata conditional on whether the bucket's current metageneration does not match the given value.",
  2072. // "format": "uint64",
  2073. // "location": "query",
  2074. // "type": "string"
  2075. // },
  2076. // "projection": {
  2077. // "description": "Set of properties to return. Defaults to noAcl.",
  2078. // "enum": [
  2079. // "full",
  2080. // "noAcl"
  2081. // ],
  2082. // "enumDescriptions": [
  2083. // "Include all properties.",
  2084. // "Omit acl and defaultObjectAcl properties."
  2085. // ],
  2086. // "location": "query",
  2087. // "type": "string"
  2088. // }
  2089. // },
  2090. // "path": "b/{bucket}",
  2091. // "response": {
  2092. // "$ref": "Bucket"
  2093. // },
  2094. // "scopes": [
  2095. // "https://www.googleapis.com/auth/devstorage.full_control",
  2096. // "https://www.googleapis.com/auth/devstorage.read_only",
  2097. // "https://www.googleapis.com/auth/devstorage.read_write"
  2098. // ]
  2099. // }
  2100. }
  2101. // method id "storage.buckets.insert":
  2102. type BucketsInsertCall struct {
  2103. s *Service
  2104. bucket *Bucket
  2105. urlParams_ gensupport.URLParams
  2106. ctx_ context.Context
  2107. header_ http.Header
  2108. }
  2109. // Insert: Creates a new bucket.
  2110. func (r *BucketsService) Insert(projectid string, bucket *Bucket) *BucketsInsertCall {
  2111. c := &BucketsInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2112. c.urlParams_.Set("project", projectid)
  2113. c.bucket = bucket
  2114. return c
  2115. }
  2116. // Projection sets the optional parameter "projection": Set of
  2117. // properties to return. Defaults to noAcl, unless the bucket resource
  2118. // specifies acl or defaultObjectAcl properties, when it defaults to
  2119. // full.
  2120. //
  2121. // Possible values:
  2122. // "full" - Include all properties.
  2123. // "noAcl" - Omit acl and defaultObjectAcl properties.
  2124. func (c *BucketsInsertCall) Projection(projection string) *BucketsInsertCall {
  2125. c.urlParams_.Set("projection", projection)
  2126. return c
  2127. }
  2128. // Fields allows partial responses to be retrieved. See
  2129. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2130. // for more information.
  2131. func (c *BucketsInsertCall) Fields(s ...googleapi.Field) *BucketsInsertCall {
  2132. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2133. return c
  2134. }
  2135. // Context sets the context to be used in this call's Do method. Any
  2136. // pending HTTP request will be aborted if the provided context is
  2137. // canceled.
  2138. func (c *BucketsInsertCall) Context(ctx context.Context) *BucketsInsertCall {
  2139. c.ctx_ = ctx
  2140. return c
  2141. }
  2142. // Header returns an http.Header that can be modified by the caller to
  2143. // add HTTP headers to the request.
  2144. func (c *BucketsInsertCall) Header() http.Header {
  2145. if c.header_ == nil {
  2146. c.header_ = make(http.Header)
  2147. }
  2148. return c.header_
  2149. }
  2150. func (c *BucketsInsertCall) doRequest(alt string) (*http.Response, error) {
  2151. reqHeaders := make(http.Header)
  2152. for k, v := range c.header_ {
  2153. reqHeaders[k] = v
  2154. }
  2155. reqHeaders.Set("User-Agent", c.s.userAgent())
  2156. var body io.Reader = nil
  2157. body, err := googleapi.WithoutDataWrapper.JSONReader(c.bucket)
  2158. if err != nil {
  2159. return nil, err
  2160. }
  2161. reqHeaders.Set("Content-Type", "application/json")
  2162. c.urlParams_.Set("alt", alt)
  2163. c.urlParams_.Set("prettyPrint", "false")
  2164. urls := googleapi.ResolveRelative(c.s.BasePath, "b")
  2165. urls += "?" + c.urlParams_.Encode()
  2166. req, err := http.NewRequest("POST", urls, body)
  2167. if err != nil {
  2168. return nil, err
  2169. }
  2170. req.Header = reqHeaders
  2171. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2172. }
  2173. // Do executes the "storage.buckets.insert" call.
  2174. // Exactly one of *Bucket or error will be non-nil. Any non-2xx status
  2175. // code is an error. Response headers are in either
  2176. // *Bucket.ServerResponse.Header or (if a response was returned at all)
  2177. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2178. // check whether the returned error was because http.StatusNotModified
  2179. // was returned.
  2180. func (c *BucketsInsertCall) Do(opts ...googleapi.CallOption) (*Bucket, error) {
  2181. gensupport.SetOptions(c.urlParams_, opts...)
  2182. res, err := c.doRequest("json")
  2183. if res != nil && res.StatusCode == http.StatusNotModified {
  2184. if res.Body != nil {
  2185. res.Body.Close()
  2186. }
  2187. return nil, &googleapi.Error{
  2188. Code: res.StatusCode,
  2189. Header: res.Header,
  2190. }
  2191. }
  2192. if err != nil {
  2193. return nil, err
  2194. }
  2195. defer googleapi.CloseBody(res)
  2196. if err := googleapi.CheckResponse(res); err != nil {
  2197. return nil, err
  2198. }
  2199. ret := &Bucket{
  2200. ServerResponse: googleapi.ServerResponse{
  2201. Header: res.Header,
  2202. HTTPStatusCode: res.StatusCode,
  2203. },
  2204. }
  2205. target := &ret
  2206. if err := gensupport.DecodeResponse(target, res); err != nil {
  2207. return nil, err
  2208. }
  2209. return ret, nil
  2210. // {
  2211. // "description": "Creates a new bucket.",
  2212. // "httpMethod": "POST",
  2213. // "id": "storage.buckets.insert",
  2214. // "parameterOrder": [
  2215. // "project"
  2216. // ],
  2217. // "parameters": {
  2218. // "project": {
  2219. // "description": "A valid API project identifier.",
  2220. // "location": "query",
  2221. // "required": true,
  2222. // "type": "string"
  2223. // },
  2224. // "projection": {
  2225. // "description": "Set of properties to return. Defaults to noAcl, unless the bucket resource specifies acl or defaultObjectAcl properties, when it defaults to full.",
  2226. // "enum": [
  2227. // "full",
  2228. // "noAcl"
  2229. // ],
  2230. // "enumDescriptions": [
  2231. // "Include all properties.",
  2232. // "Omit acl and defaultObjectAcl properties."
  2233. // ],
  2234. // "location": "query",
  2235. // "type": "string"
  2236. // }
  2237. // },
  2238. // "path": "b",
  2239. // "request": {
  2240. // "$ref": "Bucket"
  2241. // },
  2242. // "response": {
  2243. // "$ref": "Bucket"
  2244. // },
  2245. // "scopes": [
  2246. // "https://www.googleapis.com/auth/devstorage.full_control",
  2247. // "https://www.googleapis.com/auth/devstorage.read_write"
  2248. // ]
  2249. // }
  2250. }
  2251. // method id "storage.buckets.list":
  2252. type BucketsListCall struct {
  2253. s *Service
  2254. urlParams_ gensupport.URLParams
  2255. ifNoneMatch_ string
  2256. ctx_ context.Context
  2257. header_ http.Header
  2258. }
  2259. // List: Retrieves a list of buckets for a given project.
  2260. func (r *BucketsService) List(projectid string) *BucketsListCall {
  2261. c := &BucketsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2262. c.urlParams_.Set("project", projectid)
  2263. return c
  2264. }
  2265. // MaxResults sets the optional parameter "maxResults": Maximum number
  2266. // of buckets to return.
  2267. func (c *BucketsListCall) MaxResults(maxResults int64) *BucketsListCall {
  2268. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  2269. return c
  2270. }
  2271. // PageToken sets the optional parameter "pageToken": A
  2272. // previously-returned page token representing part of the larger set of
  2273. // results to view.
  2274. func (c *BucketsListCall) PageToken(pageToken string) *BucketsListCall {
  2275. c.urlParams_.Set("pageToken", pageToken)
  2276. return c
  2277. }
  2278. // Projection sets the optional parameter "projection": Set of
  2279. // properties to return. Defaults to noAcl.
  2280. //
  2281. // Possible values:
  2282. // "full" - Include all properties.
  2283. // "noAcl" - Omit acl and defaultObjectAcl properties.
  2284. func (c *BucketsListCall) Projection(projection string) *BucketsListCall {
  2285. c.urlParams_.Set("projection", projection)
  2286. return c
  2287. }
  2288. // Fields allows partial responses to be retrieved. See
  2289. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2290. // for more information.
  2291. func (c *BucketsListCall) Fields(s ...googleapi.Field) *BucketsListCall {
  2292. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2293. return c
  2294. }
  2295. // IfNoneMatch sets the optional parameter which makes the operation
  2296. // fail if the object's ETag matches the given value. This is useful for
  2297. // getting updates only after the object has changed since the last
  2298. // request. Use googleapi.IsNotModified to check whether the response
  2299. // error from Do is the result of In-None-Match.
  2300. func (c *BucketsListCall) IfNoneMatch(entityTag string) *BucketsListCall {
  2301. c.ifNoneMatch_ = entityTag
  2302. return c
  2303. }
  2304. // Context sets the context to be used in this call's Do method. Any
  2305. // pending HTTP request will be aborted if the provided context is
  2306. // canceled.
  2307. func (c *BucketsListCall) Context(ctx context.Context) *BucketsListCall {
  2308. c.ctx_ = ctx
  2309. return c
  2310. }
  2311. // Header returns an http.Header that can be modified by the caller to
  2312. // add HTTP headers to the request.
  2313. func (c *BucketsListCall) Header() http.Header {
  2314. if c.header_ == nil {
  2315. c.header_ = make(http.Header)
  2316. }
  2317. return c.header_
  2318. }
  2319. func (c *BucketsListCall) doRequest(alt string) (*http.Response, error) {
  2320. reqHeaders := make(http.Header)
  2321. for k, v := range c.header_ {
  2322. reqHeaders[k] = v
  2323. }
  2324. reqHeaders.Set("User-Agent", c.s.userAgent())
  2325. if c.ifNoneMatch_ != "" {
  2326. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2327. }
  2328. var body io.Reader = nil
  2329. c.urlParams_.Set("alt", alt)
  2330. c.urlParams_.Set("prettyPrint", "false")
  2331. urls := googleapi.ResolveRelative(c.s.BasePath, "b")
  2332. urls += "?" + c.urlParams_.Encode()
  2333. req, err := http.NewRequest("GET", urls, body)
  2334. if err != nil {
  2335. return nil, err
  2336. }
  2337. req.Header = reqHeaders
  2338. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2339. }
  2340. // Do executes the "storage.buckets.list" call.
  2341. // Exactly one of *Buckets or error will be non-nil. Any non-2xx status
  2342. // code is an error. Response headers are in either
  2343. // *Buckets.ServerResponse.Header or (if a response was returned at all)
  2344. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2345. // check whether the returned error was because http.StatusNotModified
  2346. // was returned.
  2347. func (c *BucketsListCall) Do(opts ...googleapi.CallOption) (*Buckets, error) {
  2348. gensupport.SetOptions(c.urlParams_, opts...)
  2349. res, err := c.doRequest("json")
  2350. if res != nil && res.StatusCode == http.StatusNotModified {
  2351. if res.Body != nil {
  2352. res.Body.Close()
  2353. }
  2354. return nil, &googleapi.Error{
  2355. Code: res.StatusCode,
  2356. Header: res.Header,
  2357. }
  2358. }
  2359. if err != nil {
  2360. return nil, err
  2361. }
  2362. defer googleapi.CloseBody(res)
  2363. if err := googleapi.CheckResponse(res); err != nil {
  2364. return nil, err
  2365. }
  2366. ret := &Buckets{
  2367. ServerResponse: googleapi.ServerResponse{
  2368. Header: res.Header,
  2369. HTTPStatusCode: res.StatusCode,
  2370. },
  2371. }
  2372. target := &ret
  2373. if err := gensupport.DecodeResponse(target, res); err != nil {
  2374. return nil, err
  2375. }
  2376. return ret, nil
  2377. // {
  2378. // "description": "Retrieves a list of buckets for a given project.",
  2379. // "httpMethod": "GET",
  2380. // "id": "storage.buckets.list",
  2381. // "parameterOrder": [
  2382. // "project"
  2383. // ],
  2384. // "parameters": {
  2385. // "maxResults": {
  2386. // "description": "Maximum number of buckets to return.",
  2387. // "format": "uint32",
  2388. // "location": "query",
  2389. // "minimum": "0",
  2390. // "type": "integer"
  2391. // },
  2392. // "pageToken": {
  2393. // "description": "A previously-returned page token representing part of the larger set of results to view.",
  2394. // "location": "query",
  2395. // "type": "string"
  2396. // },
  2397. // "project": {
  2398. // "description": "A valid API project identifier.",
  2399. // "location": "query",
  2400. // "required": true,
  2401. // "type": "string"
  2402. // },
  2403. // "projection": {
  2404. // "description": "Set of properties to return. Defaults to noAcl.",
  2405. // "enum": [
  2406. // "full",
  2407. // "noAcl"
  2408. // ],
  2409. // "enumDescriptions": [
  2410. // "Include all properties.",
  2411. // "Omit acl and defaultObjectAcl properties."
  2412. // ],
  2413. // "location": "query",
  2414. // "type": "string"
  2415. // }
  2416. // },
  2417. // "path": "b",
  2418. // "response": {
  2419. // "$ref": "Buckets"
  2420. // },
  2421. // "scopes": [
  2422. // "https://www.googleapis.com/auth/devstorage.full_control",
  2423. // "https://www.googleapis.com/auth/devstorage.read_only",
  2424. // "https://www.googleapis.com/auth/devstorage.read_write"
  2425. // ]
  2426. // }
  2427. }
  2428. // Pages invokes f for each page of results.
  2429. // A non-nil error returned from f will halt the iteration.
  2430. // The provided context supersedes any context provided to the Context method.
  2431. func (c *BucketsListCall) Pages(ctx context.Context, f func(*Buckets) error) error {
  2432. c.ctx_ = ctx
  2433. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  2434. for {
  2435. x, err := c.Do()
  2436. if err != nil {
  2437. return err
  2438. }
  2439. if err := f(x); err != nil {
  2440. return err
  2441. }
  2442. if x.NextPageToken == "" {
  2443. return nil
  2444. }
  2445. c.PageToken(x.NextPageToken)
  2446. }
  2447. }
  2448. // method id "storage.buckets.patch":
  2449. type BucketsPatchCall struct {
  2450. s *Service
  2451. bucket string
  2452. bucket2 *Bucket
  2453. urlParams_ gensupport.URLParams
  2454. ctx_ context.Context
  2455. header_ http.Header
  2456. }
  2457. // Patch: Updates a bucket. This method supports patch semantics.
  2458. func (r *BucketsService) Patch(bucket string, bucket2 *Bucket) *BucketsPatchCall {
  2459. c := &BucketsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2460. c.bucket = bucket
  2461. c.bucket2 = bucket2
  2462. return c
  2463. }
  2464. // IfMetagenerationMatch sets the optional parameter
  2465. // "ifMetagenerationMatch": Makes the return of the bucket metadata
  2466. // conditional on whether the bucket's current metageneration matches
  2467. // the given value.
  2468. func (c *BucketsPatchCall) IfMetagenerationMatch(ifMetagenerationMatch uint64) *BucketsPatchCall {
  2469. c.urlParams_.Set("ifMetagenerationMatch", fmt.Sprint(ifMetagenerationMatch))
  2470. return c
  2471. }
  2472. // IfMetagenerationNotMatch sets the optional parameter
  2473. // "ifMetagenerationNotMatch": Makes the return of the bucket metadata
  2474. // conditional on whether the bucket's current metageneration does not
  2475. // match the given value.
  2476. func (c *BucketsPatchCall) IfMetagenerationNotMatch(ifMetagenerationNotMatch uint64) *BucketsPatchCall {
  2477. c.urlParams_.Set("ifMetagenerationNotMatch", fmt.Sprint(ifMetagenerationNotMatch))
  2478. return c
  2479. }
  2480. // Projection sets the optional parameter "projection": Set of
  2481. // properties to return. Defaults to full.
  2482. //
  2483. // Possible values:
  2484. // "full" - Include all properties.
  2485. // "noAcl" - Omit acl and defaultObjectAcl properties.
  2486. func (c *BucketsPatchCall) Projection(projection string) *BucketsPatchCall {
  2487. c.urlParams_.Set("projection", projection)
  2488. return c
  2489. }
  2490. // Fields allows partial responses to be retrieved. See
  2491. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2492. // for more information.
  2493. func (c *BucketsPatchCall) Fields(s ...googleapi.Field) *BucketsPatchCall {
  2494. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2495. return c
  2496. }
  2497. // Context sets the context to be used in this call's Do method. Any
  2498. // pending HTTP request will be aborted if the provided context is
  2499. // canceled.
  2500. func (c *BucketsPatchCall) Context(ctx context.Context) *BucketsPatchCall {
  2501. c.ctx_ = ctx
  2502. return c
  2503. }
  2504. // Header returns an http.Header that can be modified by the caller to
  2505. // add HTTP headers to the request.
  2506. func (c *BucketsPatchCall) Header() http.Header {
  2507. if c.header_ == nil {
  2508. c.header_ = make(http.Header)
  2509. }
  2510. return c.header_
  2511. }
  2512. func (c *BucketsPatchCall) doRequest(alt string) (*http.Response, error) {
  2513. reqHeaders := make(http.Header)
  2514. for k, v := range c.header_ {
  2515. reqHeaders[k] = v
  2516. }
  2517. reqHeaders.Set("User-Agent", c.s.userAgent())
  2518. var body io.Reader = nil
  2519. body, err := googleapi.WithoutDataWrapper.JSONReader(c.bucket2)
  2520. if err != nil {
  2521. return nil, err
  2522. }
  2523. reqHeaders.Set("Content-Type", "application/json")
  2524. c.urlParams_.Set("alt", alt)
  2525. c.urlParams_.Set("prettyPrint", "false")
  2526. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}")
  2527. urls += "?" + c.urlParams_.Encode()
  2528. req, err := http.NewRequest("PATCH", urls, body)
  2529. if err != nil {
  2530. return nil, err
  2531. }
  2532. req.Header = reqHeaders
  2533. googleapi.Expand(req.URL, map[string]string{
  2534. "bucket": c.bucket,
  2535. })
  2536. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2537. }
  2538. // Do executes the "storage.buckets.patch" call.
  2539. // Exactly one of *Bucket or error will be non-nil. Any non-2xx status
  2540. // code is an error. Response headers are in either
  2541. // *Bucket.ServerResponse.Header or (if a response was returned at all)
  2542. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2543. // check whether the returned error was because http.StatusNotModified
  2544. // was returned.
  2545. func (c *BucketsPatchCall) Do(opts ...googleapi.CallOption) (*Bucket, error) {
  2546. gensupport.SetOptions(c.urlParams_, opts...)
  2547. res, err := c.doRequest("json")
  2548. if res != nil && res.StatusCode == http.StatusNotModified {
  2549. if res.Body != nil {
  2550. res.Body.Close()
  2551. }
  2552. return nil, &googleapi.Error{
  2553. Code: res.StatusCode,
  2554. Header: res.Header,
  2555. }
  2556. }
  2557. if err != nil {
  2558. return nil, err
  2559. }
  2560. defer googleapi.CloseBody(res)
  2561. if err := googleapi.CheckResponse(res); err != nil {
  2562. return nil, err
  2563. }
  2564. ret := &Bucket{
  2565. ServerResponse: googleapi.ServerResponse{
  2566. Header: res.Header,
  2567. HTTPStatusCode: res.StatusCode,
  2568. },
  2569. }
  2570. target := &ret
  2571. if err := gensupport.DecodeResponse(target, res); err != nil {
  2572. return nil, err
  2573. }
  2574. return ret, nil
  2575. // {
  2576. // "description": "Updates a bucket. This method supports patch semantics.",
  2577. // "httpMethod": "PATCH",
  2578. // "id": "storage.buckets.patch",
  2579. // "parameterOrder": [
  2580. // "bucket"
  2581. // ],
  2582. // "parameters": {
  2583. // "bucket": {
  2584. // "description": "Name of a bucket.",
  2585. // "location": "path",
  2586. // "required": true,
  2587. // "type": "string"
  2588. // },
  2589. // "ifMetagenerationMatch": {
  2590. // "description": "Makes the return of the bucket metadata conditional on whether the bucket's current metageneration matches the given value.",
  2591. // "format": "uint64",
  2592. // "location": "query",
  2593. // "type": "string"
  2594. // },
  2595. // "ifMetagenerationNotMatch": {
  2596. // "description": "Makes the return of the bucket metadata conditional on whether the bucket's current metageneration does not match the given value.",
  2597. // "format": "uint64",
  2598. // "location": "query",
  2599. // "type": "string"
  2600. // },
  2601. // "projection": {
  2602. // "description": "Set of properties to return. Defaults to full.",
  2603. // "enum": [
  2604. // "full",
  2605. // "noAcl"
  2606. // ],
  2607. // "enumDescriptions": [
  2608. // "Include all properties.",
  2609. // "Omit acl and defaultObjectAcl properties."
  2610. // ],
  2611. // "location": "query",
  2612. // "type": "string"
  2613. // }
  2614. // },
  2615. // "path": "b/{bucket}",
  2616. // "request": {
  2617. // "$ref": "Bucket"
  2618. // },
  2619. // "response": {
  2620. // "$ref": "Bucket"
  2621. // },
  2622. // "scopes": [
  2623. // "https://www.googleapis.com/auth/devstorage.full_control",
  2624. // "https://www.googleapis.com/auth/devstorage.read_write"
  2625. // ]
  2626. // }
  2627. }
  2628. // method id "storage.buckets.update":
  2629. type BucketsUpdateCall struct {
  2630. s *Service
  2631. bucket string
  2632. bucket2 *Bucket
  2633. urlParams_ gensupport.URLParams
  2634. ctx_ context.Context
  2635. header_ http.Header
  2636. }
  2637. // Update: Updates a bucket.
  2638. func (r *BucketsService) Update(bucket string, bucket2 *Bucket) *BucketsUpdateCall {
  2639. c := &BucketsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2640. c.bucket = bucket
  2641. c.bucket2 = bucket2
  2642. return c
  2643. }
  2644. // IfMetagenerationMatch sets the optional parameter
  2645. // "ifMetagenerationMatch": Makes the return of the bucket metadata
  2646. // conditional on whether the bucket's current metageneration matches
  2647. // the given value.
  2648. func (c *BucketsUpdateCall) IfMetagenerationMatch(ifMetagenerationMatch uint64) *BucketsUpdateCall {
  2649. c.urlParams_.Set("ifMetagenerationMatch", fmt.Sprint(ifMetagenerationMatch))
  2650. return c
  2651. }
  2652. // IfMetagenerationNotMatch sets the optional parameter
  2653. // "ifMetagenerationNotMatch": Makes the return of the bucket metadata
  2654. // conditional on whether the bucket's current metageneration does not
  2655. // match the given value.
  2656. func (c *BucketsUpdateCall) IfMetagenerationNotMatch(ifMetagenerationNotMatch uint64) *BucketsUpdateCall {
  2657. c.urlParams_.Set("ifMetagenerationNotMatch", fmt.Sprint(ifMetagenerationNotMatch))
  2658. return c
  2659. }
  2660. // Projection sets the optional parameter "projection": Set of
  2661. // properties to return. Defaults to full.
  2662. //
  2663. // Possible values:
  2664. // "full" - Include all properties.
  2665. // "noAcl" - Omit acl and defaultObjectAcl properties.
  2666. func (c *BucketsUpdateCall) Projection(projection string) *BucketsUpdateCall {
  2667. c.urlParams_.Set("projection", projection)
  2668. return c
  2669. }
  2670. // Fields allows partial responses to be retrieved. See
  2671. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2672. // for more information.
  2673. func (c *BucketsUpdateCall) Fields(s ...googleapi.Field) *BucketsUpdateCall {
  2674. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2675. return c
  2676. }
  2677. // Context sets the context to be used in this call's Do method. Any
  2678. // pending HTTP request will be aborted if the provided context is
  2679. // canceled.
  2680. func (c *BucketsUpdateCall) Context(ctx context.Context) *BucketsUpdateCall {
  2681. c.ctx_ = ctx
  2682. return c
  2683. }
  2684. // Header returns an http.Header that can be modified by the caller to
  2685. // add HTTP headers to the request.
  2686. func (c *BucketsUpdateCall) Header() http.Header {
  2687. if c.header_ == nil {
  2688. c.header_ = make(http.Header)
  2689. }
  2690. return c.header_
  2691. }
  2692. func (c *BucketsUpdateCall) doRequest(alt string) (*http.Response, error) {
  2693. reqHeaders := make(http.Header)
  2694. for k, v := range c.header_ {
  2695. reqHeaders[k] = v
  2696. }
  2697. reqHeaders.Set("User-Agent", c.s.userAgent())
  2698. var body io.Reader = nil
  2699. body, err := googleapi.WithoutDataWrapper.JSONReader(c.bucket2)
  2700. if err != nil {
  2701. return nil, err
  2702. }
  2703. reqHeaders.Set("Content-Type", "application/json")
  2704. c.urlParams_.Set("alt", alt)
  2705. c.urlParams_.Set("prettyPrint", "false")
  2706. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}")
  2707. urls += "?" + c.urlParams_.Encode()
  2708. req, err := http.NewRequest("PUT", urls, body)
  2709. if err != nil {
  2710. return nil, err
  2711. }
  2712. req.Header = reqHeaders
  2713. googleapi.Expand(req.URL, map[string]string{
  2714. "bucket": c.bucket,
  2715. })
  2716. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2717. }
  2718. // Do executes the "storage.buckets.update" call.
  2719. // Exactly one of *Bucket or error will be non-nil. Any non-2xx status
  2720. // code is an error. Response headers are in either
  2721. // *Bucket.ServerResponse.Header or (if a response was returned at all)
  2722. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2723. // check whether the returned error was because http.StatusNotModified
  2724. // was returned.
  2725. func (c *BucketsUpdateCall) Do(opts ...googleapi.CallOption) (*Bucket, error) {
  2726. gensupport.SetOptions(c.urlParams_, opts...)
  2727. res, err := c.doRequest("json")
  2728. if res != nil && res.StatusCode == http.StatusNotModified {
  2729. if res.Body != nil {
  2730. res.Body.Close()
  2731. }
  2732. return nil, &googleapi.Error{
  2733. Code: res.StatusCode,
  2734. Header: res.Header,
  2735. }
  2736. }
  2737. if err != nil {
  2738. return nil, err
  2739. }
  2740. defer googleapi.CloseBody(res)
  2741. if err := googleapi.CheckResponse(res); err != nil {
  2742. return nil, err
  2743. }
  2744. ret := &Bucket{
  2745. ServerResponse: googleapi.ServerResponse{
  2746. Header: res.Header,
  2747. HTTPStatusCode: res.StatusCode,
  2748. },
  2749. }
  2750. target := &ret
  2751. if err := gensupport.DecodeResponse(target, res); err != nil {
  2752. return nil, err
  2753. }
  2754. return ret, nil
  2755. // {
  2756. // "description": "Updates a bucket.",
  2757. // "httpMethod": "PUT",
  2758. // "id": "storage.buckets.update",
  2759. // "parameterOrder": [
  2760. // "bucket"
  2761. // ],
  2762. // "parameters": {
  2763. // "bucket": {
  2764. // "description": "Name of a bucket.",
  2765. // "location": "path",
  2766. // "required": true,
  2767. // "type": "string"
  2768. // },
  2769. // "ifMetagenerationMatch": {
  2770. // "description": "Makes the return of the bucket metadata conditional on whether the bucket's current metageneration matches the given value.",
  2771. // "format": "uint64",
  2772. // "location": "query",
  2773. // "type": "string"
  2774. // },
  2775. // "ifMetagenerationNotMatch": {
  2776. // "description": "Makes the return of the bucket metadata conditional on whether the bucket's current metageneration does not match the given value.",
  2777. // "format": "uint64",
  2778. // "location": "query",
  2779. // "type": "string"
  2780. // },
  2781. // "projection": {
  2782. // "description": "Set of properties to return. Defaults to full.",
  2783. // "enum": [
  2784. // "full",
  2785. // "noAcl"
  2786. // ],
  2787. // "enumDescriptions": [
  2788. // "Include all properties.",
  2789. // "Omit acl and defaultObjectAcl properties."
  2790. // ],
  2791. // "location": "query",
  2792. // "type": "string"
  2793. // }
  2794. // },
  2795. // "path": "b/{bucket}",
  2796. // "request": {
  2797. // "$ref": "Bucket"
  2798. // },
  2799. // "response": {
  2800. // "$ref": "Bucket"
  2801. // },
  2802. // "scopes": [
  2803. // "https://www.googleapis.com/auth/devstorage.full_control",
  2804. // "https://www.googleapis.com/auth/devstorage.read_write"
  2805. // ]
  2806. // }
  2807. }
  2808. // method id "storage.channels.stop":
  2809. type ChannelsStopCall struct {
  2810. s *Service
  2811. channel *Channel
  2812. urlParams_ gensupport.URLParams
  2813. ctx_ context.Context
  2814. header_ http.Header
  2815. }
  2816. // Stop: Stop watching resources through this channel
  2817. func (r *ChannelsService) Stop(channel *Channel) *ChannelsStopCall {
  2818. c := &ChannelsStopCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2819. c.channel = channel
  2820. return c
  2821. }
  2822. // Fields allows partial responses to be retrieved. See
  2823. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2824. // for more information.
  2825. func (c *ChannelsStopCall) Fields(s ...googleapi.Field) *ChannelsStopCall {
  2826. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2827. return c
  2828. }
  2829. // Context sets the context to be used in this call's Do method. Any
  2830. // pending HTTP request will be aborted if the provided context is
  2831. // canceled.
  2832. func (c *ChannelsStopCall) Context(ctx context.Context) *ChannelsStopCall {
  2833. c.ctx_ = ctx
  2834. return c
  2835. }
  2836. // Header returns an http.Header that can be modified by the caller to
  2837. // add HTTP headers to the request.
  2838. func (c *ChannelsStopCall) Header() http.Header {
  2839. if c.header_ == nil {
  2840. c.header_ = make(http.Header)
  2841. }
  2842. return c.header_
  2843. }
  2844. func (c *ChannelsStopCall) doRequest(alt string) (*http.Response, error) {
  2845. reqHeaders := make(http.Header)
  2846. for k, v := range c.header_ {
  2847. reqHeaders[k] = v
  2848. }
  2849. reqHeaders.Set("User-Agent", c.s.userAgent())
  2850. var body io.Reader = nil
  2851. body, err := googleapi.WithoutDataWrapper.JSONReader(c.channel)
  2852. if err != nil {
  2853. return nil, err
  2854. }
  2855. reqHeaders.Set("Content-Type", "application/json")
  2856. c.urlParams_.Set("alt", alt)
  2857. c.urlParams_.Set("prettyPrint", "false")
  2858. urls := googleapi.ResolveRelative(c.s.BasePath, "channels/stop")
  2859. urls += "?" + c.urlParams_.Encode()
  2860. req, err := http.NewRequest("POST", urls, body)
  2861. if err != nil {
  2862. return nil, err
  2863. }
  2864. req.Header = reqHeaders
  2865. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2866. }
  2867. // Do executes the "storage.channels.stop" call.
  2868. func (c *ChannelsStopCall) Do(opts ...googleapi.CallOption) error {
  2869. gensupport.SetOptions(c.urlParams_, opts...)
  2870. res, err := c.doRequest("json")
  2871. if err != nil {
  2872. return err
  2873. }
  2874. defer googleapi.CloseBody(res)
  2875. if err := googleapi.CheckResponse(res); err != nil {
  2876. return err
  2877. }
  2878. return nil
  2879. // {
  2880. // "description": "Stop watching resources through this channel",
  2881. // "httpMethod": "POST",
  2882. // "id": "storage.channels.stop",
  2883. // "path": "channels/stop",
  2884. // "request": {
  2885. // "$ref": "Channel",
  2886. // "parameterName": "resource"
  2887. // },
  2888. // "scopes": [
  2889. // "https://www.googleapis.com/auth/devstorage.full_control",
  2890. // "https://www.googleapis.com/auth/devstorage.read_only",
  2891. // "https://www.googleapis.com/auth/devstorage.read_write"
  2892. // ]
  2893. // }
  2894. }
  2895. // method id "storage.defaultObjectAccessControls.delete":
  2896. type DefaultObjectAccessControlsDeleteCall struct {
  2897. s *Service
  2898. bucket string
  2899. entity string
  2900. urlParams_ gensupport.URLParams
  2901. ctx_ context.Context
  2902. header_ http.Header
  2903. }
  2904. // Delete: Permanently deletes the default object ACL entry for the
  2905. // specified entity on the specified bucket.
  2906. func (r *DefaultObjectAccessControlsService) Delete(bucket string, entity string) *DefaultObjectAccessControlsDeleteCall {
  2907. c := &DefaultObjectAccessControlsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2908. c.bucket = bucket
  2909. c.entity = entity
  2910. return c
  2911. }
  2912. // Fields allows partial responses to be retrieved. See
  2913. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2914. // for more information.
  2915. func (c *DefaultObjectAccessControlsDeleteCall) Fields(s ...googleapi.Field) *DefaultObjectAccessControlsDeleteCall {
  2916. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2917. return c
  2918. }
  2919. // Context sets the context to be used in this call's Do method. Any
  2920. // pending HTTP request will be aborted if the provided context is
  2921. // canceled.
  2922. func (c *DefaultObjectAccessControlsDeleteCall) Context(ctx context.Context) *DefaultObjectAccessControlsDeleteCall {
  2923. c.ctx_ = ctx
  2924. return c
  2925. }
  2926. // Header returns an http.Header that can be modified by the caller to
  2927. // add HTTP headers to the request.
  2928. func (c *DefaultObjectAccessControlsDeleteCall) Header() http.Header {
  2929. if c.header_ == nil {
  2930. c.header_ = make(http.Header)
  2931. }
  2932. return c.header_
  2933. }
  2934. func (c *DefaultObjectAccessControlsDeleteCall) doRequest(alt string) (*http.Response, error) {
  2935. reqHeaders := make(http.Header)
  2936. for k, v := range c.header_ {
  2937. reqHeaders[k] = v
  2938. }
  2939. reqHeaders.Set("User-Agent", c.s.userAgent())
  2940. var body io.Reader = nil
  2941. c.urlParams_.Set("alt", alt)
  2942. c.urlParams_.Set("prettyPrint", "false")
  2943. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/defaultObjectAcl/{entity}")
  2944. urls += "?" + c.urlParams_.Encode()
  2945. req, err := http.NewRequest("DELETE", urls, body)
  2946. if err != nil {
  2947. return nil, err
  2948. }
  2949. req.Header = reqHeaders
  2950. googleapi.Expand(req.URL, map[string]string{
  2951. "bucket": c.bucket,
  2952. "entity": c.entity,
  2953. })
  2954. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2955. }
  2956. // Do executes the "storage.defaultObjectAccessControls.delete" call.
  2957. func (c *DefaultObjectAccessControlsDeleteCall) Do(opts ...googleapi.CallOption) error {
  2958. gensupport.SetOptions(c.urlParams_, opts...)
  2959. res, err := c.doRequest("json")
  2960. if err != nil {
  2961. return err
  2962. }
  2963. defer googleapi.CloseBody(res)
  2964. if err := googleapi.CheckResponse(res); err != nil {
  2965. return err
  2966. }
  2967. return nil
  2968. // {
  2969. // "description": "Permanently deletes the default object ACL entry for the specified entity on the specified bucket.",
  2970. // "httpMethod": "DELETE",
  2971. // "id": "storage.defaultObjectAccessControls.delete",
  2972. // "parameterOrder": [
  2973. // "bucket",
  2974. // "entity"
  2975. // ],
  2976. // "parameters": {
  2977. // "bucket": {
  2978. // "description": "Name of a bucket.",
  2979. // "location": "path",
  2980. // "required": true,
  2981. // "type": "string"
  2982. // },
  2983. // "entity": {
  2984. // "description": "The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.",
  2985. // "location": "path",
  2986. // "required": true,
  2987. // "type": "string"
  2988. // }
  2989. // },
  2990. // "path": "b/{bucket}/defaultObjectAcl/{entity}",
  2991. // "scopes": [
  2992. // "https://www.googleapis.com/auth/devstorage.full_control"
  2993. // ]
  2994. // }
  2995. }
  2996. // method id "storage.defaultObjectAccessControls.get":
  2997. type DefaultObjectAccessControlsGetCall struct {
  2998. s *Service
  2999. bucket string
  3000. entity string
  3001. urlParams_ gensupport.URLParams
  3002. ifNoneMatch_ string
  3003. ctx_ context.Context
  3004. header_ http.Header
  3005. }
  3006. // Get: Returns the default object ACL entry for the specified entity on
  3007. // the specified bucket.
  3008. func (r *DefaultObjectAccessControlsService) Get(bucket string, entity string) *DefaultObjectAccessControlsGetCall {
  3009. c := &DefaultObjectAccessControlsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3010. c.bucket = bucket
  3011. c.entity = entity
  3012. return c
  3013. }
  3014. // Fields allows partial responses to be retrieved. See
  3015. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3016. // for more information.
  3017. func (c *DefaultObjectAccessControlsGetCall) Fields(s ...googleapi.Field) *DefaultObjectAccessControlsGetCall {
  3018. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3019. return c
  3020. }
  3021. // IfNoneMatch sets the optional parameter which makes the operation
  3022. // fail if the object's ETag matches the given value. This is useful for
  3023. // getting updates only after the object has changed since the last
  3024. // request. Use googleapi.IsNotModified to check whether the response
  3025. // error from Do is the result of In-None-Match.
  3026. func (c *DefaultObjectAccessControlsGetCall) IfNoneMatch(entityTag string) *DefaultObjectAccessControlsGetCall {
  3027. c.ifNoneMatch_ = entityTag
  3028. return c
  3029. }
  3030. // Context sets the context to be used in this call's Do method. Any
  3031. // pending HTTP request will be aborted if the provided context is
  3032. // canceled.
  3033. func (c *DefaultObjectAccessControlsGetCall) Context(ctx context.Context) *DefaultObjectAccessControlsGetCall {
  3034. c.ctx_ = ctx
  3035. return c
  3036. }
  3037. // Header returns an http.Header that can be modified by the caller to
  3038. // add HTTP headers to the request.
  3039. func (c *DefaultObjectAccessControlsGetCall) Header() http.Header {
  3040. if c.header_ == nil {
  3041. c.header_ = make(http.Header)
  3042. }
  3043. return c.header_
  3044. }
  3045. func (c *DefaultObjectAccessControlsGetCall) doRequest(alt string) (*http.Response, error) {
  3046. reqHeaders := make(http.Header)
  3047. for k, v := range c.header_ {
  3048. reqHeaders[k] = v
  3049. }
  3050. reqHeaders.Set("User-Agent", c.s.userAgent())
  3051. if c.ifNoneMatch_ != "" {
  3052. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  3053. }
  3054. var body io.Reader = nil
  3055. c.urlParams_.Set("alt", alt)
  3056. c.urlParams_.Set("prettyPrint", "false")
  3057. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/defaultObjectAcl/{entity}")
  3058. urls += "?" + c.urlParams_.Encode()
  3059. req, err := http.NewRequest("GET", urls, body)
  3060. if err != nil {
  3061. return nil, err
  3062. }
  3063. req.Header = reqHeaders
  3064. googleapi.Expand(req.URL, map[string]string{
  3065. "bucket": c.bucket,
  3066. "entity": c.entity,
  3067. })
  3068. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3069. }
  3070. // Do executes the "storage.defaultObjectAccessControls.get" call.
  3071. // Exactly one of *ObjectAccessControl or error will be non-nil. Any
  3072. // non-2xx status code is an error. Response headers are in either
  3073. // *ObjectAccessControl.ServerResponse.Header or (if a response was
  3074. // returned at all) in error.(*googleapi.Error).Header. Use
  3075. // googleapi.IsNotModified to check whether the returned error was
  3076. // because http.StatusNotModified was returned.
  3077. func (c *DefaultObjectAccessControlsGetCall) Do(opts ...googleapi.CallOption) (*ObjectAccessControl, error) {
  3078. gensupport.SetOptions(c.urlParams_, opts...)
  3079. res, err := c.doRequest("json")
  3080. if res != nil && res.StatusCode == http.StatusNotModified {
  3081. if res.Body != nil {
  3082. res.Body.Close()
  3083. }
  3084. return nil, &googleapi.Error{
  3085. Code: res.StatusCode,
  3086. Header: res.Header,
  3087. }
  3088. }
  3089. if err != nil {
  3090. return nil, err
  3091. }
  3092. defer googleapi.CloseBody(res)
  3093. if err := googleapi.CheckResponse(res); err != nil {
  3094. return nil, err
  3095. }
  3096. ret := &ObjectAccessControl{
  3097. ServerResponse: googleapi.ServerResponse{
  3098. Header: res.Header,
  3099. HTTPStatusCode: res.StatusCode,
  3100. },
  3101. }
  3102. target := &ret
  3103. if err := gensupport.DecodeResponse(target, res); err != nil {
  3104. return nil, err
  3105. }
  3106. return ret, nil
  3107. // {
  3108. // "description": "Returns the default object ACL entry for the specified entity on the specified bucket.",
  3109. // "httpMethod": "GET",
  3110. // "id": "storage.defaultObjectAccessControls.get",
  3111. // "parameterOrder": [
  3112. // "bucket",
  3113. // "entity"
  3114. // ],
  3115. // "parameters": {
  3116. // "bucket": {
  3117. // "description": "Name of a bucket.",
  3118. // "location": "path",
  3119. // "required": true,
  3120. // "type": "string"
  3121. // },
  3122. // "entity": {
  3123. // "description": "The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.",
  3124. // "location": "path",
  3125. // "required": true,
  3126. // "type": "string"
  3127. // }
  3128. // },
  3129. // "path": "b/{bucket}/defaultObjectAcl/{entity}",
  3130. // "response": {
  3131. // "$ref": "ObjectAccessControl"
  3132. // },
  3133. // "scopes": [
  3134. // "https://www.googleapis.com/auth/devstorage.full_control"
  3135. // ]
  3136. // }
  3137. }
  3138. // method id "storage.defaultObjectAccessControls.insert":
  3139. type DefaultObjectAccessControlsInsertCall struct {
  3140. s *Service
  3141. bucket string
  3142. objectaccesscontrol *ObjectAccessControl
  3143. urlParams_ gensupport.URLParams
  3144. ctx_ context.Context
  3145. header_ http.Header
  3146. }
  3147. // Insert: Creates a new default object ACL entry on the specified
  3148. // bucket.
  3149. func (r *DefaultObjectAccessControlsService) Insert(bucket string, objectaccesscontrol *ObjectAccessControl) *DefaultObjectAccessControlsInsertCall {
  3150. c := &DefaultObjectAccessControlsInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3151. c.bucket = bucket
  3152. c.objectaccesscontrol = objectaccesscontrol
  3153. return c
  3154. }
  3155. // Fields allows partial responses to be retrieved. See
  3156. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3157. // for more information.
  3158. func (c *DefaultObjectAccessControlsInsertCall) Fields(s ...googleapi.Field) *DefaultObjectAccessControlsInsertCall {
  3159. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3160. return c
  3161. }
  3162. // Context sets the context to be used in this call's Do method. Any
  3163. // pending HTTP request will be aborted if the provided context is
  3164. // canceled.
  3165. func (c *DefaultObjectAccessControlsInsertCall) Context(ctx context.Context) *DefaultObjectAccessControlsInsertCall {
  3166. c.ctx_ = ctx
  3167. return c
  3168. }
  3169. // Header returns an http.Header that can be modified by the caller to
  3170. // add HTTP headers to the request.
  3171. func (c *DefaultObjectAccessControlsInsertCall) Header() http.Header {
  3172. if c.header_ == nil {
  3173. c.header_ = make(http.Header)
  3174. }
  3175. return c.header_
  3176. }
  3177. func (c *DefaultObjectAccessControlsInsertCall) doRequest(alt string) (*http.Response, error) {
  3178. reqHeaders := make(http.Header)
  3179. for k, v := range c.header_ {
  3180. reqHeaders[k] = v
  3181. }
  3182. reqHeaders.Set("User-Agent", c.s.userAgent())
  3183. var body io.Reader = nil
  3184. body, err := googleapi.WithoutDataWrapper.JSONReader(c.objectaccesscontrol)
  3185. if err != nil {
  3186. return nil, err
  3187. }
  3188. reqHeaders.Set("Content-Type", "application/json")
  3189. c.urlParams_.Set("alt", alt)
  3190. c.urlParams_.Set("prettyPrint", "false")
  3191. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/defaultObjectAcl")
  3192. urls += "?" + c.urlParams_.Encode()
  3193. req, err := http.NewRequest("POST", urls, body)
  3194. if err != nil {
  3195. return nil, err
  3196. }
  3197. req.Header = reqHeaders
  3198. googleapi.Expand(req.URL, map[string]string{
  3199. "bucket": c.bucket,
  3200. })
  3201. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3202. }
  3203. // Do executes the "storage.defaultObjectAccessControls.insert" call.
  3204. // Exactly one of *ObjectAccessControl or error will be non-nil. Any
  3205. // non-2xx status code is an error. Response headers are in either
  3206. // *ObjectAccessControl.ServerResponse.Header or (if a response was
  3207. // returned at all) in error.(*googleapi.Error).Header. Use
  3208. // googleapi.IsNotModified to check whether the returned error was
  3209. // because http.StatusNotModified was returned.
  3210. func (c *DefaultObjectAccessControlsInsertCall) Do(opts ...googleapi.CallOption) (*ObjectAccessControl, error) {
  3211. gensupport.SetOptions(c.urlParams_, opts...)
  3212. res, err := c.doRequest("json")
  3213. if res != nil && res.StatusCode == http.StatusNotModified {
  3214. if res.Body != nil {
  3215. res.Body.Close()
  3216. }
  3217. return nil, &googleapi.Error{
  3218. Code: res.StatusCode,
  3219. Header: res.Header,
  3220. }
  3221. }
  3222. if err != nil {
  3223. return nil, err
  3224. }
  3225. defer googleapi.CloseBody(res)
  3226. if err := googleapi.CheckResponse(res); err != nil {
  3227. return nil, err
  3228. }
  3229. ret := &ObjectAccessControl{
  3230. ServerResponse: googleapi.ServerResponse{
  3231. Header: res.Header,
  3232. HTTPStatusCode: res.StatusCode,
  3233. },
  3234. }
  3235. target := &ret
  3236. if err := gensupport.DecodeResponse(target, res); err != nil {
  3237. return nil, err
  3238. }
  3239. return ret, nil
  3240. // {
  3241. // "description": "Creates a new default object ACL entry on the specified bucket.",
  3242. // "httpMethod": "POST",
  3243. // "id": "storage.defaultObjectAccessControls.insert",
  3244. // "parameterOrder": [
  3245. // "bucket"
  3246. // ],
  3247. // "parameters": {
  3248. // "bucket": {
  3249. // "description": "Name of a bucket.",
  3250. // "location": "path",
  3251. // "required": true,
  3252. // "type": "string"
  3253. // }
  3254. // },
  3255. // "path": "b/{bucket}/defaultObjectAcl",
  3256. // "request": {
  3257. // "$ref": "ObjectAccessControl"
  3258. // },
  3259. // "response": {
  3260. // "$ref": "ObjectAccessControl"
  3261. // },
  3262. // "scopes": [
  3263. // "https://www.googleapis.com/auth/devstorage.full_control"
  3264. // ]
  3265. // }
  3266. }
  3267. // method id "storage.defaultObjectAccessControls.list":
  3268. type DefaultObjectAccessControlsListCall struct {
  3269. s *Service
  3270. bucket string
  3271. urlParams_ gensupport.URLParams
  3272. ifNoneMatch_ string
  3273. ctx_ context.Context
  3274. header_ http.Header
  3275. }
  3276. // List: Retrieves default object ACL entries on the specified bucket.
  3277. func (r *DefaultObjectAccessControlsService) List(bucket string) *DefaultObjectAccessControlsListCall {
  3278. c := &DefaultObjectAccessControlsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3279. c.bucket = bucket
  3280. return c
  3281. }
  3282. // IfMetagenerationMatch sets the optional parameter
  3283. // "ifMetagenerationMatch": If present, only return default ACL listing
  3284. // if the bucket's current metageneration matches this value.
  3285. func (c *DefaultObjectAccessControlsListCall) IfMetagenerationMatch(ifMetagenerationMatch int64) *DefaultObjectAccessControlsListCall {
  3286. c.urlParams_.Set("ifMetagenerationMatch", fmt.Sprint(ifMetagenerationMatch))
  3287. return c
  3288. }
  3289. // IfMetagenerationNotMatch sets the optional parameter
  3290. // "ifMetagenerationNotMatch": If present, only return default ACL
  3291. // listing if the bucket's current metageneration does not match the
  3292. // given value.
  3293. func (c *DefaultObjectAccessControlsListCall) IfMetagenerationNotMatch(ifMetagenerationNotMatch int64) *DefaultObjectAccessControlsListCall {
  3294. c.urlParams_.Set("ifMetagenerationNotMatch", fmt.Sprint(ifMetagenerationNotMatch))
  3295. return c
  3296. }
  3297. // Fields allows partial responses to be retrieved. See
  3298. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3299. // for more information.
  3300. func (c *DefaultObjectAccessControlsListCall) Fields(s ...googleapi.Field) *DefaultObjectAccessControlsListCall {
  3301. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3302. return c
  3303. }
  3304. // IfNoneMatch sets the optional parameter which makes the operation
  3305. // fail if the object's ETag matches the given value. This is useful for
  3306. // getting updates only after the object has changed since the last
  3307. // request. Use googleapi.IsNotModified to check whether the response
  3308. // error from Do is the result of In-None-Match.
  3309. func (c *DefaultObjectAccessControlsListCall) IfNoneMatch(entityTag string) *DefaultObjectAccessControlsListCall {
  3310. c.ifNoneMatch_ = entityTag
  3311. return c
  3312. }
  3313. // Context sets the context to be used in this call's Do method. Any
  3314. // pending HTTP request will be aborted if the provided context is
  3315. // canceled.
  3316. func (c *DefaultObjectAccessControlsListCall) Context(ctx context.Context) *DefaultObjectAccessControlsListCall {
  3317. c.ctx_ = ctx
  3318. return c
  3319. }
  3320. // Header returns an http.Header that can be modified by the caller to
  3321. // add HTTP headers to the request.
  3322. func (c *DefaultObjectAccessControlsListCall) Header() http.Header {
  3323. if c.header_ == nil {
  3324. c.header_ = make(http.Header)
  3325. }
  3326. return c.header_
  3327. }
  3328. func (c *DefaultObjectAccessControlsListCall) doRequest(alt string) (*http.Response, error) {
  3329. reqHeaders := make(http.Header)
  3330. for k, v := range c.header_ {
  3331. reqHeaders[k] = v
  3332. }
  3333. reqHeaders.Set("User-Agent", c.s.userAgent())
  3334. if c.ifNoneMatch_ != "" {
  3335. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  3336. }
  3337. var body io.Reader = nil
  3338. c.urlParams_.Set("alt", alt)
  3339. c.urlParams_.Set("prettyPrint", "false")
  3340. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/defaultObjectAcl")
  3341. urls += "?" + c.urlParams_.Encode()
  3342. req, err := http.NewRequest("GET", urls, body)
  3343. if err != nil {
  3344. return nil, err
  3345. }
  3346. req.Header = reqHeaders
  3347. googleapi.Expand(req.URL, map[string]string{
  3348. "bucket": c.bucket,
  3349. })
  3350. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3351. }
  3352. // Do executes the "storage.defaultObjectAccessControls.list" call.
  3353. // Exactly one of *ObjectAccessControls or error will be non-nil. Any
  3354. // non-2xx status code is an error. Response headers are in either
  3355. // *ObjectAccessControls.ServerResponse.Header or (if a response was
  3356. // returned at all) in error.(*googleapi.Error).Header. Use
  3357. // googleapi.IsNotModified to check whether the returned error was
  3358. // because http.StatusNotModified was returned.
  3359. func (c *DefaultObjectAccessControlsListCall) Do(opts ...googleapi.CallOption) (*ObjectAccessControls, error) {
  3360. gensupport.SetOptions(c.urlParams_, opts...)
  3361. res, err := c.doRequest("json")
  3362. if res != nil && res.StatusCode == http.StatusNotModified {
  3363. if res.Body != nil {
  3364. res.Body.Close()
  3365. }
  3366. return nil, &googleapi.Error{
  3367. Code: res.StatusCode,
  3368. Header: res.Header,
  3369. }
  3370. }
  3371. if err != nil {
  3372. return nil, err
  3373. }
  3374. defer googleapi.CloseBody(res)
  3375. if err := googleapi.CheckResponse(res); err != nil {
  3376. return nil, err
  3377. }
  3378. ret := &ObjectAccessControls{
  3379. ServerResponse: googleapi.ServerResponse{
  3380. Header: res.Header,
  3381. HTTPStatusCode: res.StatusCode,
  3382. },
  3383. }
  3384. target := &ret
  3385. if err := gensupport.DecodeResponse(target, res); err != nil {
  3386. return nil, err
  3387. }
  3388. return ret, nil
  3389. // {
  3390. // "description": "Retrieves default object ACL entries on the specified bucket.",
  3391. // "httpMethod": "GET",
  3392. // "id": "storage.defaultObjectAccessControls.list",
  3393. // "parameterOrder": [
  3394. // "bucket"
  3395. // ],
  3396. // "parameters": {
  3397. // "bucket": {
  3398. // "description": "Name of a bucket.",
  3399. // "location": "path",
  3400. // "required": true,
  3401. // "type": "string"
  3402. // },
  3403. // "ifMetagenerationMatch": {
  3404. // "description": "If present, only return default ACL listing if the bucket's current metageneration matches this value.",
  3405. // "format": "int64",
  3406. // "location": "query",
  3407. // "type": "string"
  3408. // },
  3409. // "ifMetagenerationNotMatch": {
  3410. // "description": "If present, only return default ACL listing if the bucket's current metageneration does not match the given value.",
  3411. // "format": "int64",
  3412. // "location": "query",
  3413. // "type": "string"
  3414. // }
  3415. // },
  3416. // "path": "b/{bucket}/defaultObjectAcl",
  3417. // "response": {
  3418. // "$ref": "ObjectAccessControls"
  3419. // },
  3420. // "scopes": [
  3421. // "https://www.googleapis.com/auth/devstorage.full_control"
  3422. // ]
  3423. // }
  3424. }
  3425. // method id "storage.defaultObjectAccessControls.patch":
  3426. type DefaultObjectAccessControlsPatchCall struct {
  3427. s *Service
  3428. bucket string
  3429. entity string
  3430. objectaccesscontrol *ObjectAccessControl
  3431. urlParams_ gensupport.URLParams
  3432. ctx_ context.Context
  3433. header_ http.Header
  3434. }
  3435. // Patch: Updates a default object ACL entry on the specified bucket.
  3436. // This method supports patch semantics.
  3437. func (r *DefaultObjectAccessControlsService) Patch(bucket string, entity string, objectaccesscontrol *ObjectAccessControl) *DefaultObjectAccessControlsPatchCall {
  3438. c := &DefaultObjectAccessControlsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3439. c.bucket = bucket
  3440. c.entity = entity
  3441. c.objectaccesscontrol = objectaccesscontrol
  3442. return c
  3443. }
  3444. // Fields allows partial responses to be retrieved. See
  3445. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3446. // for more information.
  3447. func (c *DefaultObjectAccessControlsPatchCall) Fields(s ...googleapi.Field) *DefaultObjectAccessControlsPatchCall {
  3448. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3449. return c
  3450. }
  3451. // Context sets the context to be used in this call's Do method. Any
  3452. // pending HTTP request will be aborted if the provided context is
  3453. // canceled.
  3454. func (c *DefaultObjectAccessControlsPatchCall) Context(ctx context.Context) *DefaultObjectAccessControlsPatchCall {
  3455. c.ctx_ = ctx
  3456. return c
  3457. }
  3458. // Header returns an http.Header that can be modified by the caller to
  3459. // add HTTP headers to the request.
  3460. func (c *DefaultObjectAccessControlsPatchCall) Header() http.Header {
  3461. if c.header_ == nil {
  3462. c.header_ = make(http.Header)
  3463. }
  3464. return c.header_
  3465. }
  3466. func (c *DefaultObjectAccessControlsPatchCall) doRequest(alt string) (*http.Response, error) {
  3467. reqHeaders := make(http.Header)
  3468. for k, v := range c.header_ {
  3469. reqHeaders[k] = v
  3470. }
  3471. reqHeaders.Set("User-Agent", c.s.userAgent())
  3472. var body io.Reader = nil
  3473. body, err := googleapi.WithoutDataWrapper.JSONReader(c.objectaccesscontrol)
  3474. if err != nil {
  3475. return nil, err
  3476. }
  3477. reqHeaders.Set("Content-Type", "application/json")
  3478. c.urlParams_.Set("alt", alt)
  3479. c.urlParams_.Set("prettyPrint", "false")
  3480. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/defaultObjectAcl/{entity}")
  3481. urls += "?" + c.urlParams_.Encode()
  3482. req, err := http.NewRequest("PATCH", urls, body)
  3483. if err != nil {
  3484. return nil, err
  3485. }
  3486. req.Header = reqHeaders
  3487. googleapi.Expand(req.URL, map[string]string{
  3488. "bucket": c.bucket,
  3489. "entity": c.entity,
  3490. })
  3491. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3492. }
  3493. // Do executes the "storage.defaultObjectAccessControls.patch" call.
  3494. // Exactly one of *ObjectAccessControl or error will be non-nil. Any
  3495. // non-2xx status code is an error. Response headers are in either
  3496. // *ObjectAccessControl.ServerResponse.Header or (if a response was
  3497. // returned at all) in error.(*googleapi.Error).Header. Use
  3498. // googleapi.IsNotModified to check whether the returned error was
  3499. // because http.StatusNotModified was returned.
  3500. func (c *DefaultObjectAccessControlsPatchCall) Do(opts ...googleapi.CallOption) (*ObjectAccessControl, error) {
  3501. gensupport.SetOptions(c.urlParams_, opts...)
  3502. res, err := c.doRequest("json")
  3503. if res != nil && res.StatusCode == http.StatusNotModified {
  3504. if res.Body != nil {
  3505. res.Body.Close()
  3506. }
  3507. return nil, &googleapi.Error{
  3508. Code: res.StatusCode,
  3509. Header: res.Header,
  3510. }
  3511. }
  3512. if err != nil {
  3513. return nil, err
  3514. }
  3515. defer googleapi.CloseBody(res)
  3516. if err := googleapi.CheckResponse(res); err != nil {
  3517. return nil, err
  3518. }
  3519. ret := &ObjectAccessControl{
  3520. ServerResponse: googleapi.ServerResponse{
  3521. Header: res.Header,
  3522. HTTPStatusCode: res.StatusCode,
  3523. },
  3524. }
  3525. target := &ret
  3526. if err := gensupport.DecodeResponse(target, res); err != nil {
  3527. return nil, err
  3528. }
  3529. return ret, nil
  3530. // {
  3531. // "description": "Updates a default object ACL entry on the specified bucket. This method supports patch semantics.",
  3532. // "httpMethod": "PATCH",
  3533. // "id": "storage.defaultObjectAccessControls.patch",
  3534. // "parameterOrder": [
  3535. // "bucket",
  3536. // "entity"
  3537. // ],
  3538. // "parameters": {
  3539. // "bucket": {
  3540. // "description": "Name of a bucket.",
  3541. // "location": "path",
  3542. // "required": true,
  3543. // "type": "string"
  3544. // },
  3545. // "entity": {
  3546. // "description": "The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.",
  3547. // "location": "path",
  3548. // "required": true,
  3549. // "type": "string"
  3550. // }
  3551. // },
  3552. // "path": "b/{bucket}/defaultObjectAcl/{entity}",
  3553. // "request": {
  3554. // "$ref": "ObjectAccessControl"
  3555. // },
  3556. // "response": {
  3557. // "$ref": "ObjectAccessControl"
  3558. // },
  3559. // "scopes": [
  3560. // "https://www.googleapis.com/auth/devstorage.full_control"
  3561. // ]
  3562. // }
  3563. }
  3564. // method id "storage.defaultObjectAccessControls.update":
  3565. type DefaultObjectAccessControlsUpdateCall struct {
  3566. s *Service
  3567. bucket string
  3568. entity string
  3569. objectaccesscontrol *ObjectAccessControl
  3570. urlParams_ gensupport.URLParams
  3571. ctx_ context.Context
  3572. header_ http.Header
  3573. }
  3574. // Update: Updates a default object ACL entry on the specified bucket.
  3575. func (r *DefaultObjectAccessControlsService) Update(bucket string, entity string, objectaccesscontrol *ObjectAccessControl) *DefaultObjectAccessControlsUpdateCall {
  3576. c := &DefaultObjectAccessControlsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3577. c.bucket = bucket
  3578. c.entity = entity
  3579. c.objectaccesscontrol = objectaccesscontrol
  3580. return c
  3581. }
  3582. // Fields allows partial responses to be retrieved. See
  3583. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3584. // for more information.
  3585. func (c *DefaultObjectAccessControlsUpdateCall) Fields(s ...googleapi.Field) *DefaultObjectAccessControlsUpdateCall {
  3586. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3587. return c
  3588. }
  3589. // Context sets the context to be used in this call's Do method. Any
  3590. // pending HTTP request will be aborted if the provided context is
  3591. // canceled.
  3592. func (c *DefaultObjectAccessControlsUpdateCall) Context(ctx context.Context) *DefaultObjectAccessControlsUpdateCall {
  3593. c.ctx_ = ctx
  3594. return c
  3595. }
  3596. // Header returns an http.Header that can be modified by the caller to
  3597. // add HTTP headers to the request.
  3598. func (c *DefaultObjectAccessControlsUpdateCall) Header() http.Header {
  3599. if c.header_ == nil {
  3600. c.header_ = make(http.Header)
  3601. }
  3602. return c.header_
  3603. }
  3604. func (c *DefaultObjectAccessControlsUpdateCall) doRequest(alt string) (*http.Response, error) {
  3605. reqHeaders := make(http.Header)
  3606. for k, v := range c.header_ {
  3607. reqHeaders[k] = v
  3608. }
  3609. reqHeaders.Set("User-Agent", c.s.userAgent())
  3610. var body io.Reader = nil
  3611. body, err := googleapi.WithoutDataWrapper.JSONReader(c.objectaccesscontrol)
  3612. if err != nil {
  3613. return nil, err
  3614. }
  3615. reqHeaders.Set("Content-Type", "application/json")
  3616. c.urlParams_.Set("alt", alt)
  3617. c.urlParams_.Set("prettyPrint", "false")
  3618. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/defaultObjectAcl/{entity}")
  3619. urls += "?" + c.urlParams_.Encode()
  3620. req, err := http.NewRequest("PUT", urls, body)
  3621. if err != nil {
  3622. return nil, err
  3623. }
  3624. req.Header = reqHeaders
  3625. googleapi.Expand(req.URL, map[string]string{
  3626. "bucket": c.bucket,
  3627. "entity": c.entity,
  3628. })
  3629. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3630. }
  3631. // Do executes the "storage.defaultObjectAccessControls.update" call.
  3632. // Exactly one of *ObjectAccessControl or error will be non-nil. Any
  3633. // non-2xx status code is an error. Response headers are in either
  3634. // *ObjectAccessControl.ServerResponse.Header or (if a response was
  3635. // returned at all) in error.(*googleapi.Error).Header. Use
  3636. // googleapi.IsNotModified to check whether the returned error was
  3637. // because http.StatusNotModified was returned.
  3638. func (c *DefaultObjectAccessControlsUpdateCall) Do(opts ...googleapi.CallOption) (*ObjectAccessControl, error) {
  3639. gensupport.SetOptions(c.urlParams_, opts...)
  3640. res, err := c.doRequest("json")
  3641. if res != nil && res.StatusCode == http.StatusNotModified {
  3642. if res.Body != nil {
  3643. res.Body.Close()
  3644. }
  3645. return nil, &googleapi.Error{
  3646. Code: res.StatusCode,
  3647. Header: res.Header,
  3648. }
  3649. }
  3650. if err != nil {
  3651. return nil, err
  3652. }
  3653. defer googleapi.CloseBody(res)
  3654. if err := googleapi.CheckResponse(res); err != nil {
  3655. return nil, err
  3656. }
  3657. ret := &ObjectAccessControl{
  3658. ServerResponse: googleapi.ServerResponse{
  3659. Header: res.Header,
  3660. HTTPStatusCode: res.StatusCode,
  3661. },
  3662. }
  3663. target := &ret
  3664. if err := gensupport.DecodeResponse(target, res); err != nil {
  3665. return nil, err
  3666. }
  3667. return ret, nil
  3668. // {
  3669. // "description": "Updates a default object ACL entry on the specified bucket.",
  3670. // "httpMethod": "PUT",
  3671. // "id": "storage.defaultObjectAccessControls.update",
  3672. // "parameterOrder": [
  3673. // "bucket",
  3674. // "entity"
  3675. // ],
  3676. // "parameters": {
  3677. // "bucket": {
  3678. // "description": "Name of a bucket.",
  3679. // "location": "path",
  3680. // "required": true,
  3681. // "type": "string"
  3682. // },
  3683. // "entity": {
  3684. // "description": "The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.",
  3685. // "location": "path",
  3686. // "required": true,
  3687. // "type": "string"
  3688. // }
  3689. // },
  3690. // "path": "b/{bucket}/defaultObjectAcl/{entity}",
  3691. // "request": {
  3692. // "$ref": "ObjectAccessControl"
  3693. // },
  3694. // "response": {
  3695. // "$ref": "ObjectAccessControl"
  3696. // },
  3697. // "scopes": [
  3698. // "https://www.googleapis.com/auth/devstorage.full_control"
  3699. // ]
  3700. // }
  3701. }
  3702. // method id "storage.objectAccessControls.delete":
  3703. type ObjectAccessControlsDeleteCall struct {
  3704. s *Service
  3705. bucket string
  3706. object string
  3707. entity string
  3708. urlParams_ gensupport.URLParams
  3709. ctx_ context.Context
  3710. header_ http.Header
  3711. }
  3712. // Delete: Permanently deletes the ACL entry for the specified entity on
  3713. // the specified object.
  3714. func (r *ObjectAccessControlsService) Delete(bucket string, object string, entity string) *ObjectAccessControlsDeleteCall {
  3715. c := &ObjectAccessControlsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3716. c.bucket = bucket
  3717. c.object = object
  3718. c.entity = entity
  3719. return c
  3720. }
  3721. // Generation sets the optional parameter "generation": If present,
  3722. // selects a specific revision of this object (as opposed to the latest
  3723. // version, the default).
  3724. func (c *ObjectAccessControlsDeleteCall) Generation(generation uint64) *ObjectAccessControlsDeleteCall {
  3725. c.urlParams_.Set("generation", fmt.Sprint(generation))
  3726. return c
  3727. }
  3728. // Fields allows partial responses to be retrieved. See
  3729. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3730. // for more information.
  3731. func (c *ObjectAccessControlsDeleteCall) Fields(s ...googleapi.Field) *ObjectAccessControlsDeleteCall {
  3732. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3733. return c
  3734. }
  3735. // Context sets the context to be used in this call's Do method. Any
  3736. // pending HTTP request will be aborted if the provided context is
  3737. // canceled.
  3738. func (c *ObjectAccessControlsDeleteCall) Context(ctx context.Context) *ObjectAccessControlsDeleteCall {
  3739. c.ctx_ = ctx
  3740. return c
  3741. }
  3742. // Header returns an http.Header that can be modified by the caller to
  3743. // add HTTP headers to the request.
  3744. func (c *ObjectAccessControlsDeleteCall) Header() http.Header {
  3745. if c.header_ == nil {
  3746. c.header_ = make(http.Header)
  3747. }
  3748. return c.header_
  3749. }
  3750. func (c *ObjectAccessControlsDeleteCall) doRequest(alt string) (*http.Response, error) {
  3751. reqHeaders := make(http.Header)
  3752. for k, v := range c.header_ {
  3753. reqHeaders[k] = v
  3754. }
  3755. reqHeaders.Set("User-Agent", c.s.userAgent())
  3756. var body io.Reader = nil
  3757. c.urlParams_.Set("alt", alt)
  3758. c.urlParams_.Set("prettyPrint", "false")
  3759. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o/{object}/acl/{entity}")
  3760. urls += "?" + c.urlParams_.Encode()
  3761. req, err := http.NewRequest("DELETE", urls, body)
  3762. if err != nil {
  3763. return nil, err
  3764. }
  3765. req.Header = reqHeaders
  3766. googleapi.Expand(req.URL, map[string]string{
  3767. "bucket": c.bucket,
  3768. "object": c.object,
  3769. "entity": c.entity,
  3770. })
  3771. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3772. }
  3773. // Do executes the "storage.objectAccessControls.delete" call.
  3774. func (c *ObjectAccessControlsDeleteCall) Do(opts ...googleapi.CallOption) error {
  3775. gensupport.SetOptions(c.urlParams_, opts...)
  3776. res, err := c.doRequest("json")
  3777. if err != nil {
  3778. return err
  3779. }
  3780. defer googleapi.CloseBody(res)
  3781. if err := googleapi.CheckResponse(res); err != nil {
  3782. return err
  3783. }
  3784. return nil
  3785. // {
  3786. // "description": "Permanently deletes the ACL entry for the specified entity on the specified object.",
  3787. // "httpMethod": "DELETE",
  3788. // "id": "storage.objectAccessControls.delete",
  3789. // "parameterOrder": [
  3790. // "bucket",
  3791. // "object",
  3792. // "entity"
  3793. // ],
  3794. // "parameters": {
  3795. // "bucket": {
  3796. // "description": "Name of a bucket.",
  3797. // "location": "path",
  3798. // "required": true,
  3799. // "type": "string"
  3800. // },
  3801. // "entity": {
  3802. // "description": "The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.",
  3803. // "location": "path",
  3804. // "required": true,
  3805. // "type": "string"
  3806. // },
  3807. // "generation": {
  3808. // "description": "If present, selects a specific revision of this object (as opposed to the latest version, the default).",
  3809. // "format": "uint64",
  3810. // "location": "query",
  3811. // "type": "string"
  3812. // },
  3813. // "object": {
  3814. // "description": "Name of the object.",
  3815. // "location": "path",
  3816. // "required": true,
  3817. // "type": "string"
  3818. // }
  3819. // },
  3820. // "path": "b/{bucket}/o/{object}/acl/{entity}",
  3821. // "scopes": [
  3822. // "https://www.googleapis.com/auth/devstorage.full_control"
  3823. // ]
  3824. // }
  3825. }
  3826. // method id "storage.objectAccessControls.get":
  3827. type ObjectAccessControlsGetCall struct {
  3828. s *Service
  3829. bucket string
  3830. object string
  3831. entity string
  3832. urlParams_ gensupport.URLParams
  3833. ifNoneMatch_ string
  3834. ctx_ context.Context
  3835. header_ http.Header
  3836. }
  3837. // Get: Returns the ACL entry for the specified entity on the specified
  3838. // object.
  3839. func (r *ObjectAccessControlsService) Get(bucket string, object string, entity string) *ObjectAccessControlsGetCall {
  3840. c := &ObjectAccessControlsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3841. c.bucket = bucket
  3842. c.object = object
  3843. c.entity = entity
  3844. return c
  3845. }
  3846. // Generation sets the optional parameter "generation": If present,
  3847. // selects a specific revision of this object (as opposed to the latest
  3848. // version, the default).
  3849. func (c *ObjectAccessControlsGetCall) Generation(generation uint64) *ObjectAccessControlsGetCall {
  3850. c.urlParams_.Set("generation", fmt.Sprint(generation))
  3851. return c
  3852. }
  3853. // Fields allows partial responses to be retrieved. See
  3854. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3855. // for more information.
  3856. func (c *ObjectAccessControlsGetCall) Fields(s ...googleapi.Field) *ObjectAccessControlsGetCall {
  3857. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3858. return c
  3859. }
  3860. // IfNoneMatch sets the optional parameter which makes the operation
  3861. // fail if the object's ETag matches the given value. This is useful for
  3862. // getting updates only after the object has changed since the last
  3863. // request. Use googleapi.IsNotModified to check whether the response
  3864. // error from Do is the result of In-None-Match.
  3865. func (c *ObjectAccessControlsGetCall) IfNoneMatch(entityTag string) *ObjectAccessControlsGetCall {
  3866. c.ifNoneMatch_ = entityTag
  3867. return c
  3868. }
  3869. // Context sets the context to be used in this call's Do method. Any
  3870. // pending HTTP request will be aborted if the provided context is
  3871. // canceled.
  3872. func (c *ObjectAccessControlsGetCall) Context(ctx context.Context) *ObjectAccessControlsGetCall {
  3873. c.ctx_ = ctx
  3874. return c
  3875. }
  3876. // Header returns an http.Header that can be modified by the caller to
  3877. // add HTTP headers to the request.
  3878. func (c *ObjectAccessControlsGetCall) Header() http.Header {
  3879. if c.header_ == nil {
  3880. c.header_ = make(http.Header)
  3881. }
  3882. return c.header_
  3883. }
  3884. func (c *ObjectAccessControlsGetCall) doRequest(alt string) (*http.Response, error) {
  3885. reqHeaders := make(http.Header)
  3886. for k, v := range c.header_ {
  3887. reqHeaders[k] = v
  3888. }
  3889. reqHeaders.Set("User-Agent", c.s.userAgent())
  3890. if c.ifNoneMatch_ != "" {
  3891. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  3892. }
  3893. var body io.Reader = nil
  3894. c.urlParams_.Set("alt", alt)
  3895. c.urlParams_.Set("prettyPrint", "false")
  3896. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o/{object}/acl/{entity}")
  3897. urls += "?" + c.urlParams_.Encode()
  3898. req, err := http.NewRequest("GET", urls, body)
  3899. if err != nil {
  3900. return nil, err
  3901. }
  3902. req.Header = reqHeaders
  3903. googleapi.Expand(req.URL, map[string]string{
  3904. "bucket": c.bucket,
  3905. "object": c.object,
  3906. "entity": c.entity,
  3907. })
  3908. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3909. }
  3910. // Do executes the "storage.objectAccessControls.get" call.
  3911. // Exactly one of *ObjectAccessControl or error will be non-nil. Any
  3912. // non-2xx status code is an error. Response headers are in either
  3913. // *ObjectAccessControl.ServerResponse.Header or (if a response was
  3914. // returned at all) in error.(*googleapi.Error).Header. Use
  3915. // googleapi.IsNotModified to check whether the returned error was
  3916. // because http.StatusNotModified was returned.
  3917. func (c *ObjectAccessControlsGetCall) Do(opts ...googleapi.CallOption) (*ObjectAccessControl, error) {
  3918. gensupport.SetOptions(c.urlParams_, opts...)
  3919. res, err := c.doRequest("json")
  3920. if res != nil && res.StatusCode == http.StatusNotModified {
  3921. if res.Body != nil {
  3922. res.Body.Close()
  3923. }
  3924. return nil, &googleapi.Error{
  3925. Code: res.StatusCode,
  3926. Header: res.Header,
  3927. }
  3928. }
  3929. if err != nil {
  3930. return nil, err
  3931. }
  3932. defer googleapi.CloseBody(res)
  3933. if err := googleapi.CheckResponse(res); err != nil {
  3934. return nil, err
  3935. }
  3936. ret := &ObjectAccessControl{
  3937. ServerResponse: googleapi.ServerResponse{
  3938. Header: res.Header,
  3939. HTTPStatusCode: res.StatusCode,
  3940. },
  3941. }
  3942. target := &ret
  3943. if err := gensupport.DecodeResponse(target, res); err != nil {
  3944. return nil, err
  3945. }
  3946. return ret, nil
  3947. // {
  3948. // "description": "Returns the ACL entry for the specified entity on the specified object.",
  3949. // "httpMethod": "GET",
  3950. // "id": "storage.objectAccessControls.get",
  3951. // "parameterOrder": [
  3952. // "bucket",
  3953. // "object",
  3954. // "entity"
  3955. // ],
  3956. // "parameters": {
  3957. // "bucket": {
  3958. // "description": "Name of a bucket.",
  3959. // "location": "path",
  3960. // "required": true,
  3961. // "type": "string"
  3962. // },
  3963. // "entity": {
  3964. // "description": "The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.",
  3965. // "location": "path",
  3966. // "required": true,
  3967. // "type": "string"
  3968. // },
  3969. // "generation": {
  3970. // "description": "If present, selects a specific revision of this object (as opposed to the latest version, the default).",
  3971. // "format": "uint64",
  3972. // "location": "query",
  3973. // "type": "string"
  3974. // },
  3975. // "object": {
  3976. // "description": "Name of the object.",
  3977. // "location": "path",
  3978. // "required": true,
  3979. // "type": "string"
  3980. // }
  3981. // },
  3982. // "path": "b/{bucket}/o/{object}/acl/{entity}",
  3983. // "response": {
  3984. // "$ref": "ObjectAccessControl"
  3985. // },
  3986. // "scopes": [
  3987. // "https://www.googleapis.com/auth/devstorage.full_control"
  3988. // ]
  3989. // }
  3990. }
  3991. // method id "storage.objectAccessControls.insert":
  3992. type ObjectAccessControlsInsertCall struct {
  3993. s *Service
  3994. bucket string
  3995. object string
  3996. objectaccesscontrol *ObjectAccessControl
  3997. urlParams_ gensupport.URLParams
  3998. ctx_ context.Context
  3999. header_ http.Header
  4000. }
  4001. // Insert: Creates a new ACL entry on the specified object.
  4002. func (r *ObjectAccessControlsService) Insert(bucket string, object string, objectaccesscontrol *ObjectAccessControl) *ObjectAccessControlsInsertCall {
  4003. c := &ObjectAccessControlsInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4004. c.bucket = bucket
  4005. c.object = object
  4006. c.objectaccesscontrol = objectaccesscontrol
  4007. return c
  4008. }
  4009. // Generation sets the optional parameter "generation": If present,
  4010. // selects a specific revision of this object (as opposed to the latest
  4011. // version, the default).
  4012. func (c *ObjectAccessControlsInsertCall) Generation(generation uint64) *ObjectAccessControlsInsertCall {
  4013. c.urlParams_.Set("generation", fmt.Sprint(generation))
  4014. return c
  4015. }
  4016. // Fields allows partial responses to be retrieved. See
  4017. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4018. // for more information.
  4019. func (c *ObjectAccessControlsInsertCall) Fields(s ...googleapi.Field) *ObjectAccessControlsInsertCall {
  4020. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4021. return c
  4022. }
  4023. // Context sets the context to be used in this call's Do method. Any
  4024. // pending HTTP request will be aborted if the provided context is
  4025. // canceled.
  4026. func (c *ObjectAccessControlsInsertCall) Context(ctx context.Context) *ObjectAccessControlsInsertCall {
  4027. c.ctx_ = ctx
  4028. return c
  4029. }
  4030. // Header returns an http.Header that can be modified by the caller to
  4031. // add HTTP headers to the request.
  4032. func (c *ObjectAccessControlsInsertCall) Header() http.Header {
  4033. if c.header_ == nil {
  4034. c.header_ = make(http.Header)
  4035. }
  4036. return c.header_
  4037. }
  4038. func (c *ObjectAccessControlsInsertCall) doRequest(alt string) (*http.Response, error) {
  4039. reqHeaders := make(http.Header)
  4040. for k, v := range c.header_ {
  4041. reqHeaders[k] = v
  4042. }
  4043. reqHeaders.Set("User-Agent", c.s.userAgent())
  4044. var body io.Reader = nil
  4045. body, err := googleapi.WithoutDataWrapper.JSONReader(c.objectaccesscontrol)
  4046. if err != nil {
  4047. return nil, err
  4048. }
  4049. reqHeaders.Set("Content-Type", "application/json")
  4050. c.urlParams_.Set("alt", alt)
  4051. c.urlParams_.Set("prettyPrint", "false")
  4052. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o/{object}/acl")
  4053. urls += "?" + c.urlParams_.Encode()
  4054. req, err := http.NewRequest("POST", urls, body)
  4055. if err != nil {
  4056. return nil, err
  4057. }
  4058. req.Header = reqHeaders
  4059. googleapi.Expand(req.URL, map[string]string{
  4060. "bucket": c.bucket,
  4061. "object": c.object,
  4062. })
  4063. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4064. }
  4065. // Do executes the "storage.objectAccessControls.insert" call.
  4066. // Exactly one of *ObjectAccessControl or error will be non-nil. Any
  4067. // non-2xx status code is an error. Response headers are in either
  4068. // *ObjectAccessControl.ServerResponse.Header or (if a response was
  4069. // returned at all) in error.(*googleapi.Error).Header. Use
  4070. // googleapi.IsNotModified to check whether the returned error was
  4071. // because http.StatusNotModified was returned.
  4072. func (c *ObjectAccessControlsInsertCall) Do(opts ...googleapi.CallOption) (*ObjectAccessControl, error) {
  4073. gensupport.SetOptions(c.urlParams_, opts...)
  4074. res, err := c.doRequest("json")
  4075. if res != nil && res.StatusCode == http.StatusNotModified {
  4076. if res.Body != nil {
  4077. res.Body.Close()
  4078. }
  4079. return nil, &googleapi.Error{
  4080. Code: res.StatusCode,
  4081. Header: res.Header,
  4082. }
  4083. }
  4084. if err != nil {
  4085. return nil, err
  4086. }
  4087. defer googleapi.CloseBody(res)
  4088. if err := googleapi.CheckResponse(res); err != nil {
  4089. return nil, err
  4090. }
  4091. ret := &ObjectAccessControl{
  4092. ServerResponse: googleapi.ServerResponse{
  4093. Header: res.Header,
  4094. HTTPStatusCode: res.StatusCode,
  4095. },
  4096. }
  4097. target := &ret
  4098. if err := gensupport.DecodeResponse(target, res); err != nil {
  4099. return nil, err
  4100. }
  4101. return ret, nil
  4102. // {
  4103. // "description": "Creates a new ACL entry on the specified object.",
  4104. // "httpMethod": "POST",
  4105. // "id": "storage.objectAccessControls.insert",
  4106. // "parameterOrder": [
  4107. // "bucket",
  4108. // "object"
  4109. // ],
  4110. // "parameters": {
  4111. // "bucket": {
  4112. // "description": "Name of a bucket.",
  4113. // "location": "path",
  4114. // "required": true,
  4115. // "type": "string"
  4116. // },
  4117. // "generation": {
  4118. // "description": "If present, selects a specific revision of this object (as opposed to the latest version, the default).",
  4119. // "format": "uint64",
  4120. // "location": "query",
  4121. // "type": "string"
  4122. // },
  4123. // "object": {
  4124. // "description": "Name of the object.",
  4125. // "location": "path",
  4126. // "required": true,
  4127. // "type": "string"
  4128. // }
  4129. // },
  4130. // "path": "b/{bucket}/o/{object}/acl",
  4131. // "request": {
  4132. // "$ref": "ObjectAccessControl"
  4133. // },
  4134. // "response": {
  4135. // "$ref": "ObjectAccessControl"
  4136. // },
  4137. // "scopes": [
  4138. // "https://www.googleapis.com/auth/devstorage.full_control"
  4139. // ]
  4140. // }
  4141. }
  4142. // method id "storage.objectAccessControls.list":
  4143. type ObjectAccessControlsListCall struct {
  4144. s *Service
  4145. bucket string
  4146. object string
  4147. urlParams_ gensupport.URLParams
  4148. ifNoneMatch_ string
  4149. ctx_ context.Context
  4150. header_ http.Header
  4151. }
  4152. // List: Retrieves ACL entries on the specified object.
  4153. func (r *ObjectAccessControlsService) List(bucket string, object string) *ObjectAccessControlsListCall {
  4154. c := &ObjectAccessControlsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4155. c.bucket = bucket
  4156. c.object = object
  4157. return c
  4158. }
  4159. // Generation sets the optional parameter "generation": If present,
  4160. // selects a specific revision of this object (as opposed to the latest
  4161. // version, the default).
  4162. func (c *ObjectAccessControlsListCall) Generation(generation uint64) *ObjectAccessControlsListCall {
  4163. c.urlParams_.Set("generation", fmt.Sprint(generation))
  4164. return c
  4165. }
  4166. // Fields allows partial responses to be retrieved. See
  4167. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4168. // for more information.
  4169. func (c *ObjectAccessControlsListCall) Fields(s ...googleapi.Field) *ObjectAccessControlsListCall {
  4170. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4171. return c
  4172. }
  4173. // IfNoneMatch sets the optional parameter which makes the operation
  4174. // fail if the object's ETag matches the given value. This is useful for
  4175. // getting updates only after the object has changed since the last
  4176. // request. Use googleapi.IsNotModified to check whether the response
  4177. // error from Do is the result of In-None-Match.
  4178. func (c *ObjectAccessControlsListCall) IfNoneMatch(entityTag string) *ObjectAccessControlsListCall {
  4179. c.ifNoneMatch_ = entityTag
  4180. return c
  4181. }
  4182. // Context sets the context to be used in this call's Do method. Any
  4183. // pending HTTP request will be aborted if the provided context is
  4184. // canceled.
  4185. func (c *ObjectAccessControlsListCall) Context(ctx context.Context) *ObjectAccessControlsListCall {
  4186. c.ctx_ = ctx
  4187. return c
  4188. }
  4189. // Header returns an http.Header that can be modified by the caller to
  4190. // add HTTP headers to the request.
  4191. func (c *ObjectAccessControlsListCall) Header() http.Header {
  4192. if c.header_ == nil {
  4193. c.header_ = make(http.Header)
  4194. }
  4195. return c.header_
  4196. }
  4197. func (c *ObjectAccessControlsListCall) doRequest(alt string) (*http.Response, error) {
  4198. reqHeaders := make(http.Header)
  4199. for k, v := range c.header_ {
  4200. reqHeaders[k] = v
  4201. }
  4202. reqHeaders.Set("User-Agent", c.s.userAgent())
  4203. if c.ifNoneMatch_ != "" {
  4204. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  4205. }
  4206. var body io.Reader = nil
  4207. c.urlParams_.Set("alt", alt)
  4208. c.urlParams_.Set("prettyPrint", "false")
  4209. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o/{object}/acl")
  4210. urls += "?" + c.urlParams_.Encode()
  4211. req, err := http.NewRequest("GET", urls, body)
  4212. if err != nil {
  4213. return nil, err
  4214. }
  4215. req.Header = reqHeaders
  4216. googleapi.Expand(req.URL, map[string]string{
  4217. "bucket": c.bucket,
  4218. "object": c.object,
  4219. })
  4220. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4221. }
  4222. // Do executes the "storage.objectAccessControls.list" call.
  4223. // Exactly one of *ObjectAccessControls or error will be non-nil. Any
  4224. // non-2xx status code is an error. Response headers are in either
  4225. // *ObjectAccessControls.ServerResponse.Header or (if a response was
  4226. // returned at all) in error.(*googleapi.Error).Header. Use
  4227. // googleapi.IsNotModified to check whether the returned error was
  4228. // because http.StatusNotModified was returned.
  4229. func (c *ObjectAccessControlsListCall) Do(opts ...googleapi.CallOption) (*ObjectAccessControls, error) {
  4230. gensupport.SetOptions(c.urlParams_, opts...)
  4231. res, err := c.doRequest("json")
  4232. if res != nil && res.StatusCode == http.StatusNotModified {
  4233. if res.Body != nil {
  4234. res.Body.Close()
  4235. }
  4236. return nil, &googleapi.Error{
  4237. Code: res.StatusCode,
  4238. Header: res.Header,
  4239. }
  4240. }
  4241. if err != nil {
  4242. return nil, err
  4243. }
  4244. defer googleapi.CloseBody(res)
  4245. if err := googleapi.CheckResponse(res); err != nil {
  4246. return nil, err
  4247. }
  4248. ret := &ObjectAccessControls{
  4249. ServerResponse: googleapi.ServerResponse{
  4250. Header: res.Header,
  4251. HTTPStatusCode: res.StatusCode,
  4252. },
  4253. }
  4254. target := &ret
  4255. if err := gensupport.DecodeResponse(target, res); err != nil {
  4256. return nil, err
  4257. }
  4258. return ret, nil
  4259. // {
  4260. // "description": "Retrieves ACL entries on the specified object.",
  4261. // "httpMethod": "GET",
  4262. // "id": "storage.objectAccessControls.list",
  4263. // "parameterOrder": [
  4264. // "bucket",
  4265. // "object"
  4266. // ],
  4267. // "parameters": {
  4268. // "bucket": {
  4269. // "description": "Name of a bucket.",
  4270. // "location": "path",
  4271. // "required": true,
  4272. // "type": "string"
  4273. // },
  4274. // "generation": {
  4275. // "description": "If present, selects a specific revision of this object (as opposed to the latest version, the default).",
  4276. // "format": "uint64",
  4277. // "location": "query",
  4278. // "type": "string"
  4279. // },
  4280. // "object": {
  4281. // "description": "Name of the object.",
  4282. // "location": "path",
  4283. // "required": true,
  4284. // "type": "string"
  4285. // }
  4286. // },
  4287. // "path": "b/{bucket}/o/{object}/acl",
  4288. // "response": {
  4289. // "$ref": "ObjectAccessControls"
  4290. // },
  4291. // "scopes": [
  4292. // "https://www.googleapis.com/auth/devstorage.full_control"
  4293. // ]
  4294. // }
  4295. }
  4296. // method id "storage.objectAccessControls.patch":
  4297. type ObjectAccessControlsPatchCall struct {
  4298. s *Service
  4299. bucket string
  4300. object string
  4301. entity string
  4302. objectaccesscontrol *ObjectAccessControl
  4303. urlParams_ gensupport.URLParams
  4304. ctx_ context.Context
  4305. header_ http.Header
  4306. }
  4307. // Patch: Updates an ACL entry on the specified object. This method
  4308. // supports patch semantics.
  4309. func (r *ObjectAccessControlsService) Patch(bucket string, object string, entity string, objectaccesscontrol *ObjectAccessControl) *ObjectAccessControlsPatchCall {
  4310. c := &ObjectAccessControlsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4311. c.bucket = bucket
  4312. c.object = object
  4313. c.entity = entity
  4314. c.objectaccesscontrol = objectaccesscontrol
  4315. return c
  4316. }
  4317. // Generation sets the optional parameter "generation": If present,
  4318. // selects a specific revision of this object (as opposed to the latest
  4319. // version, the default).
  4320. func (c *ObjectAccessControlsPatchCall) Generation(generation uint64) *ObjectAccessControlsPatchCall {
  4321. c.urlParams_.Set("generation", fmt.Sprint(generation))
  4322. return c
  4323. }
  4324. // Fields allows partial responses to be retrieved. See
  4325. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4326. // for more information.
  4327. func (c *ObjectAccessControlsPatchCall) Fields(s ...googleapi.Field) *ObjectAccessControlsPatchCall {
  4328. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4329. return c
  4330. }
  4331. // Context sets the context to be used in this call's Do method. Any
  4332. // pending HTTP request will be aborted if the provided context is
  4333. // canceled.
  4334. func (c *ObjectAccessControlsPatchCall) Context(ctx context.Context) *ObjectAccessControlsPatchCall {
  4335. c.ctx_ = ctx
  4336. return c
  4337. }
  4338. // Header returns an http.Header that can be modified by the caller to
  4339. // add HTTP headers to the request.
  4340. func (c *ObjectAccessControlsPatchCall) Header() http.Header {
  4341. if c.header_ == nil {
  4342. c.header_ = make(http.Header)
  4343. }
  4344. return c.header_
  4345. }
  4346. func (c *ObjectAccessControlsPatchCall) doRequest(alt string) (*http.Response, error) {
  4347. reqHeaders := make(http.Header)
  4348. for k, v := range c.header_ {
  4349. reqHeaders[k] = v
  4350. }
  4351. reqHeaders.Set("User-Agent", c.s.userAgent())
  4352. var body io.Reader = nil
  4353. body, err := googleapi.WithoutDataWrapper.JSONReader(c.objectaccesscontrol)
  4354. if err != nil {
  4355. return nil, err
  4356. }
  4357. reqHeaders.Set("Content-Type", "application/json")
  4358. c.urlParams_.Set("alt", alt)
  4359. c.urlParams_.Set("prettyPrint", "false")
  4360. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o/{object}/acl/{entity}")
  4361. urls += "?" + c.urlParams_.Encode()
  4362. req, err := http.NewRequest("PATCH", urls, body)
  4363. if err != nil {
  4364. return nil, err
  4365. }
  4366. req.Header = reqHeaders
  4367. googleapi.Expand(req.URL, map[string]string{
  4368. "bucket": c.bucket,
  4369. "object": c.object,
  4370. "entity": c.entity,
  4371. })
  4372. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4373. }
  4374. // Do executes the "storage.objectAccessControls.patch" call.
  4375. // Exactly one of *ObjectAccessControl or error will be non-nil. Any
  4376. // non-2xx status code is an error. Response headers are in either
  4377. // *ObjectAccessControl.ServerResponse.Header or (if a response was
  4378. // returned at all) in error.(*googleapi.Error).Header. Use
  4379. // googleapi.IsNotModified to check whether the returned error was
  4380. // because http.StatusNotModified was returned.
  4381. func (c *ObjectAccessControlsPatchCall) Do(opts ...googleapi.CallOption) (*ObjectAccessControl, error) {
  4382. gensupport.SetOptions(c.urlParams_, opts...)
  4383. res, err := c.doRequest("json")
  4384. if res != nil && res.StatusCode == http.StatusNotModified {
  4385. if res.Body != nil {
  4386. res.Body.Close()
  4387. }
  4388. return nil, &googleapi.Error{
  4389. Code: res.StatusCode,
  4390. Header: res.Header,
  4391. }
  4392. }
  4393. if err != nil {
  4394. return nil, err
  4395. }
  4396. defer googleapi.CloseBody(res)
  4397. if err := googleapi.CheckResponse(res); err != nil {
  4398. return nil, err
  4399. }
  4400. ret := &ObjectAccessControl{
  4401. ServerResponse: googleapi.ServerResponse{
  4402. Header: res.Header,
  4403. HTTPStatusCode: res.StatusCode,
  4404. },
  4405. }
  4406. target := &ret
  4407. if err := gensupport.DecodeResponse(target, res); err != nil {
  4408. return nil, err
  4409. }
  4410. return ret, nil
  4411. // {
  4412. // "description": "Updates an ACL entry on the specified object. This method supports patch semantics.",
  4413. // "httpMethod": "PATCH",
  4414. // "id": "storage.objectAccessControls.patch",
  4415. // "parameterOrder": [
  4416. // "bucket",
  4417. // "object",
  4418. // "entity"
  4419. // ],
  4420. // "parameters": {
  4421. // "bucket": {
  4422. // "description": "Name of a bucket.",
  4423. // "location": "path",
  4424. // "required": true,
  4425. // "type": "string"
  4426. // },
  4427. // "entity": {
  4428. // "description": "The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.",
  4429. // "location": "path",
  4430. // "required": true,
  4431. // "type": "string"
  4432. // },
  4433. // "generation": {
  4434. // "description": "If present, selects a specific revision of this object (as opposed to the latest version, the default).",
  4435. // "format": "uint64",
  4436. // "location": "query",
  4437. // "type": "string"
  4438. // },
  4439. // "object": {
  4440. // "description": "Name of the object.",
  4441. // "location": "path",
  4442. // "required": true,
  4443. // "type": "string"
  4444. // }
  4445. // },
  4446. // "path": "b/{bucket}/o/{object}/acl/{entity}",
  4447. // "request": {
  4448. // "$ref": "ObjectAccessControl"
  4449. // },
  4450. // "response": {
  4451. // "$ref": "ObjectAccessControl"
  4452. // },
  4453. // "scopes": [
  4454. // "https://www.googleapis.com/auth/devstorage.full_control"
  4455. // ]
  4456. // }
  4457. }
  4458. // method id "storage.objectAccessControls.update":
  4459. type ObjectAccessControlsUpdateCall struct {
  4460. s *Service
  4461. bucket string
  4462. object string
  4463. entity string
  4464. objectaccesscontrol *ObjectAccessControl
  4465. urlParams_ gensupport.URLParams
  4466. ctx_ context.Context
  4467. header_ http.Header
  4468. }
  4469. // Update: Updates an ACL entry on the specified object.
  4470. func (r *ObjectAccessControlsService) Update(bucket string, object string, entity string, objectaccesscontrol *ObjectAccessControl) *ObjectAccessControlsUpdateCall {
  4471. c := &ObjectAccessControlsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4472. c.bucket = bucket
  4473. c.object = object
  4474. c.entity = entity
  4475. c.objectaccesscontrol = objectaccesscontrol
  4476. return c
  4477. }
  4478. // Generation sets the optional parameter "generation": If present,
  4479. // selects a specific revision of this object (as opposed to the latest
  4480. // version, the default).
  4481. func (c *ObjectAccessControlsUpdateCall) Generation(generation uint64) *ObjectAccessControlsUpdateCall {
  4482. c.urlParams_.Set("generation", fmt.Sprint(generation))
  4483. return c
  4484. }
  4485. // Fields allows partial responses to be retrieved. See
  4486. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4487. // for more information.
  4488. func (c *ObjectAccessControlsUpdateCall) Fields(s ...googleapi.Field) *ObjectAccessControlsUpdateCall {
  4489. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4490. return c
  4491. }
  4492. // Context sets the context to be used in this call's Do method. Any
  4493. // pending HTTP request will be aborted if the provided context is
  4494. // canceled.
  4495. func (c *ObjectAccessControlsUpdateCall) Context(ctx context.Context) *ObjectAccessControlsUpdateCall {
  4496. c.ctx_ = ctx
  4497. return c
  4498. }
  4499. // Header returns an http.Header that can be modified by the caller to
  4500. // add HTTP headers to the request.
  4501. func (c *ObjectAccessControlsUpdateCall) Header() http.Header {
  4502. if c.header_ == nil {
  4503. c.header_ = make(http.Header)
  4504. }
  4505. return c.header_
  4506. }
  4507. func (c *ObjectAccessControlsUpdateCall) doRequest(alt string) (*http.Response, error) {
  4508. reqHeaders := make(http.Header)
  4509. for k, v := range c.header_ {
  4510. reqHeaders[k] = v
  4511. }
  4512. reqHeaders.Set("User-Agent", c.s.userAgent())
  4513. var body io.Reader = nil
  4514. body, err := googleapi.WithoutDataWrapper.JSONReader(c.objectaccesscontrol)
  4515. if err != nil {
  4516. return nil, err
  4517. }
  4518. reqHeaders.Set("Content-Type", "application/json")
  4519. c.urlParams_.Set("alt", alt)
  4520. c.urlParams_.Set("prettyPrint", "false")
  4521. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o/{object}/acl/{entity}")
  4522. urls += "?" + c.urlParams_.Encode()
  4523. req, err := http.NewRequest("PUT", urls, body)
  4524. if err != nil {
  4525. return nil, err
  4526. }
  4527. req.Header = reqHeaders
  4528. googleapi.Expand(req.URL, map[string]string{
  4529. "bucket": c.bucket,
  4530. "object": c.object,
  4531. "entity": c.entity,
  4532. })
  4533. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4534. }
  4535. // Do executes the "storage.objectAccessControls.update" call.
  4536. // Exactly one of *ObjectAccessControl or error will be non-nil. Any
  4537. // non-2xx status code is an error. Response headers are in either
  4538. // *ObjectAccessControl.ServerResponse.Header or (if a response was
  4539. // returned at all) in error.(*googleapi.Error).Header. Use
  4540. // googleapi.IsNotModified to check whether the returned error was
  4541. // because http.StatusNotModified was returned.
  4542. func (c *ObjectAccessControlsUpdateCall) Do(opts ...googleapi.CallOption) (*ObjectAccessControl, error) {
  4543. gensupport.SetOptions(c.urlParams_, opts...)
  4544. res, err := c.doRequest("json")
  4545. if res != nil && res.StatusCode == http.StatusNotModified {
  4546. if res.Body != nil {
  4547. res.Body.Close()
  4548. }
  4549. return nil, &googleapi.Error{
  4550. Code: res.StatusCode,
  4551. Header: res.Header,
  4552. }
  4553. }
  4554. if err != nil {
  4555. return nil, err
  4556. }
  4557. defer googleapi.CloseBody(res)
  4558. if err := googleapi.CheckResponse(res); err != nil {
  4559. return nil, err
  4560. }
  4561. ret := &ObjectAccessControl{
  4562. ServerResponse: googleapi.ServerResponse{
  4563. Header: res.Header,
  4564. HTTPStatusCode: res.StatusCode,
  4565. },
  4566. }
  4567. target := &ret
  4568. if err := gensupport.DecodeResponse(target, res); err != nil {
  4569. return nil, err
  4570. }
  4571. return ret, nil
  4572. // {
  4573. // "description": "Updates an ACL entry on the specified object.",
  4574. // "httpMethod": "PUT",
  4575. // "id": "storage.objectAccessControls.update",
  4576. // "parameterOrder": [
  4577. // "bucket",
  4578. // "object",
  4579. // "entity"
  4580. // ],
  4581. // "parameters": {
  4582. // "bucket": {
  4583. // "description": "Name of a bucket.",
  4584. // "location": "path",
  4585. // "required": true,
  4586. // "type": "string"
  4587. // },
  4588. // "entity": {
  4589. // "description": "The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.",
  4590. // "location": "path",
  4591. // "required": true,
  4592. // "type": "string"
  4593. // },
  4594. // "generation": {
  4595. // "description": "If present, selects a specific revision of this object (as opposed to the latest version, the default).",
  4596. // "format": "uint64",
  4597. // "location": "query",
  4598. // "type": "string"
  4599. // },
  4600. // "object": {
  4601. // "description": "Name of the object.",
  4602. // "location": "path",
  4603. // "required": true,
  4604. // "type": "string"
  4605. // }
  4606. // },
  4607. // "path": "b/{bucket}/o/{object}/acl/{entity}",
  4608. // "request": {
  4609. // "$ref": "ObjectAccessControl"
  4610. // },
  4611. // "response": {
  4612. // "$ref": "ObjectAccessControl"
  4613. // },
  4614. // "scopes": [
  4615. // "https://www.googleapis.com/auth/devstorage.full_control"
  4616. // ]
  4617. // }
  4618. }
  4619. // method id "storage.objects.compose":
  4620. type ObjectsComposeCall struct {
  4621. s *Service
  4622. destinationBucket string
  4623. destinationObject string
  4624. composerequest *ComposeRequest
  4625. urlParams_ gensupport.URLParams
  4626. ctx_ context.Context
  4627. header_ http.Header
  4628. }
  4629. // Compose: Concatenates a list of existing objects into a new object in
  4630. // the same bucket.
  4631. func (r *ObjectsService) Compose(destinationBucket string, destinationObject string, composerequest *ComposeRequest) *ObjectsComposeCall {
  4632. c := &ObjectsComposeCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4633. c.destinationBucket = destinationBucket
  4634. c.destinationObject = destinationObject
  4635. c.composerequest = composerequest
  4636. return c
  4637. }
  4638. // IfGenerationMatch sets the optional parameter "ifGenerationMatch":
  4639. // Makes the operation conditional on whether the object's current
  4640. // generation matches the given value.
  4641. func (c *ObjectsComposeCall) IfGenerationMatch(ifGenerationMatch uint64) *ObjectsComposeCall {
  4642. c.urlParams_.Set("ifGenerationMatch", fmt.Sprint(ifGenerationMatch))
  4643. return c
  4644. }
  4645. // IfMetagenerationMatch sets the optional parameter
  4646. // "ifMetagenerationMatch": Makes the operation conditional on whether
  4647. // the object's current metageneration matches the given value.
  4648. func (c *ObjectsComposeCall) IfMetagenerationMatch(ifMetagenerationMatch uint64) *ObjectsComposeCall {
  4649. c.urlParams_.Set("ifMetagenerationMatch", fmt.Sprint(ifMetagenerationMatch))
  4650. return c
  4651. }
  4652. // Fields allows partial responses to be retrieved. See
  4653. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4654. // for more information.
  4655. func (c *ObjectsComposeCall) Fields(s ...googleapi.Field) *ObjectsComposeCall {
  4656. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4657. return c
  4658. }
  4659. // Context sets the context to be used in this call's Do and Download
  4660. // methods. Any pending HTTP request will be aborted if the provided
  4661. // context is canceled.
  4662. func (c *ObjectsComposeCall) Context(ctx context.Context) *ObjectsComposeCall {
  4663. c.ctx_ = ctx
  4664. return c
  4665. }
  4666. // Header returns an http.Header that can be modified by the caller to
  4667. // add HTTP headers to the request.
  4668. func (c *ObjectsComposeCall) Header() http.Header {
  4669. if c.header_ == nil {
  4670. c.header_ = make(http.Header)
  4671. }
  4672. return c.header_
  4673. }
  4674. func (c *ObjectsComposeCall) doRequest(alt string) (*http.Response, error) {
  4675. reqHeaders := make(http.Header)
  4676. for k, v := range c.header_ {
  4677. reqHeaders[k] = v
  4678. }
  4679. reqHeaders.Set("User-Agent", c.s.userAgent())
  4680. var body io.Reader = nil
  4681. body, err := googleapi.WithoutDataWrapper.JSONReader(c.composerequest)
  4682. if err != nil {
  4683. return nil, err
  4684. }
  4685. reqHeaders.Set("Content-Type", "application/json")
  4686. c.urlParams_.Set("alt", alt)
  4687. c.urlParams_.Set("prettyPrint", "false")
  4688. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{destinationBucket}/o/{destinationObject}/compose")
  4689. urls += "?" + c.urlParams_.Encode()
  4690. req, err := http.NewRequest("POST", urls, body)
  4691. if err != nil {
  4692. return nil, err
  4693. }
  4694. req.Header = reqHeaders
  4695. googleapi.Expand(req.URL, map[string]string{
  4696. "destinationBucket": c.destinationBucket,
  4697. "destinationObject": c.destinationObject,
  4698. })
  4699. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4700. }
  4701. // Download fetches the API endpoint's "media" value, instead of the normal
  4702. // API response value. If the returned error is nil, the Response is guaranteed to
  4703. // have a 2xx status code. Callers must close the Response.Body as usual.
  4704. func (c *ObjectsComposeCall) Download(opts ...googleapi.CallOption) (*http.Response, error) {
  4705. gensupport.SetOptions(c.urlParams_, opts...)
  4706. res, err := c.doRequest("media")
  4707. if err != nil {
  4708. return nil, err
  4709. }
  4710. if err := googleapi.CheckMediaResponse(res); err != nil {
  4711. res.Body.Close()
  4712. return nil, err
  4713. }
  4714. return res, nil
  4715. }
  4716. // Do executes the "storage.objects.compose" call.
  4717. // Exactly one of *Object or error will be non-nil. Any non-2xx status
  4718. // code is an error. Response headers are in either
  4719. // *Object.ServerResponse.Header or (if a response was returned at all)
  4720. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  4721. // check whether the returned error was because http.StatusNotModified
  4722. // was returned.
  4723. func (c *ObjectsComposeCall) Do(opts ...googleapi.CallOption) (*Object, error) {
  4724. gensupport.SetOptions(c.urlParams_, opts...)
  4725. res, err := c.doRequest("json")
  4726. if res != nil && res.StatusCode == http.StatusNotModified {
  4727. if res.Body != nil {
  4728. res.Body.Close()
  4729. }
  4730. return nil, &googleapi.Error{
  4731. Code: res.StatusCode,
  4732. Header: res.Header,
  4733. }
  4734. }
  4735. if err != nil {
  4736. return nil, err
  4737. }
  4738. defer googleapi.CloseBody(res)
  4739. if err := googleapi.CheckResponse(res); err != nil {
  4740. return nil, err
  4741. }
  4742. ret := &Object{
  4743. ServerResponse: googleapi.ServerResponse{
  4744. Header: res.Header,
  4745. HTTPStatusCode: res.StatusCode,
  4746. },
  4747. }
  4748. target := &ret
  4749. if err := gensupport.DecodeResponse(target, res); err != nil {
  4750. return nil, err
  4751. }
  4752. return ret, nil
  4753. // {
  4754. // "description": "Concatenates a list of existing objects into a new object in the same bucket.",
  4755. // "httpMethod": "POST",
  4756. // "id": "storage.objects.compose",
  4757. // "parameterOrder": [
  4758. // "destinationBucket",
  4759. // "destinationObject"
  4760. // ],
  4761. // "parameters": {
  4762. // "destinationBucket": {
  4763. // "description": "Name of the bucket containing the source objects. The destination object is stored in this bucket.",
  4764. // "location": "path",
  4765. // "required": true,
  4766. // "type": "string"
  4767. // },
  4768. // "destinationObject": {
  4769. // "description": "Name of the new object.",
  4770. // "location": "path",
  4771. // "required": true,
  4772. // "type": "string"
  4773. // },
  4774. // "ifGenerationMatch": {
  4775. // "description": "Makes the operation conditional on whether the object's current generation matches the given value.",
  4776. // "format": "uint64",
  4777. // "location": "query",
  4778. // "type": "string"
  4779. // },
  4780. // "ifMetagenerationMatch": {
  4781. // "description": "Makes the operation conditional on whether the object's current metageneration matches the given value.",
  4782. // "format": "uint64",
  4783. // "location": "query",
  4784. // "type": "string"
  4785. // }
  4786. // },
  4787. // "path": "b/{destinationBucket}/o/{destinationObject}/compose",
  4788. // "request": {
  4789. // "$ref": "ComposeRequest"
  4790. // },
  4791. // "response": {
  4792. // "$ref": "Object"
  4793. // },
  4794. // "scopes": [
  4795. // "https://www.googleapis.com/auth/devstorage.full_control",
  4796. // "https://www.googleapis.com/auth/devstorage.read_write"
  4797. // ],
  4798. // "supportsMediaDownload": true
  4799. // }
  4800. }
  4801. // method id "storage.objects.copy":
  4802. type ObjectsCopyCall struct {
  4803. s *Service
  4804. sourceBucket string
  4805. sourceObject string
  4806. destinationBucket string
  4807. destinationObject string
  4808. object *Object
  4809. urlParams_ gensupport.URLParams
  4810. ctx_ context.Context
  4811. header_ http.Header
  4812. }
  4813. // Copy: Copies an object to a destination in the same location.
  4814. // Optionally overrides metadata.
  4815. func (r *ObjectsService) Copy(sourceBucket string, sourceObject string, destinationBucket string, destinationObject string, object *Object) *ObjectsCopyCall {
  4816. c := &ObjectsCopyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4817. c.sourceBucket = sourceBucket
  4818. c.sourceObject = sourceObject
  4819. c.destinationBucket = destinationBucket
  4820. c.destinationObject = destinationObject
  4821. c.object = object
  4822. return c
  4823. }
  4824. // IfGenerationMatch sets the optional parameter "ifGenerationMatch":
  4825. // Makes the operation conditional on whether the destination object's
  4826. // current generation matches the given value.
  4827. func (c *ObjectsCopyCall) IfGenerationMatch(ifGenerationMatch uint64) *ObjectsCopyCall {
  4828. c.urlParams_.Set("ifGenerationMatch", fmt.Sprint(ifGenerationMatch))
  4829. return c
  4830. }
  4831. // IfGenerationNotMatch sets the optional parameter
  4832. // "ifGenerationNotMatch": Makes the operation conditional on whether
  4833. // the destination object's current generation does not match the given
  4834. // value.
  4835. func (c *ObjectsCopyCall) IfGenerationNotMatch(ifGenerationNotMatch uint64) *ObjectsCopyCall {
  4836. c.urlParams_.Set("ifGenerationNotMatch", fmt.Sprint(ifGenerationNotMatch))
  4837. return c
  4838. }
  4839. // IfMetagenerationMatch sets the optional parameter
  4840. // "ifMetagenerationMatch": Makes the operation conditional on whether
  4841. // the destination object's current metageneration matches the given
  4842. // value.
  4843. func (c *ObjectsCopyCall) IfMetagenerationMatch(ifMetagenerationMatch uint64) *ObjectsCopyCall {
  4844. c.urlParams_.Set("ifMetagenerationMatch", fmt.Sprint(ifMetagenerationMatch))
  4845. return c
  4846. }
  4847. // IfMetagenerationNotMatch sets the optional parameter
  4848. // "ifMetagenerationNotMatch": Makes the operation conditional on
  4849. // whether the destination object's current metageneration does not
  4850. // match the given value.
  4851. func (c *ObjectsCopyCall) IfMetagenerationNotMatch(ifMetagenerationNotMatch uint64) *ObjectsCopyCall {
  4852. c.urlParams_.Set("ifMetagenerationNotMatch", fmt.Sprint(ifMetagenerationNotMatch))
  4853. return c
  4854. }
  4855. // IfSourceGenerationMatch sets the optional parameter
  4856. // "ifSourceGenerationMatch": Makes the operation conditional on whether
  4857. // the source object's generation matches the given value.
  4858. func (c *ObjectsCopyCall) IfSourceGenerationMatch(ifSourceGenerationMatch uint64) *ObjectsCopyCall {
  4859. c.urlParams_.Set("ifSourceGenerationMatch", fmt.Sprint(ifSourceGenerationMatch))
  4860. return c
  4861. }
  4862. // IfSourceGenerationNotMatch sets the optional parameter
  4863. // "ifSourceGenerationNotMatch": Makes the operation conditional on
  4864. // whether the source object's generation does not match the given
  4865. // value.
  4866. func (c *ObjectsCopyCall) IfSourceGenerationNotMatch(ifSourceGenerationNotMatch uint64) *ObjectsCopyCall {
  4867. c.urlParams_.Set("ifSourceGenerationNotMatch", fmt.Sprint(ifSourceGenerationNotMatch))
  4868. return c
  4869. }
  4870. // IfSourceMetagenerationMatch sets the optional parameter
  4871. // "ifSourceMetagenerationMatch": Makes the operation conditional on
  4872. // whether the source object's current metageneration matches the given
  4873. // value.
  4874. func (c *ObjectsCopyCall) IfSourceMetagenerationMatch(ifSourceMetagenerationMatch uint64) *ObjectsCopyCall {
  4875. c.urlParams_.Set("ifSourceMetagenerationMatch", fmt.Sprint(ifSourceMetagenerationMatch))
  4876. return c
  4877. }
  4878. // IfSourceMetagenerationNotMatch sets the optional parameter
  4879. // "ifSourceMetagenerationNotMatch": Makes the operation conditional on
  4880. // whether the source object's current metageneration does not match the
  4881. // given value.
  4882. func (c *ObjectsCopyCall) IfSourceMetagenerationNotMatch(ifSourceMetagenerationNotMatch uint64) *ObjectsCopyCall {
  4883. c.urlParams_.Set("ifSourceMetagenerationNotMatch", fmt.Sprint(ifSourceMetagenerationNotMatch))
  4884. return c
  4885. }
  4886. // Projection sets the optional parameter "projection": Set of
  4887. // properties to return. Defaults to noAcl, unless the object resource
  4888. // specifies the acl property, when it defaults to full.
  4889. //
  4890. // Possible values:
  4891. // "full" - Include all properties.
  4892. // "noAcl" - Omit the acl property.
  4893. func (c *ObjectsCopyCall) Projection(projection string) *ObjectsCopyCall {
  4894. c.urlParams_.Set("projection", projection)
  4895. return c
  4896. }
  4897. // SourceGeneration sets the optional parameter "sourceGeneration": If
  4898. // present, selects a specific revision of the source object (as opposed
  4899. // to the latest version, the default).
  4900. func (c *ObjectsCopyCall) SourceGeneration(sourceGeneration uint64) *ObjectsCopyCall {
  4901. c.urlParams_.Set("sourceGeneration", fmt.Sprint(sourceGeneration))
  4902. return c
  4903. }
  4904. // Fields allows partial responses to be retrieved. See
  4905. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4906. // for more information.
  4907. func (c *ObjectsCopyCall) Fields(s ...googleapi.Field) *ObjectsCopyCall {
  4908. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4909. return c
  4910. }
  4911. // Context sets the context to be used in this call's Do and Download
  4912. // methods. Any pending HTTP request will be aborted if the provided
  4913. // context is canceled.
  4914. func (c *ObjectsCopyCall) Context(ctx context.Context) *ObjectsCopyCall {
  4915. c.ctx_ = ctx
  4916. return c
  4917. }
  4918. // Header returns an http.Header that can be modified by the caller to
  4919. // add HTTP headers to the request.
  4920. func (c *ObjectsCopyCall) Header() http.Header {
  4921. if c.header_ == nil {
  4922. c.header_ = make(http.Header)
  4923. }
  4924. return c.header_
  4925. }
  4926. func (c *ObjectsCopyCall) doRequest(alt string) (*http.Response, error) {
  4927. reqHeaders := make(http.Header)
  4928. for k, v := range c.header_ {
  4929. reqHeaders[k] = v
  4930. }
  4931. reqHeaders.Set("User-Agent", c.s.userAgent())
  4932. var body io.Reader = nil
  4933. body, err := googleapi.WithoutDataWrapper.JSONReader(c.object)
  4934. if err != nil {
  4935. return nil, err
  4936. }
  4937. reqHeaders.Set("Content-Type", "application/json")
  4938. c.urlParams_.Set("alt", alt)
  4939. c.urlParams_.Set("prettyPrint", "false")
  4940. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{sourceBucket}/o/{sourceObject}/copyTo/b/{destinationBucket}/o/{destinationObject}")
  4941. urls += "?" + c.urlParams_.Encode()
  4942. req, err := http.NewRequest("POST", urls, body)
  4943. if err != nil {
  4944. return nil, err
  4945. }
  4946. req.Header = reqHeaders
  4947. googleapi.Expand(req.URL, map[string]string{
  4948. "sourceBucket": c.sourceBucket,
  4949. "sourceObject": c.sourceObject,
  4950. "destinationBucket": c.destinationBucket,
  4951. "destinationObject": c.destinationObject,
  4952. })
  4953. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4954. }
  4955. // Download fetches the API endpoint's "media" value, instead of the normal
  4956. // API response value. If the returned error is nil, the Response is guaranteed to
  4957. // have a 2xx status code. Callers must close the Response.Body as usual.
  4958. func (c *ObjectsCopyCall) Download(opts ...googleapi.CallOption) (*http.Response, error) {
  4959. gensupport.SetOptions(c.urlParams_, opts...)
  4960. res, err := c.doRequest("media")
  4961. if err != nil {
  4962. return nil, err
  4963. }
  4964. if err := googleapi.CheckMediaResponse(res); err != nil {
  4965. res.Body.Close()
  4966. return nil, err
  4967. }
  4968. return res, nil
  4969. }
  4970. // Do executes the "storage.objects.copy" call.
  4971. // Exactly one of *Object or error will be non-nil. Any non-2xx status
  4972. // code is an error. Response headers are in either
  4973. // *Object.ServerResponse.Header or (if a response was returned at all)
  4974. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  4975. // check whether the returned error was because http.StatusNotModified
  4976. // was returned.
  4977. func (c *ObjectsCopyCall) Do(opts ...googleapi.CallOption) (*Object, error) {
  4978. gensupport.SetOptions(c.urlParams_, opts...)
  4979. res, err := c.doRequest("json")
  4980. if res != nil && res.StatusCode == http.StatusNotModified {
  4981. if res.Body != nil {
  4982. res.Body.Close()
  4983. }
  4984. return nil, &googleapi.Error{
  4985. Code: res.StatusCode,
  4986. Header: res.Header,
  4987. }
  4988. }
  4989. if err != nil {
  4990. return nil, err
  4991. }
  4992. defer googleapi.CloseBody(res)
  4993. if err := googleapi.CheckResponse(res); err != nil {
  4994. return nil, err
  4995. }
  4996. ret := &Object{
  4997. ServerResponse: googleapi.ServerResponse{
  4998. Header: res.Header,
  4999. HTTPStatusCode: res.StatusCode,
  5000. },
  5001. }
  5002. target := &ret
  5003. if err := gensupport.DecodeResponse(target, res); err != nil {
  5004. return nil, err
  5005. }
  5006. return ret, nil
  5007. // {
  5008. // "description": "Copies an object to a destination in the same location. Optionally overrides metadata.",
  5009. // "httpMethod": "POST",
  5010. // "id": "storage.objects.copy",
  5011. // "parameterOrder": [
  5012. // "sourceBucket",
  5013. // "sourceObject",
  5014. // "destinationBucket",
  5015. // "destinationObject"
  5016. // ],
  5017. // "parameters": {
  5018. // "destinationBucket": {
  5019. // "description": "Name of the bucket in which to store the new object. Overrides the provided object metadata's bucket value, if any.",
  5020. // "location": "path",
  5021. // "required": true,
  5022. // "type": "string"
  5023. // },
  5024. // "destinationObject": {
  5025. // "description": "Name of the new object. Required when the object metadata is not otherwise provided. Overrides the object metadata's name value, if any.",
  5026. // "location": "path",
  5027. // "required": true,
  5028. // "type": "string"
  5029. // },
  5030. // "ifGenerationMatch": {
  5031. // "description": "Makes the operation conditional on whether the destination object's current generation matches the given value.",
  5032. // "format": "uint64",
  5033. // "location": "query",
  5034. // "type": "string"
  5035. // },
  5036. // "ifGenerationNotMatch": {
  5037. // "description": "Makes the operation conditional on whether the destination object's current generation does not match the given value.",
  5038. // "format": "uint64",
  5039. // "location": "query",
  5040. // "type": "string"
  5041. // },
  5042. // "ifMetagenerationMatch": {
  5043. // "description": "Makes the operation conditional on whether the destination object's current metageneration matches the given value.",
  5044. // "format": "uint64",
  5045. // "location": "query",
  5046. // "type": "string"
  5047. // },
  5048. // "ifMetagenerationNotMatch": {
  5049. // "description": "Makes the operation conditional on whether the destination object's current metageneration does not match the given value.",
  5050. // "format": "uint64",
  5051. // "location": "query",
  5052. // "type": "string"
  5053. // },
  5054. // "ifSourceGenerationMatch": {
  5055. // "description": "Makes the operation conditional on whether the source object's generation matches the given value.",
  5056. // "format": "uint64",
  5057. // "location": "query",
  5058. // "type": "string"
  5059. // },
  5060. // "ifSourceGenerationNotMatch": {
  5061. // "description": "Makes the operation conditional on whether the source object's generation does not match the given value.",
  5062. // "format": "uint64",
  5063. // "location": "query",
  5064. // "type": "string"
  5065. // },
  5066. // "ifSourceMetagenerationMatch": {
  5067. // "description": "Makes the operation conditional on whether the source object's current metageneration matches the given value.",
  5068. // "format": "uint64",
  5069. // "location": "query",
  5070. // "type": "string"
  5071. // },
  5072. // "ifSourceMetagenerationNotMatch": {
  5073. // "description": "Makes the operation conditional on whether the source object's current metageneration does not match the given value.",
  5074. // "format": "uint64",
  5075. // "location": "query",
  5076. // "type": "string"
  5077. // },
  5078. // "projection": {
  5079. // "description": "Set of properties to return. Defaults to noAcl, unless the object resource specifies the acl property, when it defaults to full.",
  5080. // "enum": [
  5081. // "full",
  5082. // "noAcl"
  5083. // ],
  5084. // "enumDescriptions": [
  5085. // "Include all properties.",
  5086. // "Omit the acl property."
  5087. // ],
  5088. // "location": "query",
  5089. // "type": "string"
  5090. // },
  5091. // "sourceBucket": {
  5092. // "description": "Name of the bucket in which to find the source object.",
  5093. // "location": "path",
  5094. // "required": true,
  5095. // "type": "string"
  5096. // },
  5097. // "sourceGeneration": {
  5098. // "description": "If present, selects a specific revision of the source object (as opposed to the latest version, the default).",
  5099. // "format": "uint64",
  5100. // "location": "query",
  5101. // "type": "string"
  5102. // },
  5103. // "sourceObject": {
  5104. // "description": "Name of the source object.",
  5105. // "location": "path",
  5106. // "required": true,
  5107. // "type": "string"
  5108. // }
  5109. // },
  5110. // "path": "b/{sourceBucket}/o/{sourceObject}/copyTo/b/{destinationBucket}/o/{destinationObject}",
  5111. // "request": {
  5112. // "$ref": "Object"
  5113. // },
  5114. // "response": {
  5115. // "$ref": "Object"
  5116. // },
  5117. // "scopes": [
  5118. // "https://www.googleapis.com/auth/devstorage.full_control",
  5119. // "https://www.googleapis.com/auth/devstorage.read_write"
  5120. // ],
  5121. // "supportsMediaDownload": true
  5122. // }
  5123. }
  5124. // method id "storage.objects.delete":
  5125. type ObjectsDeleteCall struct {
  5126. s *Service
  5127. bucket string
  5128. object string
  5129. urlParams_ gensupport.URLParams
  5130. ctx_ context.Context
  5131. header_ http.Header
  5132. }
  5133. // Delete: Deletes data blobs and associated metadata. Deletions are
  5134. // permanent if versioning is not enabled for the bucket, or if the
  5135. // generation parameter is used.
  5136. func (r *ObjectsService) Delete(bucket string, object string) *ObjectsDeleteCall {
  5137. c := &ObjectsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5138. c.bucket = bucket
  5139. c.object = object
  5140. return c
  5141. }
  5142. // Generation sets the optional parameter "generation": If present,
  5143. // permanently deletes a specific revision of this object (as opposed to
  5144. // the latest version, the default).
  5145. func (c *ObjectsDeleteCall) Generation(generation uint64) *ObjectsDeleteCall {
  5146. c.urlParams_.Set("generation", fmt.Sprint(generation))
  5147. return c
  5148. }
  5149. // IfGenerationMatch sets the optional parameter "ifGenerationMatch":
  5150. // Makes the operation conditional on whether the object's current
  5151. // generation matches the given value.
  5152. func (c *ObjectsDeleteCall) IfGenerationMatch(ifGenerationMatch uint64) *ObjectsDeleteCall {
  5153. c.urlParams_.Set("ifGenerationMatch", fmt.Sprint(ifGenerationMatch))
  5154. return c
  5155. }
  5156. // IfGenerationNotMatch sets the optional parameter
  5157. // "ifGenerationNotMatch": Makes the operation conditional on whether
  5158. // the object's current generation does not match the given value.
  5159. func (c *ObjectsDeleteCall) IfGenerationNotMatch(ifGenerationNotMatch uint64) *ObjectsDeleteCall {
  5160. c.urlParams_.Set("ifGenerationNotMatch", fmt.Sprint(ifGenerationNotMatch))
  5161. return c
  5162. }
  5163. // IfMetagenerationMatch sets the optional parameter
  5164. // "ifMetagenerationMatch": Makes the operation conditional on whether
  5165. // the object's current metageneration matches the given value.
  5166. func (c *ObjectsDeleteCall) IfMetagenerationMatch(ifMetagenerationMatch uint64) *ObjectsDeleteCall {
  5167. c.urlParams_.Set("ifMetagenerationMatch", fmt.Sprint(ifMetagenerationMatch))
  5168. return c
  5169. }
  5170. // IfMetagenerationNotMatch sets the optional parameter
  5171. // "ifMetagenerationNotMatch": Makes the operation conditional on
  5172. // whether the object's current metageneration does not match the given
  5173. // value.
  5174. func (c *ObjectsDeleteCall) IfMetagenerationNotMatch(ifMetagenerationNotMatch uint64) *ObjectsDeleteCall {
  5175. c.urlParams_.Set("ifMetagenerationNotMatch", fmt.Sprint(ifMetagenerationNotMatch))
  5176. return c
  5177. }
  5178. // Fields allows partial responses to be retrieved. See
  5179. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5180. // for more information.
  5181. func (c *ObjectsDeleteCall) Fields(s ...googleapi.Field) *ObjectsDeleteCall {
  5182. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5183. return c
  5184. }
  5185. // Context sets the context to be used in this call's Do method. Any
  5186. // pending HTTP request will be aborted if the provided context is
  5187. // canceled.
  5188. func (c *ObjectsDeleteCall) Context(ctx context.Context) *ObjectsDeleteCall {
  5189. c.ctx_ = ctx
  5190. return c
  5191. }
  5192. // Header returns an http.Header that can be modified by the caller to
  5193. // add HTTP headers to the request.
  5194. func (c *ObjectsDeleteCall) Header() http.Header {
  5195. if c.header_ == nil {
  5196. c.header_ = make(http.Header)
  5197. }
  5198. return c.header_
  5199. }
  5200. func (c *ObjectsDeleteCall) doRequest(alt string) (*http.Response, error) {
  5201. reqHeaders := make(http.Header)
  5202. for k, v := range c.header_ {
  5203. reqHeaders[k] = v
  5204. }
  5205. reqHeaders.Set("User-Agent", c.s.userAgent())
  5206. var body io.Reader = nil
  5207. c.urlParams_.Set("alt", alt)
  5208. c.urlParams_.Set("prettyPrint", "false")
  5209. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o/{object}")
  5210. urls += "?" + c.urlParams_.Encode()
  5211. req, err := http.NewRequest("DELETE", urls, body)
  5212. if err != nil {
  5213. return nil, err
  5214. }
  5215. req.Header = reqHeaders
  5216. googleapi.Expand(req.URL, map[string]string{
  5217. "bucket": c.bucket,
  5218. "object": c.object,
  5219. })
  5220. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5221. }
  5222. // Do executes the "storage.objects.delete" call.
  5223. func (c *ObjectsDeleteCall) Do(opts ...googleapi.CallOption) error {
  5224. gensupport.SetOptions(c.urlParams_, opts...)
  5225. res, err := c.doRequest("json")
  5226. if err != nil {
  5227. return err
  5228. }
  5229. defer googleapi.CloseBody(res)
  5230. if err := googleapi.CheckResponse(res); err != nil {
  5231. return err
  5232. }
  5233. return nil
  5234. // {
  5235. // "description": "Deletes data blobs and associated metadata. Deletions are permanent if versioning is not enabled for the bucket, or if the generation parameter is used.",
  5236. // "httpMethod": "DELETE",
  5237. // "id": "storage.objects.delete",
  5238. // "parameterOrder": [
  5239. // "bucket",
  5240. // "object"
  5241. // ],
  5242. // "parameters": {
  5243. // "bucket": {
  5244. // "description": "Name of the bucket in which the object resides.",
  5245. // "location": "path",
  5246. // "required": true,
  5247. // "type": "string"
  5248. // },
  5249. // "generation": {
  5250. // "description": "If present, permanently deletes a specific revision of this object (as opposed to the latest version, the default).",
  5251. // "format": "uint64",
  5252. // "location": "query",
  5253. // "type": "string"
  5254. // },
  5255. // "ifGenerationMatch": {
  5256. // "description": "Makes the operation conditional on whether the object's current generation matches the given value.",
  5257. // "format": "uint64",
  5258. // "location": "query",
  5259. // "type": "string"
  5260. // },
  5261. // "ifGenerationNotMatch": {
  5262. // "description": "Makes the operation conditional on whether the object's current generation does not match the given value.",
  5263. // "format": "uint64",
  5264. // "location": "query",
  5265. // "type": "string"
  5266. // },
  5267. // "ifMetagenerationMatch": {
  5268. // "description": "Makes the operation conditional on whether the object's current metageneration matches the given value.",
  5269. // "format": "uint64",
  5270. // "location": "query",
  5271. // "type": "string"
  5272. // },
  5273. // "ifMetagenerationNotMatch": {
  5274. // "description": "Makes the operation conditional on whether the object's current metageneration does not match the given value.",
  5275. // "format": "uint64",
  5276. // "location": "query",
  5277. // "type": "string"
  5278. // },
  5279. // "object": {
  5280. // "description": "Name of the object.",
  5281. // "location": "path",
  5282. // "required": true,
  5283. // "type": "string"
  5284. // }
  5285. // },
  5286. // "path": "b/{bucket}/o/{object}",
  5287. // "scopes": [
  5288. // "https://www.googleapis.com/auth/devstorage.full_control",
  5289. // "https://www.googleapis.com/auth/devstorage.read_write"
  5290. // ]
  5291. // }
  5292. }
  5293. // method id "storage.objects.get":
  5294. type ObjectsGetCall struct {
  5295. s *Service
  5296. bucket string
  5297. object string
  5298. urlParams_ gensupport.URLParams
  5299. ifNoneMatch_ string
  5300. ctx_ context.Context
  5301. header_ http.Header
  5302. }
  5303. // Get: Retrieves objects or their associated metadata.
  5304. func (r *ObjectsService) Get(bucket string, object string) *ObjectsGetCall {
  5305. c := &ObjectsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5306. c.bucket = bucket
  5307. c.object = object
  5308. return c
  5309. }
  5310. // Generation sets the optional parameter "generation": If present,
  5311. // selects a specific revision of this object (as opposed to the latest
  5312. // version, the default).
  5313. func (c *ObjectsGetCall) Generation(generation uint64) *ObjectsGetCall {
  5314. c.urlParams_.Set("generation", fmt.Sprint(generation))
  5315. return c
  5316. }
  5317. // IfGenerationMatch sets the optional parameter "ifGenerationMatch":
  5318. // Makes the operation conditional on whether the object's generation
  5319. // matches the given value.
  5320. func (c *ObjectsGetCall) IfGenerationMatch(ifGenerationMatch uint64) *ObjectsGetCall {
  5321. c.urlParams_.Set("ifGenerationMatch", fmt.Sprint(ifGenerationMatch))
  5322. return c
  5323. }
  5324. // IfGenerationNotMatch sets the optional parameter
  5325. // "ifGenerationNotMatch": Makes the operation conditional on whether
  5326. // the object's generation does not match the given value.
  5327. func (c *ObjectsGetCall) IfGenerationNotMatch(ifGenerationNotMatch uint64) *ObjectsGetCall {
  5328. c.urlParams_.Set("ifGenerationNotMatch", fmt.Sprint(ifGenerationNotMatch))
  5329. return c
  5330. }
  5331. // IfMetagenerationMatch sets the optional parameter
  5332. // "ifMetagenerationMatch": Makes the operation conditional on whether
  5333. // the object's current metageneration matches the given value.
  5334. func (c *ObjectsGetCall) IfMetagenerationMatch(ifMetagenerationMatch uint64) *ObjectsGetCall {
  5335. c.urlParams_.Set("ifMetagenerationMatch", fmt.Sprint(ifMetagenerationMatch))
  5336. return c
  5337. }
  5338. // IfMetagenerationNotMatch sets the optional parameter
  5339. // "ifMetagenerationNotMatch": Makes the operation conditional on
  5340. // whether the object's current metageneration does not match the given
  5341. // value.
  5342. func (c *ObjectsGetCall) IfMetagenerationNotMatch(ifMetagenerationNotMatch uint64) *ObjectsGetCall {
  5343. c.urlParams_.Set("ifMetagenerationNotMatch", fmt.Sprint(ifMetagenerationNotMatch))
  5344. return c
  5345. }
  5346. // Projection sets the optional parameter "projection": Set of
  5347. // properties to return. Defaults to noAcl.
  5348. //
  5349. // Possible values:
  5350. // "full" - Include all properties.
  5351. // "noAcl" - Omit the acl property.
  5352. func (c *ObjectsGetCall) Projection(projection string) *ObjectsGetCall {
  5353. c.urlParams_.Set("projection", projection)
  5354. return c
  5355. }
  5356. // Fields allows partial responses to be retrieved. See
  5357. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5358. // for more information.
  5359. func (c *ObjectsGetCall) Fields(s ...googleapi.Field) *ObjectsGetCall {
  5360. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5361. return c
  5362. }
  5363. // IfNoneMatch sets the optional parameter which makes the operation
  5364. // fail if the object's ETag matches the given value. This is useful for
  5365. // getting updates only after the object has changed since the last
  5366. // request. Use googleapi.IsNotModified to check whether the response
  5367. // error from Do is the result of In-None-Match.
  5368. func (c *ObjectsGetCall) IfNoneMatch(entityTag string) *ObjectsGetCall {
  5369. c.ifNoneMatch_ = entityTag
  5370. return c
  5371. }
  5372. // Context sets the context to be used in this call's Do and Download
  5373. // methods. Any pending HTTP request will be aborted if the provided
  5374. // context is canceled.
  5375. func (c *ObjectsGetCall) Context(ctx context.Context) *ObjectsGetCall {
  5376. c.ctx_ = ctx
  5377. return c
  5378. }
  5379. // Header returns an http.Header that can be modified by the caller to
  5380. // add HTTP headers to the request.
  5381. func (c *ObjectsGetCall) Header() http.Header {
  5382. if c.header_ == nil {
  5383. c.header_ = make(http.Header)
  5384. }
  5385. return c.header_
  5386. }
  5387. func (c *ObjectsGetCall) doRequest(alt string) (*http.Response, error) {
  5388. reqHeaders := make(http.Header)
  5389. for k, v := range c.header_ {
  5390. reqHeaders[k] = v
  5391. }
  5392. reqHeaders.Set("User-Agent", c.s.userAgent())
  5393. if c.ifNoneMatch_ != "" {
  5394. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  5395. }
  5396. var body io.Reader = nil
  5397. c.urlParams_.Set("alt", alt)
  5398. c.urlParams_.Set("prettyPrint", "false")
  5399. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o/{object}")
  5400. urls += "?" + c.urlParams_.Encode()
  5401. req, err := http.NewRequest("GET", urls, body)
  5402. if err != nil {
  5403. return nil, err
  5404. }
  5405. req.Header = reqHeaders
  5406. googleapi.Expand(req.URL, map[string]string{
  5407. "bucket": c.bucket,
  5408. "object": c.object,
  5409. })
  5410. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5411. }
  5412. // Download fetches the API endpoint's "media" value, instead of the normal
  5413. // API response value. If the returned error is nil, the Response is guaranteed to
  5414. // have a 2xx status code. Callers must close the Response.Body as usual.
  5415. func (c *ObjectsGetCall) Download(opts ...googleapi.CallOption) (*http.Response, error) {
  5416. gensupport.SetOptions(c.urlParams_, opts...)
  5417. res, err := c.doRequest("media")
  5418. if err != nil {
  5419. return nil, err
  5420. }
  5421. if err := googleapi.CheckMediaResponse(res); err != nil {
  5422. res.Body.Close()
  5423. return nil, err
  5424. }
  5425. return res, nil
  5426. }
  5427. // Do executes the "storage.objects.get" call.
  5428. // Exactly one of *Object or error will be non-nil. Any non-2xx status
  5429. // code is an error. Response headers are in either
  5430. // *Object.ServerResponse.Header or (if a response was returned at all)
  5431. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  5432. // check whether the returned error was because http.StatusNotModified
  5433. // was returned.
  5434. func (c *ObjectsGetCall) Do(opts ...googleapi.CallOption) (*Object, error) {
  5435. gensupport.SetOptions(c.urlParams_, opts...)
  5436. res, err := c.doRequest("json")
  5437. if res != nil && res.StatusCode == http.StatusNotModified {
  5438. if res.Body != nil {
  5439. res.Body.Close()
  5440. }
  5441. return nil, &googleapi.Error{
  5442. Code: res.StatusCode,
  5443. Header: res.Header,
  5444. }
  5445. }
  5446. if err != nil {
  5447. return nil, err
  5448. }
  5449. defer googleapi.CloseBody(res)
  5450. if err := googleapi.CheckResponse(res); err != nil {
  5451. return nil, err
  5452. }
  5453. ret := &Object{
  5454. ServerResponse: googleapi.ServerResponse{
  5455. Header: res.Header,
  5456. HTTPStatusCode: res.StatusCode,
  5457. },
  5458. }
  5459. target := &ret
  5460. if err := gensupport.DecodeResponse(target, res); err != nil {
  5461. return nil, err
  5462. }
  5463. return ret, nil
  5464. // {
  5465. // "description": "Retrieves objects or their associated metadata.",
  5466. // "httpMethod": "GET",
  5467. // "id": "storage.objects.get",
  5468. // "parameterOrder": [
  5469. // "bucket",
  5470. // "object"
  5471. // ],
  5472. // "parameters": {
  5473. // "bucket": {
  5474. // "description": "Name of the bucket in which the object resides.",
  5475. // "location": "path",
  5476. // "required": true,
  5477. // "type": "string"
  5478. // },
  5479. // "generation": {
  5480. // "description": "If present, selects a specific revision of this object (as opposed to the latest version, the default).",
  5481. // "format": "uint64",
  5482. // "location": "query",
  5483. // "type": "string"
  5484. // },
  5485. // "ifGenerationMatch": {
  5486. // "description": "Makes the operation conditional on whether the object's generation matches the given value.",
  5487. // "format": "uint64",
  5488. // "location": "query",
  5489. // "type": "string"
  5490. // },
  5491. // "ifGenerationNotMatch": {
  5492. // "description": "Makes the operation conditional on whether the object's generation does not match the given value.",
  5493. // "format": "uint64",
  5494. // "location": "query",
  5495. // "type": "string"
  5496. // },
  5497. // "ifMetagenerationMatch": {
  5498. // "description": "Makes the operation conditional on whether the object's current metageneration matches the given value.",
  5499. // "format": "uint64",
  5500. // "location": "query",
  5501. // "type": "string"
  5502. // },
  5503. // "ifMetagenerationNotMatch": {
  5504. // "description": "Makes the operation conditional on whether the object's current metageneration does not match the given value.",
  5505. // "format": "uint64",
  5506. // "location": "query",
  5507. // "type": "string"
  5508. // },
  5509. // "object": {
  5510. // "description": "Name of the object.",
  5511. // "location": "path",
  5512. // "required": true,
  5513. // "type": "string"
  5514. // },
  5515. // "projection": {
  5516. // "description": "Set of properties to return. Defaults to noAcl.",
  5517. // "enum": [
  5518. // "full",
  5519. // "noAcl"
  5520. // ],
  5521. // "enumDescriptions": [
  5522. // "Include all properties.",
  5523. // "Omit the acl property."
  5524. // ],
  5525. // "location": "query",
  5526. // "type": "string"
  5527. // }
  5528. // },
  5529. // "path": "b/{bucket}/o/{object}",
  5530. // "response": {
  5531. // "$ref": "Object"
  5532. // },
  5533. // "scopes": [
  5534. // "https://www.googleapis.com/auth/devstorage.full_control",
  5535. // "https://www.googleapis.com/auth/devstorage.read_only",
  5536. // "https://www.googleapis.com/auth/devstorage.read_write"
  5537. // ],
  5538. // "supportsMediaDownload": true
  5539. // }
  5540. }
  5541. // method id "storage.objects.insert":
  5542. type ObjectsInsertCall struct {
  5543. s *Service
  5544. bucket string
  5545. object *Object
  5546. urlParams_ gensupport.URLParams
  5547. mediaInfo_ *gensupport.MediaInfo
  5548. ctx_ context.Context
  5549. header_ http.Header
  5550. }
  5551. // Insert: Stores new data blobs and associated metadata.
  5552. func (r *ObjectsService) Insert(bucket string, object *Object) *ObjectsInsertCall {
  5553. c := &ObjectsInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5554. c.bucket = bucket
  5555. c.object = object
  5556. return c
  5557. }
  5558. // IfGenerationMatch sets the optional parameter "ifGenerationMatch":
  5559. // Makes the operation conditional on whether the object's current
  5560. // generation matches the given value.
  5561. func (c *ObjectsInsertCall) IfGenerationMatch(ifGenerationMatch uint64) *ObjectsInsertCall {
  5562. c.urlParams_.Set("ifGenerationMatch", fmt.Sprint(ifGenerationMatch))
  5563. return c
  5564. }
  5565. // IfGenerationNotMatch sets the optional parameter
  5566. // "ifGenerationNotMatch": Makes the operation conditional on whether
  5567. // the object's current generation does not match the given value.
  5568. func (c *ObjectsInsertCall) IfGenerationNotMatch(ifGenerationNotMatch uint64) *ObjectsInsertCall {
  5569. c.urlParams_.Set("ifGenerationNotMatch", fmt.Sprint(ifGenerationNotMatch))
  5570. return c
  5571. }
  5572. // IfMetagenerationMatch sets the optional parameter
  5573. // "ifMetagenerationMatch": Makes the operation conditional on whether
  5574. // the object's current metageneration matches the given value.
  5575. func (c *ObjectsInsertCall) IfMetagenerationMatch(ifMetagenerationMatch uint64) *ObjectsInsertCall {
  5576. c.urlParams_.Set("ifMetagenerationMatch", fmt.Sprint(ifMetagenerationMatch))
  5577. return c
  5578. }
  5579. // IfMetagenerationNotMatch sets the optional parameter
  5580. // "ifMetagenerationNotMatch": Makes the operation conditional on
  5581. // whether the object's current metageneration does not match the given
  5582. // value.
  5583. func (c *ObjectsInsertCall) IfMetagenerationNotMatch(ifMetagenerationNotMatch uint64) *ObjectsInsertCall {
  5584. c.urlParams_.Set("ifMetagenerationNotMatch", fmt.Sprint(ifMetagenerationNotMatch))
  5585. return c
  5586. }
  5587. // Name sets the optional parameter "name": Name of the object. Required
  5588. // when the object metadata is not otherwise provided. Overrides the
  5589. // object metadata's name value, if any.
  5590. func (c *ObjectsInsertCall) Name(name string) *ObjectsInsertCall {
  5591. c.urlParams_.Set("name", name)
  5592. return c
  5593. }
  5594. // Projection sets the optional parameter "projection": Set of
  5595. // properties to return. Defaults to noAcl, unless the object resource
  5596. // specifies the acl property, when it defaults to full.
  5597. //
  5598. // Possible values:
  5599. // "full" - Include all properties.
  5600. // "noAcl" - Omit the acl property.
  5601. func (c *ObjectsInsertCall) Projection(projection string) *ObjectsInsertCall {
  5602. c.urlParams_.Set("projection", projection)
  5603. return c
  5604. }
  5605. // Media specifies the media to upload in one or more chunks. The chunk
  5606. // size may be controlled by supplying a MediaOption generated by
  5607. // googleapi.ChunkSize. The chunk size defaults to
  5608. // googleapi.DefaultUploadChunkSize.The Content-Type header used in the
  5609. // upload request will be determined by sniffing the contents of r,
  5610. // unless a MediaOption generated by googleapi.ContentType is
  5611. // supplied.
  5612. // At most one of Media and ResumableMedia may be set.
  5613. func (c *ObjectsInsertCall) Media(r io.Reader, options ...googleapi.MediaOption) *ObjectsInsertCall {
  5614. if ct := c.object.ContentType; ct != "" {
  5615. options = append([]googleapi.MediaOption{googleapi.ContentType(ct)}, options...)
  5616. }
  5617. c.mediaInfo_ = gensupport.NewInfoFromMedia(r, options)
  5618. return c
  5619. }
  5620. // ResumableMedia specifies the media to upload in chunks and can be
  5621. // canceled with ctx.
  5622. //
  5623. // Deprecated: use Media instead.
  5624. //
  5625. // At most one of Media and ResumableMedia may be set. mediaType
  5626. // identifies the MIME media type of the upload, such as "image/png". If
  5627. // mediaType is "", it will be auto-detected. The provided ctx will
  5628. // supersede any context previously provided to the Context method.
  5629. func (c *ObjectsInsertCall) ResumableMedia(ctx context.Context, r io.ReaderAt, size int64, mediaType string) *ObjectsInsertCall {
  5630. c.ctx_ = ctx
  5631. c.mediaInfo_ = gensupport.NewInfoFromResumableMedia(r, size, mediaType)
  5632. return c
  5633. }
  5634. // ProgressUpdater provides a callback function that will be called
  5635. // after every chunk. It should be a low-latency function in order to
  5636. // not slow down the upload operation. This should only be called when
  5637. // using ResumableMedia (as opposed to Media).
  5638. func (c *ObjectsInsertCall) ProgressUpdater(pu googleapi.ProgressUpdater) *ObjectsInsertCall {
  5639. c.mediaInfo_.SetProgressUpdater(pu)
  5640. return c
  5641. }
  5642. // Fields allows partial responses to be retrieved. See
  5643. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5644. // for more information.
  5645. func (c *ObjectsInsertCall) Fields(s ...googleapi.Field) *ObjectsInsertCall {
  5646. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5647. return c
  5648. }
  5649. // Context sets the context to be used in this call's Do method. Any
  5650. // pending HTTP request will be aborted if the provided context is
  5651. // canceled.
  5652. // This context will supersede any context previously provided to the
  5653. // ResumableMedia method.
  5654. func (c *ObjectsInsertCall) Context(ctx context.Context) *ObjectsInsertCall {
  5655. c.ctx_ = ctx
  5656. return c
  5657. }
  5658. // Header returns an http.Header that can be modified by the caller to
  5659. // add HTTP headers to the request.
  5660. func (c *ObjectsInsertCall) Header() http.Header {
  5661. if c.header_ == nil {
  5662. c.header_ = make(http.Header)
  5663. }
  5664. return c.header_
  5665. }
  5666. func (c *ObjectsInsertCall) doRequest(alt string) (*http.Response, error) {
  5667. reqHeaders := make(http.Header)
  5668. for k, v := range c.header_ {
  5669. reqHeaders[k] = v
  5670. }
  5671. reqHeaders.Set("User-Agent", c.s.userAgent())
  5672. var body io.Reader = nil
  5673. body, err := googleapi.WithoutDataWrapper.JSONReader(c.object)
  5674. if err != nil {
  5675. return nil, err
  5676. }
  5677. reqHeaders.Set("Content-Type", "application/json")
  5678. c.urlParams_.Set("alt", alt)
  5679. c.urlParams_.Set("prettyPrint", "false")
  5680. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o")
  5681. if c.mediaInfo_ != nil {
  5682. urls = strings.Replace(urls, "https://www.googleapis.com/", "https://www.googleapis.com/upload/", 1)
  5683. c.urlParams_.Set("uploadType", c.mediaInfo_.UploadType())
  5684. }
  5685. if body == nil {
  5686. body = new(bytes.Buffer)
  5687. reqHeaders.Set("Content-Type", "application/json")
  5688. }
  5689. body, getBody, cleanup := c.mediaInfo_.UploadRequest(reqHeaders, body)
  5690. defer cleanup()
  5691. urls += "?" + c.urlParams_.Encode()
  5692. req, err := http.NewRequest("POST", urls, body)
  5693. if err != nil {
  5694. return nil, err
  5695. }
  5696. req.Header = reqHeaders
  5697. req.GetBody = getBody
  5698. googleapi.Expand(req.URL, map[string]string{
  5699. "bucket": c.bucket,
  5700. })
  5701. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5702. }
  5703. // Do executes the "storage.objects.insert" call.
  5704. // Exactly one of *Object or error will be non-nil. Any non-2xx status
  5705. // code is an error. Response headers are in either
  5706. // *Object.ServerResponse.Header or (if a response was returned at all)
  5707. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  5708. // check whether the returned error was because http.StatusNotModified
  5709. // was returned.
  5710. func (c *ObjectsInsertCall) Do(opts ...googleapi.CallOption) (*Object, error) {
  5711. gensupport.SetOptions(c.urlParams_, opts...)
  5712. res, err := c.doRequest("json")
  5713. if res != nil && res.StatusCode == http.StatusNotModified {
  5714. if res.Body != nil {
  5715. res.Body.Close()
  5716. }
  5717. return nil, &googleapi.Error{
  5718. Code: res.StatusCode,
  5719. Header: res.Header,
  5720. }
  5721. }
  5722. if err != nil {
  5723. return nil, err
  5724. }
  5725. defer googleapi.CloseBody(res)
  5726. if err := googleapi.CheckResponse(res); err != nil {
  5727. return nil, err
  5728. }
  5729. rx := c.mediaInfo_.ResumableUpload(res.Header.Get("Location"))
  5730. if rx != nil {
  5731. rx.Client = c.s.client
  5732. rx.UserAgent = c.s.userAgent()
  5733. ctx := c.ctx_
  5734. if ctx == nil {
  5735. ctx = context.TODO()
  5736. }
  5737. res, err = rx.Upload(ctx)
  5738. if err != nil {
  5739. return nil, err
  5740. }
  5741. defer res.Body.Close()
  5742. if err := googleapi.CheckResponse(res); err != nil {
  5743. return nil, err
  5744. }
  5745. }
  5746. ret := &Object{
  5747. ServerResponse: googleapi.ServerResponse{
  5748. Header: res.Header,
  5749. HTTPStatusCode: res.StatusCode,
  5750. },
  5751. }
  5752. target := &ret
  5753. if err := gensupport.DecodeResponse(target, res); err != nil {
  5754. return nil, err
  5755. }
  5756. return ret, nil
  5757. // {
  5758. // "description": "Stores new data blobs and associated metadata.",
  5759. // "httpMethod": "POST",
  5760. // "id": "storage.objects.insert",
  5761. // "mediaUpload": {
  5762. // "accept": [
  5763. // "*/*"
  5764. // ],
  5765. // "protocols": {
  5766. // "resumable": {
  5767. // "multipart": true,
  5768. // "path": "/resumable/upload/storage/v1beta2/b/{bucket}/o"
  5769. // },
  5770. // "simple": {
  5771. // "multipart": true,
  5772. // "path": "/upload/storage/v1beta2/b/{bucket}/o"
  5773. // }
  5774. // }
  5775. // },
  5776. // "parameterOrder": [
  5777. // "bucket"
  5778. // ],
  5779. // "parameters": {
  5780. // "bucket": {
  5781. // "description": "Name of the bucket in which to store the new object. Overrides the provided object metadata's bucket value, if any.",
  5782. // "location": "path",
  5783. // "required": true,
  5784. // "type": "string"
  5785. // },
  5786. // "ifGenerationMatch": {
  5787. // "description": "Makes the operation conditional on whether the object's current generation matches the given value.",
  5788. // "format": "uint64",
  5789. // "location": "query",
  5790. // "type": "string"
  5791. // },
  5792. // "ifGenerationNotMatch": {
  5793. // "description": "Makes the operation conditional on whether the object's current generation does not match the given value.",
  5794. // "format": "uint64",
  5795. // "location": "query",
  5796. // "type": "string"
  5797. // },
  5798. // "ifMetagenerationMatch": {
  5799. // "description": "Makes the operation conditional on whether the object's current metageneration matches the given value.",
  5800. // "format": "uint64",
  5801. // "location": "query",
  5802. // "type": "string"
  5803. // },
  5804. // "ifMetagenerationNotMatch": {
  5805. // "description": "Makes the operation conditional on whether the object's current metageneration does not match the given value.",
  5806. // "format": "uint64",
  5807. // "location": "query",
  5808. // "type": "string"
  5809. // },
  5810. // "name": {
  5811. // "description": "Name of the object. Required when the object metadata is not otherwise provided. Overrides the object metadata's name value, if any.",
  5812. // "location": "query",
  5813. // "type": "string"
  5814. // },
  5815. // "projection": {
  5816. // "description": "Set of properties to return. Defaults to noAcl, unless the object resource specifies the acl property, when it defaults to full.",
  5817. // "enum": [
  5818. // "full",
  5819. // "noAcl"
  5820. // ],
  5821. // "enumDescriptions": [
  5822. // "Include all properties.",
  5823. // "Omit the acl property."
  5824. // ],
  5825. // "location": "query",
  5826. // "type": "string"
  5827. // }
  5828. // },
  5829. // "path": "b/{bucket}/o",
  5830. // "request": {
  5831. // "$ref": "Object"
  5832. // },
  5833. // "response": {
  5834. // "$ref": "Object"
  5835. // },
  5836. // "scopes": [
  5837. // "https://www.googleapis.com/auth/devstorage.full_control",
  5838. // "https://www.googleapis.com/auth/devstorage.read_write"
  5839. // ],
  5840. // "supportsMediaDownload": true,
  5841. // "supportsMediaUpload": true
  5842. // }
  5843. }
  5844. // method id "storage.objects.list":
  5845. type ObjectsListCall struct {
  5846. s *Service
  5847. bucket string
  5848. urlParams_ gensupport.URLParams
  5849. ifNoneMatch_ string
  5850. ctx_ context.Context
  5851. header_ http.Header
  5852. }
  5853. // List: Retrieves a list of objects matching the criteria.
  5854. func (r *ObjectsService) List(bucket string) *ObjectsListCall {
  5855. c := &ObjectsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5856. c.bucket = bucket
  5857. return c
  5858. }
  5859. // Delimiter sets the optional parameter "delimiter": Returns results in
  5860. // a directory-like mode. items will contain only objects whose names,
  5861. // aside from the prefix, do not contain delimiter. Objects whose names,
  5862. // aside from the prefix, contain delimiter will have their name,
  5863. // truncated after the delimiter, returned in prefixes. Duplicate
  5864. // prefixes are omitted.
  5865. func (c *ObjectsListCall) Delimiter(delimiter string) *ObjectsListCall {
  5866. c.urlParams_.Set("delimiter", delimiter)
  5867. return c
  5868. }
  5869. // MaxResults sets the optional parameter "maxResults": Maximum number
  5870. // of items plus prefixes to return. As duplicate prefixes are omitted,
  5871. // fewer total results may be returned than requested.
  5872. func (c *ObjectsListCall) MaxResults(maxResults int64) *ObjectsListCall {
  5873. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  5874. return c
  5875. }
  5876. // PageToken sets the optional parameter "pageToken": A
  5877. // previously-returned page token representing part of the larger set of
  5878. // results to view.
  5879. func (c *ObjectsListCall) PageToken(pageToken string) *ObjectsListCall {
  5880. c.urlParams_.Set("pageToken", pageToken)
  5881. return c
  5882. }
  5883. // Prefix sets the optional parameter "prefix": Filter results to
  5884. // objects whose names begin with this prefix.
  5885. func (c *ObjectsListCall) Prefix(prefix string) *ObjectsListCall {
  5886. c.urlParams_.Set("prefix", prefix)
  5887. return c
  5888. }
  5889. // Projection sets the optional parameter "projection": Set of
  5890. // properties to return. Defaults to noAcl.
  5891. //
  5892. // Possible values:
  5893. // "full" - Include all properties.
  5894. // "noAcl" - Omit the acl property.
  5895. func (c *ObjectsListCall) Projection(projection string) *ObjectsListCall {
  5896. c.urlParams_.Set("projection", projection)
  5897. return c
  5898. }
  5899. // Versions sets the optional parameter "versions": If true, lists all
  5900. // versions of a file as distinct results.
  5901. func (c *ObjectsListCall) Versions(versions bool) *ObjectsListCall {
  5902. c.urlParams_.Set("versions", fmt.Sprint(versions))
  5903. return c
  5904. }
  5905. // Fields allows partial responses to be retrieved. See
  5906. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5907. // for more information.
  5908. func (c *ObjectsListCall) Fields(s ...googleapi.Field) *ObjectsListCall {
  5909. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5910. return c
  5911. }
  5912. // IfNoneMatch sets the optional parameter which makes the operation
  5913. // fail if the object's ETag matches the given value. This is useful for
  5914. // getting updates only after the object has changed since the last
  5915. // request. Use googleapi.IsNotModified to check whether the response
  5916. // error from Do is the result of In-None-Match.
  5917. func (c *ObjectsListCall) IfNoneMatch(entityTag string) *ObjectsListCall {
  5918. c.ifNoneMatch_ = entityTag
  5919. return c
  5920. }
  5921. // Context sets the context to be used in this call's Do method. Any
  5922. // pending HTTP request will be aborted if the provided context is
  5923. // canceled.
  5924. func (c *ObjectsListCall) Context(ctx context.Context) *ObjectsListCall {
  5925. c.ctx_ = ctx
  5926. return c
  5927. }
  5928. // Header returns an http.Header that can be modified by the caller to
  5929. // add HTTP headers to the request.
  5930. func (c *ObjectsListCall) Header() http.Header {
  5931. if c.header_ == nil {
  5932. c.header_ = make(http.Header)
  5933. }
  5934. return c.header_
  5935. }
  5936. func (c *ObjectsListCall) doRequest(alt string) (*http.Response, error) {
  5937. reqHeaders := make(http.Header)
  5938. for k, v := range c.header_ {
  5939. reqHeaders[k] = v
  5940. }
  5941. reqHeaders.Set("User-Agent", c.s.userAgent())
  5942. if c.ifNoneMatch_ != "" {
  5943. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  5944. }
  5945. var body io.Reader = nil
  5946. c.urlParams_.Set("alt", alt)
  5947. c.urlParams_.Set("prettyPrint", "false")
  5948. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o")
  5949. urls += "?" + c.urlParams_.Encode()
  5950. req, err := http.NewRequest("GET", urls, body)
  5951. if err != nil {
  5952. return nil, err
  5953. }
  5954. req.Header = reqHeaders
  5955. googleapi.Expand(req.URL, map[string]string{
  5956. "bucket": c.bucket,
  5957. })
  5958. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5959. }
  5960. // Do executes the "storage.objects.list" call.
  5961. // Exactly one of *Objects or error will be non-nil. Any non-2xx status
  5962. // code is an error. Response headers are in either
  5963. // *Objects.ServerResponse.Header or (if a response was returned at all)
  5964. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  5965. // check whether the returned error was because http.StatusNotModified
  5966. // was returned.
  5967. func (c *ObjectsListCall) Do(opts ...googleapi.CallOption) (*Objects, error) {
  5968. gensupport.SetOptions(c.urlParams_, opts...)
  5969. res, err := c.doRequest("json")
  5970. if res != nil && res.StatusCode == http.StatusNotModified {
  5971. if res.Body != nil {
  5972. res.Body.Close()
  5973. }
  5974. return nil, &googleapi.Error{
  5975. Code: res.StatusCode,
  5976. Header: res.Header,
  5977. }
  5978. }
  5979. if err != nil {
  5980. return nil, err
  5981. }
  5982. defer googleapi.CloseBody(res)
  5983. if err := googleapi.CheckResponse(res); err != nil {
  5984. return nil, err
  5985. }
  5986. ret := &Objects{
  5987. ServerResponse: googleapi.ServerResponse{
  5988. Header: res.Header,
  5989. HTTPStatusCode: res.StatusCode,
  5990. },
  5991. }
  5992. target := &ret
  5993. if err := gensupport.DecodeResponse(target, res); err != nil {
  5994. return nil, err
  5995. }
  5996. return ret, nil
  5997. // {
  5998. // "description": "Retrieves a list of objects matching the criteria.",
  5999. // "httpMethod": "GET",
  6000. // "id": "storage.objects.list",
  6001. // "parameterOrder": [
  6002. // "bucket"
  6003. // ],
  6004. // "parameters": {
  6005. // "bucket": {
  6006. // "description": "Name of the bucket in which to look for objects.",
  6007. // "location": "path",
  6008. // "required": true,
  6009. // "type": "string"
  6010. // },
  6011. // "delimiter": {
  6012. // "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.",
  6013. // "location": "query",
  6014. // "type": "string"
  6015. // },
  6016. // "maxResults": {
  6017. // "description": "Maximum number of items plus prefixes to return. As duplicate prefixes are omitted, fewer total results may be returned than requested.",
  6018. // "format": "uint32",
  6019. // "location": "query",
  6020. // "minimum": "0",
  6021. // "type": "integer"
  6022. // },
  6023. // "pageToken": {
  6024. // "description": "A previously-returned page token representing part of the larger set of results to view.",
  6025. // "location": "query",
  6026. // "type": "string"
  6027. // },
  6028. // "prefix": {
  6029. // "description": "Filter results to objects whose names begin with this prefix.",
  6030. // "location": "query",
  6031. // "type": "string"
  6032. // },
  6033. // "projection": {
  6034. // "description": "Set of properties to return. Defaults to noAcl.",
  6035. // "enum": [
  6036. // "full",
  6037. // "noAcl"
  6038. // ],
  6039. // "enumDescriptions": [
  6040. // "Include all properties.",
  6041. // "Omit the acl property."
  6042. // ],
  6043. // "location": "query",
  6044. // "type": "string"
  6045. // },
  6046. // "versions": {
  6047. // "description": "If true, lists all versions of a file as distinct results.",
  6048. // "location": "query",
  6049. // "type": "boolean"
  6050. // }
  6051. // },
  6052. // "path": "b/{bucket}/o",
  6053. // "response": {
  6054. // "$ref": "Objects"
  6055. // },
  6056. // "scopes": [
  6057. // "https://www.googleapis.com/auth/devstorage.full_control",
  6058. // "https://www.googleapis.com/auth/devstorage.read_only",
  6059. // "https://www.googleapis.com/auth/devstorage.read_write"
  6060. // ],
  6061. // "supportsSubscription": true
  6062. // }
  6063. }
  6064. // Pages invokes f for each page of results.
  6065. // A non-nil error returned from f will halt the iteration.
  6066. // The provided context supersedes any context provided to the Context method.
  6067. func (c *ObjectsListCall) Pages(ctx context.Context, f func(*Objects) error) error {
  6068. c.ctx_ = ctx
  6069. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  6070. for {
  6071. x, err := c.Do()
  6072. if err != nil {
  6073. return err
  6074. }
  6075. if err := f(x); err != nil {
  6076. return err
  6077. }
  6078. if x.NextPageToken == "" {
  6079. return nil
  6080. }
  6081. c.PageToken(x.NextPageToken)
  6082. }
  6083. }
  6084. // method id "storage.objects.patch":
  6085. type ObjectsPatchCall struct {
  6086. s *Service
  6087. bucket string
  6088. object string
  6089. object2 *Object
  6090. urlParams_ gensupport.URLParams
  6091. ctx_ context.Context
  6092. header_ http.Header
  6093. }
  6094. // Patch: Updates a data blob's associated metadata. This method
  6095. // supports patch semantics.
  6096. func (r *ObjectsService) Patch(bucket string, object string, object2 *Object) *ObjectsPatchCall {
  6097. c := &ObjectsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6098. c.bucket = bucket
  6099. c.object = object
  6100. c.object2 = object2
  6101. return c
  6102. }
  6103. // Generation sets the optional parameter "generation": If present,
  6104. // selects a specific revision of this object (as opposed to the latest
  6105. // version, the default).
  6106. func (c *ObjectsPatchCall) Generation(generation uint64) *ObjectsPatchCall {
  6107. c.urlParams_.Set("generation", fmt.Sprint(generation))
  6108. return c
  6109. }
  6110. // IfGenerationMatch sets the optional parameter "ifGenerationMatch":
  6111. // Makes the operation conditional on whether the object's current
  6112. // generation matches the given value.
  6113. func (c *ObjectsPatchCall) IfGenerationMatch(ifGenerationMatch uint64) *ObjectsPatchCall {
  6114. c.urlParams_.Set("ifGenerationMatch", fmt.Sprint(ifGenerationMatch))
  6115. return c
  6116. }
  6117. // IfGenerationNotMatch sets the optional parameter
  6118. // "ifGenerationNotMatch": Makes the operation conditional on whether
  6119. // the object's current generation does not match the given value.
  6120. func (c *ObjectsPatchCall) IfGenerationNotMatch(ifGenerationNotMatch uint64) *ObjectsPatchCall {
  6121. c.urlParams_.Set("ifGenerationNotMatch", fmt.Sprint(ifGenerationNotMatch))
  6122. return c
  6123. }
  6124. // IfMetagenerationMatch sets the optional parameter
  6125. // "ifMetagenerationMatch": Makes the operation conditional on whether
  6126. // the object's current metageneration matches the given value.
  6127. func (c *ObjectsPatchCall) IfMetagenerationMatch(ifMetagenerationMatch uint64) *ObjectsPatchCall {
  6128. c.urlParams_.Set("ifMetagenerationMatch", fmt.Sprint(ifMetagenerationMatch))
  6129. return c
  6130. }
  6131. // IfMetagenerationNotMatch sets the optional parameter
  6132. // "ifMetagenerationNotMatch": Makes the operation conditional on
  6133. // whether the object's current metageneration does not match the given
  6134. // value.
  6135. func (c *ObjectsPatchCall) IfMetagenerationNotMatch(ifMetagenerationNotMatch uint64) *ObjectsPatchCall {
  6136. c.urlParams_.Set("ifMetagenerationNotMatch", fmt.Sprint(ifMetagenerationNotMatch))
  6137. return c
  6138. }
  6139. // Projection sets the optional parameter "projection": Set of
  6140. // properties to return. Defaults to full.
  6141. //
  6142. // Possible values:
  6143. // "full" - Include all properties.
  6144. // "noAcl" - Omit the acl property.
  6145. func (c *ObjectsPatchCall) Projection(projection string) *ObjectsPatchCall {
  6146. c.urlParams_.Set("projection", projection)
  6147. return c
  6148. }
  6149. // Fields allows partial responses to be retrieved. See
  6150. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6151. // for more information.
  6152. func (c *ObjectsPatchCall) Fields(s ...googleapi.Field) *ObjectsPatchCall {
  6153. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6154. return c
  6155. }
  6156. // Context sets the context to be used in this call's Do method. Any
  6157. // pending HTTP request will be aborted if the provided context is
  6158. // canceled.
  6159. func (c *ObjectsPatchCall) Context(ctx context.Context) *ObjectsPatchCall {
  6160. c.ctx_ = ctx
  6161. return c
  6162. }
  6163. // Header returns an http.Header that can be modified by the caller to
  6164. // add HTTP headers to the request.
  6165. func (c *ObjectsPatchCall) Header() http.Header {
  6166. if c.header_ == nil {
  6167. c.header_ = make(http.Header)
  6168. }
  6169. return c.header_
  6170. }
  6171. func (c *ObjectsPatchCall) doRequest(alt string) (*http.Response, error) {
  6172. reqHeaders := make(http.Header)
  6173. for k, v := range c.header_ {
  6174. reqHeaders[k] = v
  6175. }
  6176. reqHeaders.Set("User-Agent", c.s.userAgent())
  6177. var body io.Reader = nil
  6178. body, err := googleapi.WithoutDataWrapper.JSONReader(c.object2)
  6179. if err != nil {
  6180. return nil, err
  6181. }
  6182. reqHeaders.Set("Content-Type", "application/json")
  6183. c.urlParams_.Set("alt", alt)
  6184. c.urlParams_.Set("prettyPrint", "false")
  6185. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o/{object}")
  6186. urls += "?" + c.urlParams_.Encode()
  6187. req, err := http.NewRequest("PATCH", urls, body)
  6188. if err != nil {
  6189. return nil, err
  6190. }
  6191. req.Header = reqHeaders
  6192. googleapi.Expand(req.URL, map[string]string{
  6193. "bucket": c.bucket,
  6194. "object": c.object,
  6195. })
  6196. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6197. }
  6198. // Do executes the "storage.objects.patch" call.
  6199. // Exactly one of *Object or error will be non-nil. Any non-2xx status
  6200. // code is an error. Response headers are in either
  6201. // *Object.ServerResponse.Header or (if a response was returned at all)
  6202. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  6203. // check whether the returned error was because http.StatusNotModified
  6204. // was returned.
  6205. func (c *ObjectsPatchCall) Do(opts ...googleapi.CallOption) (*Object, error) {
  6206. gensupport.SetOptions(c.urlParams_, opts...)
  6207. res, err := c.doRequest("json")
  6208. if res != nil && res.StatusCode == http.StatusNotModified {
  6209. if res.Body != nil {
  6210. res.Body.Close()
  6211. }
  6212. return nil, &googleapi.Error{
  6213. Code: res.StatusCode,
  6214. Header: res.Header,
  6215. }
  6216. }
  6217. if err != nil {
  6218. return nil, err
  6219. }
  6220. defer googleapi.CloseBody(res)
  6221. if err := googleapi.CheckResponse(res); err != nil {
  6222. return nil, err
  6223. }
  6224. ret := &Object{
  6225. ServerResponse: googleapi.ServerResponse{
  6226. Header: res.Header,
  6227. HTTPStatusCode: res.StatusCode,
  6228. },
  6229. }
  6230. target := &ret
  6231. if err := gensupport.DecodeResponse(target, res); err != nil {
  6232. return nil, err
  6233. }
  6234. return ret, nil
  6235. // {
  6236. // "description": "Updates a data blob's associated metadata. This method supports patch semantics.",
  6237. // "httpMethod": "PATCH",
  6238. // "id": "storage.objects.patch",
  6239. // "parameterOrder": [
  6240. // "bucket",
  6241. // "object"
  6242. // ],
  6243. // "parameters": {
  6244. // "bucket": {
  6245. // "description": "Name of the bucket in which the object resides.",
  6246. // "location": "path",
  6247. // "required": true,
  6248. // "type": "string"
  6249. // },
  6250. // "generation": {
  6251. // "description": "If present, selects a specific revision of this object (as opposed to the latest version, the default).",
  6252. // "format": "uint64",
  6253. // "location": "query",
  6254. // "type": "string"
  6255. // },
  6256. // "ifGenerationMatch": {
  6257. // "description": "Makes the operation conditional on whether the object's current generation matches the given value.",
  6258. // "format": "uint64",
  6259. // "location": "query",
  6260. // "type": "string"
  6261. // },
  6262. // "ifGenerationNotMatch": {
  6263. // "description": "Makes the operation conditional on whether the object's current generation does not match the given value.",
  6264. // "format": "uint64",
  6265. // "location": "query",
  6266. // "type": "string"
  6267. // },
  6268. // "ifMetagenerationMatch": {
  6269. // "description": "Makes the operation conditional on whether the object's current metageneration matches the given value.",
  6270. // "format": "uint64",
  6271. // "location": "query",
  6272. // "type": "string"
  6273. // },
  6274. // "ifMetagenerationNotMatch": {
  6275. // "description": "Makes the operation conditional on whether the object's current metageneration does not match the given value.",
  6276. // "format": "uint64",
  6277. // "location": "query",
  6278. // "type": "string"
  6279. // },
  6280. // "object": {
  6281. // "description": "Name of the object.",
  6282. // "location": "path",
  6283. // "required": true,
  6284. // "type": "string"
  6285. // },
  6286. // "projection": {
  6287. // "description": "Set of properties to return. Defaults to full.",
  6288. // "enum": [
  6289. // "full",
  6290. // "noAcl"
  6291. // ],
  6292. // "enumDescriptions": [
  6293. // "Include all properties.",
  6294. // "Omit the acl property."
  6295. // ],
  6296. // "location": "query",
  6297. // "type": "string"
  6298. // }
  6299. // },
  6300. // "path": "b/{bucket}/o/{object}",
  6301. // "request": {
  6302. // "$ref": "Object"
  6303. // },
  6304. // "response": {
  6305. // "$ref": "Object"
  6306. // },
  6307. // "scopes": [
  6308. // "https://www.googleapis.com/auth/devstorage.full_control",
  6309. // "https://www.googleapis.com/auth/devstorage.read_write"
  6310. // ]
  6311. // }
  6312. }
  6313. // method id "storage.objects.update":
  6314. type ObjectsUpdateCall struct {
  6315. s *Service
  6316. bucket string
  6317. object string
  6318. object2 *Object
  6319. urlParams_ gensupport.URLParams
  6320. ctx_ context.Context
  6321. header_ http.Header
  6322. }
  6323. // Update: Updates a data blob's associated metadata.
  6324. func (r *ObjectsService) Update(bucket string, object string, object2 *Object) *ObjectsUpdateCall {
  6325. c := &ObjectsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6326. c.bucket = bucket
  6327. c.object = object
  6328. c.object2 = object2
  6329. return c
  6330. }
  6331. // Generation sets the optional parameter "generation": If present,
  6332. // selects a specific revision of this object (as opposed to the latest
  6333. // version, the default).
  6334. func (c *ObjectsUpdateCall) Generation(generation uint64) *ObjectsUpdateCall {
  6335. c.urlParams_.Set("generation", fmt.Sprint(generation))
  6336. return c
  6337. }
  6338. // IfGenerationMatch sets the optional parameter "ifGenerationMatch":
  6339. // Makes the operation conditional on whether the object's current
  6340. // generation matches the given value.
  6341. func (c *ObjectsUpdateCall) IfGenerationMatch(ifGenerationMatch uint64) *ObjectsUpdateCall {
  6342. c.urlParams_.Set("ifGenerationMatch", fmt.Sprint(ifGenerationMatch))
  6343. return c
  6344. }
  6345. // IfGenerationNotMatch sets the optional parameter
  6346. // "ifGenerationNotMatch": Makes the operation conditional on whether
  6347. // the object's current generation does not match the given value.
  6348. func (c *ObjectsUpdateCall) IfGenerationNotMatch(ifGenerationNotMatch uint64) *ObjectsUpdateCall {
  6349. c.urlParams_.Set("ifGenerationNotMatch", fmt.Sprint(ifGenerationNotMatch))
  6350. return c
  6351. }
  6352. // IfMetagenerationMatch sets the optional parameter
  6353. // "ifMetagenerationMatch": Makes the operation conditional on whether
  6354. // the object's current metageneration matches the given value.
  6355. func (c *ObjectsUpdateCall) IfMetagenerationMatch(ifMetagenerationMatch uint64) *ObjectsUpdateCall {
  6356. c.urlParams_.Set("ifMetagenerationMatch", fmt.Sprint(ifMetagenerationMatch))
  6357. return c
  6358. }
  6359. // IfMetagenerationNotMatch sets the optional parameter
  6360. // "ifMetagenerationNotMatch": Makes the operation conditional on
  6361. // whether the object's current metageneration does not match the given
  6362. // value.
  6363. func (c *ObjectsUpdateCall) IfMetagenerationNotMatch(ifMetagenerationNotMatch uint64) *ObjectsUpdateCall {
  6364. c.urlParams_.Set("ifMetagenerationNotMatch", fmt.Sprint(ifMetagenerationNotMatch))
  6365. return c
  6366. }
  6367. // Projection sets the optional parameter "projection": Set of
  6368. // properties to return. Defaults to full.
  6369. //
  6370. // Possible values:
  6371. // "full" - Include all properties.
  6372. // "noAcl" - Omit the acl property.
  6373. func (c *ObjectsUpdateCall) Projection(projection string) *ObjectsUpdateCall {
  6374. c.urlParams_.Set("projection", projection)
  6375. return c
  6376. }
  6377. // Fields allows partial responses to be retrieved. See
  6378. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6379. // for more information.
  6380. func (c *ObjectsUpdateCall) Fields(s ...googleapi.Field) *ObjectsUpdateCall {
  6381. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6382. return c
  6383. }
  6384. // Context sets the context to be used in this call's Do and Download
  6385. // methods. Any pending HTTP request will be aborted if the provided
  6386. // context is canceled.
  6387. func (c *ObjectsUpdateCall) Context(ctx context.Context) *ObjectsUpdateCall {
  6388. c.ctx_ = ctx
  6389. return c
  6390. }
  6391. // Header returns an http.Header that can be modified by the caller to
  6392. // add HTTP headers to the request.
  6393. func (c *ObjectsUpdateCall) Header() http.Header {
  6394. if c.header_ == nil {
  6395. c.header_ = make(http.Header)
  6396. }
  6397. return c.header_
  6398. }
  6399. func (c *ObjectsUpdateCall) doRequest(alt string) (*http.Response, error) {
  6400. reqHeaders := make(http.Header)
  6401. for k, v := range c.header_ {
  6402. reqHeaders[k] = v
  6403. }
  6404. reqHeaders.Set("User-Agent", c.s.userAgent())
  6405. var body io.Reader = nil
  6406. body, err := googleapi.WithoutDataWrapper.JSONReader(c.object2)
  6407. if err != nil {
  6408. return nil, err
  6409. }
  6410. reqHeaders.Set("Content-Type", "application/json")
  6411. c.urlParams_.Set("alt", alt)
  6412. c.urlParams_.Set("prettyPrint", "false")
  6413. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o/{object}")
  6414. urls += "?" + c.urlParams_.Encode()
  6415. req, err := http.NewRequest("PUT", urls, body)
  6416. if err != nil {
  6417. return nil, err
  6418. }
  6419. req.Header = reqHeaders
  6420. googleapi.Expand(req.URL, map[string]string{
  6421. "bucket": c.bucket,
  6422. "object": c.object,
  6423. })
  6424. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6425. }
  6426. // Download fetches the API endpoint's "media" value, instead of the normal
  6427. // API response value. If the returned error is nil, the Response is guaranteed to
  6428. // have a 2xx status code. Callers must close the Response.Body as usual.
  6429. func (c *ObjectsUpdateCall) Download(opts ...googleapi.CallOption) (*http.Response, error) {
  6430. gensupport.SetOptions(c.urlParams_, opts...)
  6431. res, err := c.doRequest("media")
  6432. if err != nil {
  6433. return nil, err
  6434. }
  6435. if err := googleapi.CheckMediaResponse(res); err != nil {
  6436. res.Body.Close()
  6437. return nil, err
  6438. }
  6439. return res, nil
  6440. }
  6441. // Do executes the "storage.objects.update" call.
  6442. // Exactly one of *Object or error will be non-nil. Any non-2xx status
  6443. // code is an error. Response headers are in either
  6444. // *Object.ServerResponse.Header or (if a response was returned at all)
  6445. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  6446. // check whether the returned error was because http.StatusNotModified
  6447. // was returned.
  6448. func (c *ObjectsUpdateCall) Do(opts ...googleapi.CallOption) (*Object, error) {
  6449. gensupport.SetOptions(c.urlParams_, opts...)
  6450. res, err := c.doRequest("json")
  6451. if res != nil && res.StatusCode == http.StatusNotModified {
  6452. if res.Body != nil {
  6453. res.Body.Close()
  6454. }
  6455. return nil, &googleapi.Error{
  6456. Code: res.StatusCode,
  6457. Header: res.Header,
  6458. }
  6459. }
  6460. if err != nil {
  6461. return nil, err
  6462. }
  6463. defer googleapi.CloseBody(res)
  6464. if err := googleapi.CheckResponse(res); err != nil {
  6465. return nil, err
  6466. }
  6467. ret := &Object{
  6468. ServerResponse: googleapi.ServerResponse{
  6469. Header: res.Header,
  6470. HTTPStatusCode: res.StatusCode,
  6471. },
  6472. }
  6473. target := &ret
  6474. if err := gensupport.DecodeResponse(target, res); err != nil {
  6475. return nil, err
  6476. }
  6477. return ret, nil
  6478. // {
  6479. // "description": "Updates a data blob's associated metadata.",
  6480. // "httpMethod": "PUT",
  6481. // "id": "storage.objects.update",
  6482. // "parameterOrder": [
  6483. // "bucket",
  6484. // "object"
  6485. // ],
  6486. // "parameters": {
  6487. // "bucket": {
  6488. // "description": "Name of the bucket in which the object resides.",
  6489. // "location": "path",
  6490. // "required": true,
  6491. // "type": "string"
  6492. // },
  6493. // "generation": {
  6494. // "description": "If present, selects a specific revision of this object (as opposed to the latest version, the default).",
  6495. // "format": "uint64",
  6496. // "location": "query",
  6497. // "type": "string"
  6498. // },
  6499. // "ifGenerationMatch": {
  6500. // "description": "Makes the operation conditional on whether the object's current generation matches the given value.",
  6501. // "format": "uint64",
  6502. // "location": "query",
  6503. // "type": "string"
  6504. // },
  6505. // "ifGenerationNotMatch": {
  6506. // "description": "Makes the operation conditional on whether the object's current generation does not match the given value.",
  6507. // "format": "uint64",
  6508. // "location": "query",
  6509. // "type": "string"
  6510. // },
  6511. // "ifMetagenerationMatch": {
  6512. // "description": "Makes the operation conditional on whether the object's current metageneration matches the given value.",
  6513. // "format": "uint64",
  6514. // "location": "query",
  6515. // "type": "string"
  6516. // },
  6517. // "ifMetagenerationNotMatch": {
  6518. // "description": "Makes the operation conditional on whether the object's current metageneration does not match the given value.",
  6519. // "format": "uint64",
  6520. // "location": "query",
  6521. // "type": "string"
  6522. // },
  6523. // "object": {
  6524. // "description": "Name of the object.",
  6525. // "location": "path",
  6526. // "required": true,
  6527. // "type": "string"
  6528. // },
  6529. // "projection": {
  6530. // "description": "Set of properties to return. Defaults to full.",
  6531. // "enum": [
  6532. // "full",
  6533. // "noAcl"
  6534. // ],
  6535. // "enumDescriptions": [
  6536. // "Include all properties.",
  6537. // "Omit the acl property."
  6538. // ],
  6539. // "location": "query",
  6540. // "type": "string"
  6541. // }
  6542. // },
  6543. // "path": "b/{bucket}/o/{object}",
  6544. // "request": {
  6545. // "$ref": "Object"
  6546. // },
  6547. // "response": {
  6548. // "$ref": "Object"
  6549. // },
  6550. // "scopes": [
  6551. // "https://www.googleapis.com/auth/devstorage.full_control",
  6552. // "https://www.googleapis.com/auth/devstorage.read_write"
  6553. // ],
  6554. // "supportsMediaDownload": true
  6555. // }
  6556. }
  6557. // method id "storage.objects.watchAll":
  6558. type ObjectsWatchAllCall struct {
  6559. s *Service
  6560. bucket string
  6561. channel *Channel
  6562. urlParams_ gensupport.URLParams
  6563. ctx_ context.Context
  6564. header_ http.Header
  6565. }
  6566. // WatchAll: Watch for changes on all objects in a bucket.
  6567. func (r *ObjectsService) WatchAll(bucket string, channel *Channel) *ObjectsWatchAllCall {
  6568. c := &ObjectsWatchAllCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6569. c.bucket = bucket
  6570. c.channel = channel
  6571. return c
  6572. }
  6573. // Delimiter sets the optional parameter "delimiter": Returns results in
  6574. // a directory-like mode. items will contain only objects whose names,
  6575. // aside from the prefix, do not contain delimiter. Objects whose names,
  6576. // aside from the prefix, contain delimiter will have their name,
  6577. // truncated after the delimiter, returned in prefixes. Duplicate
  6578. // prefixes are omitted.
  6579. func (c *ObjectsWatchAllCall) Delimiter(delimiter string) *ObjectsWatchAllCall {
  6580. c.urlParams_.Set("delimiter", delimiter)
  6581. return c
  6582. }
  6583. // MaxResults sets the optional parameter "maxResults": Maximum number
  6584. // of items plus prefixes to return. As duplicate prefixes are omitted,
  6585. // fewer total results may be returned than requested.
  6586. func (c *ObjectsWatchAllCall) MaxResults(maxResults int64) *ObjectsWatchAllCall {
  6587. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  6588. return c
  6589. }
  6590. // PageToken sets the optional parameter "pageToken": A
  6591. // previously-returned page token representing part of the larger set of
  6592. // results to view.
  6593. func (c *ObjectsWatchAllCall) PageToken(pageToken string) *ObjectsWatchAllCall {
  6594. c.urlParams_.Set("pageToken", pageToken)
  6595. return c
  6596. }
  6597. // Prefix sets the optional parameter "prefix": Filter results to
  6598. // objects whose names begin with this prefix.
  6599. func (c *ObjectsWatchAllCall) Prefix(prefix string) *ObjectsWatchAllCall {
  6600. c.urlParams_.Set("prefix", prefix)
  6601. return c
  6602. }
  6603. // Projection sets the optional parameter "projection": Set of
  6604. // properties to return. Defaults to noAcl.
  6605. //
  6606. // Possible values:
  6607. // "full" - Include all properties.
  6608. // "noAcl" - Omit the acl property.
  6609. func (c *ObjectsWatchAllCall) Projection(projection string) *ObjectsWatchAllCall {
  6610. c.urlParams_.Set("projection", projection)
  6611. return c
  6612. }
  6613. // Versions sets the optional parameter "versions": If true, lists all
  6614. // versions of a file as distinct results.
  6615. func (c *ObjectsWatchAllCall) Versions(versions bool) *ObjectsWatchAllCall {
  6616. c.urlParams_.Set("versions", fmt.Sprint(versions))
  6617. return c
  6618. }
  6619. // Fields allows partial responses to be retrieved. See
  6620. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6621. // for more information.
  6622. func (c *ObjectsWatchAllCall) Fields(s ...googleapi.Field) *ObjectsWatchAllCall {
  6623. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6624. return c
  6625. }
  6626. // Context sets the context to be used in this call's Do method. Any
  6627. // pending HTTP request will be aborted if the provided context is
  6628. // canceled.
  6629. func (c *ObjectsWatchAllCall) Context(ctx context.Context) *ObjectsWatchAllCall {
  6630. c.ctx_ = ctx
  6631. return c
  6632. }
  6633. // Header returns an http.Header that can be modified by the caller to
  6634. // add HTTP headers to the request.
  6635. func (c *ObjectsWatchAllCall) Header() http.Header {
  6636. if c.header_ == nil {
  6637. c.header_ = make(http.Header)
  6638. }
  6639. return c.header_
  6640. }
  6641. func (c *ObjectsWatchAllCall) doRequest(alt string) (*http.Response, error) {
  6642. reqHeaders := make(http.Header)
  6643. for k, v := range c.header_ {
  6644. reqHeaders[k] = v
  6645. }
  6646. reqHeaders.Set("User-Agent", c.s.userAgent())
  6647. var body io.Reader = nil
  6648. body, err := googleapi.WithoutDataWrapper.JSONReader(c.channel)
  6649. if err != nil {
  6650. return nil, err
  6651. }
  6652. reqHeaders.Set("Content-Type", "application/json")
  6653. c.urlParams_.Set("alt", alt)
  6654. c.urlParams_.Set("prettyPrint", "false")
  6655. urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o/watch")
  6656. urls += "?" + c.urlParams_.Encode()
  6657. req, err := http.NewRequest("POST", urls, body)
  6658. if err != nil {
  6659. return nil, err
  6660. }
  6661. req.Header = reqHeaders
  6662. googleapi.Expand(req.URL, map[string]string{
  6663. "bucket": c.bucket,
  6664. })
  6665. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6666. }
  6667. // Do executes the "storage.objects.watchAll" call.
  6668. // Exactly one of *Channel or error will be non-nil. Any non-2xx status
  6669. // code is an error. Response headers are in either
  6670. // *Channel.ServerResponse.Header or (if a response was returned at all)
  6671. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  6672. // check whether the returned error was because http.StatusNotModified
  6673. // was returned.
  6674. func (c *ObjectsWatchAllCall) Do(opts ...googleapi.CallOption) (*Channel, error) {
  6675. gensupport.SetOptions(c.urlParams_, opts...)
  6676. res, err := c.doRequest("json")
  6677. if res != nil && res.StatusCode == http.StatusNotModified {
  6678. if res.Body != nil {
  6679. res.Body.Close()
  6680. }
  6681. return nil, &googleapi.Error{
  6682. Code: res.StatusCode,
  6683. Header: res.Header,
  6684. }
  6685. }
  6686. if err != nil {
  6687. return nil, err
  6688. }
  6689. defer googleapi.CloseBody(res)
  6690. if err := googleapi.CheckResponse(res); err != nil {
  6691. return nil, err
  6692. }
  6693. ret := &Channel{
  6694. ServerResponse: googleapi.ServerResponse{
  6695. Header: res.Header,
  6696. HTTPStatusCode: res.StatusCode,
  6697. },
  6698. }
  6699. target := &ret
  6700. if err := gensupport.DecodeResponse(target, res); err != nil {
  6701. return nil, err
  6702. }
  6703. return ret, nil
  6704. // {
  6705. // "description": "Watch for changes on all objects in a bucket.",
  6706. // "httpMethod": "POST",
  6707. // "id": "storage.objects.watchAll",
  6708. // "parameterOrder": [
  6709. // "bucket"
  6710. // ],
  6711. // "parameters": {
  6712. // "bucket": {
  6713. // "description": "Name of the bucket in which to look for objects.",
  6714. // "location": "path",
  6715. // "required": true,
  6716. // "type": "string"
  6717. // },
  6718. // "delimiter": {
  6719. // "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.",
  6720. // "location": "query",
  6721. // "type": "string"
  6722. // },
  6723. // "maxResults": {
  6724. // "description": "Maximum number of items plus prefixes to return. As duplicate prefixes are omitted, fewer total results may be returned than requested.",
  6725. // "format": "uint32",
  6726. // "location": "query",
  6727. // "minimum": "0",
  6728. // "type": "integer"
  6729. // },
  6730. // "pageToken": {
  6731. // "description": "A previously-returned page token representing part of the larger set of results to view.",
  6732. // "location": "query",
  6733. // "type": "string"
  6734. // },
  6735. // "prefix": {
  6736. // "description": "Filter results to objects whose names begin with this prefix.",
  6737. // "location": "query",
  6738. // "type": "string"
  6739. // },
  6740. // "projection": {
  6741. // "description": "Set of properties to return. Defaults to noAcl.",
  6742. // "enum": [
  6743. // "full",
  6744. // "noAcl"
  6745. // ],
  6746. // "enumDescriptions": [
  6747. // "Include all properties.",
  6748. // "Omit the acl property."
  6749. // ],
  6750. // "location": "query",
  6751. // "type": "string"
  6752. // },
  6753. // "versions": {
  6754. // "description": "If true, lists all versions of a file as distinct results.",
  6755. // "location": "query",
  6756. // "type": "boolean"
  6757. // }
  6758. // },
  6759. // "path": "b/{bucket}/o/watch",
  6760. // "request": {
  6761. // "$ref": "Channel",
  6762. // "parameterName": "resource"
  6763. // },
  6764. // "response": {
  6765. // "$ref": "Channel"
  6766. // },
  6767. // "scopes": [
  6768. // "https://www.googleapis.com/auth/devstorage.full_control",
  6769. // "https://www.googleapis.com/auth/devstorage.read_only",
  6770. // "https://www.googleapis.com/auth/devstorage.read_write"
  6771. // ],
  6772. // "supportsSubscription": true
  6773. // }
  6774. }