简体   繁体   English

如何使用REST API列出OpenStack对象存储区(Swift)的对象和(虚拟目录)

[英]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): 使用其示例(请注意prefixdelimiter查询字符串参数):

$ 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.

相关问题 使用Java API在Openstack Swift中复制文件时如何指定可选参数 - How can I specify optional parameters when copy files in Openstack Swift using Java API 如何从Twitter Rest API存储JSON对象 - How to store json Objects from Twitter Rest API 您如何使用 jersey REST Webtarget API 发布对象的 json 列表? - 未找到错误 MessageBodyWriter - How do you POST a json list of objects using the jersey REST Webtarget API? - getting error MessageBodyWriter not found 如何使用servlet与openstack api进行通信 - how to communicate with openstack api using servlet 通过REST API列出Azure虚拟机 - List Azure Virtual Machines via REST API 如何使用HttpPost传递包含其他自定义对象列表的对象以调用REST服务 - How to pass object containing list of other custom objects to call REST service using HttpPost 使用JSON将Rest API客户端的LIST对象传递给Web API 2 - Pass LIST object by Rest API Client to Web API 2 using JSON 如何使用Rest API在IBM云对象存储中获取区域列表 - How to get a region list in IBM cloud object storage using Rest API 如何在Windows Store App中使用C#通过REST API从Sharepoint图像库(列表)检索图像文件 - How to retrieve image files from Sharepoint Image Library (List) through REST API using C# in Windows Store App 如何在SWIFT 4中使用Twitter REST API发布直接消息 - How to POST direct message using Twitter REST API in SWIFT 4
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM