Search in sources :

Example 6 with RegionWrapper

use of com.sequenceiq.environment.environment.domain.RegionWrapper in project cloudbreak by hortonworks.

the class EnvironmentValidationHandler method validateEnvironment.

private void validateEnvironment(Event<EnvironmentValidationDto> environmentDtoEvent, EnvironmentValidationDto environmentValidationDto, Environment environment) {
    EnvironmentDto environmentDto = environmentValidationDto.getEnvironmentDto();
    RegionWrapper regionWrapper = environment.getRegionWrapper();
    CloudRegions cloudRegions = environmentService.getRegionsByEnvironment(environment);
    ValidationResult.ValidationResultBuilder validationBuilder = validatorService.validateRegionsAndLocation(regionWrapper.getName(), regionWrapper.getRegions(), environment, cloudRegions);
    validationBuilder.merge(validatorService.validateTelemetryLoggingStorageLocation(environment));
    validationBuilder.merge(validatorService.validateTelemetryLoggingStorageConfig(environment));
    validationBuilder.merge(validatorService.validateBackupStorageLocation(environment));
    validationBuilder.merge(validatorService.validateBackupStorageConfig(environment));
    validationBuilder.merge(validatorService.validateParameters(environmentValidationDto, environmentDto.getParameters()));
    validationBuilder.merge(validatorService.validateNetworkWithProvider(environmentValidationDto));
    validationBuilder.merge(validatorService.validateAuthentication(environmentValidationDto));
    validationBuilder.merge(validatorService.validateAwsKeysPresent(environmentValidationDto));
    ValidationResult validationResult = validationBuilder.build();
    if (validationResult.hasError()) {
        throw new EnvironmentServiceException(validationResult.getFormattedErrors());
    }
}
Also used : EnvironmentDto(com.sequenceiq.environment.environment.dto.EnvironmentDto) CloudRegions(com.sequenceiq.cloudbreak.cloud.model.CloudRegions) EnvironmentServiceException(com.sequenceiq.environment.exception.EnvironmentServiceException) ValidationResult(com.sequenceiq.cloudbreak.validation.ValidationResult) RegionWrapper(com.sequenceiq.environment.environment.domain.RegionWrapper)

Aggregations

RegionWrapper (com.sequenceiq.environment.environment.domain.RegionWrapper)6 CloudRegions (com.sequenceiq.cloudbreak.cloud.model.CloudRegions)3 Test (org.junit.jupiter.api.Test)3 EnvironmentDto (com.sequenceiq.environment.environment.dto.EnvironmentDto)2 Lists (com.google.common.collect.Lists)1 CompositeAuthResourcePropertyProvider (com.sequenceiq.authorization.service.CompositeAuthResourcePropertyProvider)1 EnvironmentPropertyProvider (com.sequenceiq.authorization.service.EnvironmentPropertyProvider)1 OwnerAssignmentService (com.sequenceiq.authorization.service.OwnerAssignmentService)1 ResourceWithId (com.sequenceiq.authorization.service.list.ResourceWithId)1 ThreadBasedUserCrnProvider (com.sequenceiq.cloudbreak.auth.ThreadBasedUserCrnProvider)1 GrpcUmsClient (com.sequenceiq.cloudbreak.auth.altus.GrpcUmsClient)1 RoleCrnGenerator (com.sequenceiq.cloudbreak.auth.altus.service.RoleCrnGenerator)1 Crn (com.sequenceiq.cloudbreak.auth.crn.Crn)1 RegionAwareInternalCrnGeneratorFactory (com.sequenceiq.cloudbreak.auth.crn.RegionAwareInternalCrnGeneratorFactory)1 Coordinate (com.sequenceiq.cloudbreak.cloud.model.Coordinate)1 AccountAwareResourceRepository (com.sequenceiq.cloudbreak.common.dal.repository.AccountAwareResourceRepository)1 PayloadContext (com.sequenceiq.cloudbreak.common.event.PayloadContext)1 NotFoundException (com.sequenceiq.cloudbreak.common.exception.NotFoundException)1 NotFoundException.notFound (com.sequenceiq.cloudbreak.common.exception.NotFoundException.notFound)1 NotFoundException.notFoundException (com.sequenceiq.cloudbreak.common.exception.NotFoundException.notFoundException)1