Example usage for com.amazonaws.services.ec2.model DescribeReservedInstancesOfferingsRequest setProductDescription

List of usage examples for com.amazonaws.services.ec2.model DescribeReservedInstancesOfferingsRequest setProductDescription

Introduction

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

Prototype


public void setProductDescription(RIProductDescription productDescription) 

Source Link

Document

The Reserved Instance product platform description.

Usage

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

License:Open Source License

private void addReservedOfferings(ArrayNode array, String availabilityZone, String productDescription,
        String offeringType, String instanceType) {
    DescribeReservedInstancesOfferingsRequest req = new DescribeReservedInstancesOfferingsRequest()
            .withIncludeMarketplace(false).withInstanceTenancy(Tenancy.Default); // Not Tenancy.Dedicated
    if (availabilityZone != null)
        req.setAvailabilityZone(availabilityZone);
    if (productDescription != null)
        req.setProductDescription(productDescription);
    if (offeringType != null)
        req.setOfferingType(offeringType);
    if (instanceType != null)
        req.setInstanceType(parseInstanceType(instanceType));

    String nextToken = null;/*from  ww  w  .jav a 2 s  .c om*/
    do {
        DescribeReservedInstancesOfferingsResult res = ec2.describeReservedInstancesOfferings(req);
        for (ReservedInstancesOffering o : res.getReservedInstancesOfferings()) {
            Offering offering = new Offering(o);
            try {
                array.add(offering.toJsonNode());
            } catch (JsonProcessingException e) {
                e.printStackTrace();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        nextToken = res.getNextToken();
        req.withNextToken(nextToken);
    } while (nextToken != null);
}