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