in aws-rds-dbcluster/src/main/java/software/amazon/rds/dbcluster/DeleteHandler.java [34:72]
protected ProgressEvent<ResourceModel, CallbackContext> handleRequest(
final AmazonWebServicesClientProxy proxy,
final ResourceHandlerRequest<ResourceModel> request,
final CallbackContext callbackContext,
final ProxyClient<RdsClient> proxyClient,
final Logger logger
) {
final ResourceModel model = request.getDesiredResourceState();
if (!callbackContext.isDeleting()) {
boolean deletionProtectionEnabled;
try {
deletionProtectionEnabled = isDeletionProtectionEnabled(proxyClient, model);
} catch (Exception exception) {
return Commons.handleException(
ProgressEvent.progress(model, callbackContext),
exception,
DEFAULT_DB_CLUSTER_ERROR_RULE_SET
);
}
if (deletionProtectionEnabled) {
return ProgressEvent.failed(
model,
callbackContext,
HandlerErrorCode.NotUpdatable,
String.format(DELETION_PROTECTION_ENABLED_ERROR, model.getDBClusterIdentifier())
);
}
}
return ProgressEvent.progress(model, callbackContext)
.then(progress -> {
if (isGlobalClusterMember(model)) {
return removeFromGlobalCluster(proxy, proxyClient, progress);
}
return progress;
})
.then(progress -> deleteDbCluster(proxy, request, proxyClient, progress));
}