Search in sources :

Example 1 with NodeState

use of org.jclouds.compute.domain.NodeState 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

URI (java.net.URI)1 Image (org.jclouds.compute.domain.Image)1 NodeState (org.jclouds.compute.domain.NodeState)1 NodeMetadataImpl (org.jclouds.compute.domain.internal.NodeMetadataImpl)1 Credentials (org.jclouds.domain.Credentials)1 Location (org.jclouds.domain.Location)1