CI / CI (pull_request) Canceled after 0s
- New internal/temporal/poimen.go: PoimenHandler with typed REST endpoints POST /v1/poimen/plan — call PlannerActivity (stub until workflows#23) POST /v1/poimen/execute — start DAG/Orchestrator/Routing workflows GET /v1/poimen/executions — list Poimen workflow executions GET /v1/poimen/executions/:id — describe execution GET /v1/poimen/executions/:id/history — activity event history GET /v1/poimen/executions/:id/stream — SSE events (delegates to sse.go) POST /v1/poimen/executions/:id/signal — pause/resume/cancel DELETE /v1/poimen/executions/:id — terminate workflow - New internal/serviceadapter/poimen_adapter.go: ServiceAdapter spec + factory - Wire PoimenHandler in cmd/gateway/main.go via ServiceAdapter registry - Workflow type registry: dag->DAGWorkflow, orchestrator->OrchestratorWorkflow, routing->RoutingWorkflow (all on poimen-worker task queue) Closes #32 Closes #34
98 lines
2.4 KiB
Go
98 lines
2.4 KiB
Go
package serviceadapter
|
|
|
|
import (
|
|
"forgejo.riotpiao.com/rock/homelab-frontend/internal/temporal"
|
|
)
|
|
|
|
// NewPoimenAdapter creates a ServiceAdapter for the Poimen orchestrator service.
|
|
func NewPoimenAdapter(h *temporal.Handler) *ServiceAdapter {
|
|
return &ServiceAdapter{
|
|
Namespace: "poimen",
|
|
ServiceName: "poimen",
|
|
Handler: temporal.NewPoimenHandler(h),
|
|
Spec: *GetPoimenSpec(),
|
|
}
|
|
}
|
|
|
|
// GetPoimenSpec returns the ServiceAdapter spec for the Poimen service.
|
|
func GetPoimenSpec() *Spec {
|
|
return &Spec{
|
|
ServiceName: "poimen",
|
|
Upstream: Upstream{
|
|
URL: "internal://poimen",
|
|
TimeoutSeconds: 60,
|
|
},
|
|
Auth: Auth{
|
|
Required: true,
|
|
Capability: "workflow:read",
|
|
},
|
|
Resources: []Resource{
|
|
{
|
|
Name: "plan",
|
|
Methods: []Method{{
|
|
Verb: "POST",
|
|
UpstreamPath: "/v1/poimen/plan",
|
|
Auth: &Auth{Required: true, Capability: "workflow:execute"},
|
|
}},
|
|
},
|
|
{
|
|
Name: "execute",
|
|
Methods: []Method{{
|
|
Verb: "POST",
|
|
UpstreamPath: "/v1/poimen/execute",
|
|
Auth: &Auth{Required: true, Capability: "workflow:execute"},
|
|
}},
|
|
},
|
|
{
|
|
Name: "executions",
|
|
Methods: []Method{
|
|
{
|
|
Verb: "GET",
|
|
UpstreamPath: "/v1/poimen/executions",
|
|
Auth: &Auth{Required: true, Capability: "workflow:read"},
|
|
},
|
|
},
|
|
},
|
|
{
|
|
Name: "execution-detail",
|
|
Methods: []Method{
|
|
{
|
|
Verb: "GET",
|
|
UpstreamPath: "/v1/poimen/executions/{id}",
|
|
Auth: &Auth{Required: true, Capability: "workflow:read"},
|
|
},
|
|
{
|
|
Verb: "DELETE",
|
|
UpstreamPath: "/v1/poimen/executions/{id}",
|
|
Auth: &Auth{Required: true, Capability: "workflow:execute"},
|
|
},
|
|
},
|
|
},
|
|
{
|
|
Name: "execution-history",
|
|
Methods: []Method{{
|
|
Verb: "GET",
|
|
UpstreamPath: "/v1/poimen/executions/{id}/history",
|
|
Auth: &Auth{Required: true, Capability: "workflow:read"},
|
|
}},
|
|
},
|
|
{
|
|
Name: "execution-stream",
|
|
Methods: []Method{{
|
|
Verb: "GET",
|
|
UpstreamPath: "/v1/poimen/executions/{id}/stream",
|
|
Auth: &Auth{Required: true, Capability: "workflow:read"},
|
|
}},
|
|
},
|
|
{
|
|
Name: "execution-signal",
|
|
Methods: []Method{{
|
|
Verb: "POST",
|
|
UpstreamPath: "/v1/poimen/executions/{id}/signal",
|
|
Auth: &Auth{Required: true, Capability: "workflow:execute"},
|
|
}},
|
|
},
|
|
},
|
|
}
|
|
}
|