in aws-rds-dbclusterparametergroup/src/main/java/software/amazon/rds/dbclusterparametergroup/BaseHandlerStd.java [44:88]
protected abstract ProgressEvent<ResourceModel, CallbackContext> handleRequest(AmazonWebServicesClientProxy proxy,
ResourceHandlerRequest<ResourceModel> request,
CallbackContext callbackContext,
ProxyClient<RdsClient> client,
Logger logger);
protected ProgressEvent<ResourceModel, CallbackContext> applyParameters(final AmazonWebServicesClientProxy proxy,
final ProxyClient<RdsClient> proxyClient,
final ResourceModel model,
final CallbackContext callbackContext) {
if (callbackContext.isParametersApplied()) return ProgressEvent.defaultInProgressHandler(callbackContext, NO_CALLBACK_DELAY, model);
callbackContext.setParametersApplied(true);
ProgressEvent<ResourceModel, CallbackContext> progress = ProgressEvent.defaultInProgressHandler(callbackContext, CALLBACK_DELAY_SECONDS, model);
if (model.getParameters().isEmpty()) return progress;
// check if provided parameter is supported by rds
Set<String> paramNames = model.getParameters().keySet();
String marker = null;
do {
final DescribeDbClusterParametersResponse dbClusterParametersResponse = proxyClient.injectCredentialsAndInvokeV2(
Translator.describeDbClusterParametersRequest(model, marker), proxyClient.client()::describeDBClusterParameters);
marker = dbClusterParametersResponse.marker();
final Set<Parameter> params = Translator.getParametersToModify(model, dbClusterParametersResponse.parameters());
// if no params need to be modified then skip the api invocation
if (params.isEmpty()) continue;
// substract set of found and modified params
paramNames.removeAll(params.stream().map(Parameter::parameterName).collect(Collectors.toSet()));
progress = proxy.initiate("rds::modify-db-cluster-parameter-group::" + marker, proxyClient, model, callbackContext)
.translateToServiceRequest((resourceModel) -> Translator.modifyDbClusterParameterGroupRequest(resourceModel, params))
.makeServiceCall((request, proxyInvocation) -> proxyInvocation.injectCredentialsAndInvokeV2(request, proxyInvocation.client()::modifyDBClusterParameterGroup))
.progress(CALLBACK_DELAY_SECONDS);
} while (!StringUtils.isNullOrEmpty(marker));
// if there are parameters left that couldn't be found in rds api then they are invalid
if (!paramNames.isEmpty()) throw new CfnInvalidRequestException("Invalid / Unsupported DB Parameter: " + paramNames.stream().findFirst().get());
return progress;
}