{-# 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.Kafka.Types.ClientAuthentication where
import qualified Amazonka.Core as Core
import Amazonka.Kafka.Types.Sasl
import Amazonka.Kafka.Types.Tls
import Amazonka.Kafka.Types.Unauthenticated
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data ClientAuthentication = ClientAuthentication'
{
ClientAuthentication -> Maybe Sasl
sasl :: Prelude.Maybe Sasl,
ClientAuthentication -> Maybe Tls
tls :: Prelude.Maybe Tls,
ClientAuthentication -> Maybe Unauthenticated
unauthenticated :: Prelude.Maybe Unauthenticated
}
deriving (ClientAuthentication -> ClientAuthentication -> Bool
(ClientAuthentication -> ClientAuthentication -> Bool)
-> (ClientAuthentication -> ClientAuthentication -> Bool)
-> Eq ClientAuthentication
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ClientAuthentication -> ClientAuthentication -> Bool
$c/= :: ClientAuthentication -> ClientAuthentication -> Bool
== :: ClientAuthentication -> ClientAuthentication -> Bool
$c== :: ClientAuthentication -> ClientAuthentication -> Bool
Prelude.Eq, ReadPrec [ClientAuthentication]
ReadPrec ClientAuthentication
Int -> ReadS ClientAuthentication
ReadS [ClientAuthentication]
(Int -> ReadS ClientAuthentication)
-> ReadS [ClientAuthentication]
-> ReadPrec ClientAuthentication
-> ReadPrec [ClientAuthentication]
-> Read ClientAuthentication
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ClientAuthentication]
$creadListPrec :: ReadPrec [ClientAuthentication]
readPrec :: ReadPrec ClientAuthentication
$creadPrec :: ReadPrec ClientAuthentication
readList :: ReadS [ClientAuthentication]
$creadList :: ReadS [ClientAuthentication]
readsPrec :: Int -> ReadS ClientAuthentication
$creadsPrec :: Int -> ReadS ClientAuthentication
Prelude.Read, Int -> ClientAuthentication -> ShowS
[ClientAuthentication] -> ShowS
ClientAuthentication -> String
(Int -> ClientAuthentication -> ShowS)
-> (ClientAuthentication -> String)
-> ([ClientAuthentication] -> ShowS)
-> Show ClientAuthentication
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ClientAuthentication] -> ShowS
$cshowList :: [ClientAuthentication] -> ShowS
show :: ClientAuthentication -> String
$cshow :: ClientAuthentication -> String
showsPrec :: Int -> ClientAuthentication -> ShowS
$cshowsPrec :: Int -> ClientAuthentication -> ShowS
Prelude.Show, (forall x. ClientAuthentication -> Rep ClientAuthentication x)
-> (forall x. Rep ClientAuthentication x -> ClientAuthentication)
-> Generic ClientAuthentication
forall x. Rep ClientAuthentication x -> ClientAuthentication
forall x. ClientAuthentication -> Rep ClientAuthentication x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ClientAuthentication x -> ClientAuthentication
$cfrom :: forall x. ClientAuthentication -> Rep ClientAuthentication x
Prelude.Generic)
newClientAuthentication ::
ClientAuthentication
newClientAuthentication :: ClientAuthentication
newClientAuthentication =
ClientAuthentication' :: Maybe Sasl
-> Maybe Tls -> Maybe Unauthenticated -> ClientAuthentication
ClientAuthentication'
{ $sel:sasl:ClientAuthentication' :: Maybe Sasl
sasl = Maybe Sasl
forall a. Maybe a
Prelude.Nothing,
$sel:tls:ClientAuthentication' :: Maybe Tls
tls = Maybe Tls
forall a. Maybe a
Prelude.Nothing,
$sel:unauthenticated:ClientAuthentication' :: Maybe Unauthenticated
unauthenticated = Maybe Unauthenticated
forall a. Maybe a
Prelude.Nothing
}
clientAuthentication_sasl :: Lens.Lens' ClientAuthentication (Prelude.Maybe Sasl)
clientAuthentication_sasl :: (Maybe Sasl -> f (Maybe Sasl))
-> ClientAuthentication -> f ClientAuthentication
clientAuthentication_sasl = (ClientAuthentication -> Maybe Sasl)
-> (ClientAuthentication -> Maybe Sasl -> ClientAuthentication)
-> Lens
ClientAuthentication ClientAuthentication (Maybe Sasl) (Maybe Sasl)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ClientAuthentication' {Maybe Sasl
sasl :: Maybe Sasl
$sel:sasl:ClientAuthentication' :: ClientAuthentication -> Maybe Sasl
sasl} -> Maybe Sasl
sasl) (\s :: ClientAuthentication
s@ClientAuthentication' {} Maybe Sasl
a -> ClientAuthentication
s {$sel:sasl:ClientAuthentication' :: Maybe Sasl
sasl = Maybe Sasl
a} :: ClientAuthentication)
clientAuthentication_tls :: Lens.Lens' ClientAuthentication (Prelude.Maybe Tls)
clientAuthentication_tls :: (Maybe Tls -> f (Maybe Tls))
-> ClientAuthentication -> f ClientAuthentication
clientAuthentication_tls = (ClientAuthentication -> Maybe Tls)
-> (ClientAuthentication -> Maybe Tls -> ClientAuthentication)
-> Lens
ClientAuthentication ClientAuthentication (Maybe Tls) (Maybe Tls)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ClientAuthentication' {Maybe Tls
tls :: Maybe Tls
$sel:tls:ClientAuthentication' :: ClientAuthentication -> Maybe Tls
tls} -> Maybe Tls
tls) (\s :: ClientAuthentication
s@ClientAuthentication' {} Maybe Tls
a -> ClientAuthentication
s {$sel:tls:ClientAuthentication' :: Maybe Tls
tls = Maybe Tls
a} :: ClientAuthentication)
clientAuthentication_unauthenticated :: Lens.Lens' ClientAuthentication (Prelude.Maybe Unauthenticated)
clientAuthentication_unauthenticated :: (Maybe Unauthenticated -> f (Maybe Unauthenticated))
-> ClientAuthentication -> f ClientAuthentication
clientAuthentication_unauthenticated = (ClientAuthentication -> Maybe Unauthenticated)
-> (ClientAuthentication
-> Maybe Unauthenticated -> ClientAuthentication)
-> Lens
ClientAuthentication
ClientAuthentication
(Maybe Unauthenticated)
(Maybe Unauthenticated)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ClientAuthentication' {Maybe Unauthenticated
unauthenticated :: Maybe Unauthenticated
$sel:unauthenticated:ClientAuthentication' :: ClientAuthentication -> Maybe Unauthenticated
unauthenticated} -> Maybe Unauthenticated
unauthenticated) (\s :: ClientAuthentication
s@ClientAuthentication' {} Maybe Unauthenticated
a -> ClientAuthentication
s {$sel:unauthenticated:ClientAuthentication' :: Maybe Unauthenticated
unauthenticated = Maybe Unauthenticated
a} :: ClientAuthentication)
instance Core.FromJSON ClientAuthentication where
parseJSON :: Value -> Parser ClientAuthentication
parseJSON =
String
-> (Object -> Parser ClientAuthentication)
-> Value
-> Parser ClientAuthentication
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"ClientAuthentication"
( \Object
x ->
Maybe Sasl
-> Maybe Tls -> Maybe Unauthenticated -> ClientAuthentication
ClientAuthentication'
(Maybe Sasl
-> Maybe Tls -> Maybe Unauthenticated -> ClientAuthentication)
-> Parser (Maybe Sasl)
-> Parser
(Maybe Tls -> Maybe Unauthenticated -> ClientAuthentication)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Sasl)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"sasl")
Parser (Maybe Tls -> Maybe Unauthenticated -> ClientAuthentication)
-> Parser (Maybe Tls)
-> Parser (Maybe Unauthenticated -> ClientAuthentication)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Tls)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"tls")
Parser (Maybe Unauthenticated -> ClientAuthentication)
-> Parser (Maybe Unauthenticated) -> Parser ClientAuthentication
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Unauthenticated)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"unauthenticated")
)
instance Prelude.Hashable ClientAuthentication
instance Prelude.NFData ClientAuthentication
instance Core.ToJSON ClientAuthentication where
toJSON :: ClientAuthentication -> Value
toJSON ClientAuthentication' {Maybe Sasl
Maybe Tls
Maybe Unauthenticated
unauthenticated :: Maybe Unauthenticated
tls :: Maybe Tls
sasl :: Maybe Sasl
$sel:unauthenticated:ClientAuthentication' :: ClientAuthentication -> Maybe Unauthenticated
$sel:tls:ClientAuthentication' :: ClientAuthentication -> Maybe Tls
$sel:sasl:ClientAuthentication' :: ClientAuthentication -> Maybe Sasl
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"sasl" Text -> Sasl -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Sasl -> Pair) -> Maybe Sasl -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Sasl
sasl,
(Text
"tls" Text -> Tls -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Tls -> Pair) -> Maybe Tls -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Tls
tls,
(Text
"unauthenticated" Text -> Unauthenticated -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(Unauthenticated -> Pair) -> Maybe Unauthenticated -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Unauthenticated
unauthenticated
]
)