//snippet-sourcedescription:[DeleteAccountAlias.java demonstrates how to delete an alias from an AWS account.]
//snippet-keyword:[SDK for Java 2.0]
//snippet-keyword:[Code Sample]
//snippet-service:[iam]
//snippet-sourcetype:[full-example]
//snippet-sourcedate:[]
//snippet-sourceauthor:[soo-aws]
/*
 * Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License").
 * You may not use this file except in compliance with the License.
 * A copy of the License is located at
 *
 *  http://aws.amazon.com/apache2.0
 *
 * or in the "license" file accompanying this file. This file is distributed
 * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
 * express or implied. See the License for the specific language governing
 * permissions and limitations under the License.
 */
package com.example.iam;
// snippet-start:[iam.java2.delete_account_alias.complete]
// snippet-start:[iam.java2.delete_account_alias.import]
import software.amazon.awssdk.services.iam.model.DeleteAccountAliasRequest;
import software.amazon.awssdk.services.iam.model.DeleteAccountAliasResponse;

import software.amazon.awssdk.regions.Region;
import software.amazon.awssdk.services.iam.IamClient;
 
// snippet-end:[iam.java2.delete_account_alias.import]
/**
 * Deletes an alias from an AWS account
 */
public class DeleteAccountAlias {
    public static void main(String[] args) {

        final String USAGE =
            "To run this example, supply an account alias\n" +
            "Ex: DeleteAccountAlias <account-alias>\n";

        if (args.length != 1) {
            System.out.println(USAGE);
            System.exit(1);
        }

        String alias = args[0];

        // snippet-start:[iam.java2.delete_account_alias.main]
        Region region = Region.AWS_GLOBAL;
        IamClient iam = IamClient.builder().region(region).build();

        DeleteAccountAliasRequest request = DeleteAccountAliasRequest.builder()
            .accountAlias(alias).build();

        DeleteAccountAliasResponse response = iam.deleteAccountAlias(request); 
        // snippet-end:[iam.java2.delete_account_alias.main]

        System.out.println("Successfully deleted account alias " + alias);
    }
}

// snippet-end:[iam.java2.delete_account_alias.complete]

@@ -260,16 +260,26 @@
 cedate:%5B
+03/02/2020
 %5D%0D%0A//sni
@@ -302,10 +302,15 @@
 r:%5Bs
-oo
+cmacdon
 -aws
@@ -333,18 +333,8 @@
 ght 
-2010-2019 
 Amaz
@@ -1200,18 +1200,16 @@
 ponse;%0D%0A
-%0D%0A
 import s
@@ -1302,17 +1302,80 @@
 lient;%0D%0A
- 
+import software.amazon.awssdk.services.iam.model.IamException;%0D%0A
 %0D%0A// sni
@@ -1600,16 +1600,20 @@
         
+    
 %22To run 
@@ -1656,16 +1656,28 @@
 s%5Cn%22 +%0D%0A
+            
         
@@ -1723,25 +1723,24 @@
 ias%3E%5Cn%22;%0D%0A%0D%0A
- 
        if (a
@@ -1839,18 +1839,16 @@
      %7D%0D%0A
-%0D%0A
         
@@ -2029,23 +2029,59 @@
 er()
-.region(region)
+%0D%0A                .region(region)%0D%0A                
 .bui
@@ -2081,32 +2081,51 @@
    .build();%0D%0A%0D%0A
+        try %7B%0D%0A    
         DeleteAc
@@ -2201,16 +2201,20 @@
         
+    
 .account
@@ -2230,32 +2230,36 @@
 as).build();%0D%0A%0D%0A
+    
         DeleteAc
@@ -2324,149 +2324,339 @@
 st);
- %0D%0A        // snippet-end:%5Biam.java2.
+%0D%0A%0D%0A%0D%0A             System.out.println(%22Successfully 
 delete
-_
+d 
 account
-_
+ 
 alias
-.main%5D%0D%0A%0D%0A        System.out.println(%22Successfully 
+ %22 + alias);%0D%0A%0D%0A        %7D catch (IamException e) %7B%0D%0A            System.err.println(e.awsErrorDetails().errorMessage());%0D%0A            System.exit(1);%0D%0A        %7D%0D%0A        System.out.println(%22Done%22);%0D%0A        // snippet-end:%5Biam.java2.
 delete
-d 
+_
 account
- 
+_
 alias
- %22 + alias);
+.main%5D
 %0D%0A  
@@ -2663,18 +2663,16 @@
   %7D%0D%0A%7D%0D%0A
-%0D%0A
 // snipp

Update DeleteAccountAlias.java