in aws-licensemanager-grant/src/main/java/software/amazon/licensemanager/grant/CreateHandler.java [67:97]
private CreateGrantResponse createGrant(
ProgressEvent<ResourceModel, CallbackContext> progress,
ProxyClient<LicenseManagerClient> client,
CreateGrantRequest awsRequest,
ResourceModel model,
ResourceHandlerRequest<ResourceModel> request) {
CreateGrantResponse createGrantResponse;
try {
createGrantResponse = client.injectCredentialsAndInvokeV2(awsRequest, client.client()::createGrant);
} 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,
createGrantResponse.grantArn()
)
);
return createGrantResponse;
}