use of com.sequenceiq.environment.environment.dto.SecurityAccessDto in project cloudbreak by hortonworks.
the class AzureEnvironmentSecurityGroupValidator method validate.
@Override
public void validate(EnvironmentValidationDto environmentValidationDto, ValidationResult.ValidationResultBuilder resultBuilder) {
EnvironmentDto environmentDto = environmentValidationDto.getEnvironmentDto();
SecurityAccessDto securityAccessDto = environmentDto.getSecurityAccess();
if (securityAccessDto != null) {
if (onlyOneSecurityGroupIdDefined(securityAccessDto)) {
resultBuilder.error(securityGroupIdsMustBePresent());
} else if (isSecurityGroupIdDefined(securityAccessDto)) {
if (!Strings.isNullOrEmpty(securityAccessDto.getDefaultSecurityGroupId())) {
validateSecurityGroup(environmentDto, resultBuilder, securityAccessDto.getDefaultSecurityGroupId());
}
if (!Strings.isNullOrEmpty(securityAccessDto.getSecurityGroupIdForKnox())) {
validateSecurityGroup(environmentDto, resultBuilder, securityAccessDto.getSecurityGroupIdForKnox());
}
}
}
}
use of com.sequenceiq.environment.environment.dto.SecurityAccessDto in project cloudbreak by hortonworks.
the class EnvironmentNetworkProviderValidator method validateSecurityGroup.
private void validateSecurityGroup(EnvironmentValidationDto environmentValidationDto, String cloudPlatform, ValidationResultBuilder resultBuilder) {
EnvironmentDto environmentDto = environmentValidationDto.getEnvironmentDto();
SecurityAccessDto securityAccess = environmentDto.getSecurityAccess();
NetworkDto networkDto = environmentDto.getNetwork();
if (securityAccess != null && networkDto != null) {
EnvironmentSecurityGroupValidator environmentSecurityGroupValidator = environmentSecurityGroupValidatorsByCloudPlatform.get(valueOf(cloudPlatform));
if (environmentSecurityGroupValidator != null) {
environmentSecurityGroupValidator.validate(environmentValidationDto, resultBuilder);
} else if (!MOCK.equalsIgnoreCase(cloudPlatform) && !YARN.equalsIgnoreCase(cloudPlatform) && !GCP.equalsIgnoreCase(cloudPlatform)) {
resultBuilder.error(String.format("Environment specific security group is not supported for cloud platform: '%s'!", cloudPlatform));
}
}
}
Aggregations