54 lines
2.5 KiB
C#
54 lines
2.5 KiB
C#
|
|
namespace w4c_workflows.Models;
|
||
|
|
|
||
|
|
// ---------------------------------------------------------------------------
|
||
|
|
// YAML shape (authoritative source of truth, stored in git under workflows/).
|
||
|
|
// Field names are camelCase in YAML; YamlDotNet maps them via CamelCaseNaming.
|
||
|
|
// ---------------------------------------------------------------------------
|
||
|
|
|
||
|
|
public class WorkflowDefinition
|
||
|
|
{
|
||
|
|
public string? Name { get; set; }
|
||
|
|
public string? Description { get; set; }
|
||
|
|
public string? Version { get; set; } // user-facing build/version, e.g. "1.0.1"
|
||
|
|
public string? Mode { get; set; } // function | durable | handler
|
||
|
|
public string? Language { get; set; } // shell | javascript | typescript | csharp | python
|
||
|
|
public string? Target { get; set; } // execution host (default: "default")
|
||
|
|
/// <summary>Managed-server id (or alias) that task code should run on. A task-level
|
||
|
|
/// <c>server</c> overrides this header default; when set, the worker executes the task
|
||
|
|
/// on that server via SSH instead of a local subprocess.</summary>
|
||
|
|
public string? Server { get; set; }
|
||
|
|
public TriggerDefinition? Trigger { get; set; }
|
||
|
|
public EntryDefinition? Entry { get; set; }
|
||
|
|
public Dictionary<string, string>? Env { get; set; }
|
||
|
|
public List<TaskDefinition>? Tasks { get; set; }
|
||
|
|
}
|
||
|
|
|
||
|
|
public class TaskDefinition
|
||
|
|
{
|
||
|
|
public string? Id { get; set; }
|
||
|
|
public string? Parent { get; set; } // "root" | another task id (organizational)
|
||
|
|
public string? Next { get; set; } // success flow
|
||
|
|
public string? OnError { get; set; } // failure flow (compensation)
|
||
|
|
public string? Language { get; set; } // inherits workflow language when omitted
|
||
|
|
public string? Mode { get; set; } // inherits workflow mode when omitted
|
||
|
|
/// <summary>Target managed server for this task. Overrides the workflow header <c>server</c>.</summary>
|
||
|
|
public string? Server { get; set; }
|
||
|
|
public EntryDefinition? Entry { get; set; }
|
||
|
|
public Dictionary<string, string>? Env { get; set; }
|
||
|
|
}
|
||
|
|
|
||
|
|
public class TriggerDefinition
|
||
|
|
{
|
||
|
|
public string? Type { get; set; } // queue | cron | interval | webhook | event
|
||
|
|
public string? Stream { get; set; } // queue: stream/topic (default wf:{tenant}:events)
|
||
|
|
public string? Cron { get; set; } // cron: "0 */6 * * *"
|
||
|
|
public string? Interval { get; set; } // interval: "30m", "2h", "45s"
|
||
|
|
public string? WebhookPath { get; set; } // webhook: "/h/orders"
|
||
|
|
}
|
||
|
|
|
||
|
|
public class EntryDefinition
|
||
|
|
{
|
||
|
|
public string? File { get; set; }
|
||
|
|
public string? Function { get; set; }
|
||
|
|
}
|