in aws-route53recoverycontrol-safetyrule/src/main/java/software/amazon/route53recoverycontrol/safetyrule/CreateHandler.java [127:151]
private CreateSafetyRuleResponse createSafetyRule(
CreateSafetyRuleRequest request,
ProxyClient<Route53RecoveryControlConfigClient> proxyClient
) {
CreateSafetyRuleResponse createResponse;
try {
createResponse = proxyClient.injectCredentialsAndInvokeV2(request, ClientBuilder.getClient()::createSafetyRule);
} catch (Route53RecoveryControlConfigException e) {
if (e.statusCode() == 409) {
String name = request.assertionRule() != null ?
request.assertionRule().name() : request.gatingRule().name();
throw new CfnAlreadyExistsException(ResourceModel.TYPE_NAME,
name);
} else {
throw new CfnGeneralServiceException(ResourceModel.TYPE_NAME, e);
}
} catch (AwsServiceException e) {
throw new CfnGeneralServiceException(ResourceModel.TYPE_NAME, e);
}
return createResponse;
}