Java Code Examples for org.jclouds.compute.ComputeService#getNodeMetadata()

The following examples show how to use org.jclouds.compute.ComputeService#getNodeMetadata() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CloudExplorerSupport.java    From brooklyn-server with Apache License 2.0 5 votes vote down vote up
@Override
protected void doCall(ComputeService computeService, String indent) throws Exception {

    for (String instanceId : names) {
        NodeMetadata instance = computeService.getNodeMetadata(instanceId);
        if (instance == null) {
            stderr.println(indent+"Cannot terminate instance; could not find "+instanceId);
        } else {
            boolean confirmed = confirm(indent, "terminate "+instanceId+" ("+instance+")");
            if (confirmed) {
                computeService.destroyNode(instanceId);
            }
        }
    }
}
 
Example 2
Source File: JCloudsHandler.java    From roboconf-platform with Apache License 2.0 5 votes vote down vote up
@Override
public boolean isMachineRunning( TargetHandlerParameters parameters, String machineId )
throws TargetException {

	ComputeService computeService = jcloudContext( parameters.getTargetProperties());
	return computeService.getNodeMetadata( machineId ) != null;
}
 
Example 3
Source File: JCloudsHandler.java    From roboconf-platform with Apache License 2.0 5 votes vote down vote up
@Override
public String retrievePublicIpAddress( TargetHandlerParameters parameters, String machineId )
throws TargetException {

	ComputeService computeService = jcloudContext( parameters.getTargetProperties());
	NodeMetadata metadata = computeService.getNodeMetadata( machineId );

	String result = null;
	if( metadata != null
			&& metadata.getPublicAddresses() != null
			&& ! metadata.getPublicAddresses().isEmpty())
		result = metadata.getPublicAddresses().iterator().next();

	return result;
}
 
Example 4
Source File: JcloudsIaas.java    From attic-stratos with Apache License 2.0 4 votes vote down vote up
public NodeMetadata findNodeMetadata(String nodeId) {
    ComputeService computeService = getIaasProvider().getComputeService();
    return computeService.getNodeMetadata(nodeId);
}