这段代码向RadosGW发出GET请求(我不使用Keystone)
String srcEndpoint = "http://myhost/auth/v1.0";
SwiftApi api = ContextBuilder.newBuilder(PROVIDER).endpoint(srcEndpoint)
.credentials(srcIdentity, srcCredential).buildApi(SwiftApi.class);如果openstack-swift是PROVIDER,那么我的代码将抛出
org.jclouds.http.HttpResponseException: command: POST http://myhost/auth/v1.0/tokens HTTP/1.1 failed with response: HTTP/1.1 405 Method Not Allowed; content: [{"Code":"MethodNotAllowed"}]如果PROVIDER是,那么我的代码会抛出
Exception in thread "main" com.google.inject.ConfigurationException: Guice configuration errors:
1) No implementation for org.jclouds.openstack.swift.v1.SwiftApi was bound.
while locating org.jclouds.openstack.swift.v1.SwiftApi我的依赖关系是
<dependency>
<groupId>org.apache.jclouds.api</groupId>
<artifactId>swift</artifactId>
<version>1.9.2</version>
</dependency>
<dependency>
<groupId>org.apache.jclouds.api</groupId>
<artifactId>openstack-swift</artifactId>
<version>1.9.2</version>
</dependency>如果不下载包含的blobs列表,我如何列出所有容器及其所有元数据?
openstack-swift和有什么区别?
发布于 2016-04-09 03:17:34
它的主要区别在于它支持v1 auth和openstack- v2 auth。不幸的是,斯威夫特也遭到了反对,不再被维护。
之所以会出现此错误,是因为SwiftApi特定于openstack实现。尽管jclouds为抽象所有实现细节做出了英勇的努力,但它并不完美。快速API实现返回SwiftClient,它扩展了CommonSwiftClient (其中定义了所有有趣的方法)。
而且,正如您可能已经猜到的,SwiftClient在一个不同的包中。所以一定要包括package org.jclouds.openstack.swift; (没有".v1")
可以通过在listContainers(ListContainerOptions... options)实例上调用SwiftClient来列出所有容器及其元数据。这将返回Set<ContainerMetadata>。
https://stackoverflow.com/questions/36498622
复制相似问题