in aws-kendra-index/src/main/java/software/amazon/kendra/index/DeleteHandler.java [132:156]
private DeleteIndexResponse deleteIndex(
final DeleteIndexRequest deleteIndexRequest,
final ProxyClient<KendraClient> proxyClient,
final CallbackContext callbackContext) {
DeleteIndexResponse deleteIndexResponse;
try {
deleteIndexResponse = proxyClient.injectCredentialsAndInvokeV2(deleteIndexRequest, proxyClient.client()::deleteIndex);
callbackContext.setDeleteWorkflow(true);
} catch (ResourceNotFoundException e) {
throw new CfnNotFoundException(ResourceModel.TYPE_NAME, deleteIndexRequest.id(), e);
} catch (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(DELETE_INDEX, e);
}
logger.log(String.format("%s successfully called DeleteIndex with index ID %s. Still need to stabilize.", ResourceModel.TYPE_NAME, deleteIndexRequest.id()));
return deleteIndexResponse;
}