Object Storage API, REST: Bucket.update
Updates the specified bucket.
In most cases, storage.editor
role (see documentation) should be enough
to update a bucket, subject to its policy.
HTTP request
PATCH https://storage.api.cloud.yandex.net/storage/v1/buckets/{name}
Path parameters
Parameter | Description |
---|---|
name | Required. Name of the bucket to update. The name cannot be updated. To get the bucket name, make a list request. |
Body parameters
{
"updateMask": "string",
"anonymousAccessFlags": {
"read": true,
"list": true,
"configRead": true
},
"defaultStorageClass": "string",
"maxSize": "string",
"cors": [
{
"id": "string",
"allowedMethods": [
"string"
],
"allowedHeaders": [
"string"
],
"allowedOrigins": [
"string"
],
"exposeHeaders": [
"string"
],
"maxAgeSeconds": "integer"
}
],
"websiteSettings": {
"index": "string",
"error": "string",
"redirectAllRequests": {
"protocol": "string",
"hostname": "string"
},
"routingRules": [
{
"condition": {
"httpErrorCodeReturnedEquals": "string",
"keyPrefixEquals": "string"
},
"redirect": {
"hostname": "string",
"httpRedirectCode": "string",
"protocol": "string",
"replaceKeyPrefixWith": "string",
"replaceKeyWith": "string"
}
}
]
},
"versioning": "string",
"lifecycleRules": [
{
"id": "string",
"enabled": true,
"filter": {
"prefix": "string",
"objectSizeGreaterThan": "integer",
"objectSizeLessThan": "integer",
"tag": {
"key": "string",
"value": "string"
},
"andOperator": {
"prefix": "string",
"objectSizeGreaterThan": "integer",
"objectSizeLessThan": "integer",
"tag": [
{
"key": "string",
"value": "string"
}
]
}
},
"expiration": {
"date": "string",
"days": "integer",
"expiredObjectDeleteMarker": true
},
"transitions": [
{
"date": "string",
"days": "integer",
"storageClass": "string"
}
],
"abortIncompleteMultipartUpload": {
"daysAfterExpiration": "integer"
},
"noncurrentExpiration": {
"noncurrentDays": "integer"
},
"noncurrentTransitions": [
{
"noncurrentDays": "integer",
"storageClass": "string"
}
],
"noncurrentDeleteMarkers": {
"noncurrentDays": "integer"
}
}
],
"policy": "object",
"acl": {
"grants": [
{
"permission": "string",
"grantType": "string",
"granteeId": "string"
}
]
},
"tags": [
{
"key": "string",
"value": "string"
}
],
"objectLock": {
"status": "string",
"defaultRetention": {
"mode": "string",
// `objectLock.defaultRetention` includes only one of the fields `days`, `years`
"days": "string",
"years": "string",
// end of the list of possible fields`objectLock.defaultRetention`
}
},
"encryption": {
"rules": [
{
"kmsMasterKeyId": "string",
"sseAlgorithm": "string"
}
]
}
}
Field | Description |
---|---|
updateMask | string Required. Update mask that specifies which attributes of the bucket should be updated. Use * for full update. A comma-separated names off ALL fields to be updated. Only the specified fields will be changed. The others will be left untouched. If the field is specified in If |
anonymousAccessFlags | object Flags for configuring public (anonymous) access to the bucket's content and settings. For details, see documentation. |
anonymousAccessFlags. read |
boolean (boolean) Specifies whether public (anonymous) access to read objects in the bucket is enabled. |
anonymousAccessFlags. list |
boolean (boolean) Specifies whether public (anonymous) access to the list of objects in the bucket is enabled. |
anonymousAccessFlags. configRead |
boolean (boolean) Specifies whether public (anonymous) access to read CORS, static website hosting, and object lifecycles settings of the bucket is enabled. |
defaultStorageClass | string Default storage class for objects in the bucket. Supported classes are standard storage ( |
maxSize | string (int64) Maximum size of the bucket, in bytes. For details, see documentation. |
cors[] | object List of rules for cross-domain requests to objects in the bucket (cross-origin resource sharing, CORS). For details, see documentation. |
cors[]. id |
string ID of the CORS rule. |
cors[]. allowedMethods[] |
string Required. List of HTTP methods allowed by the CORS rule. When a client sends a CORS-preflight Must contain at least one element.
|
cors[]. allowedHeaders[] |
string List of HTTP headers allowed by the CORS rule. When a client sends a CORS-preflight Each string in the list can contain at most one |
cors[]. allowedOrigins[] |
string Required. List of request origins allowed by the CORS rule. Each string in the list can contain at most one Must contain at least one element. |
cors[]. exposeHeaders[] |
string List of headers contained in responses to CORS requests that can be accessed by applications. |
cors[]. maxAgeSeconds |
integer (int64) Time in seconds that a client can cache the response to a CORS-preflight request as identified by the object requested, the HTTP method, and the origin. |
websiteSettings | object Configuration for hosting a static website in the bucket. For details, see documentation. |
websiteSettings. index |
string Key of the index page object that is returned when a response is made to the root of the website. Either If specified, the index page object must be located in the root of the bucket. |
websiteSettings. error |
string Key of the error page object that is returned when an error occurs. |
websiteSettings. redirectAllRequests |
object Configuration for redirecting all requests sent to the website. Either A configuration resource for redirecting all requests sent to the website. |
websiteSettings. redirectAllRequests. protocol |
string Scheme of the redirect URI.
|
websiteSettings. redirectAllRequests. hostname |
string Hostname of the redirect URI. |
websiteSettings. routingRules[] |
object List of redirect rules. |
websiteSettings. routingRules[]. condition |
object Redirect condition. |
websiteSettings. routingRules[]. condition. httpErrorCodeReturnedEquals |
string HTTP status code (number only) that must match for the redirect to apply. |
websiteSettings. routingRules[]. condition. keyPrefixEquals |
string Prefix of the object key from which requests are redirected. |
websiteSettings. routingRules[]. redirect |
object Redirect instructions. |
websiteSettings. routingRules[]. redirect. hostname |
string Hostname of the redirect URI. |
websiteSettings. routingRules[]. redirect. httpRedirectCode |
string HTTP status code of the redirect response. Default value: Value must match the regular expression |
websiteSettings. routingRules[]. redirect. protocol |
string Scheme of the redirect URI.
|
websiteSettings. routingRules[]. redirect. replaceKeyPrefixWith |
string Substitution for the prefix of the object key specified in At most one of |
websiteSettings. routingRules[]. redirect. replaceKeyWith |
string New object key. At most one of |
versioning | string Bucket versioning status. For details, see documentation.
|
lifecycleRules[] | object List of object lifecycle rules for the bucket. For details, see documentation. |
lifecycleRules[]. id |
string ID of the rule. Provided by the client or generated at creation time. |
lifecycleRules[]. enabled |
boolean (boolean) Indicates whether the rule is in effect. |
lifecycleRules[]. filter |
object Filter that identifies the objects to which the rule applies. If not specified, the rule applies to all objects in the bucket. |
lifecycleRules[]. filter. prefix |
string Key prefix that the object must have in order for the rule to apply. |
lifecycleRules[]. filter. objectSizeGreaterThan |
integer (int64) Size that the object must be greater. |
lifecycleRules[]. filter. objectSizeLessThan |
integer (int64) Size that the object must be less t. |
lifecycleRules[]. filter. tag |
object Tags that the object's tag set must have for the rule to apply. |
lifecycleRules[]. filter. tag. key |
string Key of the bucket tag. |
lifecycleRules[]. filter. tag. value |
string Value of the bucket tag. |
lifecycleRules[]. filter. andOperator |
object Apply a logical AND to all of the predicates configured inside the And operator. |
lifecycleRules[]. filter. andOperator. prefix |
string |
lifecycleRules[]. filter. andOperator. objectSizeGreaterThan |
integer (int64) |
lifecycleRules[]. filter. andOperator. objectSizeLessThan |
integer (int64) |
lifecycleRules[]. filter. andOperator. tag[] |
object |
lifecycleRules[]. filter. andOperator. tag[]. key |
string Key of the bucket tag. |
lifecycleRules[]. filter. andOperator. tag[]. value |
string Value of the bucket tag. |
lifecycleRules[]. expiration |
object Expiration rule. The expiration of an object is described as follows. For the unversioned bucket (Bucket.versioning is For the bucket with versioning enabled (Bucket.versioning is For the bucket with versioning suspended (Bucket.versioning is |
lifecycleRules[]. expiration. date |
string (date-time) Specific date of object expiration. The rule continues to apply even after the date has passed, i.e. any new objects created in the bucket expire immediately. Exactly one of String in RFC3339 text format. The range of possible values is from To work with values in this field, use the APIs described in the Protocol Buffers reference. In some languages, built-in datetime utilities do not support nanosecond precision (9 digits). |
lifecycleRules[]. expiration. days |
integer (int64) Time period, in number of days from the creation or modification of the object, after which an object expires. Exactly one of |
lifecycleRules[]. expiration. expiredObjectDeleteMarker |
boolean (boolean) Indicates whether a delete marker of an object with no non-current versions (referred to as an expired object delete marker) is removed at the object's expiration. Exactly one of |
lifecycleRules[]. transitions[] |
object List of transition rules. The transition of an object is described as follows. For the unversioned bucket (Bucket.versioning is For the bucket with versioning enabled (Bucket.versioning is |
lifecycleRules[]. transitions[]. date |
string (date-time) Specific date of object transition. The rule continues to apply even after the date has passed, i.e. any new objects created in the bucket are transitioned immediately. At most one of String in RFC3339 text format. The range of possible values is from To work with values in this field, use the APIs described in the Protocol Buffers reference. In some languages, built-in datetime utilities do not support nanosecond precision (9 digits). |
lifecycleRules[]. transitions[]. days |
integer (int64) Time period, in number of days from the creation or modification of the object, after which an object is transitioned. At most one of |
lifecycleRules[]. transitions[]. storageClass |
string Required. Storage class to which an object is transitioned from standard storage. The only supported class is cold storage ( |
lifecycleRules[]. abortIncompleteMultipartUpload |
object Configuration for aborting incomplete multipart uploads. |
lifecycleRules[]. abortIncompleteMultipartUpload. daysAfterExpiration |
integer (int64) Time period, in number of days from the start of the multipart upload, after which the incomplete upload is aborted. |
lifecycleRules[]. noncurrentExpiration |
object Expiration rule for non-current versions of objects in a bucket with versioning enabled (Bucket.versioning is At expiration, the non-current version of the object is deleted and cannot be recovered. |
lifecycleRules[]. noncurrentExpiration. noncurrentDays |
integer (int64) Time period, in number of days since the version of an object was classified as non-current, after which the version expires. |
lifecycleRules[]. noncurrentTransitions[] |
object List of transition rules for non-current versions of objects in a bucket with versioning enabled (Bucket.versioning is At transition, the non-current version of the object is transitioned to the specified storage class. |
lifecycleRules[]. noncurrentTransitions[]. noncurrentDays |
integer (int64) Time period, in number of days since the version of an object was classified as non-current, after which the version is transitioned. |
lifecycleRules[]. noncurrentTransitions[]. storageClass |
string Required. Storage class to which a non-current version of an object is transitioned from standard storage. The only supported class is cold storage ( |
lifecycleRules[]. noncurrentDeleteMarkers |
object Expiration rule for non-current delete markers of an objects in a bucket with versioning enabled (Bucket.versioning is At expiration, the non-current delete marker of the object is deleted and cannot be recovered. |
lifecycleRules[]. noncurrentDeleteMarkers. noncurrentDays |
integer (int64) Time period, in number of days since the version of a delete marker was classified as non-current, after which the delete marker expires. |
policy | object Bucket policies that set permissions for actions with the bucket, its objects, and groups of objects. For details, see documentation. |
acl | object Access control list (ACL) of the bucket. For details, see documentation. |
acl. grants[] |
object List of permissions granted and the grantees. |
acl. grants[]. permission |
string Required. Permission granted by the grant.
|
acl. grants[]. grantType |
string Required. The grantee type for the grant.
|
acl. grants[]. granteeId |
string ID of the account who is a grantee. Required when the |
tags[] | object List of tags for the bucket. For details, see documentation. |
tags[]. key |
string Key of the bucket tag. |
tags[]. value |
string Value of the bucket tag. |
objectLock | object Configuration for object lock on the bucket. For details about the concept, see documentation. A resource for Object Lock configuration of a bucket. For details about the concept, see documentation. |
objectLock. status |
string Activity status of the object lock settings on the bucket |
objectLock. defaultRetention |
object Default lock configuration for added objects |
objectLock. defaultRetention. mode |
string Lock type |
objectLock. defaultRetention. days |
string (int64) objectLock.defaultRetention includes only one of the fields days , years Number of days for locking |
objectLock. defaultRetention. years |
string (int64) objectLock.defaultRetention includes only one of the fields days , years Number of years for locking |
encryption | object Configuration for bucket's encryption For detauls, see documentation |
encryption. rules[] |
object |
encryption. rules[]. kmsMasterKeyId |
string |
encryption. rules[]. sseAlgorithm |
string |
Response
HTTP Code: 200 - OK
{
"id": "string",
"description": "string",
"createdAt": "string",
"createdBy": "string",
"modifiedAt": "string",
"done": true,
"metadata": "object",
// includes only one of the fields `error`, `response`
"error": {
"code": "integer",
"message": "string",
"details": [
"object"
]
},
"response": "object",
// end of the list of possible fields
}
An Operation resource. For more information, see Operation.
Field | Description |
---|---|
id | string ID of the operation. |
description | string Description of the operation. 0-256 characters long. |
createdAt | string (date-time) Creation timestamp. String in RFC3339 text format. The range of possible values is from To work with values in this field, use the APIs described in the Protocol Buffers reference. In some languages, built-in datetime utilities do not support nanosecond precision (9 digits). |
createdBy | string ID of the user or service account who initiated the operation. |
modifiedAt | string (date-time) The time when the Operation resource was last modified. String in RFC3339 text format. The range of possible values is from To work with values in this field, use the APIs described in the Protocol Buffers reference. In some languages, built-in datetime utilities do not support nanosecond precision (9 digits). |
done | boolean (boolean) If the value is |
metadata | object Service-specific metadata associated with the operation. It typically contains the ID of the target resource that the operation is performed on. Any method that returns a long-running operation should document the metadata type, if any. |
error | object The error result of the operation in case of failure or cancellation. includes only one of the fields error , response |
error. code |
integer (int32) Error code. An enum value of google.rpc.Code. |
error. message |
string An error message. |
error. details[] |
object A list of messages that carry the error details. |
response | object includes only one of the fields error , response The normal response of the operation in case of success. If the original method returns no data on success, such as Delete, the response is google.protobuf.Empty. If the original method is the standard Create/Update, the response should be the target resource of the operation. Any method that returns a long-running operation should document the response type, if any. |