Updates a bucket. This method supports patch semantics. Try it now or see an example .
The authenticated user must have
OWNER
permissions on the
bucket
.
Request
HTTP request
PATCH https://www.googleapis.com/storage/v1/b/bucket
Parameters
Parameter name | Value | Description |
---|---|---|
Path parameters | ||
bucket
|
string
|
Name of a bucket. |
Optional query parameters | ||
ifMetagenerationMatch
|
long
|
Makes the return of the bucket metadata conditional on whether the bucket's current metageneration matches the given value. |
ifMetagenerationNotMatch
|
long
|
Makes the return of the bucket metadata conditional on whether the bucket's current metageneration does not match the given value. |
predefinedAcl
|
string
|
Apply a predefined set of access controls to this bucket.
Acceptable values are:
|
projection
|
string
|
Set of properties to return. Defaults to
no_acl
.
Note: Currently only works if you override the default and specify
full
.
Acceptable values are:
|
Request body
In the request body, supply the relevant portions of a bucket resource , according to the rules of patch semantics, with the following properties:
Property name | Value | Description | Notes |
---|---|---|---|
Optional Properties | |||
acl[]
|
list
|
Access controls on the bucket. | writable |
cors[]
|
list
|
The bucket's Cross-Origin Resource Sharing (CORS) configuration. | writable |
cors[].
maxAgeSeconds
|
integer
|
The value, in seconds, to return in the Access-Control-Max-Age header used in preflight responses. | writable |
cors[].
method[]
|
list
|
The list of HTTP methods on which to include CORS response headers, (
GET
,
OPTIONS
,
POST
, etc) Note: "*" is permitted in the list of methods, and means "any method".
|
writable |
cors[].
origin[]
|
list
|
The list of Origins eligible to receive CORS response headers. Note: "*" is permitted in the list of origins, and means "any Origin". | writable |
cors[].
responseHeader[]
|
list
|
The list of HTTP headers other than the simple response headers to give permission for the user-agent to share across domains. | writable |
defaultObjectAcl[]
|
list
|
Default access controls to apply to new objects when no ACL is provided. | writable |
lifecycle
|
object
|
The bucket's lifecycle configuration. See lifecycle management for more information. | writable |
logging
|
object
|
The bucket's logging configuration, which defines the destination bucket and optional name prefix for the current bucket's logs. | writable |
logging.
logBucket
|
string
|
The destination bucket where the current bucket's logs should be placed. | writable |
logging.
logObjectPrefix
|
string
|
A prefix for log object names. | writable |
versioning
|
object
|
The bucket's versioning configuration. | writable |
versioning.
enabled
|
boolean
|
While set to true, versioning is fully enabled for this bucket. | writable |
website
|
object
|
The bucket's website configuration. | writable |
website.
mainPageSuffix
|
string
|
Behaves as the bucket's directory index where missing objects are treated as potential directories. | writable |
website.
notFoundPage
|
string
|
The custom object to return when a requested resource is not found. | writable |
Response
If successful, this method returns a bucket resource in the response body.
Examples
Note: The code examples available for this method do not represent all supported programming languages (see the client libraries page for a list of supported languages).
Python
Uses the Python client library .
# The bucket_resource need only specify the attributes we want to change. bucket_resource = { 'website': {'mainPageSuffix': 'index.html', 'notFoundPage': None} # None clears the field. } fields_to_return = 'name,website' req = client.buckets().patch( bucket=bucket_name, fields=fields_to_return, # optional body=bucket_resource) resp = req.execute() print json.dumps(resp, indent=2)
Try it!
Use the APIs Explorer below to call this method on live data and see the response. Alternatively, try the standalone Explorer .