use of com.sequenceiq.environment.api.v1.environment.model.request.EnvironmentRequest in project cloudbreak by hortonworks.
the class EnvironmentValidatorService method validateAwsEnvironmentRequest.
public ValidationResult validateAwsEnvironmentRequest(EnvironmentRequest environmentRequest) {
ValidationResultBuilder resultBuilder = new ValidationResultBuilder();
String accountId = ThreadBasedUserCrnProvider.getAccountId();
String cloudPlatform = credentialService.getCloudPlatformByCredential(environmentRequest.getCredentialName(), accountId, ENVIRONMENT);
resultBuilder.ifError(() -> !AWS.name().equalsIgnoreCase(cloudPlatform), "Environment request is not for cloud platform AWS.");
resultBuilder.ifError(() -> StringUtils.isBlank(Optional.ofNullable(environmentRequest.getAws()).map(AwsEnvironmentParameters::getS3guard).map(S3GuardRequestParameters::getDynamoDbTableName).orElse(null)), "S3Guard Dynamo DB table name is not found in environment request.");
return resultBuilder.build();
}
Aggregations