存储区操作
可通过 RESTful API 方便地提供 IBM Cloud® Object Storage 的现代功能。 此处记录了用于与存储区 (存储对象的位置) 进行交互的操作和方法。
有关许可权和访问权的更多信息,请参阅 存储区许可权。
有关访问/密钥 (HMAC) 认证的说明
通过 使用 HMAC 凭证 向 IBM Cloud® Object Storage 实例进行认证时,您需要在 构造 HMAC 签名 时 1 表中表示的信息。
键 | 值 | 示例 |
---|---|---|
{access_key} | 分配给服务证书的访问密钥 | cf4965cebe074720a4929759f57e1214 |
{date} | 请求的格式化日期 (yyyymmdd ) |
20180613 |
{region} | 端点的位置码 | us-standard |
{signature} | 使用密钥,位置和日期创建的散列 | ffe2b6e18f9dcc41f593f4dbb39882a6bb4d26a73a04326e62a8d344e07c1a3e |
{timestamp} | 请求的格式化日期和时间 | 20180614T001804Z |
列出存储区
GET
请求发送到端点根目录后,会返回与指定服务实例相关联的存储桶列表。 有关端点的更多信息,请参阅端点和存储位置。
并非所有操作都在 Satellite 环境中受支持。 有关更多信息,请参阅 受支持的 Satellite API
头 | 类型 | 必需? | 描述 |
---|---|---|---|
ibm-service-instance-id |
字符串 | 是 | 列出在此服务实例中创建的存储区。 |
查询参数 | 值 | 必需? | 描述 |
---|---|---|---|
extended |
无 | 否 | 在列表中提供 LocationConstraint 和 CreationTemplateId 元数据。 |
语法
GET https://{endpoint}/
示例请求
GET / HTTP/1.1
Authorization: Bearer {token}
Content-Type: text/plain
Host: s3.us.cloud-object-storage.appdomain.cloud
ibm-service-instance-id: {ibm-service-instance-id}
示例请求
GET / HTTP/1.1
Authorization: 'AWS4-HMAC-SHA256 Credential={access-key}/{date}/{region}/s3/aws4_request,SignedHeaders=host;x-amz-date;,Signature={signature}'
x-amz-date: {timestamp}
Content-Type: text/plain
Host: s3.us.cloud-object-storage.appdomain.cloud
示例响应
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ListAllMyBucketsResult xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<Owner>
<ID>{account-id}</ID>
<DisplayName>{account-id}</DisplayName>
</Owner>
<Buckets>
<Bucket>
<Name>bucket-27200-lwx4cfvcue</Name>
<CreationDate>2016-08-18T14:21:36.593Z</CreationDate>
</Bucket>
<Bucket>
<Name>bucket-27590-drqmydpfdv</Name>
<CreationDate>2016-08-18T14:22:32.366Z</CreationDate>
</Bucket>
<Bucket>
<Name>bucket-27852-290jtb0n2y</Name>
<CreationDate>2016-08-18T14:23:03.141Z</CreationDate>
</Bucket>
<Bucket>
<Name>bucket-28731-k0o1gde2rm</Name>
<CreationDate>2016-08-18T14:25:09.599Z</CreationDate>
</Bucket>
</Buckets>
</ListAllMyBucketsResult>
获取扩展列表
语法
GET https://{endpoint}/?extended
示例请求
GET /?extended HTTP/1.1
Authorization: Bearer {token}
Content-Type: text/plain
Host: s3.us.cloud-object-storage.appdomain.cloud
ibm-service-instance-id: {ibm-service-instance-id}
示例请求
GET /?extended HTTP/1.1
Authorization: 'AWS4-HMAC-SHA256 Credential={access-key}/{date}/{region}/s3/aws4_request,SignedHeaders=host;x-amz-date;,Signature={signature}'
x-amz-date: {timestamp}
Content-Type: text/plain
Host: s3.us.cloud-object-storage.appdomain.cloud
示例响应
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ListAllMyBucketsResult xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<Owner>
<ID>{account-id}</ID>
<DisplayName>{account-id}</DisplayName>
</Owner>
<IsTruncated>false</IsTruncated>
<MaxKeys>1000</MaxKeys>
<Prefix/>
<Marker/>
<Buckets>
<Bucket>
<Name>bucket-27200-lwx4cfvcue</Name>
<CreationDate>2016-08-18T14:21:36.593Z</CreationDate>
<LocationConstraint>us-south-standard</LocationConstraint>
</Bucket>
<Bucket>
<Name>bucket-27590-drqmydpfdv</Name>
<CreationDate>2016-08-18T14:22:32.366Z</CreationDate>
<LocationConstraint>us-standard</LocationConstraint>
</Bucket>
<Bucket>
<Name>bucket-27852-290jtb0n2y</Name>
<CreationDate>2016-08-18T14:23:03.141Z</CreationDate>
<LocationConstraint>eu-standard</LocationConstraint>
</Bucket>
<Bucket>
<Name>bucket-28731-k0o1gde2rm</Name>
<CreationDate>2016-08-18T14:25:09.599Z</CreationDate>
<LocationConstraint>us-cold</LocationConstraint>
</Bucket>
</Buckets>
</ListAllMyBucketsResult>
创建存储区
发送到端点根并后跟字符串的 PUT
请求将创建存储区。 有关端点的更多信息,请参阅端点和存储位置。 存储区名称必须全局唯一且符合 DN。 长度在 3 到 63 个字符之间的名称必须由小写字母,数字,点 (句点) 和短划线 (连字符) 组成。 存储区名称必须以小写字母或数字开头和结尾。
存储区名称不能包含连续的点或短划线。 不允许使用与 IP 地址相似的桶名。 此操作不使用特定于操作的查询参数。
存储区名称必须唯一,因为公共云中的所有存储区都共享一个全局名称空间。 根据这一要求,无需提供任何服务实例或账户信息,即可访问邮筒。 此外,也不能创建名称以 cosv1-
或 account-
开头的存储区,因为这些是系统保留的前缀。
并非所有操作都在 Satellite 环境中受支持。 有关更多信息,请参阅 受支持的 Satellite API
头 | 类型 | 必需? | 描述 |
---|---|---|---|
ibm-service-instance-id |
字符串 | 是 | 该标头引用服务实例,该服务实例将用于创建数据桶,并对其数据使用量计费。 |
x-amz-bucket-object-lock-enabled |
布尔值 | 否 | 指定是否要在新存储区上启用对象锁定。 此头自动启用版本控制。 |
在新存储区上设置对象锁定时,请确保 x-amz-bucket-object-lock-enabled
头中没有拼写错误。 如果头或值拼写错误,那么将创建存储区,但 未 启用对象锁定和版本控制。
个人身份信息 (PII):创建数据桶或添加对象时,请勿在数据桶或对象名称中使用任何可通过姓名、位置或任何其他方式识别任何用户(自然人)的信息。
语法
PUT https://{endpoint}/{bucket-name} # path style
PUT https://{bucket-name}.{endpoint} # virtual host style
示例请求
以下示例创建名为 "images" 的存储区。
PUT /images HTTP/1.1
Authorization: Bearer {token}
Content-Type: text/plain
Host: s3.us.cloud-object-storage.appdomain.cloud
ibm-service-instance-id: {ibm-service-instance-id}
示例请求
PUT /images HTTP/1.1
Authorization: 'AWS4-HMAC-SHA256 Credential={access-key}/{date}/{region}/s3/aws4_request,SignedHeaders=host;x-amz-date;,Signature={signature}'
x-amz-date: {timestamp}
Content-Type: text/plain
Host: s3.us.cloud-object-storage.appdomain.cloud
示例响应
HTTP/1.1 200 OK
Date: Wed, 24 Aug 2016 17:45:25 GMT
X-Clv-Request-Id: dca204eb-72b5-4e2a-a142-808d2a5c2a87
Accept-Ranges: bytes
Server: Cleversafe/3.9.0.115
X-Clv-S3-Version: 2.5
x-amz-request-id: dca204eb-72b5-4e2a-a142-808d2a5c2a87
Content-Length: 0
创建使用其他存储类的存储区
要创建具有不同存储类别的存储桶,请在 PUT
请求的正文中向存储桶端点发送指定存储桶配置的 XML 块,该 XML 块的 LocationConstraint
为 {provisioning code}
。 有关端点的更多信息,请参阅端点和存储位置。
标准存储区 命名规则 适用。 此操作不使用特定于操作的查询参数。
并非所有操作都在 Satellite 环境中受支持。 有关更多信息,请参阅 受支持的 Satellite API
| | 头 | 类型 | 描述 | |--------------------------|--------|--------------------------------------------------------------------------------------------------------------------- | ibm-service-instance-id
| 字符串 | 该标头引用服务实例,该服务实例将用于创建数据桶,并对其数据使用量计费。
|
语法
PUT https://{endpoint}/{bucket-name} # path style
PUT https://{bucket-name}.{endpoint} # virtual host style
请求主体必须包含具有以下模式的 XML 块:
元素 | 类型 | 子代 | 祖代 | 约束 |
---|---|---|---|---|
CreateBucketConfiguration |
容器 | LocationConstraint |
|
|
LocationConstraint |
字符串 |
|
CreateBucketConfiguration |
有效位置码 |
<CreateBucketConfiguration>
<LocationConstraint>us-vault</LocationConstraint>
</CreateBucketConfiguration>
LocationConstraint
的有效配置代码列表可参考《 存储类别指南 》。
示例请求
以下示例创建名为 "vault-images" 的存储区。
PUT /vault-images HTTP/1.1
Authorization: Bearer {token}
Content-Type: text/plain
Host: s3.us.cloud-object-storage.appdomain.cloud
ibm-service-instance-id: {ibm-service-instance-id}
Content-Length: 110
示例请求
PUT /vault-images HTTP/1.1
Authorization: 'AWS4-HMAC-SHA256 Credential={access-key}/{date}/{region}/s3/aws4_request,SignedHeaders=host;x-amz-date;,Signature={signature}'
x-amz-date: {timestamp}
Content-Type: text/plain
Host: s3.us.cloud-object-storage.appdomain.cloud
<CreateBucketConfiguration>
<LocationConstraint>us-vault</LocationConstraint>
</CreateBucketConfiguration>
示例响应
HTTP/1.1 200 OK
Date: Fri, 17 Mar 2017 17:52:17 GMT
X-Clv-Request-Id: b6483b2c-24ae-488a-884c-db1a93b9a9a6
Accept-Ranges: bytes
Server: Cleversafe/3.9.0.115
X-Clv-S3-Version: 2.5
Content-Length: 0
创建一个带有 Key Protect 或 Hyper Protect Crypto Services 受管加密密钥 (SSE-KP) 的存储桶
要创建由 Key Protect 或 Hyper Protect Crypto Services管理加密密钥的存储区,必须有权访问活动的 Key Protect 或 Hyper Protect Crypto Services 服务实例。 此操作不使用特定于操作的查询参数。
有关使用 Key Protect 管理加密密钥的更多信息,请参阅 Key Protect 文档。
有关 Hyper Protect Crypto Services的更多信息,请参阅 文档。
跨区域存储区的受管加密 必须 使用 Key Protect 实例中最近的 高可用性位置 (us-south
或 jp-tok
) 中的根密钥。
并非所有操作都在 Satellite 环境中受支持。 有关更多信息,请参阅 受支持的 Satellite API
头 | 类型 | 描述 |
---|---|---|
ibm-service-instance-id |
字符串 | 该标头引用服务实例,该服务实例将用于创建数据桶,并对其数据使用量计费。 |
ibm-sse-kp-encryption-algorithm |
字符串 | 该标头用于指定算法和密钥大小,使用 Key Protect 保存加密密钥。 此值必须设置为字符串 AES256 。 |
ibm-sse-kp-customer-root-key-crn |
字符串 | 该标头用于引用 Key Protect 或 Hyper Protect Crypto Services 用来加密该桶的特定根密钥。 此值必须是根密钥的完整 CRN。 |
语法
PUT https://{endpoint}/{bucket-name} # path style
PUT https://{bucket-name}.{endpoint} # virtual host style
示例请求
以下示例创建名为 "secure-files" 的存储区。
PUT /secure-files HTTP/1.1
Authorization: Bearer {token}
Content-Type: text/plain
Host: s3.us-south.objectstorage.s3.us-south.cloud-object-storage.appdomain.cloud.net
ibm-service-instance-id: {ibm-service-instance-id}
ibm-sse-kp-encryption-algorithm: "AES256"
ibm-sse-kp-customer-root-key-crn: {customer-root-key-id}
示例请求
PUT /secure-files HTTP/1.1
Authorization: 'AWS4-HMAC-SHA256 Credential={access-key}/{date}/{region}/s3/aws4_request,SignedHeaders=host;x-amz-date;,Signature={signature}'
x-amz-date: {timestamp}
Content-Type: text/plain
Host: s3.us.cloud-object-storage.appdomain.cloud
ibm-sse-kp-encryption-algorithm: "AES256"
ibm-sse-kp-customer-root-key-crn: {customer-root-key-id}
示例响应
HTTP/1.1 200 OK
Date: Wed, 24 Aug 2016 17:45:25 GMT
X-Clv-Request-Id: dca204eb-72b5-4e2a-a142-808d2a5c2a87
Accept-Ranges: bytes
Server: Cleversafe/3.9.0.115
X-Clv-S3-Version: 2.5
x-amz-request-id: dca204eb-72b5-4e2a-a142-808d2a5c2a87
Content-Length: 0
检索存储区的头
HEAD
会返回该邮筒的标头。
HEAD
请求不会返回主体,因此无法返回 NoSuchBucket
之类的具体错误消息,而只会返回 NotFound
。
并非所有操作都在 Satellite 环境中受支持。 有关更多信息,请参阅 受支持的 Satellite API
语法
HEAD https://{endpoint}/{bucket-name} # path style
HEAD https://{bucket-name}.{endpoint} # virtual host style
示例请求
以下示例访存 "images" 存储区的头。
HEAD /images HTTP/1.1
Content-Type: text/plain
Host: s3.us.cloud-object-storage.appdomain.cloud
Authorization:Bearer {token}
示例请求
HEAD /images HTTP/1.1
Authorization: 'AWS4-HMAC-SHA256 Credential={access-key}/{date}/{region}/s3/aws4_request,SignedHeaders=host;x-amz-date;,Signature={signature}'
x-amz-date: {timestamp}
Content-Type: text/plain
Host: s3.us.cloud-object-storage.appdomain.cloud
示例响应
HTTP/1.1 200 OK
Date: Wed, 24 Aug 2016 17:46:35 GMT
X-Clv-Request-Id: 0c2832e3-3c51-4ea6-96a3-cd8482aca08a
Accept-Ranges: bytes
Server: Cleversafe/3.9.0.115
X-Clv-S3-Version: 2.5
x-amz-request-id: 0c2832e3-3c51-4ea6-96a3-cd8482aca08a
Content-Length: 0
示例请求
HEAD
Key Protect 加密存储桶上的请求会返回额外的标头。
HEAD /secure-files HTTP/1.1
Content-Type: text/plain
Host: s3.us.cloud-object-storage.appdomain.cloud
Authorization:Bearer {token}
示例请求
HEAD /secure-files HTTP/1.1
Authorization: 'AWS4-HMAC-SHA256 Credential={access-key}/{date}/{region}/s3/aws4_request,SignedHeaders=host;x-amz-date;,Signature={signature}'
x-amz-date: {timestamp}
Content-Type: text/plain
Host: s3.us.cloud-object-storage.appdomain.cloud
示例响应
HTTP/1.1 200 OK
Date: Wed, 24 Aug 2016 17:46:35 GMT
X-Clv-Request-Id: 0c2832e3-3c51-4ea6-96a3-cd8482aca08a
Accept-Ranges: bytes
Server: Cleversafe/3.9.0.115
X-Clv-S3-Version: 2.5
x-amz-request-id: 0c2832e3-3c51-4ea6-96a3-cd8482aca08a
Content-Length: 0
ibm-sse-kp-enabled: True
ibm-sse-kp-crk-id: {customer-root-key-id}
列出特定邮筒中的对象(第 2 版)
GET
向一个桶发出的请求会返回一个对象列表,每次仅限 1,000 个,并按非书写顺序返回。 由于 Object Storage 中没有实现存储类操作,因此响应中返回的 StorageClass
值是默认值。 此操作不使用特定于操作的头或有效内容元素。
并非所有操作都在 Satellite 环境中受支持。 有关更多信息,请参阅 受支持的 Satellite API
语法
GET https://{endpoint}/{bucket-name}?list-type=2 # path style
GET https://{bucket-name}.{endpoint}?list-type=2 # virtual host style
可选查询参数
名称 | 类型 | 描述 |
---|---|---|
list-type |
字符串 | 指示 API V2,因此值必须为 2。 |
prefix |
字符串 | 限制响应以 prefix 开头的对象名称。 |
delimiter |
字符串 | 对 prefix 和 delimiter 之间的对象分组。 |
encoding-type |
字符串 | 如果在对象名称中使用了 XML 不支持的 Unicode 字符,那么可以将此参数设置为 url 以正确对响应进行编码。 |
max-keys |
字符串 | 限制要在响应中显示的对象数。 缺省值和最大值为 1,000。 |
fetch-owner |
字符串 | 缺省情况下,API V2 不包含 Owner 信息。 如果希望在回复中获得 Owner 信息,请将此参数设置为 true 。 |
continuation-token |
字符串 | 指定当响应被截断时要返回的下一组对象(IsTruncated 元素返回 true )。您的初始回复包括 NextContinuationToken 元素。 在下一个请求中将此令牌用作 continuation-token 的值。 |
start-after |
字符串 | 在特定键对象后返回键名。 此参数仅在初始请求中有效。 如果请求中包含 continuation-token 参数,那么会忽略此参数。 |
示例请求 (简单)
此请求列出“apiary”存储区中的对象。
GET /apiary?list-type=2 HTTP/1.1
Content-Type: text/plain
Host: s3.us.cloud-object-storage.appdomain.cloud
Authorization: Bearer {token}
样本请求 (简单)
GET /apiary?list-type=2 HTTP/1.1
Authorization: 'AWS4-HMAC-SHA256 Credential={access-key}/{date}/{region}/s3/aws4_request,SignedHeaders=host;x-amz-date;,Signature={signature}'
x-amz-date: {timestamp}
Content-Type: text/plain
Host: s3.us.cloud-object-storage.appdomain.cloud
示例响应(简单)
HTTP/1.1 200 OK
Date: Wed, 24 Aug 2016 17:36:24 GMT
X-Clv-Request-Id: 9f39ff2e-55d1-461b-a6f1-2d0b75138861
Accept-Ranges: bytes
Server: Cleversafe/3.13.3.57
X-Clv-S3-Version: 2.5
x-amz-request-id: 9f39ff2e-55d1-461b-a6f1-2d0b75138861
Content-Type: application/xml
Content-Length: 814
<ListBucketResult xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<Name>apiary</Name>
<Prefix/>
<KeyCount>3</KeyCount>
<MaxKeys>1000</MaxKeys>
<Delimiter/>
<IsTruncated>false</IsTruncated>
<Contents>
<Key>drone-bee</Key>
<LastModified>2016-08-25T17:38:38.549Z</LastModified>
<ETag>"0cbc6611f5540bd0809a388dc95a615b"</ETag>
<Size>4</Size>
<StorageClass>STANDARD</StorageClass>
</Contents>
<Contents>
<Key>soldier-bee</Key>
<LastModified>2016-08-25T17:49:06.006Z</LastModified>
<ETag>"37d4c94839ee181a2224d6242176c4b5"</ETag>
<Size>11</Size>
<StorageClass>STANDARD</StorageClass>
</Contents>
<Contents>
<Key>worker-bee</Key>
<LastModified>2016-08-25T17:46:53.288Z</LastModified>
<ETag>"d34d8aada2996fc42e6948b926513907"</ETag>
<Size>467</Size>
<StorageClass>STANDARD</StorageClass>
</Contents>
</ListBucketResult>
示例请求(max-keys 参数)
此请求会列出“apiary”存储区中的对象,其中返回的最大键数设置为 1。
GET /apiary?list-type=2&max-keys=1 HTTP/1.1
Content-Type: text/plain
Host: s3.us.cloud-object-storage.appdomain.cloud
Authorization: Bearer {token}
请求示例(最大键值参数)
GET /apiary?list-type=2&max-keys=1 HTTP/1.1
Authorization: 'AWS4-HMAC-SHA256 Credential={access-key}/{date}/{region}/s3/aws4_request,SignedHeaders=host;x-amz-date;,Signature={signature}'
x-amz-date: {timestamp}
Content-Type: text/plain
Host: s3.us.cloud-object-storage.appdomain.cloud
示例响应(已截断响应)
HTTP/1.1 200 OK
Date: Wed, 24 Aug 2016 17:36:24 GMT
X-Clv-Request-Id: 9f39ff2e-55d1-461b-a6f1-2d0b75138861
Accept-Ranges: bytes
Server: Cleversafe/3.13.3.57
X-Clv-S3-Version: 2.5
x-amz-request-id: 9f39ff2e-55d1-461b-a6f1-2d0b75138861
Content-Type: application/xml
Content-Length: 598
<ListBucketResult xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<Name>apiary</Name>
<Prefix/>
<NextContinuationToken>1dPe45g5uuxjyASPegLq80sQsZKL5OB2by4Iz_7YGR5NjiOENBPZXqvKJN6_PgKGVzZYTlws7qqdWaMklzb8HX2iDxxl72ane3rUFQrvNMeIih49MZ4APUjrAuYI83KxSMmfKHGZyKallFkD5N6PwKg</NextContinuationToken>
<KeyCount>1</KeyCount>
<MaxKeys>1</MaxKeys>
<Delimiter/>
<IsTruncated>true</IsTruncated>
<Contents>
<Key>drone-bee</Key>
<LastModified>2016-08-25T17:38:38.549Z</LastModified>
<ETag>"0cbc6611f5540bd0809a388dc95a615b"</ETag>
<Size>4</Size>
<StorageClass>STANDARD</StorageClass>
</Contents>
</ListBucketResult>
示例请求(continuation-token 参数)
此请求会列出“apiary”存储区中的对象,其中指定了延续令牌。
GET /apiary?list-type=2&max-keys=1&continuation-token=1dPe45g5uuxjyASPegLq80sQsZKL5OB2by4Iz_7YGR5NjiOENBPZXqvKJN6_PgKGVzZYTlws7qqdWaMklzb8HX2iDxxl72ane3rUFQrvNMeIih49MZ4APUjrAuYI83KxSMmfKHGZyKallFkD5N6PwKg HTTP/1.1
Content-Type: text/plain
Host: s3.us.cloud-object-storage.appdomain.cloud
Authorization: Bearer {token}
请求示例(continuation-token 参数)
GET /apiary?list-type=2&max-keys=1&continuation-token=1dPe45g5uuxjyASPegLq80sQsZKL5OB2by4Iz_7YGR5NjiOENBPZXqvKJN6_PgKGVzZYTlws7qqdWaMklzb8HX2iDxxl72ane3rUFQrvNMeIih49MZ4APUjrAuYI83KxSMmfKHGZyKallFkD5N6PwKg HTTP/1.1
Authorization: 'AWS4-HMAC-SHA256 Credential={access-key}/{date}/{region}/s3/aws4_request,SignedHeaders=host;x-amz-date;,Signature={signature}'
x-amz-date: {timestamp}
Content-Type: text/plain
Host: s3.us.cloud-object-storage.appdomain.cloud
示例响应(已截断响应,continuation-token 参数)
HTTP/1.1 200 OK
Date: Wed, 24 Aug 2016 17:36:24 GMT
X-Clv-Request-Id: 9f39ff2e-55d1-461b-a6f1-2d0b75138861
Accept-Ranges: bytes
Server: Cleversafe/3.13.3.57
X-Clv-S3-Version: 2.5
x-amz-request-id: 9f39ff2e-55d1-461b-a6f1-2d0b75138861
Content-Type: application/xml
Content-Length: 604
<ListBucketResult xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<Name>apiary</Name>
<Prefix/>
<ContinuationToken>1dPe45g5uuxjyASPegLq80sQsZKL5OB2by4Iz_7YGR5NjiOENBPZXqvKJN6_PgKGVzZYTlws7qqdWaMklzb8HX2iDxxl72ane3rUFQrvNMeIih49MZ4APUjrAuYI83KxSMmfKHGZyKallFkD5N6PwKg</ContinuationToken>
<NextContinuationToken>1a8j20CqowRrM4epIQ7fTBuyPZWZUeA8Epog16wYu9KhAPNoYkWQYhGURsIQbll1lP7c-OO-V5Vyzu6mogiakC4NSwlK4LyRDdHQgY-yPH4wMB76MfQR61VyxI4TJLxIWTPSZA0nmQQWcuV2mE4jiDA</NextContinuationToken>
<KeyCount>1</KeyCount>
<MaxKeys>1</MaxKeys>
<Delimiter/>
<IsTruncated>true</IsTruncated>
<Contents>
<Key>soldier-bee</Key>
<LastModified>2016-08-25T17:49:06.006Z</LastModified>
<ETag>"37d4c94839ee181a2224d6242176c4b5"</ETag>
<Size>11</Size>
<StorageClass>STANDARD</StorageClass>
</Contents>
</ListBucketResult>
列出特定邮筒中的对象(已弃用)
包含此 API 是为了与较早版本兼容。 有关在存储区中检索对象的建议方法,请参阅 V2。
并非所有操作都在 Satellite 环境中受支持。 有关更多信息,请参阅 受支持的 Satellite API
GET
向一个桶发出的请求会返回一个对象列表,每次仅限 1,000 个,并按非书写顺序返回。 由于 Object Storage 中没有实现存储类操作,因此响应中返回的 StorageClass
值是默认值。 此操作不使用特定于操作的头或有效内容元素。
语法
GET https://{endpoint}/{bucket-name} # path style
GET https://{bucket-name}.{endpoint} # virtual host style
列表对象方法的可选查询参数
名称 | 类型 | 描述 |
---|---|---|
prefix |
字符串 | 限制响应以 prefix 开头的对象名称。 |
delimiter |
字符串 | 对 prefix 和 delimiter 之间的对象分组。 |
encoding-type |
字符串 | 如果在对象名称中使用了 XML 不支持的 Unicode 字符,那么可以将此参数设置为 url 以正确对响应进行编码。 |
max-keys |
字符串 | 限制要在响应中显示的对象数。 缺省值和最大值为 1,000。 |
marker |
字符串 | 以 UTF-8 二进制顺序指定列表从哪个对象开始。 |
示例请求
此请求列出“apiary”存储区中的对象。
GET /apiary HTTP/1.1
Content-Type: text/plain
Host: s3.us.cloud-object-storage.appdomain.cloud
Authorization: Bearer {token}
示例请求
GET /apiary HTTP/1.1
Authorization: 'AWS4-HMAC-SHA256 Credential={access-key}/{date}/{region}/s3/aws4_request,SignedHeaders=host;x-amz-date;,Signature={signature}'
x-amz-date: {timestamp}
Content-Type: text/plain
Host: s3.us.cloud-object-storage.appdomain.cloud
示例响应
HTTP/1.1 200 OK
Date: Wed, 24 Aug 2016 17:36:24 GMT
X-Clv-Request-Id: 9f39ff2e-55d1-461b-a6f1-2d0b75138861
Accept-Ranges: bytes
Server: Cleversafe/3.9.0.115
X-Clv-S3-Version: 2.5
x-amz-request-id: 9f39ff2e-55d1-461b-a6f1-2d0b75138861
Content-Type: application/xml
Content-Length: 909
<ListBucketResult xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<Name>apiary</Name>
<Prefix/>
<Marker/>
<MaxKeys>1000</MaxKeys>
<Delimiter/>
<IsTruncated>false</IsTruncated>
<Contents>
<Key>drone-bee</Key>
<LastModified>2016-08-25T17:38:38.549Z</LastModified>
<ETag>"0cbc6611f5540bd0809a388dc95a615b"</ETag>
<Size>4</Size>
<Owner>
<ID>{account-id}</ID>
<DisplayName>{account-id}</DisplayName>
</Owner>
<StorageClass>STANDARD</StorageClass>
</Contents>
<Contents>
<Key>soldier-bee</Key>
<LastModified>2016-08-25T17:49:06.006Z</LastModified>
<ETag>"37d4c94839ee181a2224d6242176c4b5"</ETag>
<Size>11</Size>
<Owner>
<ID>{account-id}</ID>
<DisplayName>{account-id}</DisplayName>
</Owner>
<StorageClass>STANDARD</StorageClass>
</Contents>
<Contents>
<Key>worker-bee</Key>
<LastModified>2016-08-25T17:46:53.288Z</LastModified>
<ETag>"d34d8aada2996fc42e6948b926513907"</ETag>
<Size>467</Size>
<Owner>
<ID>{account-id}</ID>
<DisplayName>{account-id}</DisplayName>
</Owner>
<StorageClass>STANDARD</StorageClass>
</Contents>
</ListBucketResult>
删除存储区
向空桶发出的 DELETE
请求会删除该桶。 删除后,系统将保留存储区的名称 10 分钟。 10 分钟后,将发布该名称以供重新使用。 只能删除空存储区。
如果删除 Object Storage 服务实例,那么系统将保留该实例中的所有存储区名称 7 天。 在 7 天后,将发布这些名称以供重新使用。
并非所有操作都在 Satellite 环境中受支持。 有关更多信息,请参阅 受支持的 Satellite API
语法
DELETE https://{endpoint}/{bucket-name} # path style
DELETE https://{bucket-name}.{endpoint} # virtual host style
可选头
名称 | 类型 | 描述 |
---|---|---|
aspera-ak-max-tries |
字符串 | 指定尝试执行删除操作的次数。 缺省值为 2。 |
示例请求
DELETE /apiary HTTP/1.1
Host: s3.us.cloud-object-storage.appdomain.cloud
Authorization: Bearer {token}
示例请求
DELETE /apiary HTTP/1.1
Authorization: 'AWS4-HMAC-SHA256 Credential={access-key}/{date}/{region}/s3/aws4_request,SignedHeaders=host;x-amz-date;,Signature={signature}'
x-amz-date: {timestamp}
Content-Type: text/plain
Host: s3.us.cloud-object-storage.appdomain.cloud
服务器使用 204 No Content
进行响应。
如果请求删除的是非空存储区,服务器将使用 409 Conflict
进行响应。
示例响应
<Error>
<Code>BucketNotEmpty</Code>
<Message>The bucket you tried to delete is not empty.</Message>
<Resource>/apiary/</Resource>
<RequestId>9d2bbc00-2827-4210-b40a-8107863f4386</RequestId>
<httpStatusCode>409</httpStatusCode>
</Error>
在现有存储区上配置对象锁定
并非所有操作都在 Satellite 环境中受支持。 有关更多信息,请参阅 受支持的 Satellite API
使用 ?object-lock
查询参数寻址到空存储区的 PUT
请求会在存储区上设置新的对象锁定配置。
语法
PUT https://{endpoint}/{bucket-name}?object-lock # path style
PUT https://{bucket-name}.{endpoint}?object-lock # virtual host style
对象锁定配置在请求主体中以 XML 形式提供。 新请求将覆盖存储区上存在的任何现有复制规则。
对象锁定配置必须包含一条规则。
头 | 类型 | 描述 |
---|---|---|
Content-MD5 |
字符串 | 必需:有效内容的 Base64 编码的 128 位 MD5 散列,用作完整性检查,可确保有效内容在传输中未变更。 |
请求主体必须包含具有以下模式的 XML 块:
元素 | 类型 | 子代 | 祖代 | 约束 |
---|---|---|---|---|
ObjectLockConfiguration |
容器 | ObjectLockEnabled , Rule |
无 | 限制为 1。 |
ObjectLockEnabled |
字符串 | 无 | ObjectLockConfiguration |
唯一有效的值是 ENABLED 。 |
Rule |
容器 | DefaultRetention |
ObjectLockConfiguration |
限制 1 |
DefaultRetention |
容器 | Days , Mode , Years |
Rule |
限制为 1。 |
Days |
整数 | 无 | DefaultRetention |
要为缺省保留期指定的天数。 它无法与 Years 组合。 |
Mode |
字符串 | 无 | DefaultRetention |
当前仅支持 COMPLIANCE 。 |
Years |
整数 | 无 | DefaultRetention |
要为缺省保留期指定的年数。 它无法与 Days 组合。 |
示例请求
此请求列出“apiary”存储区中的对象。
GET /apiary HTTP/1.1
Content-Type: text/plain
Host: s3.us.cloud-object-storage.appdomain.cloud
Authorization: Bearer {token}
示例响应
HTTP/1.1 200 OK
Date: Wed, 24 Aug 2016 17:36:24 GMT
X-Clv-Request-Id: 9f39ff2e-55d1-461b-a6f1-2d0b75138861
Accept-Ranges: bytes
Server: Cleversafe/3.9.0.115
X-Clv-S3-Version: 2.5
x-amz-request-id: 9f39ff2e-55d1-461b-a6f1-2d0b75138861
Content-Type: application/xml
Content-Length: 909
<ObjectLockConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<ObjectLockEnabled>ENABLED</ObjectLockEnabled>
<Rule>
<DefaultRetention>
<Days>30</Days>
<Mode>COMPLIANCE</Mode>
</DefaultRetention>
</Rule>
</ObjectLockConfiguration>
列出存储区的已取消或未完成的多重部件上载
使用相应参数对存储区发出 GET
请求将检索有关存储区任何已取消或未完成的分块上传的信息。
并非所有操作都在 Satellite 环境中受支持。 有关更多信息,请参阅 受支持的 Satellite API
语法
GET https://{endpoint}/{bucket-name}?uploads= # path style
GET https://{bucket-name}.{endpoint}?uploads= # virtual host style
参数
名称 | 类型 | 描述 |
---|---|---|
prefix |
字符串 | 限制响应以 {prefix} 开头的对象名称。 |
delimiter |
字符串 | 对 prefix 和 delimiter 之间的对象分组。 |
encoding-type |
字符串 | 如果在对象名称中使用了 XML 不支持的 Unicode 字符,那么可以将此参数设置为 url 以正确对响应进行编码。 |
max-uploads |
整数 | 限制要在响应中显示的对象数。 缺省值和最大值为 1,000。 |
key-marker |
字符串 | 指定列表的起始位置。 |
upload-id-marker |
字符串 | 如果未指定 key-marker 则忽略,否则将设置一个开始列出 upload-id-marker 以上部分的点。 |
示例请求
以下示例检索所有当前已取消且未完成的多部分上载。
GET /apiary?uploads= HTTP/1.1
Authorization: Bearer {token}
Host: s3.us.cloud-object-storage.appdomain.cloud
示例请求
GET /apiary?uploads= HTTP/1.1
Authorization: 'AWS4-HMAC-SHA256 Credential={access-key}/{date}/{region}/s3/aws4_request,SignedHeaders=host;x-amz-date;,Signature={signature}'
x-amz-date: {timestamp}
Content-Type: text/plain
Host: s3.us.cloud-object-storage.appdomain.cloud
示例响应(没有进行中的分块上传)
HTTP/1.1 200 OK
Date: Wed, 5 Oct 2016 15:22:27 GMT
X-Clv-Request-Id: 9fa96daa-9f37-42ee-ab79-0bcda049c671
Accept-Ranges: bytes
Server: Cleversafe/3.9.0.129
X-Clv-S3-Version: 2.5
x-amz-request-id: 9fa96daa-9f37-42ee-ab79-0bcda049c671
Content-Type: application/xml
Content-Length: 374
<ListMultipartUploadsResult xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<Bucket>apiary</Bucket>
<KeyMarker/>
<UploadIdMarker/>
<NextKeyMarker>multipart-object-123</NextKeyMarker>
<NextUploadIdMarker>0000015a-df89-51d0-2790-dee1ac994053</NextUploadIdMarker>
<MaxUploads>1000</MaxUploads>
<IsTruncated>false</IsTruncated>
<Upload>
<Key>file</Key>
<UploadId>0000015a-d92a-bc4a-c312-8c1c2a0e89db</UploadId>
<Initiator>
<ID>d4d11b981e6e489486a945d640d41c4d</ID>
<DisplayName>d4d11b981e6e489486a945d640d41c4d</DisplayName>
</Initiator>
<Owner>
<ID>d4d11b981e6e489486a945d640d41c4d</ID>
<DisplayName>d4d11b981e6e489486a945d640d41c4d</DisplayName>
</Owner>
<StorageClass>STANDARD</StorageClass>
<Initiated>2017-03-16T22:09:01.002Z</Initiated>
</Upload>
<Upload>
<Key>multipart-object-123</Key>
<UploadId>0000015a-df89-51d0-2790-dee1ac994053</UploadId>
<Initiator>
<ID>d4d11b981e6e489486a945d640d41c4d</ID>
<DisplayName>d4d11b981e6e489486a945d640d41c4d</DisplayName>
</Initiator>
<Owner>
<ID>d4d11b981e6e489486a945d640d41c4d</ID>
<DisplayName>d4d11b981e6e489486a945d640d41c4d</DisplayName>
</Owner>
<StorageClass>STANDARD</StorageClass>
<Initiated>2017-03-18T03:50:02.960Z</Initiated>
</Upload>
</ListMultipartUploadsResult>
列出存储区的任何跨源资源共享配置
使用相应参数对存储区发出 GET
请求将检索有关存储区的跨源资源共享 (CORS) 的信息。
并非所有操作都在 Satellite 环境中受支持。 有关更多信息,请参阅 受支持的 Satellite API
语法
GET https://{endpoint}/{bucket-name}?cors= # path style
GET https://{bucket-name}.{endpoint}?cors= # virtual host style
示例请求
以下示例列出了“ap胆”存储区上的 CORS 配置。
GET /apiary?cors= HTTP/1.1
Authorization: Bearer {token}
Host: s3.us.cloud-object-storage.appdomain.cloud
示例请求
GET /apiary?cors= HTTP/1.1
Authorization: 'AWS4-HMAC-SHA256 Credential={access-key}/{date}/{region}/s3/aws4_request,SignedHeaders=host;x-amz-date;,Signature={signature}'
x-amz-date: {timestamp}
Content-Type: text/plain
Host: s3.us.cloud-object-storage.appdomain.cloud
示例响应 未设置 CORS 配置
HTTP/1.1 200 OK
Date: Wed, 5 Oct 2016 15:20:30 GMT
X-Clv-Request-Id: 0b69bce1-8420-4f93-a04a-35d7542799e6
Accept-Ranges: bytes
Server: Cleversafe/3.9.0.129
X-Clv-S3-Version: 2.5
x-amz-request-id: 0b69bce1-8420-4f93-a04a-35d7542799e6
Content-Type: application/xml
Content-Length: 123
<CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<CORSRule>
<AllowedMethod>GET</AllowedMethod>
<AllowedMethod>PUT</AllowedMethod>
<AllowedMethod>POST</AllowedMethod>
<AllowedOrigin>http://www.ibm.com</AllowedOrigin>
</CORSRule>
</CORSConfiguration>
为存储区创建跨源资源共享配置
使用相应参数对存储区发出 PUT
请求将创建或替换存储区的跨源资源共享 (CORS) 配置。
并非所有操作都在 Satellite 环境中受支持。 有关更多信息,请参阅 受支持的 Satellite API
语法
PUT https://{endpoint}/{bucket-name}?cors= # path style
PUT https://{bucket-name}.{endpoint}?cors= # virtual host style
有效内容元素
请求主体必须包含具有以下模式的 XML 块:
元素 | 类型 | 子代 | 祖代 | 约束 |
---|---|---|---|---|
CORSConfiguration |
容器 | CORSRule |
|
|
CORSRule |
容器 | AllowedOrigin , AllowedMethod |
删除(T) |
|
AllowedOrigin |
字符串 |
|
CORSRule |
有效源字符串 |
AllowedMethod |
字符串 |
|
CORSRule |
有效方法字符串 |
必需的 Content-MD5
头需要是 Base64 编码的 MD5 散列的二进制表示。 以下片段显示了实现该特定头的内容的一种方法。
echo -n (XML block) | openssl dgst -md5 -binary | openssl enc -base64
示例请求
下面的示例添加了 CORS 配置,允许来自 www.ibm.com
的请求向水桶发出 GET
、PUT
和 POST
请求。
PUT /apiary?cors= HTTP/1.1
Authorization: Bearer {token}
Content-Type: text/plain
Host: s3.us.cloud-object-storage.appdomain.cloud
Content-MD5: M625BaNwd/OytcM7O5gIaQ==
Content-Length: 237
示例请求
PUT /apiary?cors= HTTP/1.1
Authorization: 'AWS4-HMAC-SHA256 Credential={access-key}/{date}/{region}/s3/aws4_request,SignedHeaders=host;x-amz-date;,Signature={signature}'
x-amz-date: {timestamp}
Content-Type: text/plain
Host: s3.us.cloud-object-storage.appdomain.cloud
Content-MD5: M625BaNwd/OytcM7O5gIaQ==
Content-Length: 237
<CORSConfiguration>
<CORSRule>
<AllowedOrigin>http://www.ibm.com</AllowedOrigin>
<AllowedMethod>GET</AllowedMethod>
<AllowedMethod>PUT</AllowedMethod>
<AllowedMethod>POST</AllowedMethod>
</CORSRule>
</CORSConfiguration>
示例响应
HTTP/1.1 200 OK
Date: Wed, 5 Oct 2016 15:39:38 GMT
X-Clv-Request-Id: 7afca6d8-e209-4519-8f2c-1af3f1540b42
Accept-Ranges: bytes
Server: Cleversafe/3.9.0.129
X-Clv-S3-Version: 2.5
x-amz-request-id: 7afca6d8-e209-4519-8f2c-1af3f1540b42
Content-Length: 0
删除存储区的任何跨源资源共享配置
使用相应参数对存储区发出 DELETE
请求将创建或替换存储区的跨源资源共享 (CORS) 配置。
并非所有操作都在 Satellite 环境中受支持。 有关更多信息,请参阅 受支持的 Satellite API
语法
DELETE https://{endpoint}/{bucket-name}?cors= # path style
DELETE https://{bucket-name}.{endpoint}?cors= # virtual host style
示例请求
以下示例将删除存储区的 CORS 配置。
DELETE /apiary?cors= HTTP/1.1
Authorization: Bearer {token}
Host: s3.us.cloud-object-storage.appdomain.cloud
示例请求
DELETE /apiary?cors= HTTP/1.1
Authorization: 'AWS4-HMAC-SHA256 Credential={access-key}/{date}/{region}/s3/aws4_request,SignedHeaders=host;x-amz-date;,Signature={signature}'
x-amz-date: {timestamp}
Content-Type: text/plain
Host: s3.us.cloud-object-storage.appdomain.cloud
服务器使用 204 No Content
进行响应。
列出存储区的位置约束
使用相应参数对存储区发出 GET
请求将检索存储区的位置信息。
并非所有操作都在 Satellite 环境中受支持。 有关更多信息,请参阅 受支持的 Satellite API
语法
GET https://{endpoint}/{bucket-name}?location # path style
GET https://{bucket-name}.{endpoint}?location # virtual host style
示例请求
以下示例检索“ap胆”存储区的位置。
GET /apiary?location= HTTP/1.1
Authorization: Bearer {token}
Host: s3.us.cloud-object-storage.appdomain.cloud
示例请求
GET /apiary?location= HTTP/1.1
Authorization: 'AWS4-HMAC-SHA256 Credential={access-key}/{date}/{region}/s3/aws4_request,SignedHeaders=host;x-amz-date;,Signature={signature}'
x-amz-date: {timestamp}
Content-Type: text/plain
Host: s3.us.cloud-object-storage.appdomain.cloud
示例响应
HTTP/1.1 200 OK
Date: Tue, 12 Jun 2018 21:10:57 GMT
X-Clv-Request-Id: 0e469546-3e43-4c6b-b814-5ad0db5b638f
Accept-Ranges: bytes
Server: Cleversafe/3.13.3.57
X-Clv-S3-Version: 2.5
x-amz-request-id: 0e469546-3e43-4c6b-b814-5ad0db5b638f
Content-Type: application/xml
Content-Length: 161
<LocationConstraint xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
us-south-standard
</LocationConstraint>
创建存储区生命周期配置
PUT
操作使用生命周期查询参数来配置存储区的生命周期设置。 需要 Content-MD5
头作为有效内容的完整性检查。
并非所有操作都在 Satellite 环境中受支持。 有关更多信息,请参阅 受支持的 Satellite API
语法
PUT https://{endpoint}/{bucket-name}?lifecycle # path style
PUT https://{bucket-name}.{endpoint}?lifecycle # virtual host style
有效内容元素
请求主体必须包含具有以下模式的 XML 块:
元素 | 类型 | 子代 | 祖代 | 约束 |
---|---|---|---|---|
LifecycleConfiguration |
容器 | Rule |
无 | 限制 1 |
Rule |
容器 | ID , Status , Filter , Transition |
LifecycleConfiguration |
限制 1 |
ID |
字符串 | 无 | Rule |
必须 由 (a-z ,A-Z ,0-9 ) 和以下符号组成:! _ . * ' ( ) - |
Filter |
字符串 | Prefix |
Rule |
必须包含 Prefix 元素。 |
Expiration |
容器 | Days , Date , ExpiredObjectDeleteMarker |
Rule |
限制 1 |
Prefix |
字符串 | 无 | Filter |
如果使用转换 (归档) 规则,那么值 必须 设置为 <Prefix/> 。 此限制不适用于到期规则。 |
Transition |
容器 | Days , StorageClass |
Rule |
限制 1 转换规则,总共限制 1000 个规则。 |
Days |
非负整数 | 无 | Transition |
必须 是等于或大于 0 的值。 |
Date |
日期 | 无 | Transition |
必须使用 ISO 8601 格式,日期必须是未来日期。 |
StorageClass |
字符串 | 无 | Transition |
必须 设置为 GLACIER 或 ACCELERATED 。 |
ExpiredObjectDeleteMarker |
布尔值 | 无 | Expiration |
必须是 true 或 false 。 |
NoncurrentVersionExpiration |
容器 | NoncurrentDays |
NoncurrentVersionExpiration |
限制 1 |
NoncurrentDays |
正整数 | 无 | Transition |
必须为大于 0 的值。 |
AbortIncompleteMultipartUpload |
容器 | DaysAfterInitiation |
Rule |
限制 1 |
DaysAfterInitiation |
非负整数 | 无 | AbortIncompleteMultipartUpload |
必须为大于 0 的值。 |
IBM Cloud® Object Storage IaaS (非 IAM) 帐户无法将转换存储类设置为 ACCELERATED
。
<LifecycleConfiguration>
<Rule>
<ID>{string}</ID>
<Status>Enabled</Status>
<Filter>
<Prefix/>
</Filter>
<Transition>
<Days>{integer}</Days>
<StorageClass>GLACIER</StorageClass>
</Transition>
</Rule>
</LifecycleConfiguration>
必需的 Content-MD5
头需要是 Base64 编码的 MD5 散列的二进制表示。 以下片段显示了实现该特定头的内容的一种方法。
echo -n (XML block) | openssl dgst -md5 -binary | openssl enc -base64
示例请求
PUT /apiary?lifecycle HTTP/1.1
Content-Type: text/plain
Host: s3.us.cloud-object-storage.appdomain.cloud
Authorization: {authorization-string}
Content-Type: text/plain
Content-MD5: M625BaNwd/OytcM7O5gIaQ==
Content-Length: 305
示例请求
PUT /apiary?lifecycle HTTP/1.1
Authorization: 'AWS4-HMAC-SHA256 Credential={access-key}/{date}/{region}/s3/aws4_request,SignedHeaders=host;x-amz-date;,Signature={signature}'
x-amz-date: {timestamp}
Content-Type: text/plain
Content-MD5: M625BaNwd/OytcM7O5gIaQ==
Content-Length: 305
Host: s3.us.cloud-object-storage.appdomain.cloud
<LifecycleConfiguration>
<Rule>
<ID>my-archive-policy</ID>
<Filter>
<Prefix/>
</Filter>
<Status>Enabled</Status>
<Transition>
<Days>20</Days>
<StorageClass>GLACIER</StorageClass>
</Transition>
</Rule>
</LifecycleConfiguration>
服务器使用 200 OK
进行响应。
<LifecycleConfiguration>
<Rule>
<ID>{string}</ID>
<Status>Enabled</Status>
<Filter>
<Prefix/>
</Filter>
<Expiration>
<Days>{integer}</Days>
</Expiration>
</Rule>
</LifecycleConfiguration>
必需的 Content-MD5
头需要是 Base64 编码的 MD5 散列的二进制表示。 以下片段显示了实现该特定头的内容的一种方法。
echo -n (XML block) | openssl dgst -md5 -binary | openssl enc -base64
示例请求
PUT /cit-test?lifecycle HTTP/1.1
Host: 192.168.35.22
Date: Fri, 28 Feb 2020 14:12:06 +0000
Authorization: AWS MOfXYiHQ9QTyD2ALoiOh:WrlFRE2KMmhutBf3CxIZoNLl/ko=
Content-MD5: To3JYtaVNR3+aGYtl1dlmw==
Content-Length: 321
<LifecycleConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<Rule>
<ID>ID1</ID>
<Status>Enabled</Status>
<Filter>
<Prefix/>
</Filter>
<Expiration>
<Days>100</Days>
</Expiration>
</Rule>
</LifecycleConfiguration>
响应示例 服务器响应:200 OK
。
We are completely uploaded and fine
HTTP/1.1 200 OK
Date: Fri, 28 Feb 2020 14:12:06 GMT
X-Clv-Request-Id: 587d909f-4939-41ef-8c16-80aea16a0587
Server: Cleversafe/3.14.9.53
X-Clv-S3-Version: 2.5
x-amz-request-id: 587d909f-4939-41ef-8c16-80aea16a0587
Content-Length: 0
示例请求
PUT /{bucket-name}?lifecycle HTTP/1.1
Authorization: Bearer {token}
Content-Type: text/plain
Host: s3.us.cloud-object-storage.appdomain.cloud
ibm-service-instance-id: {ibm-service-instance-id}
Content-Length: 123
示例请求
PUT /{bucket-name}?lifecycle HTTP/1.1
Authorization: 'AWS4-HMAC-SHA256 Credential={access-key}/{date}/{region}/s3/aws4_request,SignedHeaders=host;x-amz-date;,Signature={signature}'
x-amz-date: {timestamp}
Content-Type: text/plain
Host: s3.us.cloud-object-storage.appdomain.cloud
Content-Length: 123
检索存储区生命周期配置
GET
操作使用生命周期查询参数来检索存储区的生命周期设置。
语法
GET https://{endpoint}/{bucket-name}?lifecycle # path style
GET https://{bucket-name}.{endpoint}?lifecycle # virtual host style
示例请求
GET /apiary?lifecycle HTTP/1.1
Content-Type: text/plain
Host: s3.us.cloud-object-storage.appdomain.cloud
Authorization: {authorization-string}
示例请求
GET /apiary?lifecycle HTTP/1.1
Authorization: 'AWS4-HMAC-SHA256 Credential={access-key}/{date}/{region}/s3/aws4_request,SignedHeaders=host;x-amz-date;,Signature={signature}'
x-amz-date: {timestamp}
Content-Type: text/plain
Host: s3.us.cloud-object-storage.appdomain.cloud
响应示例
<LifecycleConfiguration>
<Rule>
<ID>my-archive-policy</ID>
<Filter>
<Prefix/>
</Filter>
<Status>Enabled</Status>
<Transition>
<Days>20</Days>
<StorageClass>GLACIER</StorageClass>
</Transition>
</Rule>
</LifecycleConfiguration>
示例请求
GET /cit_dump-log?lifecycle HTTP/1.1
Host: 192.168.35.22
User-Agent: curl/7.64.1
Accept: */*
Date: Fri, 28 Feb 2020 14:00:43 +0000
Authorization: AWS MOfXYiHQ9QTyD2ALoiOh:iKm2QNetyW740kylP6ja2pze3DM=
Content-MD5: 1B2M2Y8AsgTpgAmY7PhCfg==
响应示例
HTTP/1.1 200 OK
Date: Fri, 28 Feb 2020 14:00:43 GMT
X-Clv-Request-Id: ecbf9294-284d-4169-b2cd-5d52b2450808
Server: Cleversafe/3.14.9.53
X-Clv-S3-Version: 2.5
Accept-Ranges: bytes
x-amz-request-id: ecbf9294-284d-4169-b2cd-5d52b2450808
Content-Type: application/xml
Content-Length: 276
<LifecycleConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<Rule>
<ID>ID1</ID>
<Status>Enabled</Status>
<Filter>
<Prefix/>
</Filter>
<Expiration>
<Days>270</Days>
</Expiration>
</Rule>
</LifecycleConfiguration>
使用到期规则删除旧数据
将延迟受存储区的不可变 Object Storage 保留策略约束的对象的任何到期操作,直到不再实施该保留策略为止。
有关使用生命周期配置来删除对象的更多信息,请查看 文档。
此 PUT
操作实现使用 lifecycle
查询参数来设置存储区的生命周期设置。 此操作支持对存储区定义单个生命周期策略。 政策被定义为由以下参数组成的一组规则:ID
, Status
, Filter
,和 Expiration
。
并非所有操作都在 Satellite 环境中受支持。 有关更多信息,请参阅 受支持的 Satellite API
头 | 类型 | 描述 |
---|---|---|
Content-MD5 |
字符串 | 必需:有效内容的 Base64 编码的 128 位 MD5 散列,用作完整性检查,可确保有效内容在传输中未变更。 |
以下片段显示了实现该特定头的内容的一种方法。
echo -n (XML block) | openssl dgst -md5 -binary | openssl enc -base64
请求主体必须包含具有以下模式的 XML 块:
元素 | 类型 | 子代 | 祖代 | 约束 |
---|---|---|---|---|
LifecycleConfiguration |
容器 | Rule |
无 | 限制为 1。 |
Rule |
容器 | ID , Status , Filter , Expiration |
LifecycleConfiguration |
限制为 1000。 |
ID |
字符串 | 无 | Rule |
必须由 (a-z ,A-Z ,0-9 ) 和以下符号组成: ! _ . * ' ( ) - |
Filter |
字符串 | Prefix |
Rule |
必须包含 Prefix 元素 |
Prefix |
字符串 | 无 | Filter |
规则会应用于其键与此前缀相匹配的任何对象。 |
Expiration |
容器 | Days 或 Date |
Rule |
限制为 1。 |
Days |
非负整数 | 无 | Expiration |
必须为大于 0 的值。 |
Date |
日期 | 无 | Expiration |
必须为 ISO 8601 格式。 |
语法
PUT https://{endpoint}/{bucket}?lifecycle # path style
PUT https://{bucket}.{endpoint}?lifecycle # virtual host style
示例请求
PUT /images?lifecycle HTTP/1.1
Host: s3.us.cloud-object-storage.appdomain.cloud
Date: Wed, 7 Feb 2018 17:50:00 GMT
Authorization: authorization string
Content-Type: text/plain
Content-MD5: M625BaNwd/OytcM7O5gIaQ==
Content-Length: 305
<LifecycleConfiguration>
<Rule>
<ID>id1</ID>
<Filter />
<Status>Enabled</Status>
<Expiration>
<Days>60</Days>
</Expiration>
</Rule>
</LifecycleConfiguration>
删除存储区的生命周期配置
使用相应参数对存储区发出 DELETE
请求将除去存储区的任何生命周期配置。
语法
DELETE https://{endpoint}/{bucket-name}?lifecycle # path style
DELETE https://{bucket-name}.{endpoint}?lifecycle # virtual host style
示例请求
DELETE /apiary?lifecycle HTTP/1.1
Authorization: {authorization-string}
Host: s3.us.cloud-object-storage.appdomain.cloud
示例请求
DELETE /apiary?lifecycle HTTP/1.1
Authorization: 'AWS4-HMAC-SHA256 Credential={access-key}/{date}/{region}/s3/aws4_request,SignedHeaders=host;x-amz-date;,Signature={signature}'
x-amz-date: {timestamp}
Content-Type: text/plain
Host: s3.us.cloud-object-storage.appdomain.cloud
服务器使用 204 No Content
进行响应。
示例请求
DELETE /cit-test?lifecycle HTTP/1.1
Host: 192.168.35.22
User-Agent: curl/7.64.1
Accept: */*
Date: Fri, 28 Feb 2020 14:16:47 +0000
Authorization: AWS MOfXYiHQ9QTyD2ALoiOh:n25GU28DiBgkNVgET5hKmLmp938=
Content-MD5: 1B2M2Y8AsgTpgAmY7PhCfg==
示例响应
HTTP/1.1 204 No Content
Date: Fri, 28 Feb 2020 14:16:47 GMT
X-Clv-Request-Id: 3e8bdf1e-b611-4b83-a404-e7d3e58e60b0
Server: Cleversafe/3.14.9.53
X-Clv-S3-Version: 2.5
x-amz-request-id: 3e8bdf1e-b611-4b83-a404-e7d3e58e60b0
服务器使用 204 No Content
进行响应。
在现有存储区上添加保留时间策略
不可变对象存储器仅在某些区域可用;有关详细信息,请参阅集成服务。 该服务还需要一个标准定价计划。 有关详细信息,请参阅定价。
在 文档 中了解有关不可变 Object Storage 的更多信息。
保留期设置 MinimumRetention
、DefaultRetention
和 MaximumRetention
的最小和最大支持值分别为 0 天和 365243 天(1000 年)。
此操作不使用额外的查询参数。 必需的 Content-MD5
头需要是 Base64 编码的 MD5 散列的二进制表示。 以下片段显示了实现该特定头的内容的一种方法。
在保留期结束之前实施策略,并且在保留期到期之前无法变更策略。 当 IBM Cloud® Object Storage 将 S3 API 用于大多数操作时,用于配置保留时间策略的 API 与 S3 API 不同,尽管某些术语可能是共享的。 请仔细阅读本文档,以防止组织中的任何用户创建无法删除的对象,即使是 IBM Cloud 管理员也是如此。
并非所有操作都在 Satellite 环境中受支持。 有关更多信息,请参阅 受支持的 Satellite API
echo -n (XML block) | openssl dgst -md5 -binary | openssl enc -base64
语法
PUT https://{endpoint}/{bucket-name}?protection= # path style
PUT https://{bucket-name}.{endpoint}?protection= # virtual host style
请求主体必须包含具有以下模式的 XML 块:
元素 | 类型 | 子代 | 祖代 | 约束 |
---|---|---|---|---|
ProtectionConfiguration |
容器 | Status , MinimumRetention , MaximumRetention , DefaultRetention |
|
|
Status |
字符串 |
|
ProtectionConfiguration |
有效状态字符串 |
MinimumRetention |
容器 | Days |
ProtectionConfiguration |
|
MaximumRetention |
容器 | Days |
ProtectionConfiguration |
|
DefaultRetention |
容器 | Days |
ProtectionConfiguration |
|
Days |
整数 |
|
MinimumRetention , MaximumRetention , DefaultRetention |
有效保留时间整数 |
示例请求
PUT /example-bucket?protection= HTTP/1.1
Authorization: {authorization-string}
x-amz-date: 20181011T190354Z
x-amz-content-sha256: 2938f51643d63c864fdbea618fe71b13579570a86f39da2837c922bae68d72df
Content-MD5: GQmpTNpruOyK6YrxHnpj7g==
Content-Type: text/plain
Host: 67.228.254.193
Content-Length: 299
<ProtectionConfiguration>
<Status>Retention</Status>
<MinimumRetention>
<Days>100</Days>
</MinimumRetention>
<MaximumRetention>
<Days>10000</Days>
</MaximumRetention>
<DefaultRetention>
<Days>2555</Days>
</DefaultRetention>
</ProtectionConfiguration>
示例响应
HTTP/1.1 200 OK
Date: Wed, 5 Oct 2018 15:39:38 GMT
X-Clv-Request-Id: 7afca6d8-e209-4519-8f2c-1af3f1540b42
Accept-Ranges: bytes
Server: Cleversafe/3.14.1
X-Clv-S3-Version: 2.5
x-amz-request-id: 7afca6d8-e209-4519-8f2c-1af3f1540b42
Content-Length: 0
为静态 Web 站点托管配置存储区
使用适当参数向水桶发布 PUT
,可创建或替换水桶的静态网站配置。
并非所有操作都在 Satellite 环境中受支持。 有关更多信息,请参阅 受支持的 Satellite API
语法
PUT https://{endpoint}/{bucket-name}?website # path style
PUT https://{bucket-name}.{endpoint}?website # virtual host style
有效内容元素
请求主体必须包含具有以下模式的 XML 块:
元素 | 类型 | 子代 | 祖代 | 注释 |
---|---|---|---|---|
WebsiteConfiguration |
容器 | ErrorDocument , IndexDocument , RedirectAllRequestsTo , RoutingRule |
|
必需 |
ErrorDocument |
容器 | Key |
WebsiteConfiguration |
|
Key |
字符串 |
|
ErrorDocument |
|
IndexDocument |
容器 | Suffix |
WebsiteConfiguration |
|
Suffix |
字符串 |
|
IndexDocument |
|
RedirectAllRequestsTo |
容器 | HostName , Protocol |
WebsiteConfiguration |
如果给定,那么它必须是唯一指定的元素 |
HostName |
字符串 |
|
RedirectAllRequestsTo |
|
Protocol |
字符串 |
|
RedirectAllRequestsTo |
|
RoutingRules |
容器 | RoutingRule |
WebsiteConfiguration |
|
RoutingRule |
容器 | Condition , Redirect |
RoutingRules |
|
Condition |
容器 | HttpErrorCodeReturnedEquals , KeyPrefixEquals |
RoutingRule |
|
HttpErrorCodeReturnedEquals |
字符串 |
|
Condition |
|
KeyPrefixEquals |
字符串 |
|
Condition |
|
Redirect |
容器 | HostName , HttpRedirectCode , Protocol , ReplaceKeyPrefixWith , ReplaceKeyWith |
RoutingRule |
|
HostName |
字符串 |
|
Redirect |
|
HttpRedirectCode |
字符串 |
|
Redirect |
|
Protocol |
字符串 |
|
Redirect |
|
ReplaceKeyPrefixWith |
字符串 |
|
Redirect |
|
ReplaceKeyWith |
字符串 |
|
Redirect |
|
示例请求
以下示例添加了一个 Web 站点配置,用于提供在每个前缀中查找 index.html
文件的基本 Web 站点。 例如,向 /apiary/images/
发出的请求将提供 /apiary/images/index.html
中的内容,而无需指定实际文件。
PUT /apiary?website HTTP/1.1
Authorization: Bearer {token}
Content-Type: text/plain
Host: s3.us.cloud-object-storage.appdomain.cloud
Content-Length: 119
PUT /apiary?website HTTP/1.1
Authorization: 'AWS4-HMAC-SHA256 Credential={access-key}/{date}/{region}/s3/aws4_request,SignedHeaders=host;x-amz-date;,Signature={signature}'
x-amz-date: {timestamp}
Content-Type: text/plain
Host: s3.us.cloud-object-storage.appdomain.cloud
Content-Length: 119
<WebsiteConfiguration>
<IndexDocument>
<Suffix>index.html</Suffix>
</IndexDocument>
</WebsiteConfiguration>
示例响应
HTTP/1.1 200 OK
Date: Wed, 5 Oct 2020 15:39:38 GMT
X-Clv-Request-Id: 7afca6d8-e209-4519-8f2c-1af3f1540b42
Accept-Ranges: bytes
Content-Length: 0
删除存储区的任何 Web 站点配置
发出到具有正确参数的存储区的 DELETE
请求将除去存储区的 Web 站点配置。
并非所有操作都在 Satellite 环境中受支持。 有关更多信息,请参阅 受支持的 Satellite API
语法
DELETE https://{endpoint}/{bucket-name}?website # path style
DELETE https://{bucket-name}.{endpoint}?website # virtual host style
示例请求
以下示例将删除存储区的 Web 站点配置。
DELETE /apiary?website HTTP/1.1
Authorization: Bearer {token}
Host: s3.us.cloud-object-storage.appdomain.cloud
示例请求
DELETE /apiary?website HTTP/1.1
Authorization: 'AWS4-HMAC-SHA256 Credential={access-key}/{date}/{region}/s3/aws4_request,SignedHeaders=host;x-amz-date;,Signature={signature}'
x-amz-date: {timestamp}
Content-Type: text/plain
Host: s3.us.cloud-object-storage.appdomain.cloud
服务器使用 204 No Content
进行响应。
阻止存储区上的公用 ACL
向存储区发出的带有正确参数的 PUT
请求会阻止在存储区上添加公共访问 ACL。 可以将其设置为使新的 ACL 请求失败,也可以将其忽略。BlockPublicAcls
不会影响现有 ACL,但 IgnorePublicAcls
会忽略现有 ACL。 此操作不会影响 IAM 公共访问策略。
并非所有操作都在 Satellite 环境中受支持。 有关更多信息,请参阅 受支持的 Satellite API
语法
PUT https://{endpoint}/{bucket-name}?publicAccessBlock # path style
PUT https://{bucket-name}.{endpoint}?publicAccessBlock # virtual host style
有效内容元素
请求主体必须包含具有以下模式的 XML 块:
元素 | 类型 | 子代 | 祖代 | 注释 |
---|---|---|---|---|
PublicAccessBlockConfiguration | 容器 | BlockPublicAcls, IgnorePublicAcls |
|
必需 |
BlockPublicAcls | 布尔值 |
|
PublicAccessBlockConfiguration |
|
IgnorePublicAcls | 布尔值 |
|
PublicAccessBlockConfiguration |
|
示例请求
PUT /apiary?publicAccessBlock HTTP/1.1
Authorization: Bearer {token}
Host: s3.us.cloud-object-storage.appdomain.cloud
Content-Length: 155
PUT /apiary?publicAccessBlock HTTP/1.1
Authorization: 'AWS4-HMAC-SHA256 Credential={access-key}/{date}/{region}/s3/aws4_request,SignedHeaders=host;x-amz-date;,Signature={signature}'
x-amz-date: {timestamp}
Host: s3.us.cloud-object-storage.appdomain.cloud
Content-Length: 155
<PublicAccessBlockConfiguration>
<BlockPublicAcls>True</BlockPublicAcls>
<IgnorePublicAcls>True</IgnorePublicAcls>
</PublicAccessBlockConfiguration>
示例响应
HTTP/1.1 200 OK
Date: Mon, 02 Nov 2020 15:39:38 GMT
X-Clv-Request-Id: 7afca6d8-e209-4519-8f2c-1af3f1540b42
Accept-Ranges: bytes
Content-Length: 0
检查存储区的公共 ACL 块
发出到具有正确参数的存储区的 GET
将返回存储区的 ACL 块配置。
语法
GET https://{endpoint}/{bucket-name}?publicAccessBlock # path style
GET https://{bucket-name}.{endpoint}?publicAccessBlock # virtual host style
示例请求
以下示例读取存储区的公共访问块。
GET /apiary?publicAccessBlock HTTP/1.1
Authorization: Bearer {token}
Host: s3.us.cloud-object-storage.appdomain.cloud
示例请求
GET /apiary?publicAccessBlock HTTP/1.1
Authorization: 'AWS4-HMAC-SHA256 Credential={access-key}/{date}/{region}/s3/aws4_request,SignedHeaders=host;x-amz-date;,Signature={signature}'
x-amz-date: {timestamp}
Content-Type: text/plain
Host: s3.us.cloud-object-storage.appdomain.cloud
HTTP/1.1 200 OK
Date: Mon, 02 Nov 2020 19:52:56 GMT
X-Clv-Request-Id: 7c9079b1-2833-4abc-ba10-466ef06725b2
Server: Cleversafe/3.15.2.31
X-Clv-S3-Version: 2.5
Accept-Ranges: bytes
Content-Type: application/xml
Content-Length: 248
<PublicAccessBlockConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<BlockPublicAcls>true</BlockPublicAcls>
<IgnorePublicAcls>true</IgnorePublicAcls>
</PublicAccessBlockConfiguration>
从存储区中删除公共 ACL 块
发出到具有正确参数的存储区的 DELETE
将从存储区中除去公共 ACL 块。
并非所有操作都在 Satellite 环境中受支持。 有关更多信息,请参阅 受支持的 Satellite API
语法
DELETE https://{endpoint}/{bucket-name}?publicAccessBlock # path style
DELETE https://{bucket-name}.{endpoint}?publicAccessBlock # virtual host style
示例请求
以下示例删除存储区的 ACL 块。
DELETE /apiary?publicAccessBlock HTTP/1.1
Authorization: Bearer {token}
Host: s3.us.cloud-object-storage.appdomain.cloud
示例请求
DELETE /apiary?publicAccessBlock HTTP/1.1
Authorization: 'AWS4-HMAC-SHA256 Credential={access-key}/{date}/{region}/s3/aws4_request,SignedHeaders=host;x-amz-date;,Signature={signature}'
x-amz-date: {timestamp}
Content-Type: text/plain
Host: s3.us.cloud-object-storage.appdomain.cloud
服务器使用 204 No Content
进行响应。
配置 PUT 存储区库存
向存储区发出了具有正确参数的 PutBucketInventoryConfiguration
。
语法
PUT {bucket}?inventory&id={id}
示例请求
以下示例是针对存储区的 PutBucketInventoryConfiguration
请求。
示例请求
PUT /mybucket?inventory&id=myid HTTP/1.1
<?xml version="1.0" encoding="UTF-8"?>
<InventoryConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<Id>myid</Id>
<IsEnabled>true</IsEnabled>
<Filter>
<Prefix>my-filter-prefix</Prefix>
</Filter>
<IncludedObjectVersions>Current</IncludedObjectVersions>
<Schedule>
<Frequency>Daily</Frequency>
</Schedule>
<OptionalFields>
<Field>Size</Field>
<Field>LastModifiedDate</Field>
<Field>ETag</Field>
<Field>IsMultipartUploaded</Field>
<Field>EncryptionStatus</Field>
<Field>ObjectOwner</Field>
</OptionalFields>
<Destination>
<S3BucketDestination>
<Bucket>mybucket</Bucket>
<Format>CSV</Format>
<Prefix>my-destination-prefix</Prefix>
</S3BucketDestination>
</Destination>
</InventoryConfiguration>
服务器使用 204 No Content
进行响应。
配置 GET 存储区库存
向存储区发出了具有正确参数的 GetBucketInventoryConfiguration
。
语法
GET {bucket}?inventory&id={id}
示例请求
以下示例是针对存储区的 GetBucketInventoryConfiguration
请求。
GET mybucket?inventory&id=myid HTTP/1.1
示例响应
<?xml version="1.0" encoding="UTF-8"?>
<InventoryConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<Id>myid</Id>
<IsEnabled>true</IsEnabled>
<Filter>
<Prefix>my-filter-prefix</Prefix>
</Filter>
<IncludedObjectVersions>Current</IncludedObjectVersions>
<Schedule>
<Frequency>Daily</Frequency>
</Schedule>
<OptionalFields>
<Field>Size</Field>
<Field>LastModifiedDate</Field>
<Field>ETag</Field>
<Field>IsMultipartUploaded</Field>
<Field>EncryptionStatus</Field>
<Field>ObjectOwner</Field>
</OptionalFields>
<Destination>
<S3BucketDestination>
<Bucket>mybucket</Bucket>
<Format>CSV</Format>
<Prefix>my-destination-prefix</Prefix>
</S3BucketDestination>
</Destination>
</InventoryConfiguration>
配置 LIST 存储区库存
向存储区发出了具有正确参数的 ListBucketInventoryConfigurations
。
语法
GET {bucket}?inventory&continuation-token={continuation-token}
示例请求
以下示例是针对存储区的 ListBucketInventoryConfigurations
请求。
GET /mybucket?inventory HTTP/1.1
示例响应
<?xml version="1.0" encoding="UTF-8"?>
<ListInventoryConfigurationsResult xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<InventoryConfiguration>
<Id>goodinventoryid</Id>
<IsEnabled>true</IsEnabled>
<Filter>
<Prefix>goodFilterPrefix</Prefix>
</Filter>
<Destination>
<S3BucketDestination>
<Format>CSV</Format>
<Bucket>mybucketCRN</Bucket>
<Prefix>goodPrefix</Prefix>
</S3BucketDestination>
</Destination>
<Schedule>
<Frequency>Daily</Frequency>
</Schedule>
<IncludedObjectVersions>All</IncludedObjectVersions>
<OptionalFields>
<Field>Size</Field>
</OptionalFields>
</InventoryConfiguration>
<InventoryConfiguration>
<Id>goodinventoryid1</Id>
...
</InventoryConfiguration>
<IsTruncated>true</IsTruncated>
<NextContinuationToken>{continuation-token}</NextContinuationToken>
</ListInventoryConfigurationsResult>
配置 DELETE 存储区库存
向存储区发出了具有正确参数的 DeleteBucketInventoryConfiguration
。
语法
DELETE {bucket}?inventory&id={id}
示例请求
以下示例是针对存储区的 DeleteBucketInventoryConfiguration
请求。
DELETE mybucket?inventory&id=myid HTTP/1.1
示例响应
204 No Content
备份策略操作
IBM Cloud® Object Storage 备份策略 API 提供用于创建、管理备份策略并与之交互的操作。 备份策略定义了如何将数据桶中的数据备份到备份库。
有关权限和访问的更多信息,请参阅 备份策略权限。
创建备份策略
向 /buckets/{bucket}/backup_policies
端点发出 POST
请求后,就会为一个存储桶创建一个新的备份策略。
头 | 类型 | 必需? | 描述 |
---|---|---|---|
MD5 |
字符串 | 否 | MD5 内容的哈希值。 如果提供,请求的哈希值必须匹配。 |
路径参数 | 类型 | 必需? | 描述 |
---|---|---|---|
bucket_name |
字符串 | 是 | 应用备份策略的存储桶名称。 |
语法
POST https://{endpoint}/buckets/{bucket}/backup_policies
请求主体
{
"policy_name": "myBackupPolicy",
"initial_retention": {
"delete_after_days": 10
},
"backup_type": "continuous",
"target_backup_vault_crn": "crn:v1:bluemix:public:cloud-object-storage:global:a1229395:1a0ec336-f391-4091-a6fb-5e084a4c56f4:backup-vault:backup-vault-name"
}
示例请求
POST /buckets/myBucket/backup_policies HTTP/1.1
Authorization: Bearer {token}
Content-Type: application/json
Host: config.cloud-object-storage.cloud.ibm.com
{
"initial_retention": {
"delete_after_days": 10
},
"policy_name": "myBackupPolicy",
"target_backup_vault_crn": "crn:v1:bluemix:public:cloud-object-storage:global:2de9d5b5:12b951c9-d4e1-61a4-518c-3acc2034ba30:backup-vault:l4pi16n8rt--ufqb7.r-fw2ziy",
"backup_type": "continuous"
}
示例响应
{
"policy_name": "myBackupPolicy",
"initial_retention": {
"delete_after_days": 10
},
"backup_type": "continuous",
"policy_id": "44d3dd41-d616-4d25-911a-9ef7fbf28aef",
"policy_status": "pending",
"target_backup_vault_crn": "crn:v1:bluemix:public:cloud-object-storage:global:a1229395:1a0ec336-f391-4091-a6fb-5e084a4c56f4:backup-vault:backup-vault-name"
}
列出备份政策
向 /buckets/{bucket}/backup_policies
端点发送 GET
请求,可检索某个存储桶的所有备份策略。
路径参数 | 类型 | 必需? | 描述 |
---|---|---|---|
bucket_name |
字符串 | 是 | 要列出备份策略的存储桶名称。 |
语法
GET https://{endpoint}/buckets/{bucket}/backup_policies
示例请求
GET /buckets/myBucket/backup_policies HTTP/1.1
Authorization: Bearer {token}
Content-Type: application/json
Host: config.cloud-object-storage.cloud.ibm.com
示例响应
[
{
"policy_name": "myBackupPolicy",
"initial_retention": {
"delete_after_days": 10
},
"backup_type": "continuous",
"policy_id": "44d3dd41-d616-4d25-911a-9ef7fbf28aef",
"policy_status": "active",
"target_backup_vault_crn": "crn:v1:bluemix:public:cloud-object-storage:global:a1229395:8dfbcba4e6a740e3866020847e525436:backup-vault:backup-vault-name"
}
]
获取备份政策详情
GET
请求 /buckets/{bucket}/backup_policies/{policy_id}
端点可检索特定备份策略的详细信息。
路径参数 | 类型 | 必需? | 描述 |
---|---|---|---|
bucket_name |
字符串 | 是 | 存储区的名称。 |
policy_id |
字符串 | 是 | 备份策略的 ID。 |
语法
GET https://{endpoint}/buckets/{bucket}/backup_policies/{policy_id}
示例请求
GET /buckets/myBucket/backup_policies/44d3dd41-d616-4d25-911a-9ef7fbf28aef HTTP/1.1
Authorization: Bearer {token}
Content-Type: application/json
Host: config.cloud-object-storage.cloud.ibm.com
示例响应
{
"policy_name": "myBackupPolicy",
"backup_type": "continuous",
"policy_id": "44d3dd41-d616-4d25-911a-9ef7fbf28aef",
"policy_status": "active",
"target_backup_vault_crn": "crn:v1:bluemix:public:cloud-object-storage:global:a1229395:1a0ec336-f391-4091-a6fb-5e084a4c56f4:backup-vault:backup-vault-name",
"initial_retention": {
"delete_after_days": 10
}
}
删除备份策略
DELETE
请求 /buckets/{bucket}/backup_policies/{policy_id}
端点删除特定备份策略。
路径参数 | 类型 | 必需? | 描述 |
---|---|---|---|
bucket_name |
字符串 | 是 | 存储区的名称。 |
policy_id |
字符串 | 是 | 备份策略的 ID。 |
语法
DELETE https://{endpoint}/buckets/{bucket}/backup_policies/{policy_id}
示例请求
DELETE /buckets/myBucket/backup_policies/44d3dd41-d616-4d25-911a-9ef7fbf28aef HTTP/1.1
Authorization: Bearer {token}
Content-Type: application/json
Host: config.cloud-object-storage.cloud.ibm.com
示例响应
HTTP/1.1 204 No Content
有关备份策略操作的更多信息,请参阅 备份库管理。
后续步骤
有关更多信息,请参阅 对象操作。