Description
オブジェクトをアップロードします。
Request URL
ObjectStorage API v1 PUT /v1/ze_{account}/{container}/ {object} |
Request Json
This operation does not accept a request body. |
Request Paramters
Parameter | Value | Style | Description |
---|---|---|---|
X-Auth-Token | Userトークン | header | トークンID |
account | テナントID | URI | テナントID |
container | コンテナ名 | URI | コンテナ名 |
object | オブジェクト名 | URI | オブジェクト名 |
Response
Normal response codes
201 |
Example
Request
curl -i -X PUT \ -H “Accept: application/json” \ -H “Content-Type: application/json” \ -H “X-Auth-Token: トークンID” \ https://object-storage.odc01.eva-clouds.com/v1/ze_テナントID/コンテナ名/ \-T オブジェクト名 |
Response
HTTP/1.1 201 Created Last-Modified: Mon, 22 Aug 2016 07:58:03 GMT Content-Length: 0 Etag: c813cd88fc19e6b5d9b0a079871560cc Content-Type: text/html; charset=UTF-8 X-Trans-Id: txb6eae321003442c6bfd5e-0057bab08a Date: Mon, 22 Aug 2016 07:58:18 GMT |
Description
オブジェクトをダウンロードします。
curlコマンドで実行する場合は -O オプションを利用することで保存が可能です。
Request URL
ObjectStorage API v1 GET /v1/ze_{account}/{container}/{object} |
Request Json
This operation does not accept a request body. |
Request Paramters
Parameter | Value | Style | Description |
---|---|---|---|
X-Auth-Token | Userトークン | header | トークンID |
account | テナントID | URI | テナントID |
container | コンテナ名 | URI | コンテナ名 |
object | オブジェクト名 | URI | オブジェクト名 |
Response
Normal response codes
200 |
Example
Request
curl -X GET \ -H “Accept: application/json” \ -H “Content-Type: application/json” \ -H “X-Auth-Token: トークンID” \ https://object-storage.odc01.eva-clouds.com/v1/ze_テナントID/コンテナ名/オブジェクト名 -O |
Response
% Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 102M 100 102M 0 0 10.9M 0 0:00:09 0:00:09 –:–:– 11.2M |
Description
コンテナを削除します。
コンテナ内のオブジェクトがすべて削除されている必要があります。
Request URL
ObjectStorage API v1 DELETE /v1/ze_{account}/{container} |
Request Json
This operation does not accept a request body. |
Request Paramters
Parameter | Value | Style | Description |
---|---|---|---|
X-Auth-Token | Userトークン | header | トークンID |
account | テナントID | URI | テナントID |
container | コンテナ名 | URI | コンテナ名 |
Response
Normal response codes
204 |
Example
Request
curl -i -X DELETE \ -H “Accept: application/json” \ -H “X-Auth-Token: トークンID” \ https://object-storage.odc01.eva-clouds.com/v1/ze_テナントID/コンテナ名 |
Response
HTTP/1.1 204 No Content Content-Length: 0 Content-Type: text/html; charset=UTF-8 X-Trans-Id: tx301b2538fabe494dba632-0057b6ceb8 Date: Fri, 19 Aug 2016 09:17:45 GMT |
Description
オブジェクト情報を取得します。
Request URL
ObjectStorage API v1 GET /v1/ze_{account}/{container}/{object} |
Request Json
This operation does not accept a request body. |
Request Paramters
Parameter | Value | Style | Description |
---|---|---|---|
X-Auth-Token | Userトークン | header | トークンID |
X-Newest(Optional) | boolean | header | |
Accept(Optional) | string | header | |
account | テナントID | URI | テナントID |
container | コンテナ名 | URI | コンテナ名 |
object | オブジェクト名 | URI | オブジェクト名 |
signature(Optional) | string | query | |
expires(Optional) | string | query | |
multipart-manifest(Optional) | string | query | |
Range(Optional) | string | header | |
If-Match(Optional) | string | header | |
If-Modified-Since(Optional) | date | header | |
If-Unmodified-Since(Optional) | date | header |
Response
Normal response codes
200 |
Example
Request
curl -i -X GET \ -H “Accept: application/json” \ -H “Content-Type: application/json” \ -H “X-Auth-Token: トークンID” \ https://object-storage.odc01.eva-clouds.com/v1/ze_テナントID/コンテナ名/オブジェクト名 |
Response
HTTP/1.1 200 OK Content-Length: 20 Accept-Ranges: bytes Last-Modified: Tue, 30 Aug 2016 06:59:30 GMT Etag: 3de8f8b0dc94b8c2230fab9ec0ba0506 X-Timestamp: 1472540369.31743 Content-Type: application/json X-Trans-Id: txee9be737701b49f28f403-0057c52ee1 Date: Tue, 30 Aug 2016 06:59:45 GMT This is a test file. |
Description
コンテナ一覧を取得します。
ヘッダーからアカウント情報を参照することができます。
Request URL
ObjectStorage API v1 GET /v1/ze_{account} |
Request Json
This operation does not accept a request body. |
Request Paramters
Parameter | Value | Style | Description |
---|---|---|---|
X-Auth-Token | Userトークン | header | トークンID |
X-Newest(Optional) | boolean | header | |
Accept (Optional) | string | header | |
account | テナントID | URI | テナントID |
limit(Optional) | int | query | |
marker(Optional) | string | query | |
end_maker(Optional) | string | query | |
format(Optional) | string | query | |
prefix(Optional) | string | query | |
delimiter(Optional) | char | query |
Response
Normal response codes
200 |
Example
Request
curl -i -X GET \ -H “Accept: application/json” \ -H “Content-Type: application/json” \ -H “X-Auth-Token: トークンID” \ https://object-storage.odc01.eva-clouds.com/v1/ze_テナントID |
Response
HTTP/1.1 200 OK Content-Length: 157 X-Account-Object-Count: 2 X-Account-Storage-Policy-Policy-0-Bytes-Used: 80831520 X-Account-Storage-Policy-Policy-0-Container-Count: 3 X-Timestamp: 1467082679.70992 X-Account-Storage-Policy-Policy-0-Object-Count: 2 X-Account-Bytes-Used: 80831520 X-Account-Container-Count: 3 Content-Type: application/json; charset=utf-8 Accept-Ranges: bytes X-Trans-Id: tx24378a39f50f429995f0d-0057b6be81 Date: Fri, 19 Aug 2016 08:08:33 GMT [ |
Description
任意のコンテナにあるオブジェクトをWeb公開したい場合に使用します。 ACLsにてRead権限をすべて許可する設定となります。
※StaticWeb機能とは異なります。
Request URL
ObjectStorage API v1 POST /v1/ze_{account}/{container} |
Request Json
This operation does not accept a request body. |
Request Paramters
Parameter | Value | Style | Description |
---|---|---|---|
X-Auth-Token | Userトークン | header | トークンID |
account | テナントID | URI | テナントID |
container | コンテナ名 | URI | コンテナ名 |
X-Container-Read(Optional) | string | header | |
X-Remove-Container-Read(Optional) | string | header |
Response
Normal response codes
202 |
Example
Request
curl -i -X POST \ -H “Accept: application/json” \ -H “Content-Type: application/json” \ -H “X-Auth-Token: トークンID” \ -H “X-Container-Read: .r:*” \ https://object-storage.odc01.eva-clouds.com/v1/ze_テナントID/コンテナ名 |
Response
HTTP/1.1 202 Accepted Content-Length: 76 Content-Type: text/html; charset=UTF-8 X-Trans-Id: tx05fdba96a9624a89843d3-0057bcfae4 Date: Wed, 24 Aug 2016 01:39:52 GMT <html><h1>Accepted</h1><p>The request is accepted for processing.</p></html> |
Description
一時的にオブジェクトを公開する場合に使用します。 Temp-Url-Keyを登録後に下記方法等にてURLを作成する必要があります。
・URL作成スクリプトを作成する
・Swift-temp-urlクライアントを使用する
Request URL
ObjectStorage API v1 POST /v1/ze_{account} |
Request Json
This operation does not accept a request body. |
Request Paramters
Parameter | Value | Style | Description |
---|---|---|---|
X-Auth-Token | Userトークン | header | トークンID |
account | テナントID | URI | テナントID |
container | コンテナ名 | URI | コンテナ名 |
X-Account-Meta-Temp-URL-Key(Optional) | string | header | tempurl用のKey |
X-Remove-Account-Meta-Temp-URL-Key(Optional) | string | header |
Response
Normal response codes
204 |
Example
Request
curl -i -X POST \ -H “Accept: application/json” \ -H “Content-Type: application/json” \ -H “X-Auth-Token: トークンID” \ -H ‘X-Account-Meta-Temp-URL-Key: tempurl用のKey‘ \ https://object-storage.odc01.eva-clouds.com/v1/ze_テナントID |
Response
HTTP/1.1 204 No Content Content-Length: 0 Content-Type: text/html; charset=UTF-8 X-Trans-Id: txb384cc23284e479cb4fb4-0057bc1694 Date: Tue, 23 Aug 2016 09:25:40 GMT |
Using
1.コンテナを作成しオブジェクトをアップロード
2.tempurl用のKeyを登録
curl -i -X POST \ -H “Accept: application/json” \ -H “Content-Type: application/json” \ -H “X-Auth-Token: トークンID” \ -H ‘X-Account-Meta-Temp-URL-Key: tempurl用のKey‘ \ https://object-storage.odc01.eva-clouds.com/v1/ze_テナントID |
3.tempurl生成するため、下記モジュールを作成
※ここでは24時間で生成、またモジュール名はcreate-tempurl.pyとします。
# vim create-tempurl.py import hmac from hashlib import sha1 from time import time method = ‘GET’ duration_in_seconds = 60*60*24 expires = int(time() + duration_in_seconds) path = ‘/v1/ze_テナントID/コンテナ名/オブジェクト名‘ key = ‘tempurl用のKey‘ hmac_body = ‘%s\n%s\n%s’ % (method, expires, path) sig = hmac.new(key, hmac_body, sha1).hexdigest() s = ‘https://{host}{path}?temp_url_sig={sig}&temp_url_expires={expires}’ url = s.format(host=’object-storage.odc01.eva-clouds.com’, path=path, sig=sig, expires=expires) print ‘%s’ % url |
4.モジュールを実行
/usr/bin/python create-tempurl.py |
Description
任意のオブジェクトを指定時間または指定時間後に自動的に削除したい場合に使用します。 ※オブジェクトは事前にアップロードしておく必要があります。
日時指定の場合エポックフォーマットにて指定する必要があります。 エポックフォーマットについては下記コマンド等にて変換ください。
(Linuxの場合)
▼エポックフォーマットに変換
date +%s -d “2016/8/23 17:40:00” |
▼ローカル時刻に変換
date -d @1471941600 |
Request URL
ObjectStorage API v1 POST /v1/ze_{account}/{container}/{object} |
Request Json
This operation does not accept a request body. |
Request Paramters
Parameter | Value | Style | Description |
---|---|---|---|
X-Auth-Token | Userトークン | header | トークンID |
account | テナントID | URI | テナントID |
container | コンテナ名 | URI | コンテナ名 |
object | オブジェクト名 | URI | オブジェクト名 |
X-Delete-After(Optional) | int | header | 指定した時間後に削除(秒) |
X-Delete-At(Optional) | int | header | 日時指定削除(エポックフォーマット) |
Response
Normal response codes
202 |
Example
Request
・X-Delete-After
curl -i -X POST \ -H “Accept: application/json” \ -H “Content-Type: application/json” \ -H “X-Auth-Token: トークンID” \ -H “X-Delete-After: 指定時間(秒)” \ https://object-storage.odc01.eva-clouds.com/v1/ze_テナントID/コンテナ名 |
・X-Delete-At
curl -i -X POST \ -H “Accept: application/json” \ -H “Content-Type: application/json” \ -H “X-Auth-Token: トークンID” \ -H “X-Delete-At: 日時指定(エポックフォーマット)” \ https://object-storage.odc01.eva-clouds.com/v1/ze_テナントID/コンテナ名 |
Response
・X-Delete-After
HTTP/1.1 202 Accepted Content-Length: 76 Content-Type: text/html; charset=UTF-8 X-Trans-Id: txeca9ec7eacd541059a949-0057bc0f27Date: Tue, 23 Aug 2016 08:54:05 GMT <html><h1>Accepted</h1><p>The request is accepted for processing.</p></html> |
・X-Delete-At
HTTP/1.1 202 Accepted Content-Length: 76 Content-Type: text/html; charset=UTF-8 X-Trans-Id: tx6dc4c69232c442e987e84-0057bc0f38 Date: Tue, 23 Aug 2016 08:54:21 GMT <html><h1>Accepted</h1><p>The request is accepted for processing.</p></html> |
Description
オブジェクトのバージョン管理を実施する場合に使用します。 バージョニング対象のコンテナに同名のファイルをアップロードした際に、 自動的に古いオブジェクトがバージョニング先のコンテナにtimestamp付で保存されます。
最新のオブジェクトを削除した場合、一世代古いファイルがバージョニング対象のコンテナに復元されます。
Request URL
ObjectStorage API v1 PUT /v1/ze_{account}/{container} |
Request Json
This operation does not accept a request body. |
Request Paramters
Parameter | Value | Style | Description |
---|---|---|---|
X-Auth-Token | Userトークン | header | トークンID |
account | テナントID | URI | テナントID |
container | コンテナ名 | URI | コンテナ名 |
X-Versions-Location(Optional) | string | header | 古いオブジェクト保存用コンテナを指定 |
X-Remove-Versions-Location(Optional) | string | header | 空以外の値を指定し、オブジェクトバージョニングを無効化します |
Response
Normal response codes
202 |
Example
Request
curl -i -X PUT \ -H “Accept: application/json” \ -H “Content-Type: application/json” \ -H “X-Auth-Token: トークンID” \ -H “X-Versions-Location: 古いオブジェクト保存用コンテナ” \ https://object-storage.odc01.eva-clouds.com/v1/ze_テナントID/バージョニング対象コンテナ名 |
Response
HTTP/1.1 202 Accepted Content-Length: 76 Content-Type: text/html; charset=UTF-8 X-Trans-Id: txab996c8ef0bd465cabd7d-0057bbfee5 Date: Tue, 23 Aug 2016 07:44:38 GMT <html><h1>Accepted</h1><p>The request is accepted for processing.</p></html> |
Description
5GBより大きいファイルをアップロードする際に使用します。
オブジェクトを5GB未満のファイルサイズに分割してアップロードし、仮想的なひとつのオブジェクトとしてダウンロード可能とします。
DLO(Dynamic Large Object)と比べ完全性、信頼性が向上します。
Request URL
ObjectStorage API v1 PUT /v1/ze_{account}/{container}/{object} |
Request Json
This operation does not accept a request body. |
Request Paramters
Parameter | Valu | Style | Description |
---|---|---|---|
X-Auth-Token | Userトークン | header | トークンID |
account | テナントID | URI | テナントID |
container | コンテナ名 | URI | コンテナ名 |
object | オブジェクト名 | URI | オブジェクト名 |
Response
Normal response codes
201 |
Example
Request
curl -i -X PUT \ -H “Accept: application/json” \ -H “Content-Type: application/json” \ -H “X-Auth-Token: トークンID” \ -d ‘[{“path” : “セグメントファイル用のコンテナ名/セグメントファイル名_aa”, “etag”: “MD5のハッシュ値“, “size_bytes”: セグメントファイルサイズ}, {“path” : “セグメントファイル用のコンテナ名/セグメントファイル名_ab”, “etag”: “MD5のハッシュ値“, “size_bytes”: セグメントファイルサイズ}, {“path” : “セグメントファイル用のコンテナ名/セグメントファイル名_ac”, “etag”: “MD5のハッシュ値“, “size_bytes”: セグメントファイルサイズ}, {“path” : “セグメントファイル用のコンテナ名/セグメントファイル名_ad”, “etag”: “MD5のハッシュ値“, “size_bytes”: セグメントファイルサイズ}, {“path” : “セグメントファイル用のコンテナ名/セグメントファイル名_ae”, “etag”: “MD5のハッシュ値“, “size_bytes”: セグメントファイルサイズ}, {“path” : “セグメントファイル用のコンテナ名/セグメントファイル名_af”, “etag”: “MD5のハッシュ値“, “size_bytes”: セグメントファイルサイズ]’ \ https://object-storage.odc01.eva-clouds.com/v1/ze_テナントID/manifestファイル用のコンテナ名/manifestファイル名?multipart-manifest=put |
Response
HTTP/1.1 201 Created Last-Modified: Tue, 23 Aug 2016 06:42:14 GMT Content-Length: 0 Etag: 6ca7bdf80fae05caa4bae626b2e207d8 Content-Type: text/html; charset=UTF-8 X-Trans-Id: tx3ef27a06bb1249b9a9263-0057bbf045 Date: Tue, 23 Aug 2016 06:42:13 GMT |
Using
1.ファイルを分割します。
※以下では1G単位で分割します。またファイル名を「largefile」とします。
split -b 1G largefile largefile_ |
2.manifestファイル用のコンテナを作成します。
※以下ではコンテナ名を「slo_container」とします。
curl -i -X PUT \ -H “Accept: application/json” \ -H “Content-Type: application/json” \ -H “X-Auth-Token: トークンID” \ https://object-storage.odc01.eva-clouds.com/v1/ze_テナントID/slo_container |
3.セグメントファイル用のコンテナを作成します。
※以下ではセグメントファイル用のコンテナ名を「slo_container_segment」とします。
curl -i -X PUT \ -H “Accept: application/json” \ -H “Content-Type: application/json” \ -H “X-Auth-Token: トークンID” \ https://object-storage.odc01.eva-clouds.com/v1/ze_テナントID/slo_container_segment |
4.セグメントファイルをアップロードします。
curl -i -X PUT -H “X-Auth-Token: トークンID” https://object-storage.odc01.eva-clouds.com/v1/ze_テナントID/slo_container_segment/ -T largefile_aa curl -i -X PUT -H “X-Auth-Token: トークンID” https://object-storage.odc01.eva-clouds.com/v1/ze_テナントID/slo_container_segment/ -T largefile_ab curl -i -X PUT -H “X-Auth-Token: トークンID” https://object-storage.odc01.eva-clouds.com/v1/ze_テナントID/slo_container_segment/ -T largefile_ac curl -i -X PUT -H “X-Auth-Token: トークンID” https://object-storage.odc01.eva-clouds.com/v1/ze_テナントID/slo_container_segment/ -T largefile_ad curl -i -X PUT -H “X-Auth-Token: トークンID” https://object-storage.odc01.eva-clouds.com/v1/ze_テナントID/slo_container_segment/ -T largefile_ae curl -i -X PUT -H “X-Auth-Token: トークンID” https://object-storage.odc01.eva-clouds.com/v1/ze_テナントID/slo_container_segment/ -T largefile_af |
5.各セグメントファイルのMD5のハッシュ値を確認
md5sum largefile_a* MD5のハッシュ値 *largefile_aa MD5のハッシュ値 *largefile_ab MD5のハッシュ値 *largefile_ac MD5のハッシュ値 *largefile_ad MD5のハッシュ値 *largefile_ae MD5のハッシュ値 *largefile_af |
6.各セグメントファイルのファイルサイズを確認
ls -l |
7.manifestファイルを作成します。
※ここではmanifestファイル名を「manifestfile」とします。
curl -i -X PUT \ -H “Accept: application/json” \ -H “Content-Type: application/json” \ -H “X-Auth-Token: トークンID” \ -d ‘[{“path” : “slo_container_segments/segment_6000M_file_aa”, “etag”: “MD5のハッシュ値“, “size_bytes”: セグメントファイルサイズ}, {“path” : “slo_container_segment/largefile_ab”, “etag”: “MD5のハッシュ値“, “size_bytes”: セグメントファイルサイズ}, {“path” : “slo_container_segment/largefile_ac”, “etag”: “MD5のハッシュ値“, “size_bytes”: セグメントファイルサイズ}, {“path” : “slo_container_segment/largefile_ad”, “etag”: “MD5のハッシュ値“, “size_bytes”: セグメントファイルサイズ}, {“path” : “slo_container_segment/largefile_ae”, “etag”: “MD5のハッシュ値“, “size_bytes”: セグメントファイルサイズ}, {“path” : “slo_container_segment/largefile_af”, “etag”: “MD5のハッシュ値“, “size_bytes”: セグメントファイルサイズ}]’ \ https://object-storage.odc01.eva-clouds.com/v1/ze_テナントID/slo_container/manifestfile?multipart-manifest=put |