[英]How to list objects and (virtual directorys) using the REST API for OpenStack Object Store(Swift)
we use the REST API for OpenStack Object Store(Swift). 我们将REST API用于OpenStack对象存储(Swift)。 guessing the following structure does exist in the OpenStack Object Store:
猜测OpenStack对象存储中确实存在以下结构:
/containername/object1.txt
/containername/object2.txt
/containername/pseudo-directoryname/object3.txt
/containername/pseudo-directoryname/object4.txt
To get a list of objects from a container we can use a HTTP GET request with the specified URL. 要从容器中获取对象列表,我们可以使用带有指定URL的HTTP GET请求。 So far so good.
到现在为止还挺好。 Result:
结果:
/object1
/object2.txt
/pseudo-directoryname/object3
/pseudo-directoryname/object4.txt
The GET request combined with a delimiter parameter ("URL+ABSOLUTEPATH?delimiter=/") cuts the pseudo directories from the result. GET请求与定界符参数(“ URL + ABSOLUTEPATH?delimiter = /”)组合会从结果中剪切伪目录。
/object1.txt
/object2.txt
I would like to have a list of all objects within the container combined with the pseudo directories within the container. 我想要一个容器内所有对象的列表以及容器内的伪目录。
Is there a solution to get the following result without getting all objects and parse them on client side? 有没有一种解决方案可以在不获取所有对象并在客户端解析它们的情况下获得以下结果?
/object1.txt
/object2.txt
/pseudo-directoryname/
I didn't find anything about wildcards when using the delimiter parameter. 使用delimiter参数时,我没有找到有关通配符的任何信息。 Something like "URL+ABSOLUTEPATH?delimiter=/*/".
类似于“ URL + ABSOLUTEPATH?delimiter = / * /”。
I was just trying to work the same thing out. 我只是想解决同样的问题。 Found the answer in the docs: http://docs.openstack.org/user-guide/cli_swift_pseudo_hierarchical_folders_directories.html#list-pseudo-hierarchical-folders-request-http
在文档中找到了答案: http : //docs.openstack.org/user-guide/cli_swift_pseudo_hierarchical_folders_directories.html#list-pseudo-hierarchical-folders-request-http
Using their example (note the prefix
and delimiter
query string parameters): 使用其示例(请注意
prefix
和delimiter
查询字符串参数):
$ curl -X GET -i -H "X-Auth-Token: $token" $publicurl/v1/AccountString/backups?prefix=photos/&delimiter=/
Would return: 将返回:
photos/animals/
photos/me.jpg
photos/plants/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.