in aws-licensemanager-license/src/main/java/software/amazon/licensemanager/license/ReadHandler.java [51:75]
private GetLicenseResponse readResource(
final GetLicenseRequest getLicenseRequest,
final ProxyClient<LicenseManagerClient> proxyClient,
final ResourceModel model) {
GetLicenseResponse getLicenseResponse = null;
try {
getLicenseResponse = proxyClient.injectCredentialsAndInvokeV2(getLicenseRequest, proxyClient.client()::getLicense);
model.setLicenseArn(getLicenseResponse.license().licenseArn());
} catch (ValidationException | InvalidParameterValueException e) {
logger.log("Resource reading failed");
throw new CfnNotFoundException(model.getLicenseArn(), ResourceModel.TYPE_NAME, e);
} catch (final AwsServiceException e) {
logger.log("Resource reading failed");
throw new CfnGeneralServiceException(ResourceModel.TYPE_NAME + e.getMessage(), e);
}
if (DELETED.equals(getLicenseResponse.license().status().toString())
|| PENDING_DELETE.equals(getLicenseResponse.license().status().toString())) {
throw new CfnNotFoundException(model.getLicenseArn(), ResourceModel.TYPE_NAME);
}
logger.log(String.format("%s has successfully been read.", ResourceModel.TYPE_NAME));
return getLicenseResponse;
}