in key/src/main/java/software/amazon/kms/key/ReadHandler.java [34:63]
protected ProgressEvent<ResourceModel, CallbackContext> handleRequest(
final AmazonWebServicesClientProxy proxy,
final ResourceHandlerRequest<ResourceModel> request,
final CallbackContext callbackContext,
final ProxyClient<KmsClient> proxyClient,
final Logger logger) {
final ResourceModel model = request.getDesiredResourceState();
return ProgressEvent.progress(model, callbackContext)
// Describe the key, and update our resource model
.then(
p -> keyHandlerHelper.describeKey(proxy, proxyClient, model, callbackContext, true))
// Retrieving the key policy can potentially cause an access denied exception
.then(p -> softFailAccessDenied(() -> keyHandlerHelper
.getKeyPolicy(proxy, proxyClient, model, callbackContext), model, callbackContext))
// Retrieving the rotation status can potentially cause an access denied exception
.then(p -> softFailAccessDenied(() -> proxy
.initiate("kms::get-key-rotation-status", proxyClient, model, callbackContext)
.translateToServiceRequest(translator::getKeyRotationStatusRequest)
.makeServiceCall(keyApiHelper::getKeyRotationStatus)
.done(getKeyRotationStatusResponse -> {
model.setEnableKeyRotation(getKeyRotationStatusResponse.keyRotationEnabled());
return ProgressEvent.progress(model, callbackContext);
}), model, callbackContext))
// Retrieving the tags can potentially cause an access denied exception, fail gracefully
.then(p -> softFailAccessDenied(() -> keyHandlerHelper
.retrieveResourceTags(proxy, proxyClient, model, callbackContext, true),
model, callbackContext))
.then(p -> ProgressEvent.defaultSuccessHandler(unsetWriteOnly(model)));
}