Search in sources :

Example 1 with DescribeAccountAttributesResult

use of com.amazonaws.services.ec2.model.DescribeAccountAttributesResult in project aws-doc-sdk-examples by awsdocs.

the class DescribeAccount method main.

public static void main(String[] args) {
    // snippet-start:[ec2.java1.describe_account.main]
    AmazonEC2 ec2 = AmazonEC2ClientBuilder.defaultClient();
    try {
        DescribeAccountAttributesResult accountResults = ec2.describeAccountAttributes();
        List<AccountAttribute> accountList = accountResults.getAccountAttributes();
        for (ListIterator iter = accountList.listIterator(); iter.hasNext(); ) {
            AccountAttribute attribute = (AccountAttribute) iter.next();
            System.out.print("\n The name of the attribute is " + attribute.getAttributeName());
            List<AccountAttributeValue> values = attribute.getAttributeValues();
            // iterate through the attribute values
            for (ListIterator iterVals = values.listIterator(); iterVals.hasNext(); ) {
                AccountAttributeValue myValue = (AccountAttributeValue) iterVals.next();
                System.out.print("\n The value of the attribute is " + myValue.getAttributeValue());
            }
        }
        System.out.print("Done");
    } catch (Exception e) {
        e.getStackTrace();
    }
// snippet-end:[ec2.java1.describe_account.main]
}
Also used : AccountAttribute(com.amazonaws.services.ec2.model.AccountAttribute) AccountAttributeValue(com.amazonaws.services.ec2.model.AccountAttributeValue) DescribeAccountAttributesResult(com.amazonaws.services.ec2.model.DescribeAccountAttributesResult) AmazonEC2(com.amazonaws.services.ec2.AmazonEC2) ListIterator(java.util.ListIterator)

Aggregations

AmazonEC2 (com.amazonaws.services.ec2.AmazonEC2)1 AccountAttribute (com.amazonaws.services.ec2.model.AccountAttribute)1 AccountAttributeValue (com.amazonaws.services.ec2.model.AccountAttributeValue)1 DescribeAccountAttributesResult (com.amazonaws.services.ec2.model.DescribeAccountAttributesResult)1 ListIterator (java.util.ListIterator)1