use of com.sequenceiq.cloudbreak.cloud.template.context.ResourceBuilderContext in project cloudbreak by hortonworks.
the class AbstractResourceConnector method upscale.
@Override
public List<CloudResourceStatus> upscale(AuthenticatedContext auth, CloudStack stack, List<CloudResource> resources) {
CloudContext cloudContext = auth.getCloudContext();
Platform platform = cloudContext.getPlatform();
// context
ResourceBuilderContext context = contextBuilders.get(platform).contextInit(cloudContext, auth, stack.getNetwork(), resources, true);
// network
context.addNetworkResources(networkResourceService.getNetworkResources(platform, resources));
Group scalingGroup = getScalingGroup(getGroup(stack.getGroups(), getGroupName(stack)));
// group
context.addGroupResources(scalingGroup.getName(), groupResourceService.getGroupResources(platform, resources));
// compute
return computeResourceService.buildResourcesForUpscale(context, auth, Collections.singletonList(scalingGroup), stack.getImage(), stack.getTags());
}
use of com.sequenceiq.cloudbreak.cloud.template.context.ResourceBuilderContext in project cloudbreak by hortonworks.
the class AbstractResourceConnector method downscale.
@Override
public List<CloudResourceStatus> downscale(AuthenticatedContext auth, CloudStack stack, List<CloudResource> resources, List<CloudInstance> vms, List<CloudResource> resourcesToRemove) {
CloudContext cloudContext = auth.getCloudContext();
Platform platform = cloudContext.getPlatform();
// context
ResourceBuilderContext context = contextBuilders.get(platform).contextInit(cloudContext, auth, stack.getNetwork(), resources, false);
// compute
return computeResourceService.deleteResources(context, auth, resourcesToRemove, true);
}
Aggregations