【问题标题】:Jclouds Rackspace Cloud Files service netJclouds Rackspace 云文件服务网
【发布时间】:2015-10-08 08:17:23
【问题描述】:

在Java中使用云文件api时是否可以使用servicenet?目前我使用如下:

ContextBuilder cb = ContextBuilder.newBuilder(config.getProvider())
    .credentials(config.getUserName(), config.getApiKey()).modules(modules);
CloudFilesApi cfa = cb.buildApi(CloudFilesApi.class);

我问这个是因为我曾经使用带有布尔参数的python客户端来选择是使用公共网络还是服务网络:

cf = pyrax.connect_to_cloudfiles(region=CDN_REGION, public=CDN_USEPUBLIC)

【问题讨论】:

    标签: java jclouds rackspace-cloudfiles private-network


    【解决方案1】:
    Iterable<Module> modules = ImmutableSet.<Module> of(new SLF4JLoggingModule(),
            new InternalUrlModule());
    
    ContextBuilder builder = ContextBuilder.newBuilder(PROVIDER)
            .modules(modules)
            .credentials(username, apiKey);
      blobStore = builder.buildView(RegionScopedBlobStoreContext.class).getBlobStore(REGION);
      cloudFiles = blobStore.getContext().unwrapApi(CloudFilesApi.class);
    

    您需要确保将 InternalUrlModule 添加到模块列表中。这反过来将使 jclouds 在连接到服务时使用适用的 ServiceNet 端点。

    【讨论】:

      猜你喜欢
      • 2014-06-23
      • 1970-01-01
      • 2014-04-22
      • 1970-01-01
      • 2011-01-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多