{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
module Amazonka.IoT.Types.HttpContext where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data HttpContext = HttpContext'
{
:: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
HttpContext -> Maybe Text
queryString :: Prelude.Maybe Prelude.Text
}
deriving (HttpContext -> HttpContext -> Bool
(HttpContext -> HttpContext -> Bool)
-> (HttpContext -> HttpContext -> Bool) -> Eq HttpContext
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: HttpContext -> HttpContext -> Bool
$c/= :: HttpContext -> HttpContext -> Bool
== :: HttpContext -> HttpContext -> Bool
$c== :: HttpContext -> HttpContext -> Bool
Prelude.Eq, ReadPrec [HttpContext]
ReadPrec HttpContext
Int -> ReadS HttpContext
ReadS [HttpContext]
(Int -> ReadS HttpContext)
-> ReadS [HttpContext]
-> ReadPrec HttpContext
-> ReadPrec [HttpContext]
-> Read HttpContext
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [HttpContext]
$creadListPrec :: ReadPrec [HttpContext]
readPrec :: ReadPrec HttpContext
$creadPrec :: ReadPrec HttpContext
readList :: ReadS [HttpContext]
$creadList :: ReadS [HttpContext]
readsPrec :: Int -> ReadS HttpContext
$creadsPrec :: Int -> ReadS HttpContext
Prelude.Read, Int -> HttpContext -> ShowS
[HttpContext] -> ShowS
HttpContext -> String
(Int -> HttpContext -> ShowS)
-> (HttpContext -> String)
-> ([HttpContext] -> ShowS)
-> Show HttpContext
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [HttpContext] -> ShowS
$cshowList :: [HttpContext] -> ShowS
show :: HttpContext -> String
$cshow :: HttpContext -> String
showsPrec :: Int -> HttpContext -> ShowS
$cshowsPrec :: Int -> HttpContext -> ShowS
Prelude.Show, (forall x. HttpContext -> Rep HttpContext x)
-> (forall x. Rep HttpContext x -> HttpContext)
-> Generic HttpContext
forall x. Rep HttpContext x -> HttpContext
forall x. HttpContext -> Rep HttpContext x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep HttpContext x -> HttpContext
$cfrom :: forall x. HttpContext -> Rep HttpContext x
Prelude.Generic)
newHttpContext ::
HttpContext
newHttpContext :: HttpContext
newHttpContext =
HttpContext' :: Maybe (HashMap Text Text) -> Maybe Text -> HttpContext
HttpContext'
{ $sel:headers:HttpContext' :: Maybe (HashMap Text Text)
headers = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
$sel:queryString:HttpContext' :: Maybe Text
queryString = Maybe Text
forall a. Maybe a
Prelude.Nothing
}
httpContext_headers :: Lens.Lens' HttpContext (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
= (HttpContext -> Maybe (HashMap Text Text))
-> (HttpContext -> Maybe (HashMap Text Text) -> HttpContext)
-> Lens
HttpContext
HttpContext
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HttpContext' {Maybe (HashMap Text Text)
headers :: Maybe (HashMap Text Text)
$sel:headers:HttpContext' :: HttpContext -> Maybe (HashMap Text Text)
headers} -> Maybe (HashMap Text Text)
headers) (\s :: HttpContext
s@HttpContext' {} Maybe (HashMap Text Text)
a -> HttpContext
s {$sel:headers:HttpContext' :: Maybe (HashMap Text Text)
headers = Maybe (HashMap Text Text)
a} :: HttpContext) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> HttpContext -> f HttpContext)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> HttpContext
-> f HttpContext
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
-> Iso
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
httpContext_queryString :: Lens.Lens' HttpContext (Prelude.Maybe Prelude.Text)
httpContext_queryString :: (Maybe Text -> f (Maybe Text)) -> HttpContext -> f HttpContext
httpContext_queryString = (HttpContext -> Maybe Text)
-> (HttpContext -> Maybe Text -> HttpContext)
-> Lens HttpContext HttpContext (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HttpContext' {Maybe Text
queryString :: Maybe Text
$sel:queryString:HttpContext' :: HttpContext -> Maybe Text
queryString} -> Maybe Text
queryString) (\s :: HttpContext
s@HttpContext' {} Maybe Text
a -> HttpContext
s {$sel:queryString:HttpContext' :: Maybe Text
queryString = Maybe Text
a} :: HttpContext)
instance Prelude.Hashable HttpContext
instance Prelude.NFData HttpContext
instance Core.ToJSON HttpContext where
toJSON :: HttpContext -> Value
toJSON HttpContext' {Maybe Text
Maybe (HashMap Text Text)
queryString :: Maybe Text
headers :: Maybe (HashMap Text Text)
$sel:queryString:HttpContext' :: HttpContext -> Maybe Text
$sel:headers:HttpContext' :: HttpContext -> Maybe (HashMap Text Text)
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"headers" Text -> HashMap Text Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (HashMap Text Text -> Pair)
-> Maybe (HashMap Text Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text Text)
headers,
(Text
"queryString" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
queryString
]
)