in aws-events-apidestination/src/main/java/software/amazon/events/apidestination/CreateHandler.java [67:87]
private CreateApiDestinationResponse createResource(CreateApiDestinationRequest awsRequest, ProxyClient<EventBridgeClient> proxyClient) {
CreateApiDestinationResponse awsResponse;
try {
awsResponse = proxyClient.injectCredentialsAndInvokeV2(awsRequest, proxyClient.client()::createApiDestination);
} catch (final ResourceAlreadyExistsException e) {
// ApiDestination with the same name already exist in the customer account
throw new CfnAlreadyExistsException(e);
} catch (final ResourceNotFoundException e) {
// Provided connection arn does not exist
throw new CfnNotFoundException(e);
} catch (final LimitExceededException e) {
// Resource limit exceeded
throw new CfnServiceLimitExceededException(ResourceModel.TYPE_NAME, awsRequest.name(), e);
} catch (final AwsServiceException e) {
// general exception
throw new CfnGeneralServiceException(ResourceModel.TYPE_NAME, e);
}
logger.log(String.format("%s successfully created.", ResourceModel.TYPE_NAME));
return awsResponse;
}