存储区操作
IBM Cloud® Object Storage 的现代功能可通过便捷的RESTful API轻松获取。 此处记录了用于与存储区 (存储对象的位置) 进行交互的操作和方法。
有关许可权和访问权的更多信息,请参阅 存储区许可权。
有关访问/密钥 (HMAC) 认证的说明
通过 使用 HMAC 凭证 向 IBM Cloud® Object Storage 实例进行认证时,您需要在 构造 HMAC 签名 时 1 表中表示的信息。
| 键 | 值 | 示例 |
|---|---|---|
| {access_key} | 分配给您的服务凭据的访问密钥 | cf4965cebe074720a4929759f57e1214 |
| {date} | 请求的格式化日期 (yyyymmdd) |
20180613 |
| {region} | 端点的位置码 | us-standard |
| {signature} | 使用密钥,位置和日期创建的散列 | ffe2b6e18f9dcc41f593f4dbb39882a6bb4d26a73a04326e62a8d344e07c1a3e |
| {timestamp} | 请求的格式化日期和时间 | 20180614T001804Z |
列出存储区
发送到端点 root 的 GET 请求将返回与指定服务实例关联的存储桶列表。 有关端点的更多信息,请参阅端点和存储位置。
| 头 | 类型 | 必需? | 描述 |
|---|---|---|---|
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- 开头的存储区,因为这些是系统保留的前缀。
| 头 | 类型 | 必需? | 描述 |
|---|---|---|---|
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 块,该块指定了存储桶配置,其中 LocationConstraint 的值为 {provisioning code}。 有关端点的更多信息,请参阅端点和存储位置。
标准存储区 命名规则 适用。 此操作不使用特定于操作的查询参数。
| | 头 | 类型 | 描述 | |--------------------------|--------|--------------------------------------------------------------------------------------------------------------------- | 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的更多信息,请参阅 文档。
跨区域存储桶的托管加密必须使用来自最近 高可用性区域 (us-south 或 jp-tok)中 Key Protect 实例的根密钥。
| 头 | 类型 | 描述 |
|---|---|---|
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。
语法
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个,且按非字典顺序返回。 响应中返回的 StorageClass 值是一个默认值,因为 Object Storage 中未实现存储类操作。 此操作不使用特定于操作的头或有效内容元素。
语法
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>
<ChecksumAlgorithm>CRC64NVME</ChecksumAlgorithm>
<ChecksumType>FULL_OBJECT</ChecksumType>
<Size>4</Size>
<StorageClass>STANDARD</StorageClass>
</Contents>
<Contents>
<Key>soldier-bee</Key>
<LastModified>2016-08-25T17:49:06.006Z</LastModified>
<ETag>"37d4c94839ee181a2224d6242176c4b5"</ETag>
<ChecksumAlgorithm>CRC64NVME</ChecksumAlgorithm>
<ChecksumType>FULL_OBJECT</ChecksumType>
<Size>11</Size>
<StorageClass>STANDARD</StorageClass>
</Contents>
<Contents>
<Key>worker-bee</Key>
<LastModified>2016-08-25T17:46:53.288Z</LastModified>
<ETag>"d34d8aada2996fc42e6948b926513907"</ETag>
<ChecksumAlgorithm>CRC64NVME</ChecksumAlgorithm>
<ChecksumType>FULL_OBJECT</ChecksumType>
<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}
示例请求(max-keys 参数)
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>
<ChecksumAlgorithm>CRC64NVME</ChecksumAlgorithm>
<ChecksumType>FULL_OBJECT</ChecksumType>
<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>
<ChecksumAlgorithm>CRC64NVME</ChecksumAlgorithm>
<ChecksumType>FULL_OBJECT</ChecksumType>
<Size>11</Size>
<StorageClass>STANDARD</StorageClass>
</Contents>
</ListBucketResult>
列出特定存储桶中的对象(已弃用)
包含此 API 是为了与较早版本兼容。 有关在存储区中检索对象的建议方法,请参阅 V2。
针对某个存储桶发起的 GET 请求将返回一个对象列表,每次返回的对象数量上限为1,000个,且按非字典顺序返回。 响应中返回的 StorageClass 值是一个默认值,因为 Object Storage 中未实现存储类操作。 此操作不使用特定于操作的头或有效内容元素。
语法
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>
<ChecksumAlgorithm>CRC64NVME</ChecksumAlgorithm>
<ChecksumType>FULL_OBJECT</ChecksumType>
<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>
<ChecksumAlgorithm>CRC64NVME</ChecksumAlgorithm>
<ChecksumType>FULL_OBJECT</ChecksumType>
<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>
<ChecksumAlgorithm>CRC64NVME</ChecksumAlgorithm>
<ChecksumType>FULL_OBJECT</ChecksumType>
<Size>467</Size>
<Owner>
<ID>{account-id}</ID>
<DisplayName>{account-id}</DisplayName>
</Owner>
<StorageClass>STANDARD</StorageClass>
</Contents>
</ListBucketResult>
删除存储区
向空存储桶发送的 DELETE 请求会删除该存储桶。 删除后,系统会将存储桶名称保留5分钟。 5分钟后,该名称将被释放以供再次使用。 只能删除空存储区。
如果删除 Object Storage 服务实例,那么系统将保留该实例中的所有存储区名称 7 天。 在 7 天后,将发布这些名称以供重新使用。
语法
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>
在现有存储区上配置对象锁定
使用 ?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 哈希编码,该哈希值用作完整性校验,以确保有效载荷在传输过程中未被篡改。 |
x-amz-checksum-crc32 |
字符串 | 该标头是对象的 Base64 编码、32 位 CRC32 校验和。 |
x-amz-checksum-crc32c |
字符串 | 该标头是对象的 Base64 编码、32 位 CRC32C 校验和。 |
x-amz-checksum-crc64nvme |
字符串 | 该标头是对象的 Base64 编码、64 位 CRC64NVME 校验和。 CRC64NVME 校验和始终是全对象校验和。 |
x-amz-checksum-sha1 |
字符串 | 该标头是对象的 Base64 编码、160 位 SHA1 摘要。 |
x-amz-checksum-sha256 |
字符串 | 该标头是对象的 Base64 编码、256 位 SHA256 摘要。 |
x-amz-sdk-checksum-algorithm |
字符串 | 表示使用 SDK 为对象创建校验和时使用的算法。 |
需要 Content-MD5 标头或 checksum 标头(包括 x-amz-checksum-crc32, x-amz-checksum-crc32c, x-amz-checksum-crc64nvme, x-amz-checksum-sha1 或 x-amz-checksum-sha256 )作为有效载荷的完整性检查。
请求主体必须包含具有以下模式的 XML 块:
| 元素 | 类型 | 子代 | 祖代 | 约束 |
|---|---|---|---|---|
ObjectLockConfiguration |
容器 | ObjectLockEnabled, Rule |
无 | 限制为 1。 |
ObjectLockEnabled |
字符串 | 无 | ObjectLockConfiguration |
唯一的有效值是 ENABLED。 |
Rule |
容器 | DefaultRetention |
ObjectLockConfiguration |
限制 1 |
DefaultRetention |
容器 | Days, Mode, Years |
Rule |
限制为 1。 |
Days |
Integer | 无 | DefaultRetention |
要为缺省保留期指定的天数。 它无法与 Years 组合。 |
Mode |
字符串 | 无 | DefaultRetention |
COMPLIANCE 或 GOVERNANCE。 |
Years |
Integer | 无 | 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 请求将检索有关存储区任何已取消或未完成的分块上传的信息。
语法
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 |
Integer | 限制要在响应中显示的对象数。 缺省值和最大值为 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) 的信息。
语法
GET https://{endpoint}/{bucket-name}?cors= # path style
GET https://{bucket-name}.{endpoint}?cors= # virtual host style
请求示例
以下示例列出了“apiary”存储桶上的 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) 配置。
语法
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 对有效载荷生成了 128 位 MD5 哈希值,该哈希值用作完整性校验,以确保有效载荷在传输过程中未被篡改。 |
x-amz-checksum-crc32 |
字符串 | 该标头是对象的 Base64 编码、32 位 CRC32 校验和。 |
x-amz-checksum-crc32c |
字符串 | 该标头是对象的 Base64 编码、32 位 CRC32C 校验和。 |
x-amz-checksum-crc64nvme |
字符串 | 该标头是对象的 Base64 编码、64 位 CRC64NVME 校验和。 CRC64NVME 校验和始终是全对象校验和。 |
x-amz-checksum-sha1 |
字符串 | 该标头是对象的 Base64 编码、160 位 SHA1 摘要。 |
x-amz-checksum-sha256 |
字符串 | 该标头是对象的 Base64 编码、256 位 SHA256 摘要。 |
x-amz-sdk-checksum-algorithm |
字符串 | 表示使用 SDK 为对象创建校验和时使用的算法。 |
需要 Content-MD5 标头或 checksum 标头(包括 x-amz-checksum-crc32, x-amz-checksum-crc32c, x-amz-checksum-crc64nvme, x-amz-checksum-sha1 或 x-amz-checksum-sha256 )作为有效载荷的完整性检查。
下面的代码段展示了实现 Content-MD5 标头内容的一种方法,它是 base64-encoded 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) 配置。
语法
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 请求将检索存储区的位置信息。
语法
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 标头或 checksum 标头(包括 x-amz-checksum-crc32, x-amz-checksum-crc32c, x-amz-checksum-crc64nvme, x-amz-checksum-sha1 或 x-amz-checksum-sha256 )作为有效载荷的完整性检查。
下面的代码段展示了实现 Content-MD5 标头内容的一种方法,它是 base64-encoded MD5 哈希值的二进制表示。
语法
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 的值。 |
| 头 | 类型 | 描述 |
|---|---|---|
Content-MD5 |
字符串 | base64 对有效载荷生成了 128 位 MD5 哈希值,该哈希值用作完整性校验,以确保有效载荷在传输过程中未被篡改。 |
x-amz-checksum-crc32 |
字符串 | 该标头是对象的 Base64 编码、32 位 CRC32 校验和。 |
x-amz-checksum-crc32c |
字符串 | 该标头是对象的 Base64 编码、32 位 CRC32C 校验和。 |
x-amz-checksum-crc64nvme |
字符串 | 该标头是对象的 Base64 编码、64 位 CRC64NVME 校验和。 CRC64NVME 校验和始终是全对象校验和。 |
x-amz-checksum-sha1 |
字符串 | 该标头是对象的 Base64 编码、160 位 SHA1 摘要。 |
x-amz-checksum-sha256 |
字符串 | 该标头是对象的 Base64 编码、256 位 SHA256 摘要。 |
x-amz-sdk-checksum-algorithm |
字符串 | 表示使用 SDK 为对象创建校验和时使用的算法。 |
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>
以下片段显示了实现该特定头的内容的一种方法。
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>
以下片段显示了实现该特定头的内容的一种方法。
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。
| 头 | 类型 | 描述 |
|---|---|---|
Content-MD5 |
字符串 | Base64 对有效载荷进行了 128 位 MD5 哈希编码,该哈希值用作完整性校验,以确保有效载荷在传输过程中未被篡改。 |
x-amz-checksum-crc32 |
字符串 | 该标头是对象的 Base64 编码、32 位 CRC32 校验和。 |
x-amz-checksum-crc32c |
字符串 | 该标头是对象的 Base64 编码、32 位 CRC32C 校验和。 |
x-amz-checksum-crc64nvme |
字符串 | 该标头是对象的 Base64 编码、64 位 CRC64NVME 校验和。 CRC64NVME 校验和始终是全对象校验和。 |
x-amz-checksum-sha1 |
字符串 | 该标头是对象的 Base64 编码、160 位 SHA1 摘要。 |
x-amz-checksum-sha256 |
字符串 | 该标头是对象的 Base64 编码、256 位 SHA256 摘要。 |
x-amz-sdk-checksum-algorithm |
字符串 | 表示使用 SDK 为对象创建校验和时使用的算法。 |
需要 Content-MD5 标头或 checksum 标头(包括 x-amz-checksum-crc32, x-amz-checksum-crc32c, x-amz-checksum-crc64nvme, x-amz-checksum-sha1 或 x-amz-checksum-sha256 )作为有效载荷的完整性检查。
下面的代码段展示了实现 Content-MD5 标头内容的一种方法,它是 base64-encoded 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 标头或 checksum 标头(包括 x-amz-checksum-crc32, x-amz-checksum-crc32c, x-amz-checksum-crc64nvme, x-amz-checksum-sha1 或 x-amz-checksum-sha256 )需要作为有效载荷的完整性检查。 下面的代码段展示了实现 Content-MD5 标头内容的一种方法,它是 base64-encoded MD5 哈希值的二进制表示。
在保留期结束之前实施策略,并且在保留期到期之前无法变更策略。 虽然 IBM Cloud® Object Storage 使用 S3 API执行大部分操作,但用于配置保留策略的API与 S3 API并不相同,尽管两者可能共享部分术语。 请仔细阅读本文档,以防止贵组织中的任何用户创建无法删除的对象,即便是 IBM Cloud 管理员也无法删除。
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 |
Integer |
|
MinimumRetention, MaximumRetention, DefaultRetention |
有效保留时间整数 |
| 头 | 类型 | 描述 |
|---|---|---|
Content-MD5 |
字符串 | base64 对有效载荷生成了 128 位 MD5 哈希值,该哈希值用作完整性校验,以确保有效载荷在传输过程中未被篡改。 |
x-amz-checksum-crc32 |
字符串 | 该标头是对象的 Base64 编码、32 位 CRC32 校验和。 |
x-amz-checksum-crc32c |
字符串 | 该标头是对象的 Base64 编码、32 位 CRC32C 校验和。 |
x-amz-checksum-crc64nvme |
字符串 | 该标头是对象的 Base64 编码、64 位 CRC64NVME 校验和。 CRC64NVME 校验和始终是全对象校验和。 |
x-amz-checksum-sha1 |
字符串 | 该标头是对象的 Base64 编码、160 位 SHA1 摘要。 |
x-amz-checksum-sha256 |
字符串 | 该标头是对象的 Base64 编码、256 位 SHA256 摘要。 |
x-amz-sdk-checksum-algorithm |
字符串 | 表示使用 SDK 为对象创建校验和时使用的算法。 |
请求示例
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 请求,将创建或替换该存储桶的静态网站配置。
语法
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 站点配置。
语法
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 公共访问策略。
语法
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 块。
语法
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进行响应。
备份策略操作
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
有关备份策略操作的更多信息,请参阅 备份库管理。
后续步骤
有关更多信息,请参阅 对象操作。