Search in sources :

Example 1 with DeleteAccountAliasRequest

use of software.amazon.awssdk.services.iam.model.DeleteAccountAliasRequest in project aws-doc-sdk-examples by awsdocs.

the class DeleteAccountAlias method deleteIAMAccountAlias.

// snippet-start:[iam.java2.delete_account_alias.main]
public static void deleteIAMAccountAlias(IamClient iam, String alias) {
    try {
        DeleteAccountAliasRequest request = DeleteAccountAliasRequest.builder().accountAlias(alias).build();
        iam.deleteAccountAlias(request);
        System.out.println("Successfully deleted account alias " + alias);
    } catch (IamException e) {
        System.err.println(e.awsErrorDetails().errorMessage());
        System.exit(1);
    }
    System.out.println("Done");
}
Also used : IamException(software.amazon.awssdk.services.iam.model.IamException) DeleteAccountAliasRequest(software.amazon.awssdk.services.iam.model.DeleteAccountAliasRequest)

Aggregations

DeleteAccountAliasRequest (software.amazon.awssdk.services.iam.model.DeleteAccountAliasRequest)1 IamException (software.amazon.awssdk.services.iam.model.IamException)1