class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin {

    public StackInfo deleteStack(String cloudSiteId, String cloudOwner, String tenantId, String instanceId)
            throws MsoException {
        if (logger.isDebugEnabled()) {
            logger.debug(String.format("Delete multicloud HEAT stack: %s in tenant %s", instanceId, tenantId));
        }
        String stackName = null;
        String stackId = null;
        int offset = instanceId.indexOf('/');
        if (offset > 0 && offset < (instanceId.length() - 1)) {
            stackName = instanceId.substring(0, offset);
            stackId = instanceId.substring(offset + 1);
        } else {
            stackName = instanceId;
            stackId = instanceId;
        }

        StackInfo returnInfo = new StackInfo();
        returnInfo.setName(stackName);
        Response response = null;

        String multicloudEndpoint = getMulticloudEndpoint(cloudSiteId, cloudOwner, stackId, false);
        RestClient multicloudClient = getMulticloudClient(multicloudEndpoint, tenantId);

        if (multicloudClient != null) {
            response = multicloudClient.delete();
            if (logger.isDebugEnabled()) {
                logger.debug(String.format("Multicloud Delete response is: %s", response.getEntity().toString()));
            }

            if (response.getStatus() == Response.Status.NOT_FOUND.getStatusCode()) {
                returnInfo.setStatus(HeatStatus.NOTFOUND);
                returnInfo.setStatusMessage(response.getStatusInfo().getReasonPhrase());
            } else if (response.getStatus() == Response.Status.NO_CONTENT.getStatusCode()) {
                return getStackStatus(cloudSiteId, cloudOwner, tenantId, instanceId);
            } else {
                returnInfo.setStatus(HeatStatus.FAILED);
                returnInfo.setStatusMessage(response.getStatusInfo().getReasonPhrase());
            }

        }
        returnInfo.setStatus(mapResponseToHeatStatus(response));
        return returnInfo;
    }

}