Example usage for com.amazonaws.services.ec2.model OfferingTypeValues fromValue

List of usage examples for com.amazonaws.services.ec2.model OfferingTypeValues fromValue

Introduction

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

Prototype

public static OfferingTypeValues fromValue(String value) 

Source Link

Document

Use this in place of valueOf.

Usage

From source file:com.kenlin.awsec2offering.App.java

License:Open Source License

/**
 * A URI-appropriate EC2 offering type parser.
 * //from   ww  w.java2s.  c o  m
 * Note: The strings that OfferingTypeValues.fromValue accepts are not URI
 * appropriate as they have spaces, etc.
 * 
 * @param value
 * @return
 */
public static String normalizeOfferingType(String value) {
    if (value == null) {
        return null;
    } else if (value.startsWith(HEAVY_PREFIX)) {
        return OfferingTypeValues.HeavyUtilization.toString();
    } else if (value.startsWith(MEDIUM_PREFIX)) {
        return OfferingTypeValues.MediumUtilization.toString();
    } else if (value.startsWith(LIGHT_PREFIX)) {
        return OfferingTypeValues.LightUtilization.toString();
    } else {
        return OfferingTypeValues.fromValue(value).toString();
    }
}