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