use of com.sequenceiq.cloudbreak.api.model.v2.SecurityGroupV2Request in project cloudbreak by hortonworks.
the class SecurityGroupToSecurityGroupV2RequestConverter method convert.
@Override
public SecurityGroupV2Request convert(SecurityGroup source) {
SecurityGroupV2Request securityGroupV2Request = new SecurityGroupV2Request();
securityGroupV2Request.setSecurityGroupId(source.getSecurityGroupId());
securityGroupV2Request.setSecurityRules(new ArrayList<>());
for (SecurityRule securityRule : source.getSecurityRules()) {
securityGroupV2Request.getSecurityRules().add(getConversionService().convert(securityRule, SecurityRuleRequest.class));
}
return securityGroupV2Request;
}
use of com.sequenceiq.cloudbreak.api.model.v2.SecurityGroupV2Request in project cloudbreak by hortonworks.
the class InstanceGroupV2PreparationTest method createSecurityRequest.
@BeforeMethod(dependsOnGroups = "igRequestCreation")
@Parameters({ "group", "securityRules" })
public void createSecurityRequest(String group, String securityRules) {
IntegrationTestContext itContext = getItContext();
Map<String, InstanceGroupV2Request> igMap = itContext.getContextParam(CloudbreakV2Constants.INSTANCEGROUP_MAP, Map.class);
InstanceGroupV2Request instanceGroupV2Request = igMap.get(group);
SecurityGroupV2Request securityGroupV2Request = new SecurityGroupV2Request();
List<String[]> secRules = templateAdditionHelper.parseCommaSeparatedRows(securityRules);
List<SecurityRuleRequest> secRulesRequests = Lists.newArrayList();
for (String[] secRule : secRules) {
SecurityRuleRequest securityRuleRequest = new SecurityRuleRequest();
securityRuleRequest.setProtocol(secRule[0]);
securityRuleRequest.setSubnet(secRule[1]);
securityRuleRequest.setPorts(secRule[2]);
secRulesRequests.add(securityRuleRequest);
}
securityGroupV2Request.setSecurityRules(secRulesRequests);
instanceGroupV2Request.setSecurityGroup(securityGroupV2Request);
}
use of com.sequenceiq.cloudbreak.api.model.v2.SecurityGroupV2Request in project cloudbreak by hortonworks.
the class CloudProviderHelper method worker.
InstanceGroupV2Request worker(String securityGroupId) {
InstanceGroupV2Request r = new InstanceGroupV2Request();
r.setNodeCount(1);
r.setGroup("worker");
r.setType(InstanceGroupType.CORE);
SecurityGroupV2Request s = new SecurityGroupV2Request();
s.setSecurityGroupId(securityGroupId);
r.setSecurityGroup(s);
r.setTemplate(template());
return r;
}
use of com.sequenceiq.cloudbreak.api.model.v2.SecurityGroupV2Request in project cloudbreak by hortonworks.
the class CloudProviderHelper method compute.
InstanceGroupV2Request compute() {
InstanceGroupV2Request r = new InstanceGroupV2Request();
r.setNodeCount(1);
r.setGroup("compute");
r.setType(InstanceGroupType.CORE);
SecurityGroupV2Request s = new SecurityGroupV2Request();
s.setSecurityRules(rules());
r.setSecurityGroup(s);
r.setTemplate(template());
return r;
}
Aggregations