@Provides @LazySingleton public CloudFilesApi getCloudFilesApi(final CloudFilesAccountConfig config) { log.info("Building Cloud Files Api..."); Iterable<com.google.inject.Module> modules; if (config.getUseServiceNet()) { log.info("Configuring Cloud Files Api to use the internal service network..."); modules = ImmutableSet.of(new SLF4JLoggingModule(), new InternalUrlModule()); } else { log.info("Configuring Cloud Files Api to use the public network..."); modules = ImmutableSet.of(new SLF4JLoggingModule()); } ProviderRegistry.registerProvider(CloudFilesUSProviderMetadata.builder().build()); ProviderRegistry.registerProvider(CloudFilesUKProviderMetadata.builder().build()); ContextBuilder cb = ContextBuilder.newBuilder(config.getProvider()) .credentials(config.getUserName(), config.getApiKey()).modules(modules); CloudFilesApi cfa = cb.buildApi(CloudFilesApi.class); log.info("Cloud Files Api built."); return cfa; }
@Override protected void configure() { bind(EndpointToSupplierURI.class).to(InternalURL.class); } }
@Override protected void configure() { bind(EndpointToSupplierURI.class).to(InternalURL.class); } }
@Override protected void configure() { bind(EndpointToSupplierURI.class).to(InternalURL.class); } }
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);