【问题标题】:Setting container location using JClouds Location API使用 JClouds Location API 设置容器位置
【发布时间】:2013-03-24 04:39:00
【问题描述】:

我正在使用 JClouds 对各种云提供商进行抽象,包括 Rackspace。

我正在使用 JClouds 的 BlobStore 来存储文件,他们的 API 建议我可以使用以下方法在特定(依赖于提供程序)位置创建容器:

context.getBlobStore().createContainerInLocation(location, "containerName");

但是,我应该如何获取位置变量(接口类型 Location)?

例如,RackSpace 支持将达拉斯或芝加哥作为容器的位置。所以我想做这样的事情:

 Location dallas = ....; // Get location that points to "US-IL"
 context.getBlobStore().createContainerInLocation(dallas, "container");

'magic' 字符串 US-IL 取自 the source

我试过用这个:

 context.getBlobStore().listAssignableLocations();  // Only contains a single default location
 context.getBlobStore().listAssignableLocations()[0].getParent(); // Not sure what this refers to, scoped at PROVIDER level

任何人都可以阐明我应该如何使用它?

相关问题:JClouds for Azure Blob(不适用,因为答案是 Azure 特定的。不需要位置...)

【问题讨论】:

    标签: rackspace jclouds


    【解决方案1】:

    这现在可以在 jclouds 1.8.0 及更高版本中实现。

    RegionScopedBlobStoreContext blobStoreContext = ContextBuilder.newBuilder(PROVIDER)
            .credentials(username, apiKey)
            .buildView(RegionScopedBlobStoreContext.class);
    BlobStore blobStore = blobStoreContext.getBlobStore(REGION);
    

    【讨论】:

    • 是的,我在源代码中发现了很多。我也检查了 Atmos (Ninefold),但那里也不支持位置。看起来输入位置 API 没有为 BlobStore 实现。
    • 我们已经在openstack-swift 开始了它,但我们还有很长的路要走。
    猜你喜欢
    • 2014-06-23
    • 2013-08-19
    • 1970-01-01
    • 1970-01-01
    • 2015-08-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多