@@ -0,0 +1,2805 @@
+//snippet-sourcedescription:%5BDescribeAccount.java demonstrates how to get information about the AWS account.%5D%0A//snippet-keyword:%5BSDK for Java 2.0%5D%0A//snippet-keyword:%5BCode Sample%5D%0A//snippet-service:%5Bec2%5D%0A//snippet-sourcetype:%5Bfull-example%5D%0A//snippet-sourcedate:%5B%5D%0A//snippet-sourceauthor:%5Bscmacdon-aws%5D%0A/*%0A * Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.%0A *%0A * Licensed under the Apache License, Version 2.0 (the %22License%22).%0A * You may not use this file except in compliance with the License.%0A * A copy of the License is located at%0A *%0A *  http://aws.amazon.com/apache2.0%0A *%0A * or in the %22license%22 file accompanying this file. This file is distributed%0A * on an %22AS IS%22 BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either%0A * express or implied. See the License for the specific language governing%0A * permissions and limitations under the License.%0A */%0A%0Apackage com.example.ec2;%0A// snippet-start:%5Bec2.java2.describe_account.complete%5D%0A// snippet-start:%5Bec2.java2.describe_account.import%5D%0Aimport software.amazon.awssdk.core.exception.SdkException;%0Aimport software.amazon.awssdk.services.ec2.Ec2Client;%0Aimport software.amazon.awssdk.services.ec2.model.AccountAttribute;%0Aimport software.amazon.awssdk.services.ec2.model.AccountAttributeValue;%0Aimport software.amazon.awssdk.services.ec2.model.DescribeAccountAttributesResponse;%0Aimport java.util.List;%0Aimport java.util.ListIterator;%0A// snippet-end:%5Bec2.java2.describe_account.import%5D%0A%0Apublic class DescribeAccount %7B%0A%0A    public static void main(String%5B%5D args)%0A    %7B%0A        // snippet-start:%5Bec2.java2.describe_account.main%5D%0A        Ec2Client ec2 = Ec2Client.create();%0A%0A        try%7B%0A            DescribeAccountAttributesResponse accountResults = ec2.describeAccountAttributes();%0A%0A            List%3CAccountAttribute%3E accountList = accountResults.accountAttributes();%0A%0A            for (ListIterator iter = accountList.listIterator(); iter.hasNext(); ) %7B%0A%0A                AccountAttribute attribute = (AccountAttribute) iter.next();%0A                System.out.print(%22%5Cn The name of the attribute is %22+attribute.attributeName());%0A                List%3CAccountAttributeValue%3E values = attribute.attributeValues();%0A%0A                //iterate through the attribute values%0A                for (ListIterator iterVals = values.listIterator(); iterVals.hasNext(); ) %7B%0A                    AccountAttributeValue myValue = (AccountAttributeValue) iterVals.next();%0A                    System.out.print(%22%5Cn The value of the attribute is %22+myValue.attributeValue());%0A                %7D%0A            %7D%0A            System.out.print(%22Done%22);%0A        %7D%0A        catch (SdkException e)%0A        %7B%0A            e.getStackTrace();%0A        %7D%0A        // snippet-end:%5Bec2.java2.describe_account.main%5D%0A    %7D%0A%7D%0A// snippet-end:%5Bec2.java2.describe_account.complete%5D%0A

Create DescribeAccount.java