private String getExistingSubnetCidr( AuthenticatedContext authenticatedContext, CloudStack stack) { Network network = stack.getNetwork(); return utils.isExistingSubnet(network) ? utils.getExistingSubnetCidr(authenticatedContext, network) : null; }
private List<CloudResourceStatus> updateHeatStack( AuthenticatedContext authenticatedContext, List<CloudResource> resources, String heatTemplate, Map<String, String> parameters) { CloudResource resource = utils.getHeatResource(resources); String stackName = authenticatedContext.getCloudContext().getName(); String heatStackId = resource.getName(); OSClient client = openStackClient.createOSClient(authenticatedContext); StackUpdate updateRequest = Builders.stackUpdate() .template(heatTemplate) .parameters(parameters) .timeoutMins(OPERATION_TIMEOUT) .build(); client.heat().stacks().update(stackName, heatStackId, updateRequest); LOGGER.info( "Heat stack update request sent with stack name: '{}' for Heat stack: '{}'", stackName, heatStackId); return check(authenticatedContext, resources); }
@Override public List<CloudResourceStatus> check( AuthenticatedContext authenticatedContext, List<CloudResource> resources) { List<CloudResourceStatus> result = new ArrayList<>(); OSClient client = openStackClient.createOSClient(authenticatedContext); for (CloudResource resource : resources) { switch (resource.getType()) { case HEAT_STACK: String heatStackId = resource.getName(); String stackName = authenticatedContext.getCloudContext().getName(); LOGGER.info("Checking OpenStack Heat stack status of: {}", stackName); Stack heatStack = client.heat().stacks().getDetails(stackName, heatStackId); CloudResourceStatus heatResourceStatus = utils.heatStatus(resource, heatStack); result.add(heatResourceStatus); break; default: throw new CloudConnectorException( String.format("Invalid resource type: %s", resource.getType())); } } return result; }
private boolean assignFloatingIp(CloudStack stack) { return utils.assignFloatingIp(stack.getNetwork()); }
private boolean isExistingNetwork(CloudStack stack) { return utils.isExistingNetwork(stack.getNetwork()); }