in aws-customerprofiles-domain/src/main/java/software/amazon/customerprofiles/domain/ReadHandler.java [29:70]
public ProgressEvent<ResourceModel, CallbackContext> handleRequest(
final AmazonWebServicesClientProxy proxy,
final ResourceHandlerRequest<ResourceModel> request,
final CallbackContext callbackContext,
final Logger logger) {
if (this.client == null) {
this.client = ClientBuilder.getClient();
}
final ResourceModel model = request.getDesiredResourceState();
final GetDomainRequest getDomainRequest = GetDomainRequest.builder()
.domainName(model.getDomainName())
.build();
final GetDomainResponse getDomainResponse;
try {
getDomainResponse = proxy.injectCredentialsAndInvokeV2(getDomainRequest, client::getDomain);
logger.log(String.format("Get Domain with domainName = %s", model.getDomainName()));
} catch (BadRequestException e) {
throw new CfnInvalidRequestException(e);
} catch (InternalServerException e) {
throw new CfnServiceInternalErrorException(e);
} catch (ResourceNotFoundException e) {
throw new CfnNotFoundException(e);
} catch (Exception e) {
throw new CfnGeneralServiceException(e);
}
final ResourceModel responseModel = ResourceModel.builder()
.createdAt(getDomainResponse.createdAt().toString())
.deadLetterQueueUrl(getDomainResponse.deadLetterQueueUrl())
.defaultEncryptionKey(getDomainResponse.defaultEncryptionKey())
.defaultExpirationDays(getDomainResponse.defaultExpirationDays())
.domainName(getDomainResponse.domainName())
.lastUpdatedAt(getDomainResponse.lastUpdatedAt().toString())
.tags(Translator.mapTagsToList(getDomainResponse.tags()))
.build();
return ProgressEvent.defaultSuccessHandler(responseModel);
}