use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.environment.placement.PlacementSettingsV4Request in project cloudbreak by hortonworks.
the class StackToStackV4RequestConverter method getPlacementSettings.
private PlacementSettingsV4Request getPlacementSettings(String region, String availabilityZone) {
PlacementSettingsV4Request ps = new PlacementSettingsV4Request();
ps.setRegion(region);
ps.setAvailabilityZone(availabilityZone);
return ps;
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.environment.placement.PlacementSettingsV4Request in project cloudbreak by hortonworks.
the class StackV4RequestToTemplatePreparationObjectConverter method decorateBuilderWithPlacement.
private void decorateBuilderWithPlacement(StackV4Request source, Builder builder) {
PlacementSettingsV4Request placementSettings = source.getPlacement();
if (placementSettings != null) {
String region = placementSettings.getRegion();
builder.withPlacementView(new PlacementView(region, region));
}
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.environment.placement.PlacementSettingsV4Request in project cloudbreak by hortonworks.
the class StackDecorator method prepareInstanceGroups.
private void prepareInstanceGroups(Stack subject, StackV4Request request, Credential credential, User user, DetailedEnvironmentResponse environment) {
Map<String, InstanceGroupParameterResponse> instanceGroupParameterResponse = cloudParameterService.getInstanceGroupParameters(extendedCloudCredentialConverter.convert(credential), getInstanceGroupParameterRequests(subject));
CloudbreakUser cloudbreakUser = legacyRestRequestThreadLocalService.getCloudbreakUser();
subject.getInstanceGroups().parallelStream().forEach(instanceGroup -> {
subject.getCluster().getHostGroups().stream().filter(hostGroup -> hostGroup.getName().equals(instanceGroup.getGroupName())).forEach(hostGroup -> hostGroup.setInstanceGroup(instanceGroup));
legacyRestRequestThreadLocalService.setCloudbreakUser(cloudbreakUser);
updateInstanceGroupParameters(instanceGroupParameterResponse, instanceGroup);
if (instanceGroup.getTemplate() != null) {
Template template = instanceGroup.getTemplate();
if (template.getId() == null) {
template.setCloudPlatform(credential.cloudPlatform());
PlacementSettingsV4Request placement = request.getPlacement();
String availabilityZone = placement != null ? placement.getAvailabilityZone() : subject.getAvailabilityZone();
String region = placement != null ? placement.getRegion() : subject.getRegion();
CdpResourceType cdpResourceType = cdpResourceTypeProvider.fromStackType(request.getType());
template = templateDecorator.decorate(credential, template, region, availabilityZone, subject.getPlatformVariant(), cdpResourceType);
template.setWorkspace(subject.getWorkspace());
setupDatabaseAttachedVolume(subject, instanceGroup, template);
template = templateService.create(user, template);
instanceGroup.setTemplate(template);
}
}
if (instanceGroup.getSecurityGroup() != null) {
SecurityGroup securityGroup = instanceGroup.getSecurityGroup();
if (securityGroup.getId() == null) {
securityGroup.setCloudPlatform(credential.cloudPlatform());
securityGroup.setWorkspace(subject.getWorkspace());
securityGroup = securityGroupService.create(user, securityGroup);
instanceGroup.setSecurityGroup(securityGroup);
}
}
if (instanceGroup.getInstanceGroupNetwork() != null) {
InstanceGroupNetwork ign = instanceGroup.getInstanceGroupNetwork();
instanceGroup.setAvailabilityZones(getAvailabilityZoneFromEnv(instanceGroup, environment));
if (ign.getId() == null) {
ign.setCloudPlatform(credential.cloudPlatform());
ign = instanceGroupNetworkService.create(ign);
instanceGroup.setInstanceGroupNetwork(ign);
}
}
});
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.environment.placement.PlacementSettingsV4Request in project cloudbreak by hortonworks.
the class FreeIpaTestDto method withPlacement.
private FreeIpaTestDto withPlacement(PlacementSettingsTestDto placementSettings) {
PlacementSettingsV4Request request = placementSettings.getRequest();
getRequest().setPlacement(new PlacementRequest().withAvailabilityZone(request.getAvailabilityZone()).withRegion(request.getRegion()));
return this;
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.environment.placement.PlacementSettingsV4Request in project cloudbreak by hortonworks.
the class DistroXV1RequestToStackV4RequestConverter method preparePlacement.
private PlacementSettingsV4Request preparePlacement(DetailedEnvironmentResponse environment) {
if (!CloudPlatform.YARN.name().equals(environment.getCloudPlatform())) {
PlacementSettingsV4Request ret = new PlacementSettingsV4Request();
ret.setRegion(getRegionFromEnv(environment));
ret.setAvailabilityZone(getAvailabilityZoneFromEnv(environment));
return ret;
}
return null;
}
Aggregations