fix(Aeson): HashMap to KeyMap; update imports
This commit is contained in:
parent
59cd492fb1
commit
b82030a9d2
@ -53,7 +53,8 @@ import qualified Data.Set as Set
|
||||
import Jobs.Types
|
||||
|
||||
import qualified Data.Aeson as Aeson
|
||||
import qualified Data.HashMap.Strict as HashMap
|
||||
--import qualified Data.HashMap.Strict as HashMap
|
||||
import qualified Data.Aeson.KeyMap as KeyMap
|
||||
|
||||
import Data.IntervalMap.Strict (IntervalMap)
|
||||
import qualified Data.IntervalMap.Strict as IntervalMap
|
||||
@ -64,6 +65,8 @@ import qualified Utils.Pool as Custom
|
||||
|
||||
import GHC.Stack
|
||||
|
||||
import Data.Maybe
|
||||
|
||||
{-# ANN module ("HLint: ignore Use even" :: String) #-}
|
||||
|
||||
|
||||
@ -491,7 +494,7 @@ classifyJobWorkerState :: JobWorkerId -> JobWorkerState -> Prometheus.Label4
|
||||
classifyJobWorkerState wId jws = (showWorkerId wId, tag, maybe "n/a" pack mJobCtl, maybe "n/a" pack mJob)
|
||||
where
|
||||
Aeson.Object obj = Aeson.toJSON jws
|
||||
Aeson.String tag = obj HashMap.! "state"
|
||||
Aeson.String tag = fromJust $ obj KeyMap.!? "state"
|
||||
mJobCtl = asum
|
||||
[ classifyJobCtl <$> jws ^? _jobWorkerJobCtl
|
||||
, "perform" <$ jws ^? _jobWorkerJob
|
||||
|
||||
@ -25,7 +25,7 @@ import Data.Aeson.Types (Parser)
|
||||
import qualified Data.Aeson as JSON
|
||||
import qualified Data.Aeson.Parser as JSON
|
||||
import qualified Data.Aeson.Parser.Internal as JSON (jsonEOF')
|
||||
import qualified Data.Aeson.Internal as JSON (iparse, formatError)
|
||||
import qualified Data.Aeson.Types as JSON (iparse, formatError)
|
||||
|
||||
import qualified Data.HashMap.Strict as HashMap
|
||||
|
||||
@ -137,6 +137,7 @@ decodeBearer (Jwt bs) = do
|
||||
Jose.Jwe (_header, payload) -> return payload
|
||||
parser <- bearerParseJSON'
|
||||
bearer@BearerToken{..} <- either (throwM . BearerTokenInvalidFormat . uncurry JSON.formatError) return $ JSON.eitherDecodeStrictWith JSON.jsonEOF' (JSON.iparse parser) content'
|
||||
-- bearer@BearerToken{..} <- either (throwM . BearerTokenInvalidFormat . _) return $ JSON.eitherDecodeStrictWith JSON.jsonEOF' (JSON.iparse parser) content'
|
||||
bearerIssuedFor' <- getsSite $ view clusterID
|
||||
unless (bearerIssuedFor' == bearerIssuedFor) $
|
||||
throwM BearerTokenWrongAudience
|
||||
|
||||
Reference in New Issue
Block a user