Search in sources :

Example 1 with CreateAccountAliasRequest

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

the class CreateAccountAlias method createIAMAccountAlias.

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

Aggregations

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