in aws-licensemanager-license/src/main/java/software/amazon/licensemanager/license/CreateHandler.java [75:107]
private CreateLicenseResponse createLicense(
ProgressEvent<ResourceModel, CallbackContext> progress,
ProxyClient<LicenseManagerClient> client,
CreateLicenseRequest awsRequest,
ResourceModel model,
ResourceHandlerRequest<ResourceModel> request) {
CreateLicenseResponse createLicenseResponse;
try {
createLicenseResponse = client.injectCredentialsAndInvokeV2(
awsRequest, client.client()::createLicense);
} catch (final ValidationException | InvalidParameterValueException e) {
logger.log(e.getMessage());
throw new CfnInvalidRequestException(String.format("Couldn't create %s due to error: %s", ResourceModel.TYPE_NAME, e.getMessage()), e);
} catch (final AccessDeniedException e) {
logger.log(e.getMessage());
throw new CfnAccessDeniedException(ResourceModel.TYPE_NAME, e);
} catch (final ResourceLimitExceededException e) {
logger.log(e.getMessage());
throw new CfnServiceLimitExceededException(e);
} catch (final InvalidResourceStateException e) {
logger.log(e.getMessage());
throw new CfnResourceConflictException(e);
}
logger.log(
String.format("%s [%s] successfully created.",
ResourceModel.TYPE_NAME,
createLicenseResponse.licenseArn()
)
);
return createLicenseResponse;
}