mirror of https://github.com/apache/jclouds.git
openstack-nova: wiring in LoadFloatingIpsForInstance
This commit is contained in:
parent
d7b4a31e70
commit
dd4d13d6bb
|
@ -18,6 +18,11 @@
|
||||||
*/
|
*/
|
||||||
package org.jclouds.openstack.nova.v1_1.compute.config;
|
package org.jclouds.openstack.nova.v1_1.compute.config;
|
||||||
|
|
||||||
|
import com.google.common.cache.CacheBuilder;
|
||||||
|
import com.google.common.cache.CacheLoader;
|
||||||
|
import com.google.common.cache.LoadingCache;
|
||||||
|
import com.google.inject.Provides;
|
||||||
|
import com.google.inject.name.Names;
|
||||||
import org.jclouds.compute.ComputeServiceAdapter;
|
import org.jclouds.compute.ComputeServiceAdapter;
|
||||||
import org.jclouds.compute.config.ComputeServiceAdapterContextModule;
|
import org.jclouds.compute.config.ComputeServiceAdapterContextModule;
|
||||||
import org.jclouds.compute.domain.Hardware;
|
import org.jclouds.compute.domain.Hardware;
|
||||||
|
@ -30,10 +35,8 @@ import org.jclouds.functions.IdentityFunction;
|
||||||
import org.jclouds.openstack.nova.v1_1.NovaAsyncClient;
|
import org.jclouds.openstack.nova.v1_1.NovaAsyncClient;
|
||||||
import org.jclouds.openstack.nova.v1_1.NovaClient;
|
import org.jclouds.openstack.nova.v1_1.NovaClient;
|
||||||
import org.jclouds.openstack.nova.v1_1.compute.NovaComputeServiceAdapter;
|
import org.jclouds.openstack.nova.v1_1.compute.NovaComputeServiceAdapter;
|
||||||
import org.jclouds.openstack.nova.v1_1.compute.functions.FlavorToHardware;
|
import org.jclouds.openstack.nova.v1_1.compute.domain.RegionAndName;
|
||||||
import org.jclouds.openstack.nova.v1_1.compute.functions.NovaImageToImage;
|
import org.jclouds.openstack.nova.v1_1.compute.functions.*;
|
||||||
import org.jclouds.openstack.nova.v1_1.compute.functions.NovaImageToOperatingSystem;
|
|
||||||
import org.jclouds.openstack.nova.v1_1.compute.functions.ServerToNodeMetadata;
|
|
||||||
import org.jclouds.openstack.nova.v1_1.compute.options.NovaTemplateOptions;
|
import org.jclouds.openstack.nova.v1_1.compute.options.NovaTemplateOptions;
|
||||||
import org.jclouds.openstack.nova.v1_1.domain.Flavor;
|
import org.jclouds.openstack.nova.v1_1.domain.Flavor;
|
||||||
import org.jclouds.openstack.nova.v1_1.domain.Server;
|
import org.jclouds.openstack.nova.v1_1.domain.Server;
|
||||||
|
@ -41,6 +44,9 @@ import org.jclouds.openstack.nova.v1_1.domain.Server;
|
||||||
import com.google.common.base.Function;
|
import com.google.common.base.Function;
|
||||||
import com.google.inject.TypeLiteral;
|
import com.google.inject.TypeLiteral;
|
||||||
|
|
||||||
|
import javax.inject.Named;
|
||||||
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Module for building a compute service context for Nova
|
* Module for building a compute service context for Nova
|
||||||
*
|
*
|
||||||
|
@ -77,5 +83,17 @@ public class NovaComputeServiceContextModule
|
||||||
}).to((Class) IdentityFunction.class);
|
}).to((Class) IdentityFunction.class);
|
||||||
|
|
||||||
bind(TemplateOptions.class).to(NovaTemplateOptions.class);
|
bind(TemplateOptions.class).to(NovaTemplateOptions.class);
|
||||||
|
|
||||||
|
bind(new TypeLiteral<CacheLoader<RegionAndName, Iterable<String>>>() {
|
||||||
|
}).annotatedWith(Names.named("FLOATINGIP")).to(LoadFloatingIpsForInstance.class);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Provides
|
||||||
|
@Singleton
|
||||||
|
@Named("FLOATINGIP")
|
||||||
|
protected LoadingCache<RegionAndName, Iterable<String>> instanceToFloatingIps(
|
||||||
|
@Named("FLOATINGIP") CacheLoader<RegionAndName, Iterable<String>> in) {
|
||||||
|
return CacheBuilder.newBuilder().build(in);
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue