-- Generated by Gleam CI helpers. module CI.Component (start, stop, restart, status, logs) where import CI.Contract as Contract import Data.Maybe (Maybe) import Effect (Effect) import CI.ModuleDependencies as Dependencies import CI.Services as Native -- | Start an idempotent background service through FluentCI’s native workspace service manager and wait for readiness. -- | @param project Workspace directory used by every native service manager call. Default: ".". -- | @param name Full service name, default module-timeplus-default; must start with module-timeplus- to scope lifecycle operations. -- | @param version Docker image version tag. Uses the profile default when omitted; cannot be combined with image. -- | @param image Full Docker image reference, including an optional digest; replaces the default repository and version. -- | @param port Host port for the primary endpoint; zero allocates an available loopback port. AWS Emulator uses the same nonzero port inside and outside its container. Default: 0. -- | @param ports Comma-separated container ports or HOST:CONTAINER bindings. Omit for every profile port with random host bindings. Include the primary port once. -- | @param volumes Comma-separated /CONTAINER_PATH anonymous volumes or SOURCE:/CONTAINER_PATH[:ro|rw] mounts. Explicit named/bind data survives stop. -- | @param env Comma-separated KEY=VALUE test configuration overrides; no JSON object. Use disposable test values because definitions are sent to the manager. -- | @param command Comma-separated foreground command tokens replacing the image command; literal argv, with no shell expansion. -- | @param dependsOn Comma-separated existing native service names whose readiness must be satisfied before startup. -- | @param startupTimeoutMs Readiness deadline, from 100 to 600000 milliseconds; defaults to the service profile. -- | @param stopTimeoutMs Graceful shutdown deadline from 100 to 120000 milliseconds. Default: 5000. -- | @param restartPolicy Native restart policy: never, on_failure or always. Default: "never". Allowed values: never, on_failure, always. -- | @param maxRestarts Maximum automatic restarts, from zero to 100. Default: 0. -- | @param healthCheck Keep running the readiness probe as the native recurring health check. Default: true. -- | @param readinessCommand Comma-separated literal probe command run inside the owned container; overrides the profile probe. -- | @param readinessPath HTTP readiness URL path for profiles using an HTTP probe. start :: { project :: Maybe String, name :: Maybe String, version :: Maybe String, image :: Maybe String, port :: Maybe Int, ports :: Maybe String, volumes :: Maybe String, env :: Maybe String, command :: Maybe String, dependsOn :: Maybe String, startupTimeoutMs :: Maybe Int, stopTimeoutMs :: Maybe Int, restartPolicy :: Maybe String, maxRestarts :: Maybe Int, healthCheck :: Maybe Boolean, readinessCommand :: Maybe String, readinessPath :: Maybe String } -> Effect Native.ServiceResult start args = do Native.start (Dependencies.ensureFor "docker") "timeplus" (Contract.input (Contract.encodeInput args)) -- | Stop only this named service through the native manager; preserve explicitly mounted data. Native dependents are stopped too. -- | @param project Workspace directory used by every native service manager call. Default: ".". -- | @param name Full service name, default module-timeplus-default; must start with module-timeplus- to scope lifecycle operations. stop :: { project :: Maybe String, name :: Maybe String } -> Effect Native.ServiceResult stop args = do Native.stop "timeplus" (Contract.input (Contract.encodeInput args)) -- | Restart the existing native service definition and wait for readiness. -- | @param project Workspace directory used by every native service manager call. Default: ".". -- | @param name Full service name, default module-timeplus-default; must start with module-timeplus- to scope lifecycle operations. restart :: { project :: Maybe String, name :: Maybe String } -> Effect Native.ServiceResult restart args = do Native.restart (Dependencies.ensureFor "docker") "timeplus" (Contract.input (Contract.encodeInput args)) -- | Return the service’s native lifecycle state and actual loopback port bindings. -- | @param project Workspace directory used by every native service manager call. Default: ".". -- | @param name Full service name, default module-timeplus-default; must start with module-timeplus- to scope lifecycle operations. status :: { project :: Maybe String, name :: Maybe String } -> Effect Native.ServiceResult status args = do Native.status "timeplus" (Contract.input (Contract.encodeInput args)) -- | Read native service logs; optionally follow new output until interrupted, without starting or stopping a service. -- | @param project Workspace directory used by every native service manager call. Default: ".". -- | @param name Full service name, default module-timeplus-default; must start with module-timeplus- to scope lifecycle operations. -- | @param tail Maximum recent log lines, from 1 to 10000, before optional live output. Default: 100. -- | @param follow Stream new native service logs until interrupted. Default false returns a bounded snapshot. Interrupting logs leaves the background service running. Default: false. logs :: { project :: Maybe String, name :: Maybe String, tail :: Maybe Int, follow :: Maybe Boolean } -> Effect String logs args = do Native.logs "timeplus" (Contract.input (Contract.encodeInput args))