in aws-amplify-domain/src/main/java/software/amazon/amplify/domain/BaseHandlerStd.java [36:62]
protected abstract ProgressEvent<ResourceModel, CallbackContext> handleRequest(
final AmazonWebServicesClientProxy proxy,
final ResourceHandlerRequest<ResourceModel> request,
final CallbackContext callbackContext,
final ProxyClient<AmplifyClient> proxyClient,
final Logger logger);
protected GetDomainAssociationResponse checkIfResourceExists(ResourceModel model,
ProxyClient<AmplifyClient> client,
Logger logger) {
GetDomainAssociationResponse response = null;
try {
logger.log(String.format("Checking if %s already exists for appId: %s, domainName: %s",
ResourceModel.TYPE_NAME, model.getAppId(), model.getDomainName()));
response = client.injectCredentialsAndInvokeV2(Translator.translateToReadRequest(model), client.client()::getDomainAssociation);
} catch (final NotFoundException e) {
// proceed
} catch (final Exception e) {
throw new CfnGeneralServiceException(ResourceModel.TYPE_NAME, e);
}
logger.log(String.format("%s has successfully been read.", ResourceModel.TYPE_NAME));
if (response != null) {
throw new CfnAlreadyExistsException(ResourceModel.TYPE_NAME, model.getDomainName());
}
// should always be null
return response;
}