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