in aws-lightsail-loadbalancertlscertificate/src/main/java/software/amazon/lightsail/loadbalancertlscertificate/helpers/handler/LoadBalancerTlsCertificateHandler.java [64:85]
protected ProgressEvent<ResourceModel, CallbackContext> preCreate(
final ProgressEvent<ResourceModel, CallbackContext> progress) {
val loadBalancerTlsCertificate = getLoadBalancerTlsCertificate(resourceModelRequest, proxyClient, logger);
if (callbackContext.getIsPreCheckDone(PRE_CHECK_CREATE)) {
return progress;
}
logger.log("Executing AWS-Lightsail-LoadBalancerTlsCertificate::Create::PreExistenceCheck...");
return proxy
.initiate("AWS-Lightsail-LoadBalancerTlsCertificate::Create::PreExistenceCheck", proxyClient, progress.getResourceModel(),
progress.getCallbackContext())
.translateToServiceRequest(Translator::translateToReadRequest).makeServiceCall((awsRequest, client) -> {
loadBalancerTlsCertificate.read(awsRequest);
logger.log(String.format("%s has successfully been read.", ResourceModel.TYPE_NAME));
throw new CfnAlreadyExistsException(ResourceType.LOAD_BALANCER_TLS_CERTIFICATE.toString(),
resourceModel.getCertificateName());
}).handleError((awsRequest, exception, client, model, context) -> {
callbackContext.getIsPreCheckDone().put(PRE_CHECK_CREATE, true);
return handleError(exception, model, callbackContext,
ImmutableList.of(InvalidInputException, NotFoundException), logger,
this.getClass().getSimpleName());
}).progress();
}