儲存區作業
IBM Cloud® Object Storage 的現代化功能可透過 RESTful API 便捷地取得。 這裡記載用來與儲存區 (儲存物件的位置) 互動的作業及方法。
如需許可權及存取權的相關資訊,請參閱 儲存區許可權。
Access/Secret 金鑰 (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 要求會建立儲存區。 如需端點的相關資訊,請參閱端點及儲存空間位置。 儲存區名稱必須是廣域唯一且符合 DNS 標準。 長度介於 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
建立具有不同儲存空間類別的儲存區
若要建立一個儲存類別不同的儲存桶,請將一個 XML 區塊(其中指定了儲存桶配置,且其 LocationConstraint 為 {provisioning code} )包含在 PUT 請求的主體中,並將該請求傳送至儲存桶端點。 如需端點的相關資訊,請參閱端點及儲存空間位置。
套用標準儲存區 命名規則。 此作業不使用作業特定的查詢參數。
| | 標頭 | 類型 | 說明 | |--------------------------|--------|--------------------------------------------------------------------------------------------------------------------- | 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 |
字串 | 指出第 2 版的 API,而且值必須為 2。 |
prefix |
字串 | 將回應限制為以 prefix 開頭的物件名稱。 |
delimiter |
字串 | 對 prefix 與 delimiter 之間的物件進行分組。 |
encoding-type |
字串 | 如果物件名稱中使用 XML 不支援的 Unicode 字元,則此參數可以設為 url,以適當地編碼回應。 |
max-keys |
字串 | 限制要在回應中顯示的物件數。 預設值及上限值為 1,000。 |
fetch-owner |
字串 | 依預設,第 2 版的 API 不包括 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 參數)
此要求會列出傳回的索引鍵上限設為 1 的 "apiary" 儲存區內的物件。
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 是為了與舊版相容。 如需擷取儲存區中物件的建議方法,請參閱第 2 版。
針對某個儲存桶發出的 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分鐘。 五分鐘後,該名稱將釋出供重新使用。 只能刪除空的儲存區。
如果刪除 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 |
整數 | 無 | DefaultRetention |
您要針對預設保留期間指定的天數。 它無法與 Years 結合。 |
Mode |
字串 | 無 | DefaultRetention |
COMPLIANCE 或 GOVERNANCE。 |
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,會擷取儲存區的任何已取消或不完整的多部分上傳的相關資訊。
語法
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) 配置的相關資訊。
語法
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 |
刪除 |
|
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
請求範例
下列範例會擷取 "apiary" 儲存區的位置。
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>
下列 Snippet 顯示達成該特定標頭的內容的一種方法。
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>
下列 Snippet 顯示達成該特定標頭的內容的一種方法。
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。
在現有儲存區上新增保留原則
只有特定地區才提供 Immutable Object Storage。如需詳細資料,請參閱整合式服務。 此服務亦需搭配「標準」定價方案。 如需詳細資料,請參閱定價。
在 文件 中進一步瞭解 Immutable 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 |
整數 |
|
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
配置靜態網站管理的儲存區
針對儲存桶發出並附有正確參數的《 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 |
|
要求範例
下列範例新增網站配置,以提供在每一個字首中尋找 index.html 檔案的基本網站。 例如,對 /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
刪除儲存區的任何網站配置
對具有適當參數的儲存區發出的 DELETE 要求會移除儲存區的網站配置。
語法
DELETE https://{endpoint}/{bucket-name}?website # path style
DELETE https://{bucket-name}.{endpoint}?website # virtual host style
請求範例
下列範例會刪除儲存區的網站配置。
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 提供用於建立、管理及與備份政策互動的操作功能。 備份政策定義儲存桶中的資料如何備份到備份儲存庫。
如需權限和存取的詳細資訊,請參閱 備份原則權限。
建立備份原則
POST 向 /buckets/{bucket}/backup_policies 端點提出的請求會為儲存桶建立新的備份原則。
| 標頭 | 類型 | 必要? | 說明 |
|---|---|---|---|
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
如需更多關於備份原則操作的資訊,請參閱備份 保管庫管理。
後續步驟
如需相關資訊,請參閱 物件作業。