github.com/qri-io/qri@v0.10.1-0.20220104210721-c771715036cb/event/automation.go (about)

     1  package event
     2  
     3  import (
     4  	"github.com/qri-io/qri/profile"
     5  )
     6  
     7  const (
     8  	// ETAutomationWorkflowTrigger signals that a workflow has been triggered
     9  	// Payload will be a WorkflowTriggerEvent
    10  	// This event should not block
    11  	ETAutomationWorkflowTrigger = Type("automation:WorkflowTrigger")
    12  	// ETAutomationWorkflowStarted signals that a workflow run has begun
    13  	// Payload will be a WorkflowStartedEvent
    14  	// This event should not block
    15  	ETAutomationWorkflowStarted = Type("automation:WorkflowStarted")
    16  	// ETAutomationWorkflowStopped signals that a workflow run has finished
    17  	// Payload will be a WorkflowStoppedEvent
    18  	// This event should not block
    19  	ETAutomationWorkflowStopped = Type("automation:WorkflowStopped")
    20  	// ETAutomationWorkflowCreated signals that a new workflow has been created
    21  	// Payload will be a workflow.Workflow
    22  	// This event should not block
    23  	ETAutomationWorkflowCreated = Type("automation:WorkflowCreated")
    24  	// ETAutomationWorkflowRemoved signals that a workflow has been removed
    25  	// Payload will be a workflow.Workflow
    26  	// This event should not block
    27  	ETAutomationWorkflowRemoved = Type("automation:WorkflowRemoved")
    28  	// ETAutomationDeployStart signals that a deploy has started
    29  	// Payload will be a DeployEvent
    30  	ETAutomationDeployStart = Type("automation:DeployStart")
    31  	// ETAutomationDeploySaveDatasetStart signals that we have started the save
    32  	// dataset portion of the deploy
    33  	// Payload will be a DeployEvent
    34  	// This event should not block
    35  	ETAutomationDeploySaveDatasetStart = Type("automation:DeploySaveDatasetStart")
    36  	// ETAutomationDeploySaveDatasetEnd signals that a save dataset has completed as
    37  	// part of a deploy
    38  	// Payload will be a DeployEvent
    39  	// This event should not block
    40  	ETAutomationDeploySaveDatasetEnd = Type("automation:DeploySaveDatasetEnd")
    41  	// ETAutomationDeploySaveWorkflowStart signals the deploy has started the workflow
    42  	// save portion of the deploy
    43  	// Payload will be a DeployEvent
    44  	// This event should not block
    45  	ETAutomationDeploySaveWorkflowStart = Type("automation:DeploySaveWorkflowStart")
    46  	// ETAutomationDeploySaveWorkflowEnd signals the deploy has finished the workflow
    47  	// save portion of the deploy
    48  	// Payload will be a DeployEvent
    49  	// This event should not block
    50  	ETAutomationDeploySaveWorkflowEnd = Type("automation:DeploySaveWorkflowEnd")
    51  	// ETAutomationDeployRun signals the deploy has begun the run portion of the
    52  	// deploy
    53  	// Payload will be a DeployEvent
    54  	// This event should not block
    55  	ETAutomationDeployRun = Type("automation:DeployRun")
    56  	// ETAutomationDeployEnd signals the deploy has finished
    57  	// Payload will be a DeployEvent, if the `Error` field is filled,
    58  	// the deploy ended in error
    59  	ETAutomationDeployEnd = Type("automation:DeployEnd")
    60  	// ETAutomationRunQueuePush signals the run is queued to execute
    61  	// Payload will be a runID
    62  	// This event should not block
    63  	ETAutomationRunQueuePush = Type("automation:RunQueuePush")
    64  	// ETAutomationRunQueuePop signals the run is queued to execute
    65  	// Payload will be a runID
    66  	// This event should not block
    67  	ETAutomationRunQueuePop = Type("automation:RunQueuePop")
    68  	// ETAutomationApplyQueuePush signals the apply is queued to execute
    69  	// Payload will be a runID
    70  	// This event should not block
    71  	ETAutomationApplyQueuePush = Type("automation:ApplyQueuePush")
    72  	// ETAutomationApplyQueuePop signals the apply is queued to execute
    73  	// Payload will be a runID
    74  	// This event should not block
    75  	ETAutomationApplyQueuePop = Type("automation:ApplyQueuePop")
    76  )
    77  
    78  // WorkflowTriggerEvent is the expected payload of the `ETAutomationWorkflowTrigger`
    79  type WorkflowTriggerEvent struct {
    80  	WorkflowID string     `json:"workflowID"`
    81  	OwnerID    profile.ID `json:"ownerID"`
    82  	TriggerID  string     `json:"triggerID"`
    83  }
    84  
    85  // WorkflowStartedEvent is the expected payload of the `ETAutomationWorkflowStarted`
    86  type WorkflowStartedEvent struct {
    87  	InitID     string     `json:"InitID"`
    88  	OwnerID    profile.ID `json:"ownerID"`
    89  	WorkflowID string     `json:"workflowID"`
    90  	RunID      string     `json:"runID"`
    91  }
    92  
    93  // WorkflowStoppedEvent is the expected payload of the `ETAutomationWorkflowStopped`
    94  type WorkflowStoppedEvent struct {
    95  	InitID     string     `json:"InitID"`
    96  	OwnerID    profile.ID `json:"ownerID"`
    97  	WorkflowID string     `json:"workflowID"`
    98  	RunID      string     `json:"runID"`
    99  	Status     string     `json:"status"`
   100  }
   101  
   102  // DeployEvent is the expected payload for deploy events
   103  type DeployEvent struct {
   104  	Ref        string `json:"ref"`
   105  	InitID     string `json:"InitID"`
   106  	WorkflowID string `json:"workflowID"`
   107  	RunID      string `json:"runID"`
   108  	Error      string `json:"error"`
   109  }