0

このコードは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>

コンテナーに含まれる BLOB のリストをダウンロードせずに、すべてのコンテナーとそのすべてのメタデータを一覧表示するにはどうすればよいですか?

swiftopenstack-swiftの違いは何ですか?

4

1 に答える 1

1

主な違いは、swiftが v1 認証をサポートし、openstack-swiftが v2 認証をサポートすることです。残念ながら、swiftも廃止され、メンテナンスされなくなりました。

そのエラーが発生する理由は、 openstack-swift API 実装SwiftApiに固有のものであるためです。jclouds は実装の詳細をすべて抽象化するために多大な努力を払っていますが、完全ではありません。迅速なAPI 実装は、拡張する(すべての興味深いメソッドが定義されている) を返します。SwiftClientCommonSwiftClient

また、ご想像のとおり、SwiftClient別のパッケージに入っています。したがって、必ず含めてpackage org.jclouds.openstack.swift;ください(「.v1」はありません)

listContainers(ListContainerOptions... options)インスタンスを呼び出して、すべてのコンテナをそのメタデータとともに一覧表示できSwiftClientます。これは を返しSet<ContainerMetadata>ます。

于 2016-04-09T03:17:34.753 に答える