Search in sources :

Example 1 with CustomServicesWorkflowRestRep

use of com.emc.storageos.model.customservices.CustomServicesWorkflowRestRep in project coprhd-controller by CoprHD.

the class WorkflowBuilder method getWorkflow.

public static void getWorkflow(final URI workflowId) {
    CustomServicesWorkflowRestRep customServicesWorkflowRestRep = getCatalogClient().customServicesPrimitives().getWorkflow(workflowId);
    renderJSON(customServicesWorkflowRestRep);
}
Also used : CustomServicesWorkflowRestRep(com.emc.storageos.model.customservices.CustomServicesWorkflowRestRep)

Example 2 with CustomServicesWorkflowRestRep

use of com.emc.storageos.model.customservices.CustomServicesWorkflowRestRep in project coprhd-controller by CoprHD.

the class WorkflowBuilder method updateWorkflowInventoryFiles.

private static boolean updateWorkflowInventoryFiles(final String localAnsiblePrimitiveId) {
    boolean updatedWorkflows = false;
    final CustomServicesWorkflowList customServicesWorkflowList = getCatalogClient().customServicesPrimitives().getWorkflows(localAnsiblePrimitiveId);
    if (customServicesWorkflowList != null && CollectionUtils.isNotEmpty(customServicesWorkflowList.getWorkflows())) {
        for (final NamedRelatedResourceRep resourceRep : customServicesWorkflowList.getWorkflows()) {
            final URI workflowId = resourceRep.getId();
            final CustomServicesWorkflowRestRep customServicesWorkflowRestRep = getCatalogClient().customServicesPrimitives().getWorkflow(workflowId);
            if (null != customServicesWorkflowRestRep) {
                Logger.info("Updating workflow {} with new host inventory files", workflowId);
                final CustomServicesWorkflowUpdateParam param = new CustomServicesWorkflowUpdateParam();
                for (final CustomServicesWorkflowDocument.Step step : customServicesWorkflowRestRep.getDocument().getSteps()) {
                    addInventoryFileInputs(step);
                }
                param.setDocument(customServicesWorkflowRestRep.getDocument());
                getCatalogClient().customServicesPrimitives().editWorkflow(workflowId, param);
                updatedWorkflows = true;
            }
        }
    }
    return updatedWorkflows;
}
Also used : CustomServicesWorkflowDocument(com.emc.storageos.model.customservices.CustomServicesWorkflowDocument) CustomServicesWorkflowList(com.emc.storageos.model.customservices.CustomServicesWorkflowList) CustomServicesWorkflowRestRep(com.emc.storageos.model.customservices.CustomServicesWorkflowRestRep) NamedRelatedResourceRep(com.emc.storageos.model.NamedRelatedResourceRep) URI(java.net.URI) CustomServicesWorkflowUpdateParam(com.emc.storageos.model.customservices.CustomServicesWorkflowUpdateParam)

Example 3 with CustomServicesWorkflowRestRep

use of com.emc.storageos.model.customservices.CustomServicesWorkflowRestRep in project coprhd-controller by CoprHD.

the class WorkflowBuilder method createWorkflow.

public static void createWorkflow(final String workflowName, final String dirID) throws URISyntaxException {
    // Create workflow with just name
    final CustomServicesWorkflowCreateParam param = new CustomServicesWorkflowCreateParam();
    final CustomServicesWorkflowDocument document = new CustomServicesWorkflowDocument();
    document.setName(workflowName);
    List<CustomServicesWorkflowDocument.Step> steps = getStartEndSteps();
    document.setSteps(steps);
    param.setDocument(document);
    final CustomServicesWorkflowRestRep customServicesWorkflowRestRep = getCatalogClient().customServicesPrimitives().createWorkflow(param);
    // Add this workflowid to directory
    if (null != customServicesWorkflowRestRep) {
        addResourceToWFDirectory(customServicesWorkflowRestRep.getId(), dirID);
    } else {
        flash.error("Error creating workflow");
    }
    renderJSON(customServicesWorkflowRestRep);
}
Also used : CustomServicesWorkflowCreateParam(com.emc.storageos.model.customservices.CustomServicesWorkflowCreateParam) CustomServicesWorkflowDocument(com.emc.storageos.model.customservices.CustomServicesWorkflowDocument) CustomServicesWorkflowRestRep(com.emc.storageos.model.customservices.CustomServicesWorkflowRestRep)

Example 4 with CustomServicesWorkflowRestRep

use of com.emc.storageos.model.customservices.CustomServicesWorkflowRestRep in project coprhd-controller by CoprHD.

the class WorkflowBuilder method saveWorkflow.

public static void saveWorkflow(final URI workflowId, final CustomServicesWorkflowDocument workflowDoc) {
    final CustomServicesWorkflowUpdateParam param = new CustomServicesWorkflowUpdateParam();
    for (final CustomServicesWorkflowDocument.Step step : workflowDoc.getSteps()) {
        final String success_criteria = ESAPI.encoder().decodeForHTML(step.getSuccessCriteria());
        step.setSuccessCriteria(success_criteria);
        // If this workflow has any ansible steps add host_file input
        addInventoryFileInputs(step);
    }
    param.setDocument(workflowDoc);
    final CustomServicesWorkflowRestRep customServicesWorkflowRestRep = getCatalogClient().customServicesPrimitives().editWorkflow(workflowId, param);
}
Also used : CustomServicesWorkflowDocument(com.emc.storageos.model.customservices.CustomServicesWorkflowDocument) CustomServicesWorkflowRestRep(com.emc.storageos.model.customservices.CustomServicesWorkflowRestRep) CustomServicesWorkflowUpdateParam(com.emc.storageos.model.customservices.CustomServicesWorkflowUpdateParam)

Example 5 with CustomServicesWorkflowRestRep

use of com.emc.storageos.model.customservices.CustomServicesWorkflowRestRep in project coprhd-controller by CoprHD.

the class WorkflowBuilder method publishWorkflow.

public static void publishWorkflow(final URI workflowId) {
    CustomServicesWorkflowRestRep customServicesWorkflowRestRep = getCatalogClient().customServicesPrimitives().publishWorkflow(workflowId);
    renderJSON(customServicesWorkflowRestRep);
}
Also used : CustomServicesWorkflowRestRep(com.emc.storageos.model.customservices.CustomServicesWorkflowRestRep)

Aggregations

CustomServicesWorkflowRestRep (com.emc.storageos.model.customservices.CustomServicesWorkflowRestRep)11 URI (java.net.URI)5 NamedURI (com.emc.storageos.db.client.model.NamedURI)3 CustomServicesWorkflowDocument (com.emc.storageos.model.customservices.CustomServicesWorkflowDocument)3 CustomServicesWorkflowUpdateParam (com.emc.storageos.model.customservices.CustomServicesWorkflowUpdateParam)3 ResourcePackage (com.emc.sa.workflow.CustomServicesWorkflowPackage.ResourcePackage)2 CustomServicesWorkflow (com.emc.storageos.db.client.model.uimodels.CustomServicesWorkflow)2 CustomServicesPrimitiveRestRep (com.emc.storageos.model.customservices.CustomServicesPrimitiveRestRep)2 NamedRelatedResourceRep (com.emc.storageos.model.NamedRelatedResourceRep)1 CustomServicesPrimitiveResourceRestRep (com.emc.storageos.model.customservices.CustomServicesPrimitiveResourceRestRep)1 CustomServicesWorkflowCreateParam (com.emc.storageos.model.customservices.CustomServicesWorkflowCreateParam)1 Step (com.emc.storageos.model.customservices.CustomServicesWorkflowDocument.Step)1 CustomServicesWorkflowList (com.emc.storageos.model.customservices.CustomServicesWorkflowList)1 CustomServicesViPRPrimitive (com.emc.storageos.primitives.java.vipr.CustomServicesViPRPrimitive)1 BufferedOutputStream (java.io.BufferedOutputStream)1 IOException (java.io.IOException)1 Date (java.util.Date)1 GZIPOutputStream (java.util.zip.GZIPOutputStream)1 TarArchiveOutputStream (org.apache.commons.compress.archivers.tar.TarArchiveOutputStream)1