Skip to content

Commit

Permalink
add missing WorkflowStatus to swagger.json
Browse files Browse the repository at this point in the history
  • Loading branch information
edwardgeorge committed May 28, 2018
1 parent 7e5a3e5 commit 5fb51d8
Show file tree
Hide file tree
Showing 7 changed files with 367 additions and 0 deletions.
121 changes: 121 additions & 0 deletions lib/Argo/Model.hs
Original file line number Diff line number Diff line change
Expand Up @@ -506,6 +506,35 @@ mkMetadata =
, metadataLabels = Nothing
}

-- ** NodeStatus
-- | NodeStatus
-- NodeStatus contains status information about an individual node in the workflow
data NodeStatus = NodeStatus
{
} deriving (P.Show, P.Eq, P.Typeable)

-- | FromJSON NodeStatus
instance A.FromJSON NodeStatus where
parseJSON = A.withObject "NodeStatus" $ \o ->
pure NodeStatus


-- | ToJSON NodeStatus
instance A.ToJSON NodeStatus where
toJSON NodeStatus =
_omitNulls
[
]


-- | Construct a value of type 'NodeStatus' (by applying it's required fields, if any)
mkNodeStatus
:: NodeStatus
mkNodeStatus =
NodeStatus
{
}

-- ** Outputs
-- | Outputs
-- Outputs hold parameters, artifacts, and results from a step
Expand Down Expand Up @@ -1372,6 +1401,59 @@ mkWorkflowSpec workflowSpecEntrypoint workflowSpecTemplates =
, workflowSpecVolumes = Nothing
}

-- ** WorkflowStatus
-- | WorkflowStatus
-- WorkflowStatus contains overall status information about a workflow
data WorkflowStatus = WorkflowStatus
{ workflowStatusPhase :: !(Maybe E'Phase) -- ^ "phase" - Phase a simple, high-level summary of where the workflow is in its lifecycle.
, workflowStatusStartedAt :: !(Maybe DateTime) -- ^ "startedAt" - Time at which this workflow started
, workflowStatusFinishedAt :: !(Maybe DateTime) -- ^ "finishedAt" - Time at which this workflow completed
, workflowStatusMessage :: !(Maybe Text) -- ^ "message" - A human readable message indicating details about why the workflow is in this condition.
, workflowStatusNodes :: !(Maybe (Map.Map String NodeStatus)) -- ^ "nodes" - Nodes is a mapping between a node ID and the node's status.
, workflowStatusPersistentVolumeClaims :: !(Maybe [V1Volume]) -- ^ "persistentVolumeClaims" - PersistentVolumeClaims tracks all PVCs that were created as part of the workflow. The contents of this list are drained at the end of the workflow.
, workflowStatusOutputs :: !(Maybe Outputs) -- ^ "outputs" - Outputs captures output values and artifact locations produced by the workflow via global outputs
} deriving (P.Show, P.Eq, P.Typeable)

-- | FromJSON WorkflowStatus
instance A.FromJSON WorkflowStatus where
parseJSON = A.withObject "WorkflowStatus" $ \o ->
WorkflowStatus
<$> (o .:? "phase")
<*> (o .:? "startedAt")
<*> (o .:? "finishedAt")
<*> (o .:? "message")
<*> (o .:? "nodes")
<*> (o .:? "persistentVolumeClaims")
<*> (o .:? "outputs")

-- | ToJSON WorkflowStatus
instance A.ToJSON WorkflowStatus where
toJSON WorkflowStatus {..} =
_omitNulls
[ "phase" .= workflowStatusPhase
, "startedAt" .= workflowStatusStartedAt
, "finishedAt" .= workflowStatusFinishedAt
, "message" .= workflowStatusMessage
, "nodes" .= workflowStatusNodes
, "persistentVolumeClaims" .= workflowStatusPersistentVolumeClaims
, "outputs" .= workflowStatusOutputs
]


-- | Construct a value of type 'WorkflowStatus' (by applying it's required fields, if any)
mkWorkflowStatus
:: WorkflowStatus
mkWorkflowStatus =
WorkflowStatus
{ workflowStatusPhase = Nothing
, workflowStatusStartedAt = Nothing
, workflowStatusFinishedAt = Nothing
, workflowStatusMessage = Nothing
, workflowStatusNodes = Nothing
, workflowStatusPersistentVolumeClaims = Nothing
, workflowStatusOutputs = Nothing
}

-- ** WorkflowStep
-- | WorkflowStep
-- WorkflowStep is a reference to a template to execute in a series of step
Expand Down Expand Up @@ -1422,5 +1504,44 @@ mkWorkflowStep =
}


-- * Enums


-- ** E'Phase

-- | Enum of 'Text' .
-- Phase a simple, high-level summary of where the workflow is in its lifecycle.
data E'Phase
= E'Phase'Running -- ^ @"Running"@
| E'Phase'Succeeded -- ^ @"Succeeded"@
| E'Phase'Skipped -- ^ @"Skipped"@
| E'Phase'Failed -- ^ @"Failed"@
| E'Phase'Error -- ^ @"Error"@
deriving (P.Show, P.Eq, P.Typeable, P.Ord, P.Bounded, P.Enum)

instance A.ToJSON E'Phase where toJSON = A.toJSON . fromE'Phase
instance A.FromJSON E'Phase where parseJSON o = P.either P.fail (pure . P.id) . toE'Phase =<< A.parseJSON o
instance WH.ToHttpApiData E'Phase where toQueryParam = WH.toQueryParam . fromE'Phase
instance WH.FromHttpApiData E'Phase where parseQueryParam o = WH.parseQueryParam o >>= P.left T.pack . toE'Phase
instance MimeRender MimeMultipartFormData E'Phase where mimeRender _ = mimeRenderDefaultMultipartFormData

-- | unwrap 'E'Phase' enum
fromE'Phase :: E'Phase -> Text
fromE'Phase = \case
E'Phase'Running -> "Running"
E'Phase'Succeeded -> "Succeeded"
E'Phase'Skipped -> "Skipped"
E'Phase'Failed -> "Failed"
E'Phase'Error -> "Error"

-- | parse 'E'Phase' enum
toE'Phase :: Text -> P.Either String E'Phase
toE'Phase = \case
"Running" -> P.Right E'Phase'Running
"Succeeded" -> P.Right E'Phase'Succeeded
"Skipped" -> P.Right E'Phase'Skipped
"Failed" -> P.Right E'Phase'Failed
"Error" -> P.Right E'Phase'Error
s -> P.Left $ "toE'Phase: enum parse failure: " P.++ P.show s


13 changes: 13 additions & 0 deletions lib/Argo/Model/Missing.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{-# LANGUAGE DeriveDataTypeable #-}
module Argo.Model.Missing where
import Data.Aeson as A
import Data.Typeable (Typeable)

data WorkflowStatus = WorkflowStatus
deriving (Eq, Show, Typeable)

instance A.ToJSON WorkflowStatus where
toJSON WorkflowStatus = object []

instance A.FromJSON WorkflowStatus where
parseJSON _ = pure WorkflowStatus
43 changes: 43 additions & 0 deletions lib/Argo/ModelLens.hs
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,10 @@ metadataLabelsL f Metadata{..} = (\metadataLabels -> Metadata { metadataLabels,



-- * NodeStatus



-- * Outputs

-- | 'outputsArtifacts' Lens
Expand Down Expand Up @@ -909,6 +913,45 @@ workflowSpecVolumesL f WorkflowSpec{..} = (\workflowSpecVolumes -> WorkflowSpec



-- * WorkflowStatus

-- | 'workflowStatusPhase' Lens
workflowStatusPhaseL :: Lens_' WorkflowStatus (Maybe E'Phase)
workflowStatusPhaseL f WorkflowStatus{..} = (\workflowStatusPhase -> WorkflowStatus { workflowStatusPhase, ..} ) <$> f workflowStatusPhase
{-# INLINE workflowStatusPhaseL #-}

-- | 'workflowStatusStartedAt' Lens
workflowStatusStartedAtL :: Lens_' WorkflowStatus (Maybe DateTime)
workflowStatusStartedAtL f WorkflowStatus{..} = (\workflowStatusStartedAt -> WorkflowStatus { workflowStatusStartedAt, ..} ) <$> f workflowStatusStartedAt
{-# INLINE workflowStatusStartedAtL #-}

-- | 'workflowStatusFinishedAt' Lens
workflowStatusFinishedAtL :: Lens_' WorkflowStatus (Maybe DateTime)
workflowStatusFinishedAtL f WorkflowStatus{..} = (\workflowStatusFinishedAt -> WorkflowStatus { workflowStatusFinishedAt, ..} ) <$> f workflowStatusFinishedAt
{-# INLINE workflowStatusFinishedAtL #-}

-- | 'workflowStatusMessage' Lens
workflowStatusMessageL :: Lens_' WorkflowStatus (Maybe Text)
workflowStatusMessageL f WorkflowStatus{..} = (\workflowStatusMessage -> WorkflowStatus { workflowStatusMessage, ..} ) <$> f workflowStatusMessage
{-# INLINE workflowStatusMessageL #-}

-- | 'workflowStatusNodes' Lens
workflowStatusNodesL :: Lens_' WorkflowStatus (Maybe (Map.Map String NodeStatus))
workflowStatusNodesL f WorkflowStatus{..} = (\workflowStatusNodes -> WorkflowStatus { workflowStatusNodes, ..} ) <$> f workflowStatusNodes
{-# INLINE workflowStatusNodesL #-}

-- | 'workflowStatusPersistentVolumeClaims' Lens
workflowStatusPersistentVolumeClaimsL :: Lens_' WorkflowStatus (Maybe [V1Volume])
workflowStatusPersistentVolumeClaimsL f WorkflowStatus{..} = (\workflowStatusPersistentVolumeClaims -> WorkflowStatus { workflowStatusPersistentVolumeClaims, ..} ) <$> f workflowStatusPersistentVolumeClaims
{-# INLINE workflowStatusPersistentVolumeClaimsL #-}

-- | 'workflowStatusOutputs' Lens
workflowStatusOutputsL :: Lens_' WorkflowStatus (Maybe Outputs)
workflowStatusOutputsL f WorkflowStatus{..} = (\workflowStatusOutputs -> WorkflowStatus { workflowStatusOutputs, ..} ) <$> f workflowStatusOutputs
{-# INLINE workflowStatusOutputsL #-}



-- * WorkflowStep

-- | 'workflowStepArguments' Lens
Expand Down
118 changes: 118 additions & 0 deletions swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -830,6 +830,124 @@
}
}
},
"WorkflowStatus": {
"description": "WorkflowStatus contains overall status information about a workflow",
"properties": {
"phase": {
"description": "Phase a simple, high-level summary of where the workflow is in its lifecycle.",
"type": "string",
"enum": ["Running", "Succeeded", "Skipped", "Failed", "Error"]
},
"startedAt": {
"description": "Time at which this workflow started",
"type": "string",
"format": "date-time"
},
"finishedAt": {
"description": "Time at which this workflow completed",
"type": "string",
"format": "date-time"
},
"message": {
"description": "A human readable message indicating details about why the workflow is in this condition.",
"type": "string"
},
"nodes": {
"description": "Nodes is a mapping between a node ID and the node's status.",
"type": "object",
"additionalProperties": {
"$ref": "#/definitions/NodeStatus"
}
},
"persistentVolumeClaims": {
"description": "PersistentVolumeClaims tracks all PVCs that were created as part of the workflow. The contents of this list are drained at the end of the workflow.",
"type": "array",
"items": {
"$ref": "#/definitions/v1.Volume"
}
},
"outputs": {
"description": "Outputs captures output values and artifact locations produced by the workflow via global outputs",
"$ref": "#/definitions/Outputs"
}
}
},
"NodeStatus": {
"description": "NodeStatus contains status information about an individual node in the workflow",
"required": ["id", "name", "displayName", "type"],
"id": {
"description": "ID is a unique identifier of a node within the worklow. It is implemented as a hash of the node name, which makes the ID deterministic.",
"type": "string"
},
"name": {
"description": "Name is unique name in the node tree used to generate the node ID",
"type": "string"
},
"displayName": {
"description": "DisplayName is a human readable representation of the node. Unique within a template boundary",
"type": "string"
},
"type": {
"description": "Type indicates type of node",
"$ref": "#/definitions/NodeType"
},
"templateName": {
"description": "TemplateName is the template name which this node corresponds to. Not applicable to virtual nodes (e.g. Retry, StepGroup)",
"type": "string"
},
"phase": {
"description": "Phase a simple, high-level summary of where the node is in its lifecycle.",
"$ref": "#/definitions/NodePhase"
},
"boundaryID": {
"description": "BoundaryID indicates the node ID of the associated template root node in which this node belongs to",
"type": "string"
},
"message": {
"description": "A human readable message indicating details about why the node is in this condition.",
"type": "string"
},
"startedAt": {
"description": "Time at which this node started",
"type": "string",
"format": "date-time"
},
"finishedAt": {
"description": "Time at which this node completed",
"type": "string",
"format": "date-time"
},
"podIP": {
"description": "PodIP captures the IP of the pod for daemoned steps",
"type": "string"
},
"daemoned": {
"description": "Daemoned tracks whether or not this node was daemoned and need to be terminated",
"type": "boolean"
},
"inputs": {
"description": "Inputs captures input parameter values and artifact locations supplied to this template invocation",
"$ref": "#/definitions/Inputs"
},
"outputs": {
"description": "Outputs captures output parameter values and artifact locations produced by this template invocation",
"$ref": "#/definitions/Outputs"
},
"children": {
"description": "Children is a list of child node IDs",
"type": "array",
"items": {
"type": "string"
}
},
"outboundNodes": {
"description": "OutboundNodes tracks the node IDs which are considered \"outbound\" nodes to a template invocation. For every invocation of a template, there are nodes which we considered as \"outbound\". Essentially, these are last nodes in the execution sequence to run, before the template is considered completed. These nodes are then connected as parents to a following step. In the case of single pod steps (i.e. container, script, resource templates), this list will be nil since the pod itself is already considered the \"outbound\" node. In the case of DAGs, outbound nodes are the \"target\" tasks (tasks with no children). In the case of steps, outbound nodes are all the containers involved in the last step group. NOTE: since templates are composable, the list of outbound nodes are carried upwards when a DAG/steps template invokes another DAG/steps template. In other words, the outbound nodes of a template, will be a superset of the outbound nodes of its last children.",
"type": "array",
"items": {
"type": "string"
}
}
},
"WorkflowList": {
"description": "WorkflowList is list of Workflow resources",
"required": [
Expand Down
51 changes: 51 additions & 0 deletions swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -921,6 +921,57 @@ definitions:
$ref: "#/definitions/WorkflowStatus"
x-dataType: "WorkflowStatus"
description: "Workflow is the definition of a workflow resource"
WorkflowStatus:
properties:
phase:
type: "string"
description: "Phase a simple, high-level summary of where the workflow is\
\ in its lifecycle."
enum:
- "Running"
- "Succeeded"
- "Skipped"
- "Failed"
- "Error"
x-dataType: "E'Phase"
startedAt:
type: "string"
format: "date-time"
description: "Time at which this workflow started"
x-dataType: "DateTime"
finishedAt:
type: "string"
format: "date-time"
description: "Time at which this workflow completed"
x-dataType: "DateTime"
message:
type: "string"
description: "A human readable message indicating details about why the workflow\
\ is in this condition."
x-dataType: "Text"
nodes:
type: "object"
description: "Nodes is a mapping between a node ID and the node's status."
additionalProperties:
$ref: "#/definitions/NodeStatus"
x-dataType: "(Map.Map String NodeStatus)"
persistentVolumeClaims:
type: "array"
description: "PersistentVolumeClaims tracks all PVCs that were created as\
\ part of the workflow. The contents of this list are drained at the end\
\ of the workflow."
items:
$ref: "#/definitions/v1.Volume"
x-dataType: "[V1Volume]"
outputs:
description: "Outputs captures output values and artifact locations produced\
\ by the workflow via global outputs"
$ref: "#/definitions/Outputs"
x-dataType: "Outputs"
description: "WorkflowStatus contains overall status information about a workflow"
NodeStatus:
description: "NodeStatus contains status information about an individual node\
\ in the workflow"
WorkflowList:
required:
- "items"
Expand Down
Loading

0 comments on commit 5fb51d8

Please sign in to comment.