def Fin.run.go

bend-kube-runtime@0.2.0.0 · src/helpers.bend:48

import bend-kube-runtime@0.2.0.0/src/helpers.bend as Helpers
import Base
import bend-kube-runtime@0.2.0.0/src/json.bend as J
import bend-kube-runtime@0.2.0.0/src/core.bend as C
import bend-kube-runtime@0.2.0.0/src/config.bend as K
import bend-kube-runtime@0.2.0.0/src/client.bend as Cl
import bend-kube-runtime@0.2.0.0/src/queue.bend as Q
import bend-kube-runtime@0.2.0.0/src/finalizer.bend as F

48def Fin.run.go(~apply: J.Json -> K.Config -> IO(Q.Action), ~cleanup: J.Json -> K.Config -> IO(Q.Action),
49  +cfg: K.Config, +api: C.Api, +o: J.Json, s: F.FState) -> IO(Q.Action):
50  match s:
51    case F.FApply{}:
52      apply(o, cfg)
53    case F.FAdd{p}:
54      IO.bind(Result<&2, &2, Cl.KErr, J.Json>, Q.Action, Cl.Client.patch(cfg, api, C.Obj.name(o), C.PJson{}, p),
55        Fin.added)
56    case F.FCleanup{p}:
57      IO.bind(Q.Action, Q.Action, cleanup(o, cfg), a => Fin.cleaned(cfg, api, C.Obj.name(o), p, a))
58    case F.FDone{}:
59      IO.pure(Q.Action, Q.AwaitChange{})

Uses (15)

Used by (1)