{-# 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.ApiGatewayV2.Types.JWTConfiguration where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data JWTConfiguration = JWTConfiguration'
{
JWTConfiguration -> Maybe [Text]
audience :: Prelude.Maybe [Prelude.Text],
JWTConfiguration -> Maybe Text
issuer :: Prelude.Maybe Prelude.Text
}
deriving (JWTConfiguration -> JWTConfiguration -> Bool
(JWTConfiguration -> JWTConfiguration -> Bool)
-> (JWTConfiguration -> JWTConfiguration -> Bool)
-> Eq JWTConfiguration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: JWTConfiguration -> JWTConfiguration -> Bool
$c/= :: JWTConfiguration -> JWTConfiguration -> Bool
== :: JWTConfiguration -> JWTConfiguration -> Bool
$c== :: JWTConfiguration -> JWTConfiguration -> Bool
Prelude.Eq, ReadPrec [JWTConfiguration]
ReadPrec JWTConfiguration
Int -> ReadS JWTConfiguration
ReadS [JWTConfiguration]
(Int -> ReadS JWTConfiguration)
-> ReadS [JWTConfiguration]
-> ReadPrec JWTConfiguration
-> ReadPrec [JWTConfiguration]
-> Read JWTConfiguration
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [JWTConfiguration]
$creadListPrec :: ReadPrec [JWTConfiguration]
readPrec :: ReadPrec JWTConfiguration
$creadPrec :: ReadPrec JWTConfiguration
readList :: ReadS [JWTConfiguration]
$creadList :: ReadS [JWTConfiguration]
readsPrec :: Int -> ReadS JWTConfiguration
$creadsPrec :: Int -> ReadS JWTConfiguration
Prelude.Read, Int -> JWTConfiguration -> ShowS
[JWTConfiguration] -> ShowS
JWTConfiguration -> String
(Int -> JWTConfiguration -> ShowS)
-> (JWTConfiguration -> String)
-> ([JWTConfiguration] -> ShowS)
-> Show JWTConfiguration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [JWTConfiguration] -> ShowS
$cshowList :: [JWTConfiguration] -> ShowS
show :: JWTConfiguration -> String
$cshow :: JWTConfiguration -> String
showsPrec :: Int -> JWTConfiguration -> ShowS
$cshowsPrec :: Int -> JWTConfiguration -> ShowS
Prelude.Show, (forall x. JWTConfiguration -> Rep JWTConfiguration x)
-> (forall x. Rep JWTConfiguration x -> JWTConfiguration)
-> Generic JWTConfiguration
forall x. Rep JWTConfiguration x -> JWTConfiguration
forall x. JWTConfiguration -> Rep JWTConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep JWTConfiguration x -> JWTConfiguration
$cfrom :: forall x. JWTConfiguration -> Rep JWTConfiguration x
Prelude.Generic)
newJWTConfiguration ::
JWTConfiguration
newJWTConfiguration :: JWTConfiguration
newJWTConfiguration =
JWTConfiguration' :: Maybe [Text] -> Maybe Text -> JWTConfiguration
JWTConfiguration'
{ $sel:audience:JWTConfiguration' :: Maybe [Text]
audience = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
$sel:issuer:JWTConfiguration' :: Maybe Text
issuer = Maybe Text
forall a. Maybe a
Prelude.Nothing
}
jWTConfiguration_audience :: Lens.Lens' JWTConfiguration (Prelude.Maybe [Prelude.Text])
jWTConfiguration_audience :: (Maybe [Text] -> f (Maybe [Text]))
-> JWTConfiguration -> f JWTConfiguration
jWTConfiguration_audience = (JWTConfiguration -> Maybe [Text])
-> (JWTConfiguration -> Maybe [Text] -> JWTConfiguration)
-> Lens
JWTConfiguration JWTConfiguration (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\JWTConfiguration' {Maybe [Text]
audience :: Maybe [Text]
$sel:audience:JWTConfiguration' :: JWTConfiguration -> Maybe [Text]
audience} -> Maybe [Text]
audience) (\s :: JWTConfiguration
s@JWTConfiguration' {} Maybe [Text]
a -> JWTConfiguration
s {$sel:audience:JWTConfiguration' :: Maybe [Text]
audience = Maybe [Text]
a} :: JWTConfiguration) ((Maybe [Text] -> f (Maybe [Text]))
-> JWTConfiguration -> f JWTConfiguration)
-> ((Maybe [Text] -> f (Maybe [Text]))
-> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> JWTConfiguration
-> f JWTConfiguration
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [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 [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
jWTConfiguration_issuer :: Lens.Lens' JWTConfiguration (Prelude.Maybe Prelude.Text)
jWTConfiguration_issuer :: (Maybe Text -> f (Maybe Text))
-> JWTConfiguration -> f JWTConfiguration
jWTConfiguration_issuer = (JWTConfiguration -> Maybe Text)
-> (JWTConfiguration -> Maybe Text -> JWTConfiguration)
-> Lens JWTConfiguration JWTConfiguration (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\JWTConfiguration' {Maybe Text
issuer :: Maybe Text
$sel:issuer:JWTConfiguration' :: JWTConfiguration -> Maybe Text
issuer} -> Maybe Text
issuer) (\s :: JWTConfiguration
s@JWTConfiguration' {} Maybe Text
a -> JWTConfiguration
s {$sel:issuer:JWTConfiguration' :: Maybe Text
issuer = Maybe Text
a} :: JWTConfiguration)
instance Core.FromJSON JWTConfiguration where
parseJSON :: Value -> Parser JWTConfiguration
parseJSON =
String
-> (Object -> Parser JWTConfiguration)
-> Value
-> Parser JWTConfiguration
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"JWTConfiguration"
( \Object
x ->
Maybe [Text] -> Maybe Text -> JWTConfiguration
JWTConfiguration'
(Maybe [Text] -> Maybe Text -> JWTConfiguration)
-> Parser (Maybe [Text]) -> Parser (Maybe Text -> JWTConfiguration)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe (Maybe [Text]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"audience" Parser (Maybe (Maybe [Text]))
-> Maybe [Text] -> Parser (Maybe [Text])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Text]
forall a. Monoid a => a
Prelude.mempty)
Parser (Maybe Text -> JWTConfiguration)
-> Parser (Maybe Text) -> Parser JWTConfiguration
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"issuer")
)
instance Prelude.Hashable JWTConfiguration
instance Prelude.NFData JWTConfiguration
instance Core.ToJSON JWTConfiguration where
toJSON :: JWTConfiguration -> Value
toJSON JWTConfiguration' {Maybe [Text]
Maybe Text
issuer :: Maybe Text
audience :: Maybe [Text]
$sel:issuer:JWTConfiguration' :: JWTConfiguration -> Maybe Text
$sel:audience:JWTConfiguration' :: JWTConfiguration -> Maybe [Text]
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"audience" 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]
audience,
(Text
"issuer" 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
issuer
]
)