Search in sources :

Example 6 with Location

use of org.jclouds.domain.Location in project whirr by apache.

the class RunningInstanceToNodeMetadata method apply.

@Override
public NodeMetadata apply(final RunningInstance instance) {
    String id = checkNotNull(instance, "instance").getId();
    // user doesn't determine a node name;
    String name = null;
    // no uri to get rest access to host info
    URI uri = null;
    String tag = getTagForInstace(instance);
    Credentials credentials = getCredentialsForInstanceWithTag(instance, tag);
    Map<String, String> userMetadata = ImmutableMap.<String, String>of();
    NodeState state = instanceToNodeState.get(instance.getInstanceState());
    Set<String> publicAddresses = nullSafeSet(instance.getIpAddress());
    Set<String> privateAddresses = nullSafeSet(instance.getPrivateIpAddress());
    Map<String, String> extra = getExtra(instance);
    Location location = getLocationForAvailabilityZone(instance);
    Image image = resolveImageForInstanceInLocation(instance, location);
    return new NodeMetadataImpl(id, name, instance.getRegion() + "/" + instance.getId(), location, uri, userMetadata, tag, image, state, publicAddresses, privateAddresses, extra, credentials);
}
Also used : NodeState(org.jclouds.compute.domain.NodeState) NodeMetadataImpl(org.jclouds.compute.domain.internal.NodeMetadataImpl) Image(org.jclouds.compute.domain.Image) URI(java.net.URI) Credentials(org.jclouds.domain.Credentials) Location(org.jclouds.domain.Location)

Aggregations

Location (org.jclouds.domain.Location)6 Properties (java.util.Properties)3 ComputeServiceContext (org.jclouds.compute.ComputeServiceContext)2 Credentials (org.jclouds.domain.Credentials)2 Function (com.google.common.base.Function)1 Predicate (com.google.common.base.Predicate)1 Module (com.google.inject.Module)1 IOException (java.io.IOException)1 URI (java.net.URI)1 Nullable (javax.annotation.Nullable)1 PostConstruct (javax.annotation.PostConstruct)1 IgniteInterruptedCheckedException (org.apache.ignite.internal.IgniteInterruptedCheckedException)1 IgniteSpiException (org.apache.ignite.spi.IgniteSpiException)1 ContextBuilder (org.jclouds.ContextBuilder)1 BlobStoreContext (org.jclouds.blobstore.BlobStoreContext)1 ComputeMetadata (org.jclouds.compute.domain.ComputeMetadata)1 Image (org.jclouds.compute.domain.Image)1 NodeState (org.jclouds.compute.domain.NodeState)1 NodeMetadataImpl (org.jclouds.compute.domain.internal.NodeMetadataImpl)1 LocationBuilder (org.jclouds.domain.LocationBuilder)1