in aws-networkfirewall-rulegroup/src/main/java/software/amazon/networkfirewall/rulegroup/UpdateHandler.java [56:81]
private ProgressEvent<ResourceModel, CallbackContext> verifyResourceExists(
final ProgressEvent<ResourceModel, CallbackContext> progress) {
return proxy.initiate(
"RuleGroup::Update-ResourceExists", proxyClient, progress.getResourceModel(), callbackContext)
.translateToServiceRequest(Translator::translateToReadRequest)
.makeServiceCall((describeRuleGroupRequest, client) -> {
try {
DescribeRuleGroupResponse describeResponse = client.injectCredentialsAndInvokeV2(describeRuleGroupRequest, client.client()::describeRuleGroup);
final Integer actualCapacityFromCreate = describeResponse.ruleGroupResponse().capacity();
if (desiredStateModel.getCapacity() == null) {
desiredStateModel.setCapacity(actualCapacityFromCreate);
} else {
if (!actualCapacityFromCreate.equals(desiredStateModel.getCapacity())) {
throw new CfnInvalidRequestException("RuleGroup capacity cannot be updated.");
}
}
} catch (final ResourceNotFoundException e) {
throw new CfnNotFoundException(e);
} catch (final AwsServiceException e) {
translateToCfnException(e);
}
// resource we are trying to update exists, return success
return ProgressEvent.defaultSuccessHandler(null);
})
.progress();
}