Search in sources :

Example 6 with InstanceGroupV2Request

use of com.sequenceiq.cloudbreak.api.model.v2.InstanceGroupV2Request in project cloudbreak by hortonworks.

the class CloudProviderHelper method worker.

InstanceGroupV2Request worker() {
    InstanceGroupV2Request r = new InstanceGroupV2Request();
    r.setNodeCount(1);
    r.setGroup("worker");
    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)

Example 7 with InstanceGroupV2Request

use of com.sequenceiq.cloudbreak.api.model.v2.InstanceGroupV2Request in project cloudbreak by hortonworks.

the class CloudProviderHelper method compute.

InstanceGroupV2Request compute(String securityGroupId) {
    InstanceGroupV2Request r = new InstanceGroupV2Request();
    r.setNodeCount(1);
    r.setGroup("compute");
    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 8 with InstanceGroupV2Request

use of com.sequenceiq.cloudbreak.api.model.v2.InstanceGroupV2Request in project cloudbreak by hortonworks.

the class StackV2RequestToStackRequestConverter method convert.

@Override
public StackRequest convert(StackV2Request source) {
    StackRequest stackRequest = new StackRequest();
    stackRequest.setName(source.getGeneral().getName());
    if (source.getPlacement() != null) {
        stackRequest.setAvailabilityZone(source.getPlacement().getAvailabilityZone());
        stackRequest.setRegion(source.getPlacement().getRegion());
    }
    stackRequest.setPlatformVariant(source.getPlatformVariant());
    stackRequest.setAmbariVersion(source.getAmbariVersion());
    stackRequest.setHdpVersion(source.getHdpVersion());
    stackRequest.setParameters(convertParameters(source.getParameters()));
    if (source.getCustomDomain() != null) {
        stackRequest.setCustomDomain(source.getCustomDomain().getCustomDomain());
        stackRequest.setCustomHostname(source.getCustomDomain().getCustomHostname());
        stackRequest.setClusterNameAsSubdomain(source.getCustomDomain().isClusterNameAsSubdomain());
        stackRequest.setHostgroupNameAsHostname(source.getCustomDomain().isHostgroupNameAsHostname());
    }
    if (source.getTags() != null) {
        stackRequest.setApplicationTags(source.getTags().getApplicationTags());
        stackRequest.setDefaultTags(source.getTags().getDefaultTags());
        stackRequest.setUserDefinedTags(source.getTags().getUserDefinedTags());
    }
    stackRequest.setInstanceGroups(new ArrayList<>());
    for (InstanceGroupV2Request instanceGroupV2Request : source.getInstanceGroups()) {
        InstanceGroupRequest convert = conversionService.convert(instanceGroupV2Request, InstanceGroupRequest.class);
        stackRequest.getInstanceGroups().add(convert);
    }
    stackRequest.setFailurePolicy(source.getFailurePolicy());
    stackRequest.setStackAuthentication(source.getStackAuthentication());
    stackRequest.setNetwork(conversionService.convert(source.getNetwork(), NetworkRequest.class));
    OrchestratorRequest orchestrator = new OrchestratorRequest();
    orchestrator.setType("SALT");
    stackRequest.setOrchestrator(orchestrator);
    if (source.getImageSettings() != null) {
        stackRequest.setImageCatalog(source.getImageSettings().getImageCatalog());
        stackRequest.setImageId(source.getImageSettings().getImageId());
    }
    stackRequest.setFlexId(source.getFlexId());
    stackRequest.setCredentialName(source.getGeneral().getCredentialName());
    stackRequest.setOwner(Strings.isNullOrEmpty(source.getOwner()) ? authenticatedUserService.getCbUser().getUserId() : source.getOwner());
    stackRequest.setAccount(Strings.isNullOrEmpty(source.getAccount()) ? authenticatedUserService.getCbUser().getAccount() : source.getAccount());
    stackRequest.setOwnerEmail(Strings.isNullOrEmpty(source.getOwnerEmail()) ? authenticatedUserService.getCbUser().getUsername() : source.getOwnerEmail());
    convertClusterRequest(source, stackRequest);
    stackRequest.setCloudPlatform(credentialService.get(stackRequest.getCredentialName(), stackRequest.getAccount()).cloudPlatform());
    return stackRequest;
}
Also used : InstanceGroupV2Request(com.sequenceiq.cloudbreak.api.model.v2.InstanceGroupV2Request) InstanceGroupRequest(com.sequenceiq.cloudbreak.api.model.InstanceGroupRequest) OrchestratorRequest(com.sequenceiq.cloudbreak.api.model.OrchestratorRequest) NetworkRequest(com.sequenceiq.cloudbreak.api.model.NetworkRequest) StackRequest(com.sequenceiq.cloudbreak.api.model.StackRequest)

Example 9 with InstanceGroupV2Request

use of com.sequenceiq.cloudbreak.api.model.v2.InstanceGroupV2Request in project cloudbreak by hortonworks.

the class InstanceGroupV2RequestToHostGroupRequestConverterTest method createSource.

@Override
public InstanceGroupV2Request createSource() {
    InstanceGroupV2Request instanceGroupV2Request = new InstanceGroupV2Request();
    instanceGroupV2Request.setGroup("master");
    instanceGroupV2Request.setNodeCount(4);
    instanceGroupV2Request.setParameters(new HashMap<>());
    instanceGroupV2Request.setRecipeNames(Sets.newHashSet(Arrays.asList("recipe1", "recipe2")));
    instanceGroupV2Request.setRecoveryMode(RecoveryMode.MANUAL);
    instanceGroupV2Request.setType(InstanceGroupType.CORE);
    TemplateV2Request templateV2Request = new TemplateV2Request();
    templateV2Request.setInstanceType("m4.xlarge");
    templateV2Request.setParameters(new HashMap<>());
    templateV2Request.setVolumeCount(1);
    templateV2Request.setVolumeSize(100);
    templateV2Request.setVolumeType("ebs");
    instanceGroupV2Request.setTemplate(templateV2Request);
    SecurityGroupV2Request securityGroupV2Request = new SecurityGroupV2Request();
    securityGroupV2Request.setSecurityGroupId("groupid");
    securityGroupV2Request.setSecurityRules(new ArrayList<>());
    instanceGroupV2Request.setSecurityGroup(securityGroupV2Request);
    return instanceGroupV2Request;
}
Also used : InstanceGroupV2Request(com.sequenceiq.cloudbreak.api.model.v2.InstanceGroupV2Request) SecurityGroupV2Request(com.sequenceiq.cloudbreak.api.model.v2.SecurityGroupV2Request) TemplateV2Request(com.sequenceiq.cloudbreak.api.model.v2.TemplateV2Request)

Example 10 with InstanceGroupV2Request

use of com.sequenceiq.cloudbreak.api.model.v2.InstanceGroupV2Request in project cloudbreak by hortonworks.

the class StackToStackV2RequestConverter method convert.

@Override
public StackV2Request convert(Stack source) {
    StackV2Request stackV2Request = new StackV2Request();
    stackV2Request.setGeneral(getGeneralSettings("", source.getCredential().getName()));
    stackV2Request.setPlacement(getPlacementSettings(source.getRegion(), source.getAvailabilityZone()));
    stackV2Request.setCustomDomain(getCustomDomainSettings(source.getCustomDomain(), source.getCustomHostname(), source.isHostgroupNameAsHostname(), source.isClusterNameAsSubdomain()));
    stackV2Request.setFlexId(source.getFlexSubscription() == null ? null : source.getFlexSubscription().getId());
    stackV2Request.setParameters(source.getParameters());
    stackV2Request.setInstanceGroups(new ArrayList<>());
    stackV2Request.setStackAuthentication(getConversionService().convert(source.getStackAuthentication(), StackAuthenticationRequest.class));
    stackV2Request.setNetwork(getConversionService().convert(source.getNetwork(), NetworkV2Request.class));
    stackV2Request.setCluster(getConversionService().convert(source.getCluster(), ClusterV2Request.class));
    for (InstanceGroup instanceGroup : source.getInstanceGroups()) {
        InstanceGroupV2Request instanceGroupV2Request = getConversionService().convert(instanceGroup, InstanceGroupV2Request.class);
        instanceGroupV2Request = collectInformationsFromActualHostgroup(source, instanceGroup, instanceGroupV2Request);
        stackV2Request.getInstanceGroups().add(instanceGroupV2Request);
    }
    prepareImage(source, stackV2Request);
    prepareTags(source, stackV2Request);
    return stackV2Request;
}
Also used : StackAuthenticationRequest(com.sequenceiq.cloudbreak.api.model.StackAuthenticationRequest) StackV2Request(com.sequenceiq.cloudbreak.api.model.v2.StackV2Request) InstanceGroupV2Request(com.sequenceiq.cloudbreak.api.model.v2.InstanceGroupV2Request) ClusterV2Request(com.sequenceiq.cloudbreak.api.model.v2.ClusterV2Request) NetworkV2Request(com.sequenceiq.cloudbreak.api.model.v2.NetworkV2Request) InstanceGroup(com.sequenceiq.cloudbreak.domain.InstanceGroup)

Aggregations

InstanceGroupV2Request (com.sequenceiq.cloudbreak.api.model.v2.InstanceGroupV2Request)22 SecurityGroupV2Request (com.sequenceiq.cloudbreak.api.model.v2.SecurityGroupV2Request)9 IntegrationTestContext (com.sequenceiq.it.IntegrationTestContext)9 Parameters (org.testng.annotations.Parameters)9 BeforeClass (org.testng.annotations.BeforeClass)5 BeforeMethod (org.testng.annotations.BeforeMethod)4 TemplateV2Request (com.sequenceiq.cloudbreak.api.model.v2.TemplateV2Request)3 HostGroupRequest (com.sequenceiq.cloudbreak.api.model.HostGroupRequest)2 StackV2Request (com.sequenceiq.cloudbreak.api.model.v2.StackV2Request)2 ClusterRequest (com.sequenceiq.cloudbreak.api.model.ClusterRequest)1 ConstraintJson (com.sequenceiq.cloudbreak.api.model.ConstraintJson)1 InstanceGroupRequest (com.sequenceiq.cloudbreak.api.model.InstanceGroupRequest)1 NetworkRequest (com.sequenceiq.cloudbreak.api.model.NetworkRequest)1 OrchestratorRequest (com.sequenceiq.cloudbreak.api.model.OrchestratorRequest)1 SecurityRuleRequest (com.sequenceiq.cloudbreak.api.model.SecurityRuleRequest)1 StackAuthenticationRequest (com.sequenceiq.cloudbreak.api.model.StackAuthenticationRequest)1 StackRequest (com.sequenceiq.cloudbreak.api.model.StackRequest)1 UpdateClusterJson (com.sequenceiq.cloudbreak.api.model.UpdateClusterJson)1 ClusterV2Request (com.sequenceiq.cloudbreak.api.model.v2.ClusterV2Request)1 GeneralSettings (com.sequenceiq.cloudbreak.api.model.v2.GeneralSettings)1