Example usage for com.amazonaws.services.ec2.model StateReason getMessage

List of usage examples for com.amazonaws.services.ec2.model StateReason getMessage

Introduction

In this page you can find the example usage for com.amazonaws.services.ec2.model StateReason getMessage.

Prototype


public String getMessage() 

Source Link

Document

The message for the state change.

Usage

From source file:org.occiware.clouddriver.util.InstanceDataFactory.java

License:Apache License

public static InstanceDO buildInstanceDataFromModel(Instance instance) {
    InstanceDO instanceDO = new InstanceDO();
    buildBasicInstanceData(instance, instanceDO);

    Placement placement = instance.getPlacement();
    if (placement != null) {
        PlacementDO placementDO = buildPlacementDO(instanceDO, placement);
        instanceDO.setPlacement(placementDO);
    }/*from   w ww .j a  va 2  s .  c om*/

    // Ebs volumes attached on instance.
    if (instance.getBlockDeviceMappings() != null && !instance.getBlockDeviceMappings().isEmpty()) {
        List<InstanceVolumeDO> instanceVolumeDOs = BuildInstanceVolumeDOs(instance);
        instanceDO.setVolumes(instanceVolumeDOs);
    }

    if (instance.getIamInstanceProfile() != null) {
        IamInstanceProfileDO profileDO = buildIamInstanceProfileDO(instance);
        instanceDO.setIamInstanceProfile(profileDO);
    }

    if (instance.getMonitoring() != null) {
        Monitoring monitoring = instance.getMonitoring();
        instanceDO.setMonitoringState(monitoring.getState());
    }

    // Network part.
    if (instance.getNetworkInterfaces() != null && !instance.getNetworkInterfaces().isEmpty()) {
        List<NetworkInterfaceDO> networkInterfaceDOs = buildNetworkInterfacesDatas(instance);
        instanceDO.setNetworkAdapters(networkInterfaceDOs);
    }

    List<ProductCode> productCodes = instance.getProductCodes();
    if (productCodes != null && !productCodes.isEmpty()) {
        List<ProductCodeDO> productCodeDOs = buildProductCodesDatas(productCodes);
        instanceDO.setProductCodes(productCodeDOs);
    }

    List<GroupIdentifier> groups = instance.getSecurityGroups();
    if (groups != null && !groups.isEmpty()) {
        List<GroupIdentifierDO> groupIdentifierDOs = buildSecurityGroupsDatas(groups);
        instanceDO.setSecurityGroups(groupIdentifierDOs);
    }

    InstanceState state = instance.getState();
    if (state != null) {
        instanceDO.setInstanceState(state.getName());
        instanceDO.setInstanceStateCode(state.getCode());
        StateReason stateReason = instance.getStateReason();
        if (stateReason != null) {
            instanceDO.setInstanceStateReasonMessage(stateReason.getMessage());
            instanceDO.setInstanceStateReasonCode(stateReason.getCode());
        }
    }

    List<Tag> tags = instance.getTags();
    if (tags != null && !tags.isEmpty()) {
        List<TagDO> tagDOs = buildTagsDatas(tags);
        instanceDO.setTags(tagDOs);
    }
    return instanceDO;
}