use of com.sequenceiq.cloudbreak.cloud.template.context.ResourceBuilderContext in project cloudbreak by hortonworks.
the class AbstractInstanceConnector method start.
@Override
public List<CloudVmInstanceStatus> start(AuthenticatedContext ac, List<CloudResource> resources, List<CloudInstance> vms) {
CloudContext cloudContext = ac.getCloudContext();
Platform platform = cloudContext.getPlatform();
// context
ResourceBuilderContext context = contextBuilders.get(platform).contextInit(cloudContext, ac, null, resources, true);
// compute
return computeResourceService.startInstances(context, ac, resources, vms);
}
use of com.sequenceiq.cloudbreak.cloud.template.context.ResourceBuilderContext in project cloudbreak by hortonworks.
the class AbstractResourceConnector method update.
@Override
public List<CloudResourceStatus> update(AuthenticatedContext auth, CloudStack stack, List<CloudResource> resources) throws Exception {
CloudContext cloudContext = auth.getCloudContext();
Platform platform = cloudContext.getPlatform();
// context
ResourceBuilderContext context = contextBuilders.get(platform).contextInit(cloudContext, auth, stack.getNetwork(), resources, true);
// group
List<CloudResource> groupResources = groupResourceService.getGroupResources(platform, resources);
List<CloudResourceStatus> groupStatuses = groupResourceService.update(context, auth, stack.getNetwork(), stack.getCloudSecurity(), groupResources);
// network
List<CloudResource> networkResources = networkResourceService.getNetworkResources(platform, resources);
List<CloudResourceStatus> networkStatuses = networkResourceService.update(context, auth, stack.getNetwork(), stack.getCloudSecurity(), networkResources);
groupStatuses.addAll(networkStatuses);
return groupStatuses;
}
use of com.sequenceiq.cloudbreak.cloud.template.context.ResourceBuilderContext in project cloudbreak by hortonworks.
the class AbstractResourceConnector method launch.
@Override
public List<CloudResourceStatus> launch(AuthenticatedContext auth, CloudStack stack, PersistenceNotifier notifier, AdjustmentType adjustmentType, Long threshold) throws Exception {
CloudContext cloudContext = auth.getCloudContext();
Platform platform = cloudContext.getPlatform();
// context
ResourceBuilderContext context = contextBuilders.get(platform).contextInit(cloudContext, auth, stack.getNetwork(), null, true);
// network
List<CloudResourceStatus> cloudResourceStatuses = networkResourceService.buildResources(context, auth, stack.getNetwork(), stack.getCloudSecurity());
context.addNetworkResources(getCloudResources(cloudResourceStatuses));
// group
List<CloudResourceStatus> groupStatuses = groupResourceService.buildResources(context, auth, stack.getGroups(), stack.getNetwork(), stack.getCloudSecurity());
cloudResourceStatuses.addAll(groupStatuses);
// compute
List<CloudResourceStatus> computeStatuses = computeResourceService.buildResourcesForLaunch(context, auth, stack.getGroups(), stack.getImage(), stack.getTags(), adjustmentType, threshold);
cloudResourceStatuses.addAll(computeStatuses);
return cloudResourceStatuses;
}
use of com.sequenceiq.cloudbreak.cloud.template.context.ResourceBuilderContext in project cloudbreak by hortonworks.
the class AbstractInstanceConnector method stop.
@Override
public List<CloudVmInstanceStatus> stop(AuthenticatedContext ac, List<CloudResource> resources, List<CloudInstance> vms) {
CloudContext cloudContext = ac.getCloudContext();
Platform platform = cloudContext.getPlatform();
// context
ResourceBuilderContext context = contextBuilders.get(platform).contextInit(cloudContext, ac, null, resources, false);
// compute
return computeResourceService.stopInstances(context, ac, resources, vms);
}
use of com.sequenceiq.cloudbreak.cloud.template.context.ResourceBuilderContext in project cloudbreak by hortonworks.
the class AbstractResourceConnector method terminate.
@Override
public List<CloudResourceStatus> terminate(AuthenticatedContext auth, CloudStack stack, List<CloudResource> cloudResources) throws Exception {
CloudContext cloudContext = auth.getCloudContext();
Platform platform = cloudContext.getPlatform();
// context
ResourceBuilderContext context = contextBuilders.get(platform).contextInit(cloudContext, auth, stack.getNetwork(), cloudResources, false);
// compute
List<CloudResourceStatus> cloudResourceStatuses = computeResourceService.deleteResources(context, auth, cloudResources, false);
// group
List<CloudResourceStatus> groupStatuses = groupResourceService.deleteResources(context, auth, cloudResources, stack.getNetwork(), false);
cloudResourceStatuses.addAll(groupStatuses);
// network
List<CloudResourceStatus> networkStatuses = networkResourceService.deleteResources(context, auth, cloudResources, stack.getNetwork(), false);
cloudResourceStatuses.addAll(networkStatuses);
return cloudResourceStatuses;
}
Aggregations