OpenStack Swift安装配置相关整理(2)

Date: Tue, 02 Aug 2011 08:47:02 GMT

zzfancy@129:~$ curl -k -X HEAD -D - -H 'X-Auth-Token: AUTH_tkefdc936d7e94493982d78f3dd6c16ead' https://192.168.1.31:8080/v1/AUTH_d6084598cca04ee6a0951dbdd89612c6 HTTP/1.1 204 No Content X-Account-Object-Count: 8 X-Account-Bytes-Used: 15177385 X-Account-Container-Count: 2 Content-Length: 0 Date: Tue, 02 Aug 2011 08:47:02 GMT

列表用户的container和object,可加参数(本例中参数为format-xml,详情请查询API)

zzfancy@129:~$ curl -k -X GET -H 'X-Auth-Token: AUTH_tkefdc936d7e94493982d78f3dd6c16ead' https://192.168.1.31:8080/v1.0/AUTH_d6084598cca04ee6a0951dbdd89612c6/images

1Mb.file

test.jpg

test1.jpg

zzfancy@129:~$ curl -k -X GET -H 'X-Auth-Token: AUTH_tkefdc936d7e94493982d78f3dd6c16ead' https://192.168.1.31:8080/v1.0/AUTH_d6084598cca04ee6a0951dbdd89612c6/images?format=xml

<?xml version="1.0" encoding="UTF-8"?>

<container>

<object>

<name>1Mb.file</name>

<hash>b6d81b360a5672d80c27430f39153e2c</hash>

<bytes>1048576</bytes>

<content_type>application/octet-stream</content_type>

<last_modified>2011-06-20T07:57:34.523220</last_modified>

</object>

<object>

<name>test.jpg</name>

<hash>a9d7d0f2d01bf737027256b8e7e9bf6a</hash>

<bytes>87345</bytes>

<content_type>image/jpeg</content_type>

<last_modified>2011-06-17T03:32:21.838280</last_modified>

</object>

<object><name>test1.jpg</name>

<hash>a9d7d0f2d01bf737027256b8e7e9bf6a</hash>

<bytes>87345</bytes>

<content_type>image/jpeg</content_type>

<last_modified>2011-06-19T16:07:39.431260</last_modified>

</object>

</container>

zzfancy@129:~$ curl -k -X GET -H 'X-Auth-Token: AUTH_tkefdc936d7e94493982d78f3dd6c16ead' https://192.168.1.31:8080/v1.0/AUTH_d6084598cca04ee6a0951dbdd89612c6/images 1Mb.file test.jpg test1.jpg zzfancy@129:~$ curl -k -X GET -H 'X-Auth-Token: AUTH_tkefdc936d7e94493982d78f3dd6c16ead' https://192.168.1.31:8080/v1.0/AUTH_d6084598cca04ee6a0951dbdd89612c6/images?format=xml <?xml version="1.0" encoding="UTF-8"?> <container> <object> <name>1Mb.file</name> <hash>b6d81b360a5672d80c27430f39153e2c</hash> <bytes>1048576</bytes> <content_type>application/octet-stream</content_type> <last_modified>2011-06-20T07:57:34.523220</last_modified> </object> <object> <name>test.jpg</name> <hash>a9d7d0f2d01bf737027256b8e7e9bf6a</hash> <bytes>87345</bytes> <content_type>image/jpeg</content_type> <last_modified>2011-06-17T03:32:21.838280</last_modified> </object> <object><name>test1.jpg</name> <hash>a9d7d0f2d01bf737027256b8e7e9bf6a</hash> <bytes>87345</bytes> <content_type>image/jpeg</content_type> <last_modified>2011-06-19T16:07:39.431260</last_modified> </object> </container>

创建container并上传object

zzfancy@129:~$ curl -k -X PUT -T ./2Mb.jpeg -H 'Content-Type: image/jpeg' -H 'X-Auth-Token: AUTH_tkefdc936d7e94493982d78f3dd6c16ead' https://192.168.1.31:8080/v1.0/AUTH_d6084598cca04ee6a0951dbdd89612c6/images/2Mb.jpeg

<html>

<head>

<title>201 Created</title>

</head>

<body>

<h1>201 Created</h1>

<br /><br />

</body>

</html>

zzfancy@129:~$ curl -k -X PUT -T ./2Mb.jpeg -H 'Content-Type: image/jpeg' -H 'X-Auth-Token: AUTH_tkefdc936d7e94493982d78f3dd6c16ead' https://192.168.1.31:8080/v1.0/AUTH_d6084598cca04ee6a0951dbdd89612c6/images/2Mb.jpeg <html> <head> <title>201 Created</title> </head> <body> <h1>201 Created</h1> <br /><br /> </body> </html>

下载object

zzfancy@129:~$ curl -s -k -X GET -H 'X-Auth-Token: AUTH_tkefdc936d7e94493982d78f3dd6c16ead' https://192.168.1.31:8080/v1/AUTH_d6084598cca04ee6a0951dbdd89612c6/images/2Mb.jpeg -O .

zzfancy@129:~$ curl -s -k -X GET -H 'X-Auth-Token: AUTH_tkefdc936d7e94493982d78f3dd6c16ead' https://192.168.1.31:8080/v1/AUTH_d6084598cca04ee6a0951dbdd89612c6/images/2Mb.jpeg -O .

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://www.heiqu.com/b4da5a2d5b3836760f9a3cb91a4a1162.html