use of org.onap.so.openstack.mappers.StackInfoMapper in project so by onap.
the class MsoHeatUtils method deleteStack.
/**
* Delete a stack (by Name/ID) in a tenant. If the stack is not found, it will be considered a successful deletion.
* The return value is a StackInfo object which contains the current stack status.
*
* The client may choose to let the adapter poll Openstack for completion of the stack deletion, or may handle
* polling itself via separate query calls. In either case, a StackInfo object will be returned. When polling is
* enabled, a final status of NOTFOUND is expected. When not polling, a status of DELETING is expected.
*
* There is no rollback from a successful stack deletion. A deletion failure will also result in an undefined stack
* state - the components may or may not have been all or partially deleted, so the resulting stack must be
* considered invalid.
*
* @param tenantId The Openstack ID of the tenant in which to perform the delete
* @param cloudOwner the cloud owner of the cloud site in which to delete the stack
* @param cloudSiteId The cloud identifier (may be a region) from which to delete the stack.
* @param stackName The name/id of the stack to delete. May be simple or canonical
* @param pollForCompletion Indicator that polling should be handled in Java vs. in the client
* @return A StackInfo object
* @throws MsoOpenstackException Thrown if the Openstack API call returns an exception.
* @throws MsoCloudSiteNotFound
*/
public StackInfo deleteStack(String tenantId, String cloudOwner, String cloudSiteId, String stackName, boolean pollForCompletion, int timeoutMinutes) throws MsoException {
Stack currentStack = queryHeatStack(stackName, cloudSiteId, tenantId);
StackInfo stackInfo = null;
if (currentStack == null || DELETE_COMPLETE.equals(currentStack.getStackStatus())) {
stackInfo = new StackInfo(stackName, HeatStatus.NOTFOUND);
stackInfo.setOperationPerformed(false);
} else {
currentStack = deleteStack(currentStack, timeoutMinutes, cloudSiteId, tenantId, pollForCompletion);
stackInfo = new StackInfoMapper(currentStack).map();
stackInfo.setName(stackName);
stackInfo.setOperationPerformed(true);
if (currentStack != null) {
stackInfo.setCanonicalName(currentStack.getStackName() + "/" + currentStack.getId());
}
}
return stackInfo;
}
use of org.onap.so.openstack.mappers.StackInfoMapper in project so by onap.
the class PollService method pollCreateResource.
private StackInfo pollCreateResource(int pollingTimeout, String cloudSiteId, String tenantId, String stackId, MutableBoolean success) throws MsoException {
Stack currentStack = createCurrentStack(stackId);
Stack stack = msoHeatUtils.pollStackForStatus(pollingTimeout, currentStack, "CREATE_IN_PROGRESS", cloudSiteId, tenantId, false);
msoHeatUtils.postProcessStackCreate(stack, false, 0, false, cloudSiteId, tenantId, null);
success.setTrue();
return new StackInfoMapper(stack).map();
}
Aggregations