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);
}
Aggregations