Share
2

How do Orchestrator constructs look in Git?

by Mayank Goyal · 7 Jun 2024
  1. Workflows
    1. Schema Diagram with Code (Workflows/path../wf-name/workflow.xml)
    2. Input form (Workflows/path../wf-name/forms/_.json)
  2. Resources
    1. Metadata (Resources/path../resource-name.r.properties)
    2. Actual File (Resources/path../resource-name)
  3. Packages
    1. Equivalent XML file (Packages/package-name.xml)
  4. Configurations
    1. Equivalent XML file (Configurations/path../configuration-name.xml)
  5. Actions
    1. XML file with code (Actions/path../action-name.xml)
  6. Polyglot Actions
    1. XML file with code (Actions/path../action-name.xml)
  7. Environments
    1. Metadata (Environments/env-name/env.json)
    2. Package bundle(Environments/env-name/data.zip)

Workflows

It splits up into two files.

Schema Diagram with Code (Workflows/path../wf-name/workflow.xml)

XML
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ns2:workflow xmlns:ns2="http://vmware.com/vco/workflow" root-name="item1" object-name="workflow:name=generic" id="f5d13719-378d-4629-bf48-b783d6f2acae" editor-version="2.0" version="1.0.0" api-version="6.0.0" restartMode="1" resumeFromFailedMode="0">
    <display-name>Cancel a running workflow</display-name>
    <position y="10.0" x="50.0"/>
    <input>
        <param name="vroFqdn" type="string"/>
        <param name="bearerToken" type="string"/>
        <param name="workflowId" type="string"/>
        <param name="workflowTokenId" type="string"/>
        <param name="workflowName" type="string"/>
    </input>
    <output/>
    <workflow-item name="item0" type="end" end-mode="0" comparator="0">
        <in-binding/>
        <out-binding/>
        <position y="10.0" x="310.0"/>
    </workflow-item>
    <workflow-item name="item1" out-name="item0" type="task" comparator="0">
        <display-name>DELETE a workflowToken state</display-name>
        <script encoded="false">var method = "DELETE";
var uri = "https://"+vroFqdn+"/vco/api/workflows/"+workflowId+"/executions/"+workflowTokenId+"/state"
System.log("URL to hit: "+uri);
var requestContentType = "application/json"

var restHost = RESTHostManager.createHost("dynamicRequest");
restHost.operationTimeout = 600;
httpRestHost = RESTHostManager.createTransientHostFrom(restHost);
httpRestHost.url = uri;

var request = httpRestHost.createRequest(method, uri, null);

var newAuth = RESTAuthenticationManager.createAuthentication ("OAuth 2.0", [bearerToken, "Authorization header"]);
httpRestHost.authentication = newAuth;

// Set Content Type
request.contentType = requestContentType;

// Execute REST Request
System.log("Executing REST request...");
var response = request.execute();
System.log("DELETE operation completed");

// Output Handling
statusCodeAttribute = response.statusCode;
System.log("REST Response Status Code: " + statusCodeAttribute);
if(statusCodeAttribute == "204") System.log("Workflow  "+workflowName +" with workflowId "+workflowTokenId+" is successfully canceled");
else System.warn("Workflow  "+workflowName +" with workflowId "+workflowTokenId+" failed to be canceled!");</script>
        <in-binding>
            <bind name="vroFqdn" type="string" export-name="vroFqdn"/>
            <bind name="bearerToken" type="string" export-name="bearerToken"/>
            <bind name="workflowId" type="string" export-name="workflowId"/>
            <bind name="workflowTokenId" type="string" export-name="workflowTokenId"/>
            <bind name="workflowName" type="string" export-name="workflowName"/>
        </in-binding>
        <out-binding/>
        <description>Simple task with custom script capability.</description>
        <position y="20.0" x="140.0"/>
    </workflow-item>
</ns2:workflow>

Input form (Workflows/path../wf-name/forms/_.json)

JSON
{
  "schema": {
    "vroFqdn": {
      "id": "vroFqdn",
      "type": {
        "dataType": "string"
      },
      "label": "vroFqdn",
      "constraints": {
        "required": false
      }
    },
    "bearerToken": {
      "id": "bearerToken",
      "type": {
        "dataType": "string"
      },
      "label": "bearerToken",
      "constraints": {
        "required": false
      }
    },
    "workflowId": {
      "id": "workflowId",
      "type": {
        "dataType": "string"
      },
      "label": "workflowId",
      "constraints": {
        "required": false
      }
    },
    "workflowTokenId": {
      "id": "workflowTokenId",
      "type": {
        "dataType": "string"
      },
      "label": "workflowTokenId",
      "constraints": {
        "required": false
      }
    },
    "workflowName": {
      "id": "workflowName",
      "type": {
        "dataType": "string"
      },
      "label": "workflowName",
      "constraints": {
        "required": false
      }
    }
  },
  "layout": {
    "pages": [
      {
        "id": "page_j18o814u",
        "title": "General",
        "sections": [
          {
            "id": "section_gxmqa4d0",
            "fields": [
              {
                "id": "vroFqdn",
                "display": "textField",
                "signpostPosition": "right-middle",
                "state": {
                  "visible": true,
                  "read-only": false
                }
              }
            ]
          },
          {
            "id": "section_vu1id8pi",
            "fields": [
              {
                "id": "bearerToken",
                "display": "textField",
                "signpostPosition": "right-middle",
                "state": {
                  "visible": true,
                  "read-only": false
                }
              }
            ]
          },
          {
            "id": "section_2uwr5k9z",
            "fields": [
              {
                "id": "workflowId",
                "display": "textField",
                "signpostPosition": "right-middle",
                "state": {
                  "visible": true,
                  "read-only": false
                }
              }
            ]
          },
          {
            "id": "section_dojucai0",
            "fields": [
              {
                "id": "workflowTokenId",
                "display": "textField",
                "signpostPosition": "right-middle",
                "state": {
                  "visible": true,
                  "read-only": false
                }
              }
            ]
          },
          {
            "id": "section_cgytba2n",
            "fields": [
              {
                "id": "workflowName",
                "display": "textField",
                "signpostPosition": "right-middle",
                "state": {
                  "visible": true,
                  "read-only": false
                }
              }
            ]
          }
        ]
      }
    ]
  },
  "itemId": ""
}

Resources

A resource also splits up into 2 files.

Metadata (Resources/path../resource-name.r.properties)

Plaintext
id=d53d4f14-691e-4f92-a3b8-e7387408f3a8
name=diagram_storage.png
mimeType=image/png
description=Imported from : 'diagram_storage.png

Actual File (Resources/path../resource-name)

This consists of the real file which is imported as resource in O10R.

Packages

Equivalent XML file (Packages/package-name.xml)

XML
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<package>
<elm src-category='null'><![CDATA[dunes://service.dunes.ch/Workflow?id='104c3c3a-1459-4f2b-9028-9364cd343d62'&dunesName='Workflow']]></elm>
<elm src-category='null'><![CDATA[dunes://service.dunes.ch/Action?id='1b53b60c-e033-4979-a440-79a4ccba9059'&dunesName='Action'&name='getDate24hoursAgo'&category='com.mayank.actions']]></elm>
<elm src-category='null'><![CDATA[dunes://service.dunes.ch/Workflow?id='2ff89b58-11f4-4883-b293-f6d77e8f6fcb'&dunesName='Workflow']]></elm>
<elm src-category='null'><![CDATA[dunes://service.dunes.ch/Action?id='e516f9ea-654a-4cd3-aaa5-6e8328765700'&dunesName='Action'&name='cancelARunningWorkflow'&category='com.mayank.actions']]></elm>
<elm src-category='null'><![CDATA[dunes://service.dunes.ch/Workflow?id='f5d13719-378d-4629-bf48-b783d6f2acae'&dunesName='Workflow']]></elm>
</package>

Configurations

Equivalent XML file (Configurations/path../configuration-name.xml)

XML
<?xml version='1.0' encoding='UTF-8'?>
<config-element id="5dcabcec-507b-4a89-9475-906b6c275007" version="6.0.0" allowed-operations="vfe">
  <display-name><![CDATA[coolmailConf]]></display-name>
  <atts>
    <att name="mailServer" type="string" read-only="false">
      <value encoded="n"><![CDATA[mail.spglobal.com]]></value>
    </att>
    <att name="smtpPass" type="SecureString" read-only="false"/>
    <att name="smtpUser" type="string" read-only="false">
      <value encoded="n"><![CDATA[]]></value>
    </att>
    <att name="smtpPort" type="number" read-only="false">
      <value encoded="n"><![CDATA[25.0]]></value>
    </att>
    <att name="smtpFromName" type="string" read-only="false">
      <value encoded="n"><![CDATA[test-FromName]]></value>
    </att>
    <att name="smtpSSL" type="boolean" read-only="false">
      <value encoded="n"><![CDATA[false]]></value>
    </att>
    <att name="smtpFromMail" type="string" read-only="false">
      <value encoded="n"><![CDATA[test-FromMail]]></value>
    </att>
    <att name="smtpStartTLS" type="boolean" read-only="false">
      <value encoded="n"><![CDATA[false]]></value>
    </att>
    <att name="debugFlag" type="boolean" read-only="false">
      <value encoded="n"><![CDATA[false]]></value>
      <description><![CDATA[Some more debugging information]]></description>
    </att>
  </atts>
</config-element>

Actions

XML file with code (Actions/path../action-name.xml)

XML
<?xml version='1.0' encoding='UTF-8'?>
<dunes-script-module name="exposeSecureStringLocally" result-type="string" api-version="6.0.0" id="b815632a-5281-4a7f-90d8-3a63c5630b7b" version="0.0.0" allowed-operations="vfe" category-name="actions.mayank.goyal">
  <param n="confElementName" t="string"/>
  <param n="keyName" t="string"/>
  <script encoded="false"><![CDATA[System.log("*** START exposeSecureStringLocally")
var allCategories = Server.getAllConfigurationElementCategories();
System.log("Total Configuration Categories found: "+ allCategories.length);
var totalAvailableConfElements = [];
for (var cat in allCategories) {
    //System.log("Looking in category "+allCategories[cat].name);
    var allConfElements = allCategories[cat].allConfigurationElements;
    for (var conf in allConfElements) {
       //System.log("ContainedConfiguration element name "+allConfElements[conf].name);
        totalAvailableConfElements.push(allConfElements[conf]);
    }
}
System.log("Total Configuration Elements found: "+ allConfElements.length);
for (var conf in totalAvailableConfElements){
    if (totalAvailableConfElements[conf].name == confElementName) {
        var allKeys = totalAvailableConfElements[conf].attributes;
        for (var key in allKeys) {
            if (allKeys[key].name == keyName){
                System.log("Key "+keyName+" found");
                System.log(typeof allKeys[key].value);
                if(typeof allKeys[key].value == 'string'){
                    System.log(allKeys[key].name +": "+ allKeys[key].value);
                    System.log("*** END exposeSecureStringLocally")
                    return allKeys[key].value;
                }
                if(typeof allKeys[key].value == 'object'){
                    var compTypeVar = allKeys[key].value; //CompositeType variable
                    for (var i = 0; i < compTypeVar.keys.length; i++){
                        var pointer = compTypeVar.keys[i];
                        System.log(pointer +": "+ compTypeVar.get(pointer));
                        System.log("*** END exposeSecureStringLocally")
                        return compTypeVar.get(pointer);
                    }
                }
                break;
            }
        }
    }
}

/*System.log(typeof allKeys[key].value);  //object
System.log(System.getObjectType(allKeys[key].value)); //null
System.log(System.getObjectClassName(allKeys[key].value)) //** fails ** can't be null */]]></script>
</dunes-script-module>

Polyglot Actions

XML file with code (Actions/path../action-name.xml)

XML
<?xml version='1.0' encoding='UTF-8'?>
<dunes-script-module name="polyglotAction" result-type="string" api-version="6.0.0" id="5223fdda-dc92-418a-97c6-c6367dfc3c60" version="0.0.0" category-name="actions.mayank.goyal">
  <runtime><![CDATA[node:18]]></runtime>
  <script encoded="false"><![CDATA[exports.handler = (context, inputs, callback) => {
    console.log('Inputs were ' + JSON.stringify(inputs));
    callback(undefined, {status: "done"});
}
]]></script>
</dunes-script-module>

Environments

Environments consists of two files.

Metadata (Environments/env-name/env.json)

JSON
{
  "name" : "SQLServer_PS",
  "version" : "0.0.0",
  "environmentVariables" : { },
  "dependencies" : {
    "SqlServer" : "22.2.0"
  },
  "repositories" : { },
  "bundleHash" : "c27ca1e14950f5f1c0955c3eea2d1b1b2308fb6d8082dc033b872da36cf23c26",
  "id" : "bf779974-6b03-4f89-95e4-e8fcfbe783d7",
  "runtime" : "powershell:7.3",
  "memoryLimit" : 0,
  "timeout" : 180
}

Package bundle(Environments/env-name/data.zip)


Discover more from Cloud Blogger

Subscribe to get the latest posts sent to your email.

You may also like