| Safe Haskell | None |
|---|---|
| Language | GHC2024 |
Arbiter.Servant.API
Contents
Description
Servant API type definitions for Arbiter job queue admin interface.
The API is generated from the registry, creating separate endpoints for each table.
Synopsis
- type ArbiterAPI (registry :: JobPayloadRegistry) = "api" :> ("v1" :> RegistryToAPI registry)
- type family RegistryToAPI (registry :: [(Symbol, Type)]) where ...
- data TableAPI payload (mode :: k) = TableAPI {}
- data JobsAPI payload (mode :: k) = JobsAPI {
- listJobs :: mode :- (QueryParam "limit" Int :> (QueryParam "offset" Int :> (QueryParam "group_key" Text :> (QueryParam "parent_id" Int64 :> (QueryParam "suspended" Bool :> (QueryFlag "roots_only" :> (QueryFlag "in_flight" :> (QueryParam "sort_by" JobSortColumn :> (QueryParam "sort_dir" SortDir :> Get '[JSON] (JobsResponse payload))))))))))
- insertJob :: mode :- (ReqBody '[JSON] (ApiJobWrite payload) :> Post '[JSON] (JobResponse payload))
- insertJobsBatch :: mode :- ("batch" :> (ReqBody '[JSON] (BatchInsertRequest payload) :> Post '[JSON] (BatchInsertResponse payload)))
- getJob :: mode :- (Capture "id" Int64 :> Get '[JSON] (JobResponse payload))
- cancelJob :: mode :- (Capture "id" Int64 :> DeleteNoContent)
- promoteJob :: mode :- (Capture "id" Int64 :> ("promote" :> PostNoContent))
- moveToDLQ :: mode :- (Capture "id" Int64 :> ("move-to-dlq" :> PostNoContent))
- pauseChildren :: mode :- (Capture "id" Int64 :> ("pause-children" :> PostNoContent))
- resumeChildren :: mode :- (Capture "id" Int64 :> ("resume-children" :> PostNoContent))
- suspendJob :: mode :- (Capture "id" Int64 :> ("suspend" :> PostNoContent))
- resumeJob :: mode :- (Capture "id" Int64 :> ("resume" :> PostNoContent))
- data DLQAPI payload (mode :: k) = DLQAPI {
- listDLQ :: mode :- (QueryParam "limit" Int :> (QueryParam "offset" Int :> (QueryParam "parent_id" Int64 :> (QueryParam "group_key" Text :> (QueryParam "sort_by" DLQSortColumn :> (QueryParam "sort_dir" SortDir :> Get '[JSON] (DLQResponse payload)))))))
- retryFromDLQ :: mode :- (Capture "id" Int64 :> ("retry" :> PostNoContent))
- deleteDLQ :: mode :- (Capture "id" Int64 :> DeleteNoContent)
- deleteDLQBatch :: mode :- ("batch-delete" :> (ReqBody '[JSON] BatchDeleteRequest :> Post '[JSON] BatchDeleteResponse))
- data StatsAPI (mode :: k) = StatsAPI {
- getStats :: mode :- Get '[JSON] StatsResponse
- data QueuesAPI (mode :: k) = QueuesAPI {
- listQueues :: mode :- Get '[JSON] QueuesResponse
- type EventsAPI = "stream" :> Raw
- data CronAPI (mode :: k) = CronAPI {
- listSchedules :: mode :- ("schedules" :> Get '[JSON] CronSchedulesResponse)
- updateSchedule :: mode :- ("schedules" :> (Capture "name" Text :> (ReqBody '[JSON] CronScheduleUpdate :> Patch '[JSON] CronScheduleRow)))
Documentation
type ArbiterAPI (registry :: JobPayloadRegistry) = "api" :> ("v1" :> RegistryToAPI registry) Source #
Top-level Arbiter API, mounted at /api/v1. The route tree under that
prefix is generated from the registry; see RegistryToAPI for the shape
and the per-route data types (TableAPI, QueuesAPI, EventsAPI,
CronAPI) for what each one exposes.
type family RegistryToAPI (registry :: [(Symbol, Type)]) where ... Source #
Generates a TableAPI route for each entry in the registry, followed by
the shared QueuesAPI, EventsAPI, and CronAPI routes. The expansion is
in the equations below.
Equations
| RegistryToAPI ('[] :: [(Symbol, Type)]) = ("queues" :> NamedRoutes (QueuesAPI :: Type -> Type)) :<|> (("events" :> EventsAPI) :<|> ("cron" :> NamedRoutes (CronAPI :: Type -> Type))) | |
| RegistryToAPI '['(tableName, payload)] = (tableName :> NamedRoutes (TableAPI payload :: Type -> Type)) :<|> (("queues" :> NamedRoutes (QueuesAPI :: Type -> Type)) :<|> (("events" :> EventsAPI) :<|> ("cron" :> NamedRoutes (CronAPI :: Type -> Type)))) | |
| RegistryToAPI ('(tableName, payload) ': rest) = (tableName :> NamedRoutes (TableAPI payload :: Type -> Type)) :<|> RegistryToAPI rest |
data TableAPI payload (mode :: k) Source #
API routes for a specific table
Constructors
| TableAPI | |
Instances
| Generic (TableAPI payload mode) Source # | |||||
Defined in Arbiter.Servant.API Associated Types
| |||||
| type Rep (TableAPI payload mode) Source # | |||||
Defined in Arbiter.Servant.API type Rep (TableAPI payload mode) = D1 ('MetaData "TableAPI" "Arbiter.Servant.API" "arbiter-servant-0.1.0.0-inplace" 'False) (C1 ('MetaCons "TableAPI" 'PrefixI 'True) (S1 ('MetaSel ('Just "jobs") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (mode :- ("jobs" :> NamedRoutes (JobsAPI payload :: Type -> Type)))) :*: (S1 ('MetaSel ('Just "dlq") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (mode :- ("dlq" :> NamedRoutes (DLQAPI payload :: Type -> Type)))) :*: S1 ('MetaSel ('Just "stats") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (mode :- ("stats" :> NamedRoutes (StatsAPI :: Type -> Type))))))) | |||||
data JobsAPI payload (mode :: k) Source #
Jobs API routes - manage jobs in a specific table
Constructors
| JobsAPI | |
Fields
| |
Instances
| Generic (JobsAPI payload mode) Source # | |||||
Defined in Arbiter.Servant.API Associated Types
| |||||
| type Rep (JobsAPI payload mode) Source # | |||||
Defined in Arbiter.Servant.API type Rep (JobsAPI payload mode) = D1 ('MetaData "JobsAPI" "Arbiter.Servant.API" "arbiter-servant-0.1.0.0-inplace" 'False) (C1 ('MetaCons "JobsAPI" 'PrefixI 'True) (((S1 ('MetaSel ('Just "listJobs") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (mode :- (QueryParam "limit" Int :> (QueryParam "offset" Int :> (QueryParam "group_key" Text :> (QueryParam "parent_id" Int64 :> (QueryParam "suspended" Bool :> (QueryFlag "roots_only" :> (QueryFlag "in_flight" :> (QueryParam "sort_by" JobSortColumn :> (QueryParam "sort_dir" SortDir :> Get '[JSON] (JobsResponse payload)))))))))))) :*: S1 ('MetaSel ('Just "insertJob") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (mode :- (ReqBody '[JSON] (ApiJobWrite payload) :> Post '[JSON] (JobResponse payload))))) :*: (S1 ('MetaSel ('Just "insertJobsBatch") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (mode :- ("batch" :> (ReqBody '[JSON] (BatchInsertRequest payload) :> Post '[JSON] (BatchInsertResponse payload))))) :*: (S1 ('MetaSel ('Just "getJob") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (mode :- (Capture "id" Int64 :> Get '[JSON] (JobResponse payload)))) :*: S1 ('MetaSel ('Just "cancelJob") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (mode :- (Capture "id" Int64 :> DeleteNoContent)))))) :*: ((S1 ('MetaSel ('Just "promoteJob") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (mode :- (Capture "id" Int64 :> ("promote" :> PostNoContent)))) :*: (S1 ('MetaSel ('Just "moveToDLQ") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (mode :- (Capture "id" Int64 :> ("move-to-dlq" :> PostNoContent)))) :*: S1 ('MetaSel ('Just "pauseChildren") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (mode :- (Capture "id" Int64 :> ("pause-children" :> PostNoContent)))))) :*: (S1 ('MetaSel ('Just "resumeChildren") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (mode :- (Capture "id" Int64 :> ("resume-children" :> PostNoContent)))) :*: (S1 ('MetaSel ('Just "suspendJob") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (mode :- (Capture "id" Int64 :> ("suspend" :> PostNoContent)))) :*: S1 ('MetaSel ('Just "resumeJob") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (mode :- (Capture "id" Int64 :> ("resume" :> PostNoContent))))))))) | |||||
data DLQAPI payload (mode :: k) Source #
DLQ API routes - manage failed jobs in a specific table
Constructors
| DLQAPI | |
Fields
| |
Instances
| Generic (DLQAPI payload mode) Source # | |||||
Defined in Arbiter.Servant.API Associated Types
| |||||
| type Rep (DLQAPI payload mode) Source # | |||||
Defined in Arbiter.Servant.API type Rep (DLQAPI payload mode) = D1 ('MetaData "DLQAPI" "Arbiter.Servant.API" "arbiter-servant-0.1.0.0-inplace" 'False) (C1 ('MetaCons "DLQAPI" 'PrefixI 'True) ((S1 ('MetaSel ('Just "listDLQ") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (mode :- (QueryParam "limit" Int :> (QueryParam "offset" Int :> (QueryParam "parent_id" Int64 :> (QueryParam "group_key" Text :> (QueryParam "sort_by" DLQSortColumn :> (QueryParam "sort_dir" SortDir :> Get '[JSON] (DLQResponse payload))))))))) :*: S1 ('MetaSel ('Just "retryFromDLQ") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (mode :- (Capture "id" Int64 :> ("retry" :> PostNoContent))))) :*: (S1 ('MetaSel ('Just "deleteDLQ") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (mode :- (Capture "id" Int64 :> DeleteNoContent))) :*: S1 ('MetaSel ('Just "deleteDLQBatch") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (mode :- ("batch-delete" :> (ReqBody '[JSON] BatchDeleteRequest :> Post '[JSON] BatchDeleteResponse))))))) | |||||
data StatsAPI (mode :: k) Source #
Stats API routes - queue statistics for a specific table
Constructors
| StatsAPI | |
Fields
| |
Instances
| Generic (StatsAPI mode) Source # | |||||
Defined in Arbiter.Servant.API Associated Types
| |||||
| type Rep (StatsAPI mode) Source # | |||||
Defined in Arbiter.Servant.API type Rep (StatsAPI mode) = D1 ('MetaData "StatsAPI" "Arbiter.Servant.API" "arbiter-servant-0.1.0.0-inplace" 'False) (C1 ('MetaCons "StatsAPI" 'PrefixI 'True) (S1 ('MetaSel ('Just "getStats") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (mode :- Get '[JSON] StatsResponse)))) | |||||
data QueuesAPI (mode :: k) Source #
Queues API routes - list available queues
Constructors
| QueuesAPI | |
Fields
| |
Instances
| Generic (QueuesAPI mode) Source # | |||||
Defined in Arbiter.Servant.API Associated Types
| |||||
| type Rep (QueuesAPI mode) Source # | |||||
Defined in Arbiter.Servant.API type Rep (QueuesAPI mode) = D1 ('MetaData "QueuesAPI" "Arbiter.Servant.API" "arbiter-servant-0.1.0.0-inplace" 'False) (C1 ('MetaCons "QueuesAPI" 'PrefixI 'True) (S1 ('MetaSel ('Just "listQueues") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (mode :- Get '[JSON] QueuesResponse)))) | |||||
data CronAPI (mode :: k) Source #
Cron API routes - manage cron schedules
Constructors
| CronAPI | |
Fields
| |
Instances
| Generic (CronAPI mode) Source # | |||||
Defined in Arbiter.Servant.API Associated Types
| |||||
| type Rep (CronAPI mode) Source # | |||||
Defined in Arbiter.Servant.API type Rep (CronAPI mode) = D1 ('MetaData "CronAPI" "Arbiter.Servant.API" "arbiter-servant-0.1.0.0-inplace" 'False) (C1 ('MetaCons "CronAPI" 'PrefixI 'True) (S1 ('MetaSel ('Just "listSchedules") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (mode :- ("schedules" :> Get '[JSON] CronSchedulesResponse))) :*: S1 ('MetaSel ('Just "updateSchedule") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (mode :- ("schedules" :> (Capture "name" Text :> (ReqBody '[JSON] CronScheduleUpdate :> Patch '[JSON] CronScheduleRow))))))) | |||||
Orphan instances
| FromHttpApiData DLQSortColumn Source # | |
Methods parseUrlPiece :: Text -> Either Text DLQSortColumn | |
| FromHttpApiData JobSortColumn Source # | |
Methods parseUrlPiece :: Text -> Either Text JobSortColumn | |
| FromHttpApiData SortDir Source # | |
Methods parseUrlPiece :: Text -> Either Text SortDir parseHeader :: ByteString -> Either Text SortDir parseQueryParam :: Text -> Either Text SortDir | |
| ToHttpApiData DLQSortColumn Source # | |
Methods toUrlPiece :: DLQSortColumn -> Text toEncodedUrlPiece :: DLQSortColumn -> Builder toHeader :: DLQSortColumn -> ByteString toQueryParam :: DLQSortColumn -> Text | |
| ToHttpApiData JobSortColumn Source # | |
Methods toUrlPiece :: JobSortColumn -> Text toEncodedUrlPiece :: JobSortColumn -> Builder toHeader :: JobSortColumn -> ByteString toQueryParam :: JobSortColumn -> Text | |
| ToHttpApiData SortDir Source # | |
Methods toUrlPiece :: SortDir -> Text toEncodedUrlPiece :: SortDir -> Builder toHeader :: SortDir -> ByteString toQueryParam :: SortDir -> Text | |