Search in sources :

Example 1 with CreateAliasRequest

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

the class CreateAlias method createCustomAlias.

// snippet-start:[kms.java2._create_alias.main]
public static void createCustomAlias(KmsClient kmsClient, String targetKeyId, String aliasName) {
    try {
        CreateAliasRequest aliasRequest = CreateAliasRequest.builder().aliasName(aliasName).targetKeyId(targetKeyId).build();
        kmsClient.createAlias(aliasRequest);
    } catch (KmsException e) {
        System.err.println(e.getMessage());
        System.exit(1);
    }
}
Also used : KmsException(software.amazon.awssdk.services.kms.model.KmsException) CreateAliasRequest(software.amazon.awssdk.services.kms.model.CreateAliasRequest)

Aggregations

CreateAliasRequest (software.amazon.awssdk.services.kms.model.CreateAliasRequest)1 KmsException (software.amazon.awssdk.services.kms.model.KmsException)1