Search in sources :

Example 6 with SecurityGroupV2Request

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;
}
Also used : SecurityGroupV2Request(com.sequenceiq.cloudbreak.api.model.v2.SecurityGroupV2Request) SecurityRuleRequest(com.sequenceiq.cloudbreak.api.model.SecurityRuleRequest) SecurityRule(com.sequenceiq.cloudbreak.domain.SecurityRule)

Example 7 with 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);
}
Also used : IntegrationTestContext(com.sequenceiq.it.IntegrationTestContext) InstanceGroupV2Request(com.sequenceiq.cloudbreak.api.model.v2.InstanceGroupV2Request) SecurityGroupV2Request(com.sequenceiq.cloudbreak.api.model.v2.SecurityGroupV2Request) SecurityRuleRequest(com.sequenceiq.cloudbreak.api.model.SecurityRuleRequest) Parameters(org.testng.annotations.Parameters) BeforeMethod(org.testng.annotations.BeforeMethod)

Example 8 with 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;
}
Also used : InstanceGroupV2Request(com.sequenceiq.cloudbreak.api.model.v2.InstanceGroupV2Request) SecurityGroupV2Request(com.sequenceiq.cloudbreak.api.model.v2.SecurityGroupV2Request)

Example 9 with SecurityGroupV2Request

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;
}
Also used : InstanceGroupV2Request(com.sequenceiq.cloudbreak.api.model.v2.InstanceGroupV2Request) SecurityGroupV2Request(com.sequenceiq.cloudbreak.api.model.v2.SecurityGroupV2Request)

Aggregations

SecurityGroupV2Request (com.sequenceiq.cloudbreak.api.model.v2.SecurityGroupV2Request)9 InstanceGroupV2Request (com.sequenceiq.cloudbreak.api.model.v2.InstanceGroupV2Request)8 SecurityRuleRequest (com.sequenceiq.cloudbreak.api.model.SecurityRuleRequest)2 TemplateV2Request (com.sequenceiq.cloudbreak.api.model.v2.TemplateV2Request)1 SecurityRule (com.sequenceiq.cloudbreak.domain.SecurityRule)1 IntegrationTestContext (com.sequenceiq.it.IntegrationTestContext)1 BeforeMethod (org.testng.annotations.BeforeMethod)1 Parameters (org.testng.annotations.Parameters)1