in aws-logs-loggroup/src/main/java/software/amazon/logs/loggroup/UpdateHandler.java [108:136]
private void disassociateKmsKey(final AmazonWebServicesClientProxy proxy,
final ResourceHandlerRequest<ResourceModel> request,
final Logger logger) {
final ResourceModel model = request.getDesiredResourceState();
final DisassociateKmsKeyRequest disassociateKmsKeyRequest =
Translator.translateToDisassociateKmsKeyRequest(model);
try {
proxy.injectCredentialsAndInvokeV2(disassociateKmsKeyRequest,
ClientBuilder.getClient()::disassociateKmsKey);
} catch (final ResourceNotFoundException e) {
// The specified resource does not exist.
throwNotFoundException(model);
} catch (final InvalidParameterException e) {
// A parameter is specified incorrectly. We should be passing valid parameters.
throw new CfnInternalFailureException(e);
} catch (final OperationAbortedException e){
// Multiple requests to update the same resource were in conflict.
throw new CfnResourceConflictException(ResourceModel.TYPE_NAME,
Objects.toString(model.getPrimaryIdentifier()), "OperationAborted", e);
} catch (final ServiceUnavailableException e) {
// The service cannot complete the request.
throw new CfnServiceInternalErrorException(e);
}
final String kmsKeyMessage =
String.format("%s [%s] successfully disassociated kms key.",
ResourceModel.TYPE_NAME, model.getLogGroupName());
logger.log(kmsKeyMessage);
}