in aws-kendra-datasource/src/main/java/software/amazon/kendra/datasource/CreateHandler.java [90:113]
private CreateDataSourceResponse createDataSource(
final CreateDataSourceRequest createDataSourceRequest,
final ProxyClient<KendraClient> proxyClient) {
CreateDataSourceResponse createDataSourceResponse;
try {
createDataSourceResponse = proxyClient.injectCredentialsAndInvokeV2(createDataSourceRequest,
proxyClient.client()::createDataSource);
} catch(final ValidationException e) {
throw new CfnInvalidRequestException(e.getMessage(), e);
} catch (final ConflictException e) {
throw new CfnResourceConflictException(e);
} catch (final AwsServiceException e) {
/*
* While the handler contract states that the handler must always return a progress event,
* you may throw any instance of BaseHandlerException, as the wrapper map it to a progress event.
* Each BaseHandlerException maps to a specific error code, and you should map service exceptions as closely as possible
* to more specific error codes
*/
throw new CfnGeneralServiceException(CREATE_DATASOURCE, e);
}
logger.log(String.format("%s successfully created.", ResourceModel.TYPE_NAME));
return createDataSourceResponse;
}