arazzo: 1.0.1 info: title: Appmixer Decommission a Flow summary: Read a flow, stop it if it is running, then delete it. description: >- A safe teardown pattern for retiring an Appmixer flow. The workflow reads the flow to learn its stage, stops it first when it is still running so no in-flight executions are orphaned, and then deletes the flow. A stopped flow skips straight to deletion. version: 1.0.0 sourceDescriptions: - name: appmixerApi url: ../openapi/appmixer-api-openapi.yml type: openapi workflows: - workflowId: decommission-flow summary: Stop a running flow if necessary and then delete it. description: >- Fetches the flow, branches on its running stage to stop it when live, and deletes the flow in both branches. inputs: type: object required: - token - flowId properties: token: type: string description: Appmixer access token obtained from /user/auth. flowId: type: string description: The identifier of the flow to decommission. steps: - stepId: getFlow description: Read the flow to determine whether it is currently running. operationId: getFlow parameters: - name: Authorization in: header value: Bearer $inputs.token - name: flowId in: path value: $inputs.flowId successCriteria: - condition: $statusCode == 200 outputs: stage: $response.body#/stage onSuccess: - name: flowRunning type: goto stepId: stopFlow criteria: - context: $response.body condition: $.stage == "running" type: jsonpath - name: flowStopped type: goto stepId: deleteFlow criteria: - context: $response.body condition: $.stage != "running" type: jsonpath - stepId: stopFlow description: Stop the running flow before deleting it. operationId: stopFlow parameters: - name: Authorization in: header value: Bearer $inputs.token - name: flowId in: path value: $inputs.flowId successCriteria: - condition: $statusCode == 200 - stepId: deleteFlow description: Delete the flow now that it is stopped. operationId: deleteFlow parameters: - name: Authorization in: header value: Bearer $inputs.token - name: flowId in: path value: $inputs.flowId successCriteria: - condition: $statusCode == 200 outputs: deletedFlowId: $inputs.flowId outputs: deletedFlowId: $steps.deleteFlow.outputs.deletedFlowId