Documentation
¶
Index ¶
- Variables
- func Handler(conf Config, g *echo.Group) error
- func ReqTypeForAction(a Action) cmsintegrationcommon.ReqType
- func WebhookHandler(conf Config) (cmswebhook.Handler, error)
- type Action
- type ActionKind
- type Config
- type Event
- type EventKind
- type Flow
- type FlowInternalResult
- type FlowRequest
- type FlowRequestResult
- type FlowResult
- type ID
- type PCMS
- type Phase
- type Services
- func (s *Services) ClearFlowRunID(ctx context.Context, itemID string) error
- func (s *Services) DownloadAsset(ctx context.Context, assetID string) (io.ReadCloser, error)
- func (s *Services) DownloadAssetAsBytes(ctx context.Context, assetID string) ([]byte, error)
- func (s *Services) Fail(ctx context.Context, itemID string, ty cmsintegrationcommon.ReqType, ...) error
- func (s *Services) GET(ctx context.Context, url string) (io.ReadCloser, error)
- func (s *Services) GETAsBytes(ctx context.Context, url string) ([]byte, error)
- func (s *Services) GetMainItemWithMetadata(ctx context.Context, i *cms.Item) (_ *cms.Item, err error)
- func (s *Services) UpdateFeatureItemStatus(ctx context.Context, itemID string, ty cmsintegrationcommon.ReqType, ...) error
- func (s *Services) UpdateFlowRunID(ctx context.Context, itemID, runID, triggerID string) error
- func (s *Services) UpdateStatus(ctx context.Context, itemID string, ...) error
- func (s *Services) UploadAsset(ctx context.Context, pid, url string) (_ string, err error)
- type WorkflowConfig
- type WorkflowMachine
- type WorkflowState
Constants ¶
This section is empty.
Variables ¶
var ErrInvalidID = errors.New("invalid fme id")
Functions ¶
func ReqTypeForAction ¶
func ReqTypeForAction(a Action) cmsintegrationcommon.ReqType
ReqTypeForAction returns the ReqType that should be used when executing an action. This bridges the state machine's action output to the existing Flow trigger API.
func WebhookHandler ¶
func WebhookHandler(conf Config) (cmswebhook.Handler, error)
Types ¶
type Action ¶
type Action struct {
Kind ActionKind
QCStatus cmsintegrationcommon.ConvertionStatus // for ActionSetStatus
ConvStatus cmsintegrationcommon.ConvertionStatus // for ActionSetStatus
Message string // for ActionFail
}
Action represents a side-effect to be executed by the caller. The caller interprets these to perform I/O (CMS updates, Flow API calls).
type ActionKind ¶
type ActionKind int
ActionKind identifies a side-effect to be executed by the caller.
const ( ActionSkip ActionKind = iota // do nothing ActionSetStatus // update CMS item status fields ActionStartQC // trigger QC flow job ActionStartConv // trigger Conv flow job ActionFail // set error status + comment )
type Event ¶
type Event struct {
Kind EventKind
QCOK bool // only for EventQCCompleted: true if QC passed without errors
Message string // for EventFlowFailed: error message
}
Event represents something that happened in the system.
type Flow ¶
type Flow interface {
Request(context.Context, FlowRequest) (FlowRequestResult, error)
Cancel(ctx context.Context, baseURL, runID, triggerID string) error
}
type FlowInternalResult ¶
type FlowRequest ¶
type FlowRequest struct {
TriggerID string
BaseURL string // Optional: overrides client's base URL if set
NotificationURL string
AuthToken string
CityGMLURL string
ConvSettings *cmsintegrationcommon.ConvSettings
DryRun bool
}
func (FlowRequest) MarshalJSON ¶
func (r FlowRequest) MarshalJSON() ([]byte, error)
type FlowRequestResult ¶
type FlowResult ¶
type FlowResult struct {
ID string `json:"-"`
RunID string `json:"runId"`
TriggerID string `json:"triggerId"`
DeploymentID string `json:"deploymentId"`
Status string `json:"status"`
Logs []string `json:"logs"`
Outputs []string `json:"outputs"`
}
func (FlowResult) IDsMessage ¶
func (r FlowResult) IDsMessage() string
func (FlowResult) Internal ¶
func (r FlowResult) Internal() (res FlowInternalResult)
Internal parses Flow outputs and extracts conversion results, dictionary, and QC results
func (FlowResult) IsFailed ¶
func (r FlowResult) IsFailed() bool
func (FlowResult) IsSucceeded ¶
func (r FlowResult) IsSucceeded() bool
type ID ¶
type ID struct {
ItemID string
ProjectID string
FeatureType string
Type cmsintegrationcommon.ReqType
}
type PCMS ¶
type PCMS interface {
plateaucms.FeatureTypeStore
plateaucms.MetadataStore
plateaucms.SpecStore
}
type Phase ¶
type Phase string
Phase represents the lifecycle phase of a single operation (QC or Conv).
type Services ¶
type Services struct {
CMS cms.Interface
HTTP *http.Client
TaskRunner gcptaskrunner.TaskRunner
PCMS PCMS
Flow Flow
}
func NewServices ¶
func (*Services) ClearFlowRunID ¶
func (*Services) DownloadAsset ¶
func (*Services) DownloadAssetAsBytes ¶
func (*Services) GETAsBytes ¶
func (*Services) GetMainItemWithMetadata ¶
func (*Services) UpdateFeatureItemStatus ¶
func (s *Services) UpdateFeatureItemStatus(ctx context.Context, itemID string, ty cmsintegrationcommon.ReqType, status cmsintegrationcommon.ConvertionStatus) error
func (*Services) UpdateFlowRunID ¶
func (*Services) UpdateStatus ¶
func (s *Services) UpdateStatus(ctx context.Context, itemID string, qcStatus, convStatus cmsintegrationcommon.ConvertionStatus) error
UpdateStatus updates the QC/Conv status fields directly. This is used by the workflow state machine's action execution.
type WorkflowConfig ¶
type WorkflowConfig struct {
SkipQC bool // QC should be skipped (from IsQCAndConvSkipped or !featureType.QC)
SkipConv bool // Conv should be skipped (from IsQCAndConvSkipped or !featureType.Conv)
FeatureConv bool // feature type supports Conv
}
WorkflowConfig captures static configuration that affects transitions.
type WorkflowMachine ¶
type WorkflowMachine struct {
State WorkflowState
Config WorkflowConfig
}
WorkflowMachine is a pure state machine for the QC/Conv workflow. It contains no I/O — the caller executes the returned actions.
func NewWorkflowMachine ¶
func NewWorkflowMachine(item *cmsintegrationcommon.FeatureItem, featureQC, featureConv bool) *WorkflowMachine
NewWorkflowMachine builds the state machine from the current CMS item state.
func (*WorkflowMachine) Transition ¶
func (m *WorkflowMachine) Transition(event Event) ([]Action, error)
Transition computes the next state and actions to execute.
type WorkflowState ¶
WorkflowState is the compound state of (qc_status, conv_status).