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;
}
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;
}
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;
}
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;
}
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;
}
Aggregations