{
  "orderPreparation": {
    "parameters": {
      "flight_destination": {
        "type": "String",
        "default": "\"London\""
      },
      "booking_code": {
        "type": "String",
        "default": "\"BA1289\""
      }
    },
    "allowUndeclared": false
  },
  "instructions": [
    {
      "TYPE": "Execute.Named",
      "jobName": "run-powershell-multi-line",
      "label": "run-powershell-multi-line"
    },
    {
      "TYPE": "Execute.Named",
      "jobName": "run-powershell-single-line",
      "label": "run-powershell-single-line"
    },
    {
      "TYPE": "Execute.Named",
      "jobName": "run-powershell-from-file",
      "label": "run-powershell-from-file"
    },
    {
      "TYPE": "Execute.Named",
      "jobName": "run-powershell-error-handling",
      "label": "run-powershell-error-handling"
    }
  ],
  "title": "xx",
  "timeZone": "Etc/UTC",
  "jobs": {
    "run-powershell-multi-line": {
      "agentName": "windowsAgent",
      "withSubagentClusterIdExpr": false,
      "executable": {
        "TYPE": "ShellScriptExecutable",
        "script": "@@setlocal enabledelayedexpansion & set t=%time:~0,2%%time:~3,2%%time:~6,2%%time:~9,2% & set \"t=!t: =0!\" & set f=%~n0.!t!.ps1 & @@findstr/v \"^@@[fs].*&\" \"%~f0\" > !f! & powershell.exe -NonInteractive -File !f! & set e=!errorlevel! & del /q !f! & exit !e!/b&\n\nWrite-Output \"Flight Destination: $env:FLIGHT_DESTINATION\" \nWrite-Output \"Booking Code: $env:BOOKING_CODE\" \nStart-Sleep -Seconds 15\n",
        "env": {
          "FLIGHT_DESTINATION": "$flight_destination",
          "BOOKING_CODE": "$booking_code"
        },
        "v1Compatible": false
      },
      "skipIfNoAdmissionForOrderDay": false,
      "killAtEndOfAdmissionPeriod": false,
      "parallelism": 1,
      "graceTimeout": 1,
      "failOnErrWritten": true,
      "warnOnErrWritten": false,
      "title": "run PowerShell script from multiple lines",
      "isNotRestartable": false
    },
    "run-powershell-single-line": {
      "agentName": "windowsAgent",
      "withSubagentClusterIdExpr": false,
      "executable": {
        "TYPE": "ShellScriptExecutable",
        "script": "powershell.exe -NoLogo -NonInteractive -Command \"& { echo `\"Flight Destination: $env:FLIGHT_DESTINATION`\"; echo `\"Booking Code: $env:BOOKING_CODE`\"; }\"\n",
        "env": {
          "FLIGHT_DESTINATION": "$flight_destination",
          "BOOKING_CODE": "$booking_code"
        },
        "v1Compatible": false
      },
      "skipIfNoAdmissionForOrderDay": false,
      "killAtEndOfAdmissionPeriod": false,
      "parallelism": 1,
      "graceTimeout": 1,
      "failOnErrWritten": true,
      "warnOnErrWritten": false,
      "title": "run PowerShell script from a single command line",
      "isNotRestartable": false
    },
    "run-powershell-from-file": {
      "agentName": "windowsAgent",
      "withSubagentClusterIdExpr": false,
      "executable": {
        "TYPE": "ShellScriptExecutable",
        "script": "powershell.exe -f %JS7_AGENT_CONFIG_DIR%/scripts/some-script.ps1\n",
        "env": {
          "FLIGHT_DESTINATION": "$flight_destination",
          "BOOKING_CODE": "$booking_code"
        },
        "v1Compatible": false
      },
      "skipIfNoAdmissionForOrderDay": false,
      "killAtEndOfAdmissionPeriod": false,
      "parallelism": 1,
      "graceTimeout": 1,
      "failOnErrWritten": true,
      "warnOnErrWritten": false,
      "title": "run PowerShell script from file",
      "isNotRestartable": false
    },
    "run-powershell-error-handling": {
      "agentName": "windowsAgent",
      "withSubagentClusterIdExpr": false,
      "executable": {
        "TYPE": "ShellScriptExecutable",
        "script": "@@setlocal enabledelayedexpansion & set t=%time:~0,2%%time:~3,2%%time:~6,2%%time:~9,2% & set \"t=!t: =0!\" & set f=%~n0.!t!.ps1 & @@findstr/v \"^@@[fs].*&\" \"%~f0\" > !f! & powershell.exe -NonInteractive -File !f! & set e=!errorlevel! & del /q !f! & exit !e!/b&\n\nWrite-Output \"begin of test\"\n$ErrorActionPreference = 'Stop'\n\n# a) syntax error\n# some-weird-cmdlet\n\n# b) exceptions\n# throw \"some error\"\n\n# c) exit code\n# exit 24\n\n# d) OS commands\n# undiscovered error as exit code is not modified and no output to stderr is created\n# ping /unknown-argument\n# discovered error\n# ping unknown-host\n",
        "env": {
          "FLIGHT_DESTINATION": "$flight_destination",
          "BOOKING_CODE": "$booking_code"
        },
        "v1Compatible": false
      },
      "skipIfNoAdmissionForOrderDay": false,
      "killAtEndOfAdmissionPeriod": false,
      "parallelism": 1,
      "graceTimeout": 1,
      "failOnErrWritten": true,
      "warnOnErrWritten": false,
      "isNotRestartable": false
    }
  }
}