Search in sources :

Example 1 with DescribeKeyResponse

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

the class DescribeKey method describeSpecifcKey.

// snippet-start:[kms.java2_describe_key.main]
public static void describeSpecifcKey(KmsClient kmsClient, String keyId) {
    try {
        DescribeKeyRequest keyRequest = DescribeKeyRequest.builder().keyId(keyId).build();
        DescribeKeyResponse response = kmsClient.describeKey(keyRequest);
        System.out.println("The key description is " + response.keyMetadata().description());
        System.out.println("The key ARN is " + response.keyMetadata().arn());
    } catch (KmsException e) {
        System.err.println(e.getMessage());
        System.exit(1);
    }
}
Also used : DescribeKeyResponse(software.amazon.awssdk.services.kms.model.DescribeKeyResponse) KmsException(software.amazon.awssdk.services.kms.model.KmsException) DescribeKeyRequest(software.amazon.awssdk.services.kms.model.DescribeKeyRequest)

Aggregations

DescribeKeyRequest (software.amazon.awssdk.services.kms.model.DescribeKeyRequest)1 DescribeKeyResponse (software.amazon.awssdk.services.kms.model.DescribeKeyResponse)1 KmsException (software.amazon.awssdk.services.kms.model.KmsException)1